Skip to content

Commit 6f0c890

Browse files
author
Nino van Galen
committed
feat: Added flp endpoint
1 parent dc85779 commit 6f0c890

4 files changed

Lines changed: 131 additions & 0 deletions

File tree

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/**
2+
* This file is part of the ALICE Electronic Logbook v2, also known as Jiskefet.
3+
* Copyright (C) 2020 Stichting Hogeschool van Amsterdam
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Affero General Public License as published
7+
* by the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Affero General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Affero General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
/**
20+
* create a new flp.
21+
*
22+
* @param {Object} request The *request* object represents the HTTP request and has properties for the request query
23+
* string, parameters, body, HTTP headers, and so on.
24+
* @param {Object} response The *response* object represents the HTTP response that an Express app sends when it gets an
25+
* HTTP request.
26+
* @param {Function} next The *next* object represents the next middleware function which is used to pass control to the
27+
* next middleware function.
28+
* @returns {undefined}
29+
*/
30+
const create = (request, response, next) => {
31+
response.status(501).json({
32+
errors: [
33+
{
34+
status: '501',
35+
title: 'Not implemented',
36+
},
37+
],
38+
});
39+
};
40+
41+
/**
42+
* update flp.
43+
*
44+
* @param {Object} request The *request* object represents the HTTP request and has properties for the request query
45+
* string, parameters, body, HTTP headers, and so on.
46+
* @param {Object} response The *response* object represents the HTTP response that an Express app sends when it gets an
47+
* HTTP request.
48+
* @param {Function} next The *next* object represents the next middleware function which is used to pass control to the
49+
* next middleware function.
50+
* @returns {undefined}
51+
*/
52+
const update = (request, response, next) => {
53+
response.status(501).json({
54+
errors: [
55+
{
56+
status: '501',
57+
title: 'Not implemented',
58+
},
59+
],
60+
});
61+
};
62+
63+
/**
64+
* read flp.
65+
*
66+
* @param {Object} request The *request* object represents the HTTP request and has properties for the request query
67+
* string, parameters, body, HTTP headers, and so on.
68+
* @param {Object} response The *response* object represents the HTTP response that an Express app sends when it gets an
69+
* HTTP request.
70+
* @param {Function} next The *next* object represents the next middleware function which is used to pass control to the
71+
* next middleware function.
72+
* @returns {undefined}
73+
*/
74+
const read = (request, response, next) => {
75+
response.status(501).json({
76+
errors: [
77+
{
78+
status: '501',
79+
title: 'Not implemented',
80+
},
81+
],
82+
});
83+
};
84+
85+
module.exports = {
86+
create,
87+
update,
88+
read,
89+
};

backend/lib/controllers/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818

19+
const FlpController = require('./flp.controller');
1920
const HomeController = require('./home.controller');
2021
const LogsController = require('./logs.controller');
2122
const OverviewsController = require('./overviews.controller');
@@ -26,6 +27,7 @@ const TagsController = require('./tags.controller');
2627
const UsersController = require('./users.controller');
2728

2829
module.exports = {
30+
FlpController,
2931
HomeController,
3032
LogsController,
3133
OverviewsController,

backend/lib/routers/flp.router.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* This file is part of the ALICE Electronic Logbook v2, also known as Jiskefet.
3+
* Copyright (C) 2020 Stichting Hogeschool van Amsterdam
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Affero General Public License as published
7+
* by the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Affero General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Affero General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
const { FlpController } = require('../controllers');
19+
20+
module.exports = {
21+
method: 'post',
22+
path: 'flp',
23+
controller: FlpController.create,
24+
args: { public: true },
25+
children: [
26+
{
27+
method: 'get',
28+
path: ':name/runs/:id',
29+
controller: FlpController.read,
30+
children: [
31+
{
32+
method: 'patch',
33+
controller: FlpController.update,
34+
},
35+
],
36+
},
37+
],
38+
};

backend/lib/routers/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818

19+
const flpRoute = require('./flp.router');
1920
const homeRoute = require('./home.router');
2021
const logRoute = require('./logs.router');
2122
const overviewRoute = require('./overviews.router');
@@ -27,6 +28,7 @@ const usersRoute = require('./users.router');
2728
const { appendPath, deepmerge } = require('../utils');
2829

2930
const routes = [
31+
flpRoute,
3032
homeRoute,
3133
logRoute,
3234
overviewRoute,

0 commit comments

Comments
 (0)