-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
115 lines (110 loc) · 3.52 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
const express = require('express');
const app = express();
const swaggerJSDoc = require('swagger-jsdoc');
const swaggerUI = require('swagger-ui-express');
const { right_of_access, right_of_erase } = require('./backend.request')
const PORT = process.env.PORT || 8080;
const swaggerOptions = {
definition: {
openapi: '3.0.0',
info: {
title: 'BackEnd ROA and ROE APIs',
version: '1.0.0',
description: 'BackEnd ROA and ROE APIs for async APIS',
contact: {
name: 'Pankaj Upadhayay',
email: '[email protected]'
},
servers: ["http://localhost:3000"]
}
},
apis: ["index.js"]
}
const swaggerDocs = swaggerJSDoc(swaggerOptions);
app.use('/api-docs', swaggerUI.serve, swaggerUI.setup(swaggerDocs));
app.use(express.json());
/**
* @swagger
* definitions:
* ROARequest:
* type: object
* properties:
* request_id:
* type: string
* description: request_id of the privacy request
* example: '2ef99e18-73e8-4829-b453-d0118a91b039'
* identifier:
* type: string
* description: identifier of the privacy request
* example: '{type:"emailAddress", value:"[email protected]"}'
* task_id:
* type: string
* description: task_id of the privacy request
* example: '2ef99e18-73e8-4829-b453-d0118a91b039'
* client_name:
* type: string
* description: selected client instance for ROE privacy request
* example: '{"walmert","walmart_uk","walmart_ca"}'
* upload_url:
* type: string
* description: upload url of the task for privacy request if data found
* example: 'https://example.s3.us-west-1.amazonaws.com/yourDirectory/5ef5e88a-4305-481f-9f9c-4d1364a003d1?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ACREDENTIALSTRING%2F20210521%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210521T211815Z&X-Amz-Expires=900&X-Amz-Signature=f651971xs974fw974e97819f87a19w78ef49aw7ef46aw8e1fa651ef42a9fec60&X-Amz-SignedHeaders=host'
* ROERequest:
* type: object
* properties:
* request_id:
* type: string
* description: request_id of the privacy request
* example: '2ef99e18-73e8-4829-b453-d0118a91b039'
* identifier:
* type: string
* description: identifier of the privacy request
* example: '{type:"emailAddress", value:"[email protected]"}'
* task_id:
* type: string
* description: task_id of the privacy request
* example: '2ef99e18-73e8-4829-b453-d0118a91b039'
* client_name:
* type: string
* description: selected client instance for ROE privacy request
* example: '{"walmert","walmart_uk","walmart_ca"}'
*/
/**
* @swagger
* /roa_request:
* post:
* summary: create ROA request
* description: create ROA request
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/ROARequest'
* responses:
* 203:
* description: ROA request submitted succesfully
* 403:
* description: ROA request submitted fail
*/
app.post("/roa_request", right_of_access);
/**
* @swagger
* /roe_request:
* post:
* summary: create ROE request
* description: create ROE request
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/ROERequest'
* responses:
* 203:
* description: ROE request submitted succesfully
* 403:
* description: ROE request submitted fail
*/
app.post("/roe_request", right_of_erase);
app.listen(PORT, () => {
console.log("server listening in port PORT");
})