This project was generated using Nx.
Server is a monolith built using NestJS framework.
Client is a React application.
- Copy ./apps/api/.env.dev and rename to
.env
. Change environment variables to production ones. - Run the following command:
docker compose -f compose.prod.yaml up --build
- Install dependencies
1.1 Git
1.2 Node.js 16+
1.3 MongoDB - Install npm dependencies (in project's folder):
npm i
- Build (in project's folder):
npm run build
- Create
.env
file in project's root (see ./apps/api/.env.dev) OR provide environment variables to the run command (see the next step). - Run API server (in project's folder):
npm start
Run automated tests:
npm run test
This project has monolithic architecture and provides the following REST-full API (some endpoints might not be reflected in this doc):
// PAYLOAD
LoginAsUserDto {
email: String,
password: String
}
// RESPONSE
LoginAsUserResponse {
user: UserModel {
id: String,
role: "ADMIN",
email: String,
},
permissions: PermissionMap,
accessToken: { access_token: String }
}
// PAYLOAD
LoginAsVpoDto {
vpoReferenceNumber: String,
}
// RESPONSE
LoginAsVpoResponseDto {
user: VpoUserModel {
id: String,
role: "VPO",
vpoReferenceNumber: String,
scheduleDate: DateISOString,
},
permissions: PermissionMap,
accessToken: { access_token: String },
}
// PAYLOAD
EmailHolderDto {
email: String,
}
// RESPONSE
200
Auth, Permissions: ["SCHEDULE.WRITE"]
// PAYLOAD
ScheduleDto {
0: [
{
timeFrom: TimeString,
timeTo: TimeString,
numberOfPersons: Number,
}
],
...,
6: [{...}],
}
// RESPONSE
{ ...ScheduleDto }
// RESPONSE
{ ...ScheduleDto }
// RESPONSE
ScheduleAvailableDto {
items: [
ScheduleSlotAvailableDto {
dateFrom: DateISOString,
dateTo: DateISOString,
},
];
}
// PAYLOAD
RegisterVpoDto {
email: String,
verificationCode: String,
vpoIssueDate: DateISOString,
vpoReferenceNumber: String,
firstName: String,
lastName: String,
middleName: String,
phoneNumber: String,
dateOfBirth: DateISOString,
addressOfRegistration: String,
addressOfResidence: String,
numberOfRelatives: Number,
numberOfRelativesBelow16: Number,
numberOfRelativesAbove65: Number,
scheduleDate: DateISOString,
receivedHelpDate?: DateISOString,
receivedGoods?: { [productName]: Number },
}
// RESPONSE
{ ...VpoUserModel }
Auth, Permissions: ["VPO_LIST.READ"]
// RESPONSE
{
items: [VpoModel],
totalItems: Number,
}
Auth, Permissions: ["VPO_EXPORT.READ"]
// RESPONSE
vpo_table.csv;
Auth, Permissions: ["VPO_IMPORT.WRITE"]
// PAYLOAD
vpo_that_received_goods_table.csv;
// RESPONSE
200;
Auth, Permissions: ["SETTINGS.WRITE"]
// PAYLOAD
UpdateSettingsDto {
daysToNextVpoRegistration?: Number,
endOfRegistrationDate?: DateISOString,
scheduleDaysAvailable?: Number,
}
// RESPONSE
{ ...SettingsDto }
Auth, Permissions: ["SETTINGS.READ"]
// RESPONSE
{ ...SettingsDto }
// RESPONSE
HtmlPageModel {
id: String,
name: String,
content: {
[fieldName]: String,
}
}
Auth, Permissions: ["HTML.WRITE"]
// PAYLOAD
{
name?: String,
content: {
[fieldName]: String,
}
}
// RESPONSE
{ ...HtmlPageModel }