Skip to content

Commit c3f6acb

Browse files
committed
added update infrastructure to apidoc
1 parent b74a53b commit c3f6acb

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

_apidoc.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,24 @@
191191
*
192192
* */
193193

194+
/**
195+
* @api {post} /infrastructure/update Update infrastructure details
196+
* @apiName UpdateInfrastructure
197+
* @apiGroup Infrastructure
198+
* @apiDescription update Existing Infrastructure details
199+
*
200+
* @apiBody {String} id Id of the infrastructure to be updated
201+
* @apiBody {String} [name] The name of the infrastructure.
202+
* @apiBody {String} [type] The type of the infrastructure.
203+
* @apiBody {String} [wing] The wing where the infrastructure is located.
204+
* @apiBody {Number} [floor] The floor where the infrastructure is located.
205+
* @apiBody {Number} [capacity] The capacity of the infrastructure.
206+
*
207+
* @apiSuccess {String} res infrastructure updated.
208+
* @apiError (Error 500) err Error in updating database
209+
*
210+
*/
211+
194212
// ------------------------------------------------------------------------------------------
195213
// Accreditation.
196214
// ------------------------------------------------------------------------------------------

controller/accreditation.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { addNewAccreditation, deleteAccreditationById, updateAccreditationById, getAccreditations } from "#services/accreditation";
1+
import {
2+
addNewAccreditation, deleteAccreditationById, updateAccreditationById, getAccreditations,
3+
} from "#services/accreditation";
24
import { logger } from "#util";
35

46
async function addAccreditation(req, res) {
@@ -31,7 +33,7 @@ async function updateAccreditation(req, res) {
3133
const {
3234
id, ...data
3335
} = req.body;
34-
36+
3537
try {
3638
await updateAccreditationById(id, data);
3739
res.json({ res: "accreditation updated" });
@@ -53,4 +55,6 @@ async function showAccreditation(req, res) {
5355
}
5456
}
5557

56-
export default { addAccreditation, updateAccreditation, deleteAccreditation, showAccreditation };
58+
export default {
59+
addAccreditation, updateAccreditation, deleteAccreditation, showAccreditation,
60+
};

services/accreditation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ export async function getAccreditations(filter) {
2323
}
2424

2525
export async function deleteAccreditationById(accredationId) {
26-
const deleted = await accreditation.remove({ _id: accredationId });
26+
const deleted = await Accreditation.remove({ _id: accredationId });
2727
if (deleted) {
2828
return deleted;
2929
}
3030
throw new databaseError.DataDeleteError("Accreditation");
3131
}
3232

3333
export async function updateAccreditationById(id, data) {
34-
const updated = await accreditation.update({ _id: id }, data);
34+
const updated = await Accreditation.update({ _id: id }, data);
3535
if (updated) {
3636
return updated;
3737
}

0 commit comments

Comments
 (0)