Skip to content

Commit

Permalink
Remove legacy code
Browse files Browse the repository at this point in the history
  • Loading branch information
dyedwiper committed Jan 25, 2024
1 parent 3dfd70a commit 0e8903c
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 162 deletions.
42 changes: 0 additions & 42 deletions src/services/school/docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,48 +110,6 @@ components:
skip:
type: integer
paths:
/schoolsList:
get:
parameters:
- description: Number of results to return
in: query
name: $limit
schema:
type: integer
- description: Number of results to skip
in: query
name: $skip
schema:
type: integer
- description: Property to sort results
in: query
name: $sort
style: deepObject
schema:
type: object
- description: Query parameters to filter
in: query
name: filter
style: form
explode: true
schema:
$ref: '#/components/schemas/schools'
responses:
'200':
description: success
content:
application/json:
schema:
$ref: '#/components/schemas/schools_list'
'401':
description: not authenticated
'500':
description: general error
description: Retrieves a list of all schools.
summary: ''
tags:
- schoolsList
security: [ ]
/schools:
get:
parameters:
Expand Down
21 changes: 0 additions & 21 deletions src/services/school/hooks/publicSchools.hooks.js

This file was deleted.

17 changes: 0 additions & 17 deletions src/services/school/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ const path = require('path');

const schoolModels = require('./model');
const hooks = require('./hooks');
const publicSchoolsHooks = require('./hooks/publicSchools.hooks');
const schoolGroupHooks = require('./hooks/schoolGroup.hooks');
const { SchoolMaintenanceService } = require('./maintenance');
const { HandlePermissions, handlePermissionsHooks } = require('./services/permissions');
const { SchoolsListService } = require('./services/schoolsList');

module.exports = function schoolServices() {
const app = this;
Expand All @@ -31,21 +29,6 @@ module.exports = function schoolServices() {
const schoolService = app.service('/schools');
schoolService.hooks(hooks);

// public endpoint, called from login
app.use('/schoolsList/api', staticContent(path.join(__dirname, './docs/openapi.yaml')));
app.use(
'/schoolsList',
new SchoolsListService({
Model: schoolModels.schoolModel,
paginate: {
default: 2,
max: 3,
},
})
);
const schoolsListService = app.service('schoolsList');
schoolsListService.hooks(publicSchoolsHooks);

app.use('/schools/:schoolId/maintenance', new SchoolMaintenanceService());

/* schoolGroup service */
Expand Down
30 changes: 0 additions & 30 deletions src/services/school/services/schoolsList.js

This file was deleted.

2 changes: 0 additions & 2 deletions test/routes/whitelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const whitelistNoJwt = {
'oauth2/baseUrl': { get: 200 },
registrationlink: { post: 201 },
roster: { get: 200 },
schoolsList: { get: 200 },
'tools/link': { post: 404 },
years: { get: 200 },
'system_info/haproxy': { get: 200 },
Expand All @@ -20,7 +19,6 @@ const whitelistNoJwt = {

const whitelistInvalidJwt = {
...whitelistNoJwt,
schoolsList: { get: 401 },
years: { get: 401 },
gradeLevels: { get: 401 },
};
Expand Down
48 changes: 0 additions & 48 deletions test/services/school/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,51 +628,3 @@ describe('years service', () => {
assert.ok(app.service('gradeLevels'));
});
});

describe('schoolsList service', () => {
let app;
let server;
let schoolsListService;

before(async () => {
app = await appPromise();
server = await app.listen();
schoolsListService = app.service('schoolsList');
});

after(async () => {
await testObjects.cleanup();
await server.close();
});

it('registered the schoolsList services', () => {
assert.ok(schoolsListService);
});

describe('find', () => {
before('load data and set samples', async () => {
await createSchool();
});

it('can be accessed unautorized', async () => {
const params = {
provider: 'rest',
headers: {
authorization: undefined,
},
account: undefined,
query: {},
};
const result = await schoolsListService.find(params);
expect(result.length).gt(0);
});

it('should return only certain fields', async () => {
const schoolsList = await schoolsListService.find();
const fields = ['name', '_id', 'systems'];
schoolsList.forEach((school) => {
expect(Object.keys(school).every((field) => fields.includes(field))).to.be.true;
});
});
});
});
2 changes: 0 additions & 2 deletions test/services/school/services/permissions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ describe('permissons service', () => {
app.unuse('schools');
app.unuse('schools/api');
app.unuse('/schools/:schoolId/maintenance');
app.unuse('schoolsList');
app.unuse('schoolsList/api');
app.unuse('schoolGroup');
app.unuse('gradeLevels');
app.unuse('/school/teacher/studentvisibility');
Expand Down

0 comments on commit 0e8903c

Please sign in to comment.