-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(admin): add route to get service configuration (#50)
* feature(admin): add route to get service configuration * feat(admin): add explicit error status on getting service configuration * feat(admin): only add service id in response when getting all of services * fix(admin): fix error message to get right service from request parameters * feat(test): add cucumber test for /services/:service route * feat(admin): update get service configuration according review * fix(admin): function getServicesConfigurations do not need request parameters * creation and use of serviceRequest, and form changes --------- Co-authored-by: Loic <loic.grondin@ign.fr>
- Loading branch information
1 parent
2a07aec
commit 0d36022
Showing
11 changed files
with
273 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
'use strict'; | ||
|
||
const Request = require('./request'); | ||
|
||
/** | ||
* | ||
* @class | ||
* @name serviceRequest | ||
* @description Classe modélisant une requête sur un service géré par l'administrateur. | ||
* | ||
*/ | ||
|
||
module.exports = class serviceRequest extends Request { | ||
|
||
/** | ||
* | ||
* @function | ||
* @name constructor | ||
* @description Constructeur de la classe serviceRequest | ||
* @param {string} serviceId - Id du service interrogé | ||
* | ||
*/ | ||
|
||
constructor(serviceId) { | ||
|
||
super("service", "serviceRequest"); | ||
|
||
// Id du service d'après l'administrateur | ||
this._service = serviceId; | ||
|
||
} | ||
|
||
/** | ||
* | ||
* @function | ||
* @name get service | ||
* @description Récupérer le caractère verbeux de la requête | ||
* | ||
*/ | ||
get service() { | ||
return this._service; | ||
} | ||
|
||
/** | ||
* | ||
* @function | ||
* @name set service | ||
* @description Attribuer le caractère verbeux de la requête. | ||
* @param {string} id - Id du service | ||
* | ||
*/ | ||
set service(id) { | ||
this._service = id; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
test/integration/mocha/requests/integrationServiceRequest.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const assert = require('assert'); | ||
const ServiceRequest = require('../../../../src/js/requests/serviceRequest'); | ||
const logManager = require('../logManager'); | ||
|
||
describe('Test de la classe ServiceRequest', function() { | ||
|
||
before(function() { | ||
// runs before all tests in this block | ||
logManager.manageLogs(); | ||
}); | ||
|
||
let request = new ServiceRequest("test"); | ||
|
||
describe('Test du constructeur et des getters/setters', function() { | ||
|
||
it('Get type', function() { | ||
assert.equal(request.type, "serviceRequest"); | ||
}); | ||
|
||
it('Get service', function() { | ||
assert.equal(request.service, "test"); | ||
}); | ||
|
||
it('Set service', function() { | ||
request.service = "main"; | ||
assert.equal(request.service, "main"); | ||
}); | ||
|
||
}); | ||
|
||
}); |
Oops, something went wrong.