From 763576d0b1ca7e6de95f92c0b29a4e8960351bed Mon Sep 17 00:00:00 2001 From: Pawel Nawrocki Date: Wed, 7 Dec 2016 00:21:51 +0100 Subject: [PATCH] OLMIS-982: Nested locations/endpoints in service discovery. --- .gitignore | 1 + Dockerfile | 10 +- build.gradle | 17 +- consul/config.json | 11 + consul/package.json | 13 + consul/registration.js | 303 ++ package.json | 6 +- registration.gradle | 32 + run.sh | 3 + .../web/BaseWebIntegrationTest.java | 6 +- .../web/UserControllerIntegrationTest.java | 2 +- .../CustomWebMvcConfigurerAdapter.java | 14 +- .../ResourceServerSecurityConfiguration.java | 5 +- .../referencedata/service/UserService.java | 10 +- .../referencedata/web/VersionController.java | 2 +- src/main/resources/api-definition.yaml | 3481 +++++++++-------- src/main/resources/application.properties | 4 +- .../{ => referencedata}/docs/index.html | 4 +- 18 files changed, 2156 insertions(+), 1768 deletions(-) create mode 100644 consul/config.json create mode 100644 consul/package.json create mode 100644 consul/registration.js create mode 100644 registration.gradle create mode 100644 run.sh rename src/main/resources/static/{ => referencedata}/docs/index.html (97%) diff --git a/.gitignore b/.gitignore index 1a6f31b6e..c9d504d71 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +*~ *.iml *.ipr *.iws diff --git a/Dockerfile b/Dockerfile index c6bf17632..dbbb2d302 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,14 @@ FROM anapsix/alpine-java:jre8 COPY build/libs/*.jar /service.jar COPY build/demo-data /demo-data +COPY build/consul /consul +COPY run.sh /run.sh + +RUN chmod +x run.sh \ + && apk update \ + && apk add nodejs \ + && mv consul/package.json package.json \ + && npm install EXPOSE 8080 -CMD java $JAVA_OPTS -jar /service.jar \ No newline at end of file +CMD ./run.sh diff --git a/build.gradle b/build.gradle index 89862beca..59894eba7 100644 --- a/build.gradle +++ b/build.gradle @@ -187,12 +187,6 @@ sonarqube { } } -build { - dependsOn check - dependsOn jacocoTestReport - dependsOn demoDataSeed -} - pmd { toolVersion = '5.4.0' consoleOutput= true @@ -221,9 +215,20 @@ processResources { } } +apply from: "registration.gradle" + +build { + dependsOn check + dependsOn jacocoTestReport + dependsOn demoDataSeed +} + check { dependsOn ramlToHtml dependsOn ramlToSwagger dependsOn copyRamlHtmlToBuild dependsOn integrationTest + dependsOn copyConsulRegistrationToBuild } + +bootRun.dependsOn consulRegistration diff --git a/consul/config.json b/consul/config.json new file mode 100644 index 000000000..67daeed13 --- /dev/null +++ b/consul/config.json @@ -0,0 +1,11 @@ +{ + "name": "referencedata", + "raml": "src/main/resources/api-definition.yaml", + "path": [ + "referencedata", + "referencedata/docs", + "referencedata/docs/", + "referencedata/webjars", + "referencedata/webjars/" + ] +} diff --git a/consul/package.json b/consul/package.json new file mode 100644 index 000000000..f53497a08 --- /dev/null +++ b/consul/package.json @@ -0,0 +1,13 @@ +{ + "name": "openlmis-consul-registration", + "version": "0.0.1", + + "devDependencies": + { + "uuid": "~3.0.0", + "raml-parser": "~0.8.0", + "command-line-args": "~3.0.0", + "deasync": "~0.1.9", + "ip": "~1.1.0" + } +} diff --git a/consul/registration.js b/consul/registration.js new file mode 100644 index 000000000..cc41fc890 --- /dev/null +++ b/consul/registration.js @@ -0,0 +1,303 @@ +const fs = require('fs'); +const ip = require('ip'); +const http = require('http'); +const uuid = require('uuid'); +const deasync = require('deasync'); +const raml = require('raml-parser'); +const commandLineArgs = require('command-line-args'); + +function ServiceRAMLParser() { + var self = this; + + self.extractResources = function(filename) { + // Parse RAML file to retrieve available resources list + return raml.loadFile(filename).then(function(data) { + var resources = []; + data.resources.forEach(function(node) { + self.extractNodeResources(node).forEach(function(resource) { + resources.push(resource); + }) + }); + return resources; + }); + } + + self.extractNodeResources = function(node) { + var paths = []; + + if (node.resources) { + node.resources.forEach(function(childNode) { + self.extractNodeResources(childNode).forEach(function(path) { + paths.push(node.relativeUri + path); + }); + }); + } + + if (node.methods instanceof Array && node.methods.length > 0){ + paths.push(node.relativeUri); + } + + return paths; + } +} +function ServiceConsulRegistrator(host, port) { + self = this; + self.host = host; + self.port = port; + + self.registerService = function(serviceData) { + return registerServiceBase(serviceData, 'PUT'); + } + + self.deregisterService = function(serviceData) { + return registerServiceBase(serviceData, 'DELETE'); + } + + self.registerResources = function(serviceData, resourceArray) { + return registerResourcesBase(serviceData, resourceArray, 'PUT'); + } + + self.deregisterResources = function(serviceData, resourceArray) { + return registerResourcesBase(serviceData, resourceArray, 'DELETE'); + } + + function registerServiceBase(serviceData, mode) { + var requestPath = mode === 'PUT' ? 'register' : 'deregister/' + serviceData.ID; + var request = http.request({ + host: self.host, + port: self.port, + path: '/v1/agent/service/' + requestPath, + method: 'PUT' + }); + + request.write(JSON.stringify(serviceData)); + request.end(); + + return request; + } + + function registerResourcesBase(serviceData, resourceArray, mode) { + var requests = []; + + // Customize each request parameters + resourceArray.forEach(function(resource) { + var path = '/v1/kv/resources' + resource; + var request = http.request({ + host: self.host, + port: self.port, + path: path, + method: mode + }); + + requests.push(request); + }); + + // Start sending requests + requests.forEach(function(request) { + request.write(serviceData.Name); + request.end(); + }); + + return requests; + } +} +function RegistrationService(host, port) { + var self = this; + + self.consulHost = host; + self.consulPort = port; + self.filename = '.consul_service_id~'; + + self.registrator = new ServiceConsulRegistrator(self.consulHost, self.consulPort);; + self.parser = new ServiceRAMLParser(); + + self.register = function(args) { + registration.registerService(args.name); + + if (args.raml) { + registration.registerRaml(args.name, args.raml); + } + + if (args.path) { + registration.registerPath(args.name, args.path); + } + } + + self.registerService = function(serviceName) { + return serviceRegistrationBase(serviceName, 'register'); + } + + self.registerRaml = function(serviceName, filename) { + return ramlRegistrationBase(serviceName, filename, 'register'); + } + + self.registerPath = function(serviceName, paths) { + return pathRegistrationBase(serviceName, paths, 'register'); + } + + self.deregister = function(args) { + registration.deregisterService(args.name); + + if (args.raml) { + registration.deregisterRaml(args.name, args.raml); + } + + if (args.path) { + registration.deregisterPath(args.name, args.path); + } + + clearServiceId(); + } + + self.deregisterService = function(serviceName) { + return serviceRegistrationBase(serviceName, 'deregister'); + } + + self.deregisterRaml = function(serviceName, filename) { + return ramlRegistrationBase(serviceName, filename, 'deregister'); + } + + self.deregisterPath = function(serviceName, paths) { + return pathRegistrationBase(serviceName, paths, 'deregister'); + } + + function getServiceData(serviceName) { + var serviceId = getServiceId(serviceName); + return { + 'ID': serviceId, + 'Name': serviceName, + 'Port': 8080, + 'Address': ip.address(), + 'Tags': ['openlmis-service'], + 'EnableTagOverride': false + }; + } + + function getServiceId(serviceName) { + var serviceId = null; + + try { + fs.accessSync(self.filename, fs.R_OK | fs.W_OK); + serviceId = fs.readFileSync(fs.openSync(self.filename, 'r+')).toString(); + } catch (err) { + serviceId = uuid() + '-' + serviceName; + fs.writeSync(fs.openSync(self.filename, 'w+'), serviceId); + } + + return serviceId; + } + + function clearServiceId() { + try { + fs.unlinkSync(self.filename); + } catch (err) { + console.error("Service ID file could not be found or accessed."); + } + + } + + function serviceRegistrationBase(serviceName, mode) { + var serviceData = getServiceData(serviceName, mode); + if (mode === 'register') { + return self.registrator.registerService(serviceData); + } else { + return self.registrator.deregisterService(serviceData); + } + } + + function ramlRegistrationBase(serviceName, filename, mode) { + var serviceData = getServiceData(serviceName, mode); + var resourceRequests; + + self.parser.extractResources(filename).then(function(resources) { + if (mode === 'register') { + resourceRequests = self.registrator.registerResources(serviceData, resources); + } else { + resourceRequests = self.registrator.deregisterResources(serviceData, resources); + } + }); + + // Wait for RAML parsing + while(!resourceRequests) { + deasync.runLoopOnce(); + } + + return Promise.all(resourceRequests); + } + + function pathRegistrationBase(serviceName, paths, mode) { + var serviceData = getServiceData(serviceName, mode); + + for (var i = 0; i < paths.length; i++) { + if (!paths[i].startsWith("/")) { + paths[i] = "/" + paths[i]; + } + } + + if (mode === 'register') { + return self.registrator.registerResources(serviceData, paths); + } else { + return self.registrator.deregisterResources(serviceData, paths); + } + } +} + +function processArgs() { + var args = commandLineArgs([ + { name: 'config-file', alias: 'f', type: String }, + { name: 'name', alias: 'n', type: String }, + { name: 'command', alias: 'c', type: String }, + { name: 'raml', alias: 'r', type: String }, + { name: 'path', alias: 'p', type: String, multiple: true } + ]); + + if (args['config-file']) { + // If other arguments are not present, override them with config file values + var config = JSON.parse(fs.readFileSync(fs.openSync(args['config-file'], 'r+')).toString()); + var values = ['name', 'command', 'path', 'raml']; + + for (var i = 0; i < values.length; i++) { + var keyword = values[i]; + if (!(args[keyword])) { + args[keyword] = config[keyword]; + } + } + } + + if (!args.name) { + throw new Error("Name parameter is missing."); + } else if (!args.command) { + throw new Error("Command parameter is missing."); + } else if (!(args.raml || args.path)) { + throw new Error("You must either provide path or file parameter."); + } + + return args; +} + +try { + var consulHost = process.env.CONSUL_HOST || 'consul'; + var consulPort = process.env.CONSUL_PORT || '8500'; + + // Retrieve arguments passed to script + var args = processArgs(); + + var registration = new RegistrationService(consulHost, consulPort); + var initialMessage = "Starting service " + args.command + "..."; + + if (args.command === 'register') { + console.log(initialMessage); + registration.register(args); + } else if (args.command === 'deregister') { + console.log(initialMessage); + registration.deregister(args); + } else { + throw new Error("Invalid command. It should be either 'register' or 'deregister'.") + } + + console.log("Service " + args.command + " successful!"); +} catch(err) { + console.error("Error during service registration:") + console.error(err.message); + process.exit(1); +} diff --git a/package.json b/package.json index 6a51c6a5a..59e4b775b 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,9 @@ "scripts": { - "runApiSpecConverter": "api-spec-converter --from raml --to swagger_2 /app/build/resources/main/api-definition-raml.yaml > /app/build/resources/main/static/docs/api-definition.json", + "runApiSpecConverter": "api-spec-converter --from raml --to swagger_2 /app/build/resources/main/api-definition-raml.yaml > /app/build/resources/main/static/referencedata/docs/api-definition.json", "runApiHtmlConverter": "raml2html --input /app/build/resources/main/api-definition-raml.yaml --output /app/build/resources/main/api-definition.html" - } + }, + + "files": [ "consul/package.json" ] } diff --git a/registration.gradle b/registration.gradle new file mode 100644 index 000000000..ef1f511fd --- /dev/null +++ b/registration.gradle @@ -0,0 +1,32 @@ +task consulRegistration(type:Exec) { + executable "node" + args "consul/registration.js", "-c", "register", "-f", "consul/config.json" +} + +task consulDeregistration(type:Exec) { + executable "node" + args "consul/registration.js", "-c", "deregister", "-f", "consul/config.json" +} + +task copyRegistrationToConsulBuild(type: Copy) { + from 'consul' + into 'build/consul' +} + +task copyRamlToConsulBuild(type: Copy) { + from 'src/main/resources' + into 'build/consul' + include 'api-definition.yaml' +} + +task copyRamlSchemasToConsulBuild(type: Copy) { + from 'src/main/resources/schemas' + into 'build/consul/schemas' +} + +task copyConsulRegistrationToBuild(type:Copy) +copyConsulRegistrationToBuild { + dependsOn copyRegistrationToConsulBuild + dependsOn copyRamlSchemasToConsulBuild + dependsOn copyRamlToConsulBuild +} diff --git a/run.sh b/run.sh new file mode 100644 index 000000000..0a134436f --- /dev/null +++ b/run.sh @@ -0,0 +1,3 @@ +#!/bin/sh +node consul/registration.js -c register -f consul/config.json -r consul/api-definition.yaml +java $JAVA_OPTS -jar /service.jar diff --git a/src/integration-test/java/org/openlmis/referencedata/web/BaseWebIntegrationTest.java b/src/integration-test/java/org/openlmis/referencedata/web/BaseWebIntegrationTest.java index dc8debbc2..a4bcc085f 100644 --- a/src/integration-test/java/org/openlmis/referencedata/web/BaseWebIntegrationTest.java +++ b/src/integration-test/java/org/openlmis/referencedata/web/BaseWebIntegrationTest.java @@ -73,18 +73,18 @@ public abstract class BaseWebIntegrationTest { public BaseWebIntegrationTest() { // This mocks the auth check to always return valid admin credentials. - wireMockRule.stubFor(post(urlEqualTo("/auth/oauth/check_token")) + wireMockRule.stubFor(post(urlEqualTo("/api/oauth/check_token")) .willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBody(MOCK_CHECK_RESULT))); // This mocks the call to auth to post to an auth user. - wireMockRule.stubFor(post(urlPathEqualTo("/auth/api/users")) + wireMockRule.stubFor(post(urlPathEqualTo("/api/users")) .willReturn(aResponse() .withStatus(200))); // This mocks the call to notification to post a notification. - wireMockRule.stubFor(post(urlPathEqualTo("/notification")) + wireMockRule.stubFor(post(urlPathEqualTo("/api/notification")) .willReturn(aResponse() .withStatus(200))); } diff --git a/src/integration-test/java/org/openlmis/referencedata/web/UserControllerIntegrationTest.java b/src/integration-test/java/org/openlmis/referencedata/web/UserControllerIntegrationTest.java index 7574aab4f..ca59dd5e6 100644 --- a/src/integration-test/java/org/openlmis/referencedata/web/UserControllerIntegrationTest.java +++ b/src/integration-test/java/org/openlmis/referencedata/web/UserControllerIntegrationTest.java @@ -90,7 +90,7 @@ public class UserControllerIntegrationTest extends BaseWebIntegrationTest { private static final String SUPERVISORY_NODE_CODE = "SN1"; private static final String WAREHOUSE_CODE = "W1"; private static final String HOME_FACILITY_CODE = "HF1"; - private static final String USER_API_STRING = "/auth/api/users"; + private static final String USER_API_STRING = "/api/users"; private static final String RIGHT_ID_STRING = "rightId"; private static final String PROGRAM_ID_STRING = "programId"; diff --git a/src/main/java/org/openlmis/referencedata/CustomWebMvcConfigurerAdapter.java b/src/main/java/org/openlmis/referencedata/CustomWebMvcConfigurerAdapter.java index f9bb8e23b..48e2396f1 100644 --- a/src/main/java/org/openlmis/referencedata/CustomWebMvcConfigurerAdapter.java +++ b/src/main/java/org/openlmis/referencedata/CustomWebMvcConfigurerAdapter.java @@ -2,6 +2,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @@ -13,8 +14,17 @@ public class CustomWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter { @Override public void addViewControllers(ViewControllerRegistry registry) { - registry.addViewController("/docs").setViewName("redirect:" + serviceUrl + "/docs/"); - registry.addViewController("/docs/").setViewName("forward:/docs/index.html"); + registry.addViewController("/referencedata/docs") + .setViewName("redirect:" + serviceUrl + "/referencedata/docs/"); + registry.addViewController("/referencedata/docs/") + .setViewName("forward:/referencedata/docs/index.html"); super.addViewControllers(registry); } + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("/referencedata/webjars/**") + .addResourceLocations("classpath:/META-INF/resources/webjars/"); + super.addResourceHandlers(registry); + } } diff --git a/src/main/java/org/openlmis/referencedata/security/ResourceServerSecurityConfiguration.java b/src/main/java/org/openlmis/referencedata/security/ResourceServerSecurityConfiguration.java index ee3ad191e..ea96f902f 100644 --- a/src/main/java/org/openlmis/referencedata/security/ResourceServerSecurityConfiguration.java +++ b/src/main/java/org/openlmis/referencedata/security/ResourceServerSecurityConfiguration.java @@ -63,9 +63,10 @@ protected void doFilterInternal(HttpServletRequest request, http .authorizeRequests() .antMatchers( - "/", + "/referencedata", "/webjars/**", - "/docs/**" + "/referencedata/webjars/**", + "/referencedata/docs/**" ).permitAll() .antMatchers("/**").fullyAuthenticated(); } diff --git a/src/main/java/org/openlmis/referencedata/service/UserService.java b/src/main/java/org/openlmis/referencedata/service/UserService.java index 9dd537b59..c05a750e0 100644 --- a/src/main/java/org/openlmis/referencedata/service/UserService.java +++ b/src/main/java/org/openlmis/referencedata/service/UserService.java @@ -135,7 +135,7 @@ private void saveAuthUser(User user, String token) { userRequest.setEmail(user.getEmail()); userRequest.setReferenceDataUserId(user.getId()); - String url = virtualHostBaseUrl + "/auth/api/users?access_token=" + token; + String url = virtualHostBaseUrl + "/api/users?access_token=" + token; RestTemplate restTemplate = new RestTemplate(); restTemplate.postForObject(url, userRequest, Object.class); @@ -146,7 +146,7 @@ private void saveAuthUser(User user, String token) { */ public void passwordReset(PasswordResetRequest passwordResetRequest, String token) { try { - String url = virtualHostBaseUrl + "/auth/api/users/passwordReset?access_token=" + token; + String url = virtualHostBaseUrl + "/api/users/passwordReset?access_token=" + token; RestTemplate restTemplate = new RestTemplate(); restTemplate.postForObject(url, passwordResetRequest, String.class); @@ -162,7 +162,7 @@ public void passwordReset(PasswordResetRequest passwordResetRequest, String toke */ public void changePassword(PasswordChangeRequest passwordChangeRequest, String token) { try { - String url = virtualHostBaseUrl + "/auth/api/users/changePassword?access_token=" + token; + String url = virtualHostBaseUrl + "/api/users/changePassword?access_token=" + token; RestTemplate restTemplate = new RestTemplate(); restTemplate.postForObject(url, passwordChangeRequest, String.class); @@ -196,7 +196,7 @@ private void sendResetPasswordEmail(User user, String authToken) { private UUID createPasswordResetToken(UUID userId, String token) { try { - String url = virtualHostBaseUrl + "/auth/api/users/passwordResetToken?userId=" + userId + String url = virtualHostBaseUrl + "/api/users/passwordResetToken?userId=" + userId + "&access_token=" + token; RestTemplate restTemplate = new RestTemplate(); @@ -210,7 +210,7 @@ private void sendMail(String from, String to, String subject, String content, St try { NotificationRequest request = new NotificationRequest(from, to, subject, content, null); - String url = virtualHostBaseUrl + "/notification/notification?access_token=" + token; + String url = virtualHostBaseUrl + "/api/notification?access_token=" + token; RestTemplate restTemplate = new RestTemplate(); restTemplate.postForObject(url, request, Object.class); diff --git a/src/main/java/org/openlmis/referencedata/web/VersionController.java b/src/main/java/org/openlmis/referencedata/web/VersionController.java index fd0235ab1..5779eae74 100644 --- a/src/main/java/org/openlmis/referencedata/web/VersionController.java +++ b/src/main/java/org/openlmis/referencedata/web/VersionController.java @@ -19,7 +19,7 @@ public class VersionController { * * @return {Version} Returns version read from file. */ - @RequestMapping("/") + @RequestMapping("/referencedata") public Version display() { LOGGER.debug("Returning version"); return new Version(); diff --git a/src/main/resources/api-definition.yaml b/src/main/resources/api-definition.yaml index e75ff8ec3..94a019993 100644 --- a/src/main/resources/api-definition.yaml +++ b/src/main/resources/api-definition.yaml @@ -2,7 +2,7 @@ --- title: OpenLMIS Reference Data API version: "@version@" -baseUri: "@baseUrl@/api" +baseUri: "@baseUrl@" documentation: - title: Getting Started @@ -174,13 +174,13 @@ schemas: } - user: !include schemas/user.json - + - userArray: | { "type": "array", "items": { "type": "object", "$ref": "schemas/user.json" } } - + - userQueryDto: !include schemas/userQueryDto.json - detailedRoleAssignmentDto: !include schemas/detailedRoleAssignmentDto.json @@ -190,7 +190,7 @@ schemas: "type": "array", "items": { "type": "object", "$ref": "schemas/detailedRoleAssignmentDto.json" } } - + - supervisoryNode: | { "type": "object", "$schema": "http://json-schema.org/draft-03/schema", @@ -342,229 +342,81 @@ resourceTypes: responses: 200: -/processingPeriods: - displayName: Processing Period - get: - is: [ secured ] - description: Get all periods. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - post: - is: [ secured ] - description: Creates given processingPeriod if possible. - body: - application/json: - responses: - "201": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - /{id}: - uriParameters: - id: - displayName: id - type: string - required: true - repeat: false - delete: - is: [ secured ] - description: Delete chosen processingPeriod. - responses: - "204": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "409": - headers: - X-Content-Type-Options: - X-XSS-Protection: - get: - is: [ secured ] - description: Get chosen processingPeriod. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - put: - is: [ secured ] - description: Update existing processingPeriod. - body: - application/json: - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - /{id}/duration: - uriParameters: - id: - displayName: id - type: string - required: true - repeat: false - get: - is: [ secured ] - description: Display total months of processingPeriod. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: integerResult - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "500": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - /search: - get: - is: [ secured ] - description: Find periods with matched parameters. - queryParameters: - programId: - displayName: program - type: string - required: true - repeat: false - facilityId: - displayName: facility - type: string - required: true - repeat: false - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - /searchByScheduleAndDate: - get: - is: [ secured ] - description: Find periods with matched parameters. - queryParameters: - processingScheduleId: - displayName: processingSchedule - type: string - required: true - repeat: false - startDate: - displayName: startDate - type: string - required: false - repeat: false - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - -/productCategories: - displayName: Product Categories - post: +/api: + /processingPeriods: + displayName: Processing Period + get: is: [ secured ] - description: Create new productCategory. - body: - application/json: - schema: productCategory + description: Get all periods. responses: - "201": + "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - schema: productCategory - "400": + application/json: + "404": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: - get: + post: is: [ secured ] - description: Get all productCategories. + description: Creates given processingPeriod if possible. + body: + application/json: responses: - "200": + "201": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - schema: productCategoryArray - "404": + application/json: + "400": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - /{id}: + application/json: + /{id}: uriParameters: - id: - displayName: id - type: string - required: true - repeat: false + id: + displayName: id + type: string + required: true + repeat: false + delete: + is: [ secured ] + description: Delete chosen processingPeriod. + responses: + "204": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "409": + headers: + X-Content-Type-Options: + X-XSS-Protection: + get: + is: [ secured ] + description: Get chosen processingPeriod. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: put: is: [ secured ] - description: Update existing productCategory. + description: Update existing processingPeriod. body: application/json: responses: @@ -573,1321 +425,865 @@ resourceTypes: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - schema: productCategory - "404": + application/json: + "400": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: + /{id}/duration: + uriParameters: + id: + displayName: id + type: string + required: true + repeat: false get: is: [ secured ] - description: Get chosen productCategory. + description: Display total months of processingPeriod. responses: "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - schema: productCategory - "404": + application/json: + schema: integerResult + "400": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - delete: + application/json: + "500": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + /search: + get: is: [ secured ] - description: Delete chosen productCategory. + description: Find periods with matched parameters. + queryParameters: + programId: + displayName: program + type: string + required: true + repeat: false + facilityId: + displayName: facility + type: string + required: true + repeat: false responses: - "204": + "200": headers: X-Content-Type-Options: X-XSS-Protection: + body: + application/json: "404": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - "409": + application/json: + /searchByScheduleAndDate: + get: + is: [ secured ] + description: Find periods with matched parameters. + queryParameters: + processingScheduleId: + displayName: processingSchedule + type: string + required: true + repeat: false + startDate: + displayName: startDate + type: string + required: false + repeat: false + responses: + "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - /search: - get: - is: [ secured ] - description: Find product categories with matched code. - queryParameters: - code: - displayName: code - description: productCategory code. - type: string - required: false - repeat: false - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: productCategoryArray - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - -/orderableProducts: - displayName: Orderable Product - get: - is: [ secured ] - description: Get all Orderable Products. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: orderableProductArray - /{id}: - uriParameters: - id: - displayName: id - type: string - required: true - repeat: false - get: - is: [ secured ] - description: Get chosen orderable product. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: orderableProduct - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: -/tradeItems: - displayName: Trade Item - put: - is: [ secured ] - description: Create or update a Trade Item. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: tradeItem - -/globalProducts: - displayName: Global Product - put: - is: [ secured ] - description: Create or update a Global Product. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: globalProduct - /{id}/tradeItems: - uriParameters: - id: - displayName: id - type: string - required: true - repeat: false - get: - is: [ secured ] - description: Get a list of Trade Item UUIDs that may fulfill for the given Global Product. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: uuidArray - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - put: + /productCategories: + displayName: Product Categories + post: is: [ secured ] - description: Update the list of Trade Item UUIDs that may fulfill for the given Global Product. + description: Create new productCategory. body: application/json: - schema: uuidArray + schema: productCategory responses: - "200": + "201": headers: X-Content-Type-Options: X-XSS-Protection: + body: + application/json: + schema: productCategory "400": headers: X-Content-Type-Options: X-XSS-Protection: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - -/processingSchedules: - displayName: Processing Schedule - get: - is: [ secured ] - description: Get all schedules. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - post: - is: [ secured ] - description: Creates new processingSchedule. - body: - application/json: - responses: - "201": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - - /search: - get: + body: + application/json: + get: is: [ secured ] - description: Retrieve Processing Schedule based on the provided parameters. - queryParameters: - programId: - displayName: program - type: string - required: true - repeat: false - facilityId: - displayName: facility - type: string - required: true - repeat: false + description: Get all productCategories. responses: "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - schema: processingScheduleArray - "400": + application/json: + schema: productCategoryArray + "404": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - schema: errorResponse - - /{id}: - uriParameters: - id: - displayName: id - type: string - required: true - repeat: false - delete: - is: [ secured ] - description: Delete chosen processingSchedule. - responses: - "204": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "409": - headers: - X-Content-Type-Options: - X-XSS-Protection: - get: - is: [ secured ] - description: Get chosen processingSchedule. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - put: - is: [ secured ] - description: Update existing processingSchedule. - body: - application/json: - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - -/supplyLines: - displayName: Supply Lines - get: - is: [ secured ] - description: Get all supplyLines. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - post: - is: [ secured ] - description: Creates new supplyLine. - body: - application/json: - responses: - "201": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - /{id}: - uriParameters: - id: - displayName: id - type: string - required: true - repeat: false - delete: - is: [ secured ] - description: Delete chosen supplyLine. - responses: - "204": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "409": - headers: - X-Content-Type-Options: - X-XSS-Protection: - get: - is: [ secured ] - description: Get chosen supplyLine. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - put: - is: [ secured ] - description: Update existing supplyLine. - body: - application/json: - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - /search: - get: - is: [ secured ] - description: Find Supply Lines with matched parameters. - queryParameters: - program: - displayName: program - description: program ID - type: string - required: true - repeat: false - supervisoryNode: - displayName: supervisoryNode - description: supervisoryNode ID - type: string - required: true - repeat: false - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "500": - headers: - X-Content-Type-Options: - X-XSS-Protection: - - /searchByUUID: - get: - is: [ secured ] - description: Find Supply Lines with matched parameters. - queryParameters: - programId: - displayName: programId - description: program ID - type: string - required: true - repeat: false - supervisoryNodeId: - displayName: supervisoryNodeId - description: supervisoryNode ID - type: string - required: true - repeat: false - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "500": - headers: - X-Content-Type-Options: - X-XSS-Protection: - -/users: - displayName: User - get: - is: [ secured ] - description: Get all users. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - put: - is: [ secured ] - description: Create or update user. - body: - application/json: - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - text/plain: - "500": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - /{userId}: - uriParameters: - userId: - displayName: User ID - type: string - required: true - repeat: false - delete: - is: [ secured ] - description: Delete chosen user. - responses: - "204": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - get: - is: [ secured ] - description: Get chosen user. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - /roleAssignments: - get: + application/json: + /{id}: + uriParameters: + id: + displayName: id + type: string + required: true + repeat: false + put: is: [ secured ] - description: Return full information about user's roles and rights. + description: Update existing productCategory. + body: + application/json: responses: "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - schema: detailedRoleAssignmentDtoArray + application/json: + schema: productCategory "404": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - schema: errorResponse - /hasRight: + application/json: get: is: [ secured ] - description: Check if the user has a right with certain criteria. - queryParameters: - rightId: - displayName: Right ID - description: The right to check. - type: string - required: true - repeat: false - programId: - displayName: Program ID - description: The program to check (for supervision rights). - type: string - required: false - repeat: false - facilityId: - displayName: Facility ID - description: The facility to check (for supervision rights). If program is specified, this is required. - type: string - required: false - repeat: false - warehouseId: - displayName: Warehouse ID - description: The warehouse to check (for fulfillment rights). - type: string - required: false - repeat: false + description: Get chosen productCategory. responses: "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - schema: booleanResult - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - text/plain: + application/json: + schema: productCategory "404": headers: X-Content-Type-Options: X-XSS-Protection: - /programs: - is: [ secured ] - displayName: User supervised programs - get: - is: [ secured ] - description: Get all programs the associated user supervises (through the home - facility or through supervisory nodes). - queryParameters: - forHomeFacility: - displayName: For Home Facility - description: Flag to get programs for home facility. - type: boolean - required: false - repeat: false - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - /supervisedFacilities: - is: [ secured ] - displayName: User supervised facilities - get: + application/json: + delete: is: [ secured ] - description: Get all facilities the associated user supervises, by right and program. - queryParameters: - rightId: - displayName: Right ID - description: The right to check. - type: string - required: true - repeat: false - programId: - displayName: Program ID - description: The program to check. - type: string - required: true - repeat: false + description: Delete chosen productCategory. responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "400": + "204": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: - schema: errorResponse "404": headers: X-Content-Type-Options: X-XSS-Protection: - /search: - post: - is: [ secured ] - description: "Search users, matching all parameters specified. Searching is done in the request body, in JSON format. The JSON in the request body should be one or more key-value pairs." - body: - application/json: - schema: userQueryDto - responses: - 200: + body: + application/json: + "409": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - schema: userArray - -/facilities: - displayName: Facility - get: - is: [ secured ] - description: Get all facilities. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: facilityArray - post: - is: [ secured ] - description: Creates new facility. - body: - application/json: - schema: facility - responses: - "201": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: facility - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: errorResponse - /{id}: - uriParameters: - id: - displayName: id - type: string - required: true - repeat: false - delete: - is: [ secured ] - description: Delete chosen facility. - responses: - "204": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "409": - headers: - X-Content-Type-Options: - X-XSS-Protection: - get: - is: [ secured ] - description: Get chosen facility. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: facility - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - put: - is: [ secured ] - description: Update existing facility. - body: - application/json: - schema: facility - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: facility - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: errorResponse - /{id}/approvedProducts: - uriParameters: - id: - displayName: Facility ID - type: string - required: true - repeat: false - get: - is: [ secured ] - description: Returns a list of full or non-full supply approved products for this facility - queryParameters: - programId: - displayName: Program ID - type: string - required: true - repeat: false - fullSupply: - displayName: Full-supply product - type: boolean - required: true - repeat: false - responses: - 200: + application/json: + /search: + get: + is: [ secured ] + description: Find product categories with matched code. + queryParameters: + code: + displayName: code + description: productCategory code. + type: string + required: false + repeat: false + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: productCategoryArray + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + + /orderableProducts: + displayName: Orderable Product + get: + is: [ secured ] + description: Get all Orderable Products. + responses: + "200": headers: X-Content-Type-Options: X-XSS-Protection: body: application/json: - schema: approvedProductDtoArray - - 400: - headers: + schema: orderableProductArray + /{id}: + uriParameters: + id: + displayName: id + type: string + required: true + repeat: false + get: + is: [ secured ] + description: Get chosen orderable product. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: orderableProduct + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + + /tradeItems: + displayName: Trade Item + put: + is: [ secured ] + description: Create or update a Trade Item. + responses: + "200": + headers: X-Content-Type-Options: X-XSS-Protection: body: application/json: - schema: errorResponse - /{id}/orders: - uriParameters: - id: - displayName: homeFacilityId - type: string - required: true - repeat: false - get: - is: [ secured ] - description: Returns a list of filtered orders supplied by a home facility. - queryParameters: - program: - displayName: program - type: string - required: false - repeat: false - requestingFacility: - displayName: requestingFacility - type: string - required: false - repeat: false - period: - displayName: processingPeriod - type: string - required: false - repeat: false - schedule: - displayName: processingSchedule - type: string - required: false - repeat: false - startDate: - displayName: startDate - type: string - required: false - repeat: false - endDate: - displayName: endDate - type: string - required: false - repeat: false - responses: - 200: + schema: tradeItem + + /globalProducts: + displayName: Global Product + put: + is: [ secured ] + description: Create or update a Global Product. + responses: + "200": headers: X-Content-Type-Options: X-XSS-Protection: body: application/json: - 400: + schema: globalProduct + /{id}/tradeItems: + uriParameters: + id: + displayName: id + type: string + required: true + repeat: false + get: + is: [ secured ] + description: Get a list of Trade Item UUIDs that may fulfill for the given Global Product. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: uuidArray + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + put: + is: [ secured ] + description: Update the list of Trade Item UUIDs that may fulfill for the given Global Product. + body: + application/json: + schema: uuidArray + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "400": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + + /processingSchedules: + displayName: Processing Schedule + get: + is: [ secured ] + description: Get all schedules. + responses: + "200": headers: X-Content-Type-Options: X-XSS-Protection: - 404: + body: + application/json: + "404": headers: X-Content-Type-Options: X-XSS-Protection: - 500: + post: + is: [ secured ] + description: Creates new processingSchedule. + body: + application/json: + responses: + "201": headers: X-Content-Type-Options: X-XSS-Protection: - /supplying: - get: - is: [ secured ] - description: Returns a list of facilities. - queryParameters: - programId: - displayName: programId - type: string - required: true - repeat: false - supervisoryNodeId: - displayName: supervisoryNodeId - type: string - required: true - repeat: false - responses: - 200: + body: + application/json: + "400": headers: X-Content-Type-Options: X-XSS-Protection: body: application/json: - 400: + + /search: + get: + is: [ secured ] + description: Retrieve Processing Schedule based on the provided parameters. + queryParameters: + programId: + displayName: program + type: string + required: true + repeat: false + facilityId: + displayName: facility + type: string + required: true + repeat: false + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: processingScheduleArray + "400": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: errorResponse + + /{id}: + uriParameters: + id: + displayName: id + type: string + required: true + repeat: false + delete: + is: [ secured ] + description: Delete chosen processingSchedule. + responses: + "204": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "409": + headers: + X-Content-Type-Options: + X-XSS-Protection: + get: + is: [ secured ] + description: Get chosen processingSchedule. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + put: + is: [ secured ] + description: Update existing processingSchedule. + body: + application/json: + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "400": + headers: + X-Content-Type-Options: + X-XSS-Protection: + + /supplyLines: + displayName: Supply Lines + get: + is: [ secured ] + description: Get all supplyLines. + responses: + "200": headers: X-Content-Type-Options: X-XSS-Protection: body: application/json: - schema: errorResponse - 404: + "404": headers: X-Content-Type-Options: X-XSS-Protection: - 500: + post: + is: [ secured ] + description: Creates new supplyLine. + body: + application/json: + responses: + "201": headers: X-Content-Type-Options: X-XSS-Protection: - - /search: - get: - is: [ secured ] - description: Returns a list of facilities. - queryParameters: - code: - displayName: code - type: string - required: false - repeat: false - name: - displayName: name - type: string - required: false - repeat: false - responses: - 200: + body: + application/json: + "400": headers: X-Content-Type-Options: X-XSS-Protection: body: application/json: - schema: facilityArray - 404: + /{id}: + uriParameters: + id: + displayName: id + type: string + required: true + repeat: false + delete: + is: [ secured ] + description: Delete chosen supplyLine. + responses: + "204": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "409": + headers: + X-Content-Type-Options: + X-XSS-Protection: + get: + is: [ secured ] + description: Get chosen supplyLine. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + put: + is: [ secured ] + description: Update existing supplyLine. + body: + application/json: + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "400": + headers: + X-Content-Type-Options: + X-XSS-Protection: + /search: + get: + is: [ secured ] + description: Find Supply Lines with matched parameters. + queryParameters: + program: + displayName: program + description: program ID + type: string + required: true + repeat: false + supervisoryNode: + displayName: supervisoryNode + description: supervisoryNode ID + type: string + required: true + repeat: false + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "500": + headers: + X-Content-Type-Options: + X-XSS-Protection: + + /searchByUUID: + get: + is: [ secured ] + description: Find Supply Lines with matched parameters. + queryParameters: + programId: + displayName: programId + description: program ID + type: string + required: true + repeat: false + supervisoryNodeId: + displayName: supervisoryNodeId + description: supervisoryNode ID + type: string + required: true + repeat: false + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "500": + headers: + X-Content-Type-Options: + X-XSS-Protection: + + /users: + displayName: User + get: + is: [ secured ] + description: Get all users. + responses: + "200": headers: X-Content-Type-Options: X-XSS-Protection: - -/facilityTypes: - displayName: Facility Type - get: - is: [ secured ] - description: Get all facilityTypes. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - post: - is: [ secured ] - description: Creates new facilityType. - body: - application/json: - responses: - "201": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - /{id}: - uriParameters: - id: - displayName: id - type: string - required: true - repeat: false - delete: - is: [ secured ] - description: Delete chosen facilityType. - responses: - "204": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "409": - headers: - X-Content-Type-Options: - X-XSS-Protection: - get: - is: [ secured ] - description: Get chosen facilityType. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - put: - is: [ secured ] - description: Update existing facilityType. - body: - application/json: - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - -/programs: - displayName: Program - get: - is: [ secured ] - description: Get all programs. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - post: - is: [ secured ] - description: Creates new program. - body: - application/json: - responses: - "201": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - /{id}: - uriParameters: - id: - displayName: id - type: string - required: true - repeat: false - delete: - is: [ secured ] - description: Delete chosen program. - responses: - "204": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "409": - headers: - X-Content-Type-Options: - X-XSS-Protection: - get: - is: [ secured ] - description: Get chosen program. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - put: - is: [ secured ] - description: Update existing program. - body: - application/json: - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - /search: - get: - is: [ secured ] - description: Get chosen program. - queryParameters: - name: - displayName: name - type: string - required: true - repeat: false - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - -/stockAdjustmentReasons: - displayName: Stock Adjustment Reason - get: - is: [ secured ] - description: Get all stockAdjustmentReasons. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: stockAdjustmentReasonArray - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - post: - is: [ secured ] - description: Creates new Stock Adjustment Reason. - body: - application/json: - schema: stockAdjustmentReason - responses: - "201": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: stockAdjustmentReason - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - /{id}: - uriParameters: - id: - displayName: id - type: string - required: true - repeat: false - delete: - is: [ secured ] - description: Delete chosen Stock Adjustment Reason. - responses: - "204": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "409": - headers: - X-Content-Type-Options: - X-XSS-Protection: - get: - is: [ secured ] - description: Get chosen Stock Adjustment Reason. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: stockAdjustmentReason - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - put: - is: [ secured ] - description: Update existing Stock Adjustment Reason. - body: - application/json: - schema: stockAdjustmentReason - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: stockAdjustmentReason - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - /search: - get: - is: [ secured ] - description: Search for Stock Adjustment Reasons. - queryParameters: - program: - displayName: programId - type: string - required: true - repeat: false - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: stockAdjustmentReasonArray - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - -/facilityOperators: - displayName: Facility Operators - post: + body: + application/json: + put: is: [ secured ] - description: Add Facility Operator to database. + description: Create or update user. body: application/json: responses: - "201": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "500": + "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - get: - is: [ secured ] - description: Returns Facility Operators with given id from database. - responses: - "200": + application/json: + "400": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - "404": + text/plain: + "500": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - /{id}: + application/json: + /{userId}: uriParameters: - id: - displayName: id - type: string - required: true - repeat: false - put: + userId: + displayName: User ID + type: string + required: true + repeat: false + delete: is: [ secured ] - description: Updates Facility Operators with given id from database. - body: - application/json: + description: Delete chosen user. responses: - "200": + "204": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "400": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: + application/json: "404": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: get: is: [ secured ] - description: Updates Facility Operators with given id from database. + description: Get chosen user. responses: "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: + application/json: "404": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: + /roleAssignments: + get: + is: [ secured ] + description: Return full information about user's roles and rights. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: detailedRoleAssignmentDtoArray + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: errorResponse + /hasRight: + get: + is: [ secured ] + description: Check if the user has a right with certain criteria. + queryParameters: + rightId: + displayName: Right ID + description: The right to check. + type: string + required: true + repeat: false + programId: + displayName: Program ID + description: The program to check (for supervision rights). + type: string + required: false + repeat: false + facilityId: + displayName: Facility ID + description: The facility to check (for supervision rights). If program is specified, this is required. + type: string + required: false + repeat: false + warehouseId: + displayName: Warehouse ID + description: The warehouse to check (for fulfillment rights). + type: string + required: false + repeat: false + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: booleanResult + "400": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + text/plain: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + /programs: + is: [ secured ] + displayName: User supervised programs + get: + is: [ secured ] + description: Get all programs the associated user supervises (through the home + facility or through supervisory nodes). + queryParameters: + forHomeFacility: + displayName: For Home Facility + description: Flag to get programs for home facility. + type: boolean + required: false + repeat: false + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + /supervisedFacilities: + is: [ secured ] + displayName: User supervised facilities + get: + is: [ secured ] + description: Get all facilities the associated user supervises, by right and program. + queryParameters: + rightId: + displayName: Right ID + description: The right to check. + type: string + required: true + repeat: false + programId: + displayName: Program ID + description: The program to check. + type: string + required: true + repeat: false + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "400": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: errorResponse + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + /search: + post: + is: [ secured ] + description: "Search users, matching all parameters specified. Searching is done in the request body, in JSON format. The JSON in the request body should be one or more key-value pairs." + body: + application/json: + schema: userQueryDto + responses: + 200: + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: userArray + + /facilities: + displayName: Facility + get: + is: [ secured ] + description: Get all facilities. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: facilityArray + post: + is: [ secured ] + description: Creates new facility. + body: + application/json: + schema: facility + responses: + "201": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: facility + "400": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: errorResponse + /{id}: + uriParameters: + id: + displayName: id + type: string + required: true + repeat: false delete: is: [ secured ] - description: Updates Facility Operators with given id from database. + description: Delete chosen facility. responses: "204": headers: @@ -1897,697 +1293,1302 @@ resourceTypes: headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: "409": headers: X-Content-Type-Options: X-XSS-Protection: + get: + is: [ secured ] + description: Get chosen facility. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: body: - application/json: - -/geographicZones: - displayName: Geographic Zone - get: - is: [ secured ] - description: Get all geographicZones. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - post: - is: [ secured ] - description: Creates new geographicZone. - body: - application/json: - responses: - "201": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: + application/json: + schema: facility + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + put: + is: [ secured ] + description: Update existing facility. + body: application/json: - /{id}: - uriParameters: - id: - displayName: id - type: string - required: true - repeat: false - delete: - is: [ secured ] - description: Delete chosen geographicZone. - responses: - "204": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "409": - headers: - X-Content-Type-Options: - X-XSS-Protection: - get: - is: [ secured ] - description: Get chosen geographicZone. - responses: - "200": + schema: facility + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: facility + "400": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: errorResponse + /{id}/approvedProducts: + uriParameters: + id: + displayName: Facility ID + type: string + required: true + repeat: false + get: + is: [ secured ] + description: Returns a list of full or non-full supply approved products for this facility + queryParameters: + programId: + displayName: Program ID + type: string + required: true + repeat: false + fullSupply: + displayName: Full-supply product + type: boolean + required: true + repeat: false + responses: + 200: headers: X-Content-Type-Options: X-XSS-Protection: body: application/json: - "404": + schema: approvedProductDtoArray + + 400: headers: X-Content-Type-Options: X-XSS-Protection: - put: - is: [ secured ] - description: Update existing geographicZone. - body: - application/json: - responses: - "200": + body: + application/json: + schema: errorResponse + /{id}/orders: + uriParameters: + id: + displayName: homeFacilityId + type: string + required: true + repeat: false + get: + is: [ secured ] + description: Returns a list of filtered orders supplied by a home facility. + queryParameters: + program: + displayName: program + type: string + required: false + repeat: false + requestingFacility: + displayName: requestingFacility + type: string + required: false + repeat: false + period: + displayName: processingPeriod + type: string + required: false + repeat: false + schedule: + displayName: processingSchedule + type: string + required: false + repeat: false + startDate: + displayName: startDate + type: string + required: false + repeat: false + endDate: + displayName: endDate + type: string + required: false + repeat: false + responses: + 200: headers: X-Content-Type-Options: X-XSS-Protection: body: application/json: - "400": + 400: headers: X-Content-Type-Options: X-XSS-Protection: - -/geographicLevels: - displayName: Geographic Level - get: - is: [ secured ] - description: Get all geographicLevels. - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - post: - is: [ secured ] - description: Creates new geographicLevel. - body: - application/json: - responses: - "201": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "400": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - /{id}: - uriParameters: - id: - displayName: id - type: string - required: true - repeat: false - delete: - is: [ secured ] - description: Delete chosen geographicLevel. - responses: - "204": + 404: headers: X-Content-Type-Options: X-XSS-Protection: - "404": + 500: headers: X-Content-Type-Options: X-XSS-Protection: - "409": + /supplying: + get: + is: [ secured ] + description: Returns a list of facilities. + queryParameters: + programId: + displayName: programId + type: string + required: true + repeat: false + supervisoryNodeId: + displayName: supervisoryNodeId + type: string + required: true + repeat: false + responses: + 200: headers: X-Content-Type-Options: X-XSS-Protection: - get: - is: [ secured ] - description: Get chosen geographicLevel. - responses: - "200": + body: + application/json: + 400: headers: X-Content-Type-Options: X-XSS-Protection: body: application/json: - "404": + schema: errorResponse + 404: headers: X-Content-Type-Options: X-XSS-Protection: - put: - is: [ secured ] - description: Update existing geographicLevel. - body: - application/json: - responses: - "200": + 500: + headers: + X-Content-Type-Options: + X-XSS-Protection: + + /search: + get: + is: [ secured ] + description: Returns a list of facilities. + queryParameters: + code: + displayName: code + type: string + required: false + repeat: false + name: + displayName: name + type: string + required: false + repeat: false + responses: + 200: headers: X-Content-Type-Options: X-XSS-Protection: body: application/json: - "400": + schema: facilityArray + 404: headers: X-Content-Type-Options: X-XSS-Protection: -/facilityTypeApprovedProducts: - displayName: Facility Type Approved Product - post: + /facilityTypes: + displayName: Facility Type + get: is: [ secured ] - description: Create new facilityTypeApprovedProduct. - body: - application/json: + description: Get all facilityTypes. responses: - "201": + "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - "500": + application/json: + "404": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: - get: + post: is: [ secured ] - description: Get all facilityTypeApprovedProducts. + description: Creates new facilityType. + body: + application/json: responses: - "200": + "201": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - "404": + application/json: + "400": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - /search: - get: - is: [ secured ] - description: Get list of full supply FacilityTypeApprovedProduct. - queryParameters: - facility: - displayName: facility - type: string - required: true - repeat: false - program: - displayName: program - type: string - required: true - repeat: false - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - /{id}: + application/json: + /{id}: uriParameters: - id: - displayName: id - type: string - required: true - repeat: false - put: + id: + displayName: id + type: string + required: true + repeat: false + delete: is: [ secured ] - description: Update existing facilityTypeApprovedProduct. - body: - application/json: + description: Delete chosen facilityType. responses: - "200": + "204": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: "404": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: + "409": + headers: + X-Content-Type-Options: + X-XSS-Protection: get: is: [ secured ] - description: Get chosen facilityTypeApprovedProduct. + description: Get chosen facilityType. responses: "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: + application/json: "404": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: - delete: + put: is: [ secured ] - description: Delete chosen facilityTypeApprovedProduct. + description: Update existing facilityType. + body: + application/json: responses: - "204": - headers: - X-Content-Type-Options: - X-XSS-Protection: - "404": + "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - "409": + application/json: + "400": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: -/supervisoryNodes: - displayName: Supervisory Node - post: + /programs: + displayName: Program + get: is: [ secured ] - description: Create new supervisoryNode. - body: - application/json: + description: Get all programs. responses: - "201": + "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - "500": + application/json: + "404": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: - get: + post: is: [ secured ] - description: Get all supervisoryNodes. + description: Creates new program. + body: + application/json: responses: - "200": + "201": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - "404": + application/json: + "400": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - /{id}: + application/json: + /{id}: uriParameters: - id: - displayName: id - type: string - required: true - repeat: false - put: + id: + displayName: id + type: string + required: true + repeat: false + delete: is: [ secured ] - description: Update existing supervisoryNode. - body: - application/json: + description: Delete chosen program. responses: - "200": + "204": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: "404": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: + "409": + headers: + X-Content-Type-Options: + X-XSS-Protection: get: is: [ secured ] - description: Get chosen supervisoryNode. + description: Get chosen program. responses: "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: + application/json: "404": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: - delete: + put: is: [ secured ] - description: Delete chosen supervisoryNode. + description: Update existing program. + body: + application/json: responses: - "204": + "200": headers: X-Content-Type-Options: X-XSS-Protection: - "404": + body: + application/json: + "400": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: - "409": + /search: + get: + is: [ secured ] + description: Get chosen program. + queryParameters: + name: + displayName: name + type: string + required: true + repeat: false + responses: + "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: -/roles: - displayName: Role - post: + /stockAdjustmentReasons: + displayName: Stock Adjustment Reason + get: is: [ secured ] - description: Create new role. - body: - application/json: - schema: role + description: Get all stockAdjustmentReasons. responses: - "201": + "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - schema: role - "400": + application/json: + schema: stockAdjustmentReasonArray + "404": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: - "409": + post: + is: [ secured ] + description: Creates new Stock Adjustment Reason. + body: + application/json: + schema: stockAdjustmentReason + responses: + "201": headers: X-Content-Type-Options: X-XSS-Protection: body: - text/plain: - get: - is: [ secured ] - description: Get all roles. - responses: - "200": + application/json: + schema: stockAdjustmentReason + "400": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - schema: roleArray - /{roleId}: + application/json: + /{id}: uriParameters: - roleId: - displayName: Role ID - type: string - required: true - repeat: false - put: + id: + displayName: id + type: string + required: true + repeat: false + delete: is: [ secured ] - description: Update existing role (or create new one using role ID). - body: - application/json: - schema: role + description: Delete chosen Stock Adjustment Reason. responses: - "200": + "204": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: - schema: role - "400": + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "409": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: get: is: [ secured ] - description: Get chosen role. + description: Get chosen Stock Adjustment Reason. responses: "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - schema: role + application/json: + schema: stockAdjustmentReason "404": headers: X-Content-Type-Options: X-XSS-Protection: - delete: + put: is: [ secured ] - description: Delete chosen role. + description: Update existing Stock Adjustment Reason. + body: + application/json: + schema: stockAdjustmentReason responses: - "204": + "200": headers: X-Content-Type-Options: X-XSS-Protection: + body: + application/json: + schema: stockAdjustmentReason "400": headers: X-Content-Type-Options: X-XSS-Protection: + /search: + get: + is: [ secured ] + description: Search for Stock Adjustment Reasons. + queryParameters: + program: + displayName: programId + type: string + required: true + repeat: false + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: body: - application/json: + application/json: + schema: stockAdjustmentReasonArray "404": headers: X-Content-Type-Options: X-XSS-Protection: -/rights: - displayName: Right - put: + /facilityOperators: + displayName: Facility Operators + post: + is: [ secured ] + description: Add Facility Operator to database. + body: + application/json: + responses: + "201": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "500": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + get: + is: [ secured ] + description: Returns Facility Operators with given id from database. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + /{id}: + uriParameters: + id: + displayName: id + type: string + required: true + repeat: false + put: + is: [ secured ] + description: Updates Facility Operators with given id from database. + body: + application/json: + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + get: + is: [ secured ] + description: Updates Facility Operators with given id from database. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + delete: + is: [ secured ] + description: Updates Facility Operators with given id from database. + responses: + "204": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "409": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + + /geographicZones: + displayName: Geographic Zone + get: is: [ secured ] - description: Save a right. - body: - application/json: - schema: right + description: Get all geographicZones. responses: "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - schema: right - "400": + application/json: + "404": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: - get: + post: is: [ secured ] - description: Get all rights. + description: Creates new geographicZone. + body: + application/json: responses: - "200": + "201": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - schema: rightArray - /{rightId}: + application/json: + "400": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + /{id}: uriParameters: - rightId: - displayName: Right ID - type: string - required: true - repeat: false - get: + id: + displayName: id + type: string + required: true + repeat: false + delete: is: [ secured ] - description: Get chosen right. + description: Delete chosen geographicZone. responses: - "200": + "204": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: - schema: right "404": headers: X-Content-Type-Options: X-XSS-Protection: - delete: + "409": + headers: + X-Content-Type-Options: + X-XSS-Protection: + get: is: [ secured ] - description: Delete chosen right. + description: Get chosen geographicZone. responses: - "204": + "200": headers: X-Content-Type-Options: X-XSS-Protection: - "400": + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + put: + is: [ secured ] + description: Update existing geographicZone. + body: + application/json: + responses: + "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - "404": + application/json: + "400": headers: X-Content-Type-Options: X-XSS-Protection: - /search: - get: - is: [ secured ] - description: Search for rights. - queryParameters: - name: - displayName: Name of the right to find - type: string - required: true - repeat: false - responses: - "200": - headers: - X-Content-Type-Options: - X-XSS-Protection: - body: - application/json: - schema: rightArray - "404": - headers: - X-Content-Type-Options: - X-XSS-Protection: -/requisitionGroups: - displayName: Requisition Group - post: + /geographicLevels: + displayName: Geographic Level + get: is: [ secured ] - description: Create new requisitionGroup. - body: - application/json: + description: Get all geographicLevels. responses: - "201": + "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - "500": + application/json: + "404": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: - get: + post: is: [ secured ] - description: Get all requisitionGroups. + description: Creates new geographicLevel. + body: + application/json: responses: - "200": + "201": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: - "404": + application/json: + "400": headers: X-Content-Type-Options: X-XSS-Protection: - /{id}: + body: + application/json: + /{id}: uriParameters: - id: - displayName: id - type: string - required: true - repeat: false - put: + id: + displayName: id + type: string + required: true + repeat: false + delete: is: [ secured ] - description: Update existing requisitionGroup. - body: - application/json: + description: Delete chosen geographicLevel. responses: - "200": + "204": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: "404": headers: X-Content-Type-Options: X-XSS-Protection: - body: - application/json: + "409": + headers: + X-Content-Type-Options: + X-XSS-Protection: get: is: [ secured ] - description: Get chosen requisitionGroup. + description: Get chosen geographicLevel. responses: "200": headers: X-Content-Type-Options: X-XSS-Protection: body: - application/json: + application/json: "404": headers: X-Content-Type-Options: X-XSS-Protection: - delete: + put: is: [ secured ] - description: Delete chosen requisitionGroup. + description: Update existing geographicLevel. + body: + application/json: responses: - "204": + "200": headers: X-Content-Type-Options: X-XSS-Protection: - "404": + body: + application/json: + "400": headers: X-Content-Type-Options: X-XSS-Protection: - "409": + + /facilityTypeApprovedProducts: + displayName: Facility Type Approved Product + post: + is: [ secured ] + description: Create new facilityTypeApprovedProduct. + body: + application/json: + responses: + "201": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "500": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + get: + is: [ secured ] + description: Get all facilityTypeApprovedProducts. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + /search: + get: + is: [ secured ] + description: Get list of full supply FacilityTypeApprovedProduct. + queryParameters: + facility: + displayName: facility + type: string + required: true + repeat: false + program: + displayName: program + type: string + required: true + repeat: false + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": headers: X-Content-Type-Options: X-XSS-Protection: + body: + application/json: + /{id}: + uriParameters: + id: + displayName: id + type: string + required: true + repeat: false + put: + is: [ secured ] + description: Update existing facilityTypeApprovedProduct. + body: + application/json: + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + get: + is: [ secured ] + description: Get chosen facilityTypeApprovedProduct. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + delete: + is: [ secured ] + description: Delete chosen facilityTypeApprovedProduct. + responses: + "204": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "409": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + + /supervisoryNodes: + displayName: Supervisory Node + post: + is: [ secured ] + description: Create new supervisoryNode. + body: + application/json: + responses: + "201": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "500": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + get: + is: [ secured ] + description: Get all supervisoryNodes. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + /{id}: + uriParameters: + id: + displayName: id + type: string + required: true + repeat: false + put: + is: [ secured ] + description: Update existing supervisoryNode. + body: + application/json: + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + get: + is: [ secured ] + description: Get chosen supervisoryNode. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + delete: + is: [ secured ] + description: Delete chosen supervisoryNode. + responses: + "204": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "409": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + + /roles: + displayName: Role + post: + is: [ secured ] + description: Create new role. + body: + application/json: + schema: role + responses: + "201": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: role + "400": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "409": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + text/plain: + get: + is: [ secured ] + description: Get all roles. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: roleArray + /{roleId}: + uriParameters: + roleId: + displayName: Role ID + type: string + required: true + repeat: false + put: + is: [ secured ] + description: Update existing role (or create new one using role ID). + body: + application/json: + schema: role + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: role + "400": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + get: + is: [ secured ] + description: Get chosen role. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: role + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + delete: + is: [ secured ] + description: Delete chosen role. + responses: + "204": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "400": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + + /rights: + displayName: Right + put: + is: [ secured ] + description: Save a right. + body: + application/json: + schema: right + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: right + "400": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + get: + is: [ secured ] + description: Get all rights. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: rightArray + /{rightId}: + uriParameters: + rightId: + displayName: Right ID + type: string + required: true + repeat: false + get: + is: [ secured ] + description: Get chosen right. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: right + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + delete: + is: [ secured ] + description: Delete chosen right. + responses: + "204": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "400": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + /search: + get: + is: [ secured ] + description: Search for rights. + queryParameters: + name: + displayName: Name of the right to find + type: string + required: true + repeat: false + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + schema: rightArray + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + + /requisitionGroups: + displayName: Requisition Group + post: + is: [ secured ] + description: Create new requisitionGroup. + body: + application/json: + responses: + "201": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "500": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + get: + is: [ secured ] + description: Get all requisitionGroups. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + /{id}: + uriParameters: + id: + displayName: id + type: string + required: true + repeat: false + put: + is: [ secured ] + description: Update existing requisitionGroup. + body: + application/json: + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + get: + is: [ secured ] + description: Get chosen requisitionGroup. + responses: + "200": + headers: + X-Content-Type-Options: + X-XSS-Protection: + body: + application/json: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + delete: + is: [ secured ] + description: Delete chosen requisitionGroup. + responses: + "204": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "404": + headers: + X-Content-Type-Options: + X-XSS-Protection: + "409": + headers: + X-Content-Type-Options: + X-XSS-Protection: diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 705f41b6b..5b9946416 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -17,10 +17,10 @@ spring.jpa.show-sql=false defaultLocale=en -service.url=http://${VIRTUAL_HOST:localhost}/referencedata +service.url=http://${VIRTUAL_HOST:localhost} auth.server.baseUrl=http://${VIRTUAL_HOST:localhost} -auth.server.url=http://${VIRTUAL_HOST:localhost}/auth/oauth/check_token +auth.server.url=http://${VIRTUAL_HOST:localhost}/api/oauth/check_token auth.server.clientId=trusted-client auth.server.clientSecret=secret diff --git a/src/main/resources/static/docs/index.html b/src/main/resources/static/referencedata/docs/index.html similarity index 97% rename from src/main/resources/static/docs/index.html rename to src/main/resources/static/referencedata/docs/index.html index 86184c8df..c8119f38f 100644 --- a/src/main/resources/static/docs/index.html +++ b/src/main/resources/static/referencedata/docs/index.html @@ -41,8 +41,6 @@ var url = window.location.search.match(/url=([^&]+)/); // Location without filename var baseUrl = window.location.href.replace(/[#|?].*/, "").match(/^(http.+\/).+$/)[1]; - // Location without filename and protocol - var basePath = baseUrl.replace(/.*?:\/\//g, ""); if (url && url.length > 1) { url = decodeURIComponent(url[1]); @@ -94,7 +92,7 @@ window.swaggerUi.load(); setTimeout(function(){ - window.swaggerUi.api.setHost(basePath); + window.swaggerUi.api.setHost(window.location.hostname); }, 1000); function log() {