-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c329101
commit 6798dbe
Showing
12 changed files
with
355 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ docker-compose.yml | |
.env | ||
k8s | ||
.husky | ||
gen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules/ | |
build/ | ||
dist/ | ||
coverage/ | ||
gen/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ coverage/ | |
pkg/ | ||
bin/ | ||
.env | ||
gen/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules/ | |
build/ | ||
dist/ | ||
coverage/ | ||
gen/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { basename } from 'path'; | ||
import { cp } from 'fs'; | ||
import copydir from 'copy-dir'; | ||
|
||
cp('./open-api.json', './dist/open-api.json', (error) => { | ||
if (error) { | ||
throw error; | ||
} | ||
}); | ||
|
||
copydir('./node_modules/swagger-ui-dist', './dist/', { | ||
filter: (_, filepath) => { | ||
const filename = basename(filepath); | ||
|
||
return filename.startsWith('swagger-ui') || filename.startsWith('favicon'); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,225 @@ | ||
{ | ||
"openapi": "3.0.3", | ||
"info": { | ||
"title": "Consents API", | ||
"version": "0.1.0" | ||
}, | ||
"paths": { | ||
"/users": { | ||
"post": { | ||
"tags": [ | ||
"Users" | ||
], | ||
"summary": "Creates a new user", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "object", | ||
"required": true, | ||
"properties": { | ||
"email": { | ||
"type": "string", | ||
"description": "Unique email address of user", | ||
"required": true | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"required": true | ||
}, | ||
"responses": { | ||
"201": { | ||
"description": "Returns newly created user", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/userResponse" | ||
} | ||
} | ||
} | ||
}, | ||
"422": { | ||
"description": "When input is not valid", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/errorsResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/users/{id}": { | ||
"parameters": [ | ||
{ | ||
"name": "id", | ||
"in": "path", | ||
"required": true, | ||
"schema": { | ||
"type": "string" | ||
} | ||
} | ||
], | ||
"delete": { | ||
"tags": [ | ||
"Users" | ||
], | ||
"summary": "Deletes the user", | ||
"responses": { | ||
"204": { | ||
"description": "No content is returned upon success" | ||
}, | ||
"404": { | ||
"description": "When user does not exist", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/errorsResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"get": { | ||
"tags": [ | ||
"Users" | ||
], | ||
"summary": "Returns the user", | ||
"responses": { | ||
"200": { | ||
"description": "Returns the matching user", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/userResponse" | ||
} | ||
} | ||
} | ||
}, | ||
"404": { | ||
"description": "When user does not exist", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/errorsResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/events": { | ||
"post": { | ||
"tags": [ | ||
"Events" | ||
], | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "object", | ||
"required": true, | ||
"properties": { | ||
"user": { | ||
"type": "object", | ||
"required": true, | ||
"properties": { | ||
"id": { | ||
"type": "string", | ||
"required": true | ||
} | ||
} | ||
}, | ||
"consents": { | ||
"type": "array", | ||
"required": true, | ||
"items": { | ||
"type": "object", | ||
"required": true, | ||
"properties": { | ||
"id": { | ||
"type": "string", | ||
"required": true, | ||
"enum": [ | ||
"email_notifications", | ||
"sms_notifications" | ||
] | ||
}, | ||
"enabled": { | ||
"type": "boolean", | ||
"required": true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"summary": "Records consents of the given user", | ||
"responses": { | ||
"201": { | ||
"description": "Returns nothing upon success" | ||
}, | ||
"422": { | ||
"description": "When input is not valid", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/errorsResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"errorsResponse": { | ||
"type": "object", | ||
"properties": { | ||
"errors": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"userResponse": { | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "string" | ||
}, | ||
"email": { | ||
"type": "string" | ||
}, | ||
"consents": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "string" | ||
}, | ||
"enabled": { | ||
"type": "boolean" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.