Services and Controller structure for entities
This commit is contained in:
VincentAlamelle 2023-03-20 15:56:39 +01:00 committed by GitHub
commit d344172eb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 1733 additions and 1220 deletions

View File

@ -1,39 +1,47 @@
# Install dependencies only when needed
FROM node:19-alpine AS deps
WORKDIR tezosLink
WORKDIR leCoffre
RUN npm install -D prisma@4.11.0
COPY package.json ./
COPY src/common/databases/schema.prisma ./src/common/databases/schema.prisma
RUN npx prisma generate
RUN npm install --frozen-lockfile
# Rebuild the source code only when needed
FROM node:19-alpine AS builder
WORKDIR tezosLink
WORKDIR leCoffre
COPY . .
COPY --from=deps tezosLink/node_modules ./node_modules
RUN apk update && apk add openssh-client git
COPY id_ed25519 /root/.ssh/id_ed25519
RUN chmod 600 ~/.ssh/id_ed25519
RUN eval "$(ssh-agent -s)" && ssh-add /root/.ssh/id_ed25519
RUN ssh-keyscan github.com smart-chain-fr/leCoffre-resources.git >> /root/.ssh/known_hosts
COPY node_modules ./node_modules
RUN npx prisma generate
RUN npm run build
# Production image, copy all the files and run next
FROM node:19-alpine AS production
WORKDIR tezosLink
WORKDIR leCoffre
RUN adduser -D tezoslinkuser --uid 10000 && chown -R tezoslinkuser .
RUN adduser -D lecoffreuser --uid 10000 && chown -R lecoffreuser .
COPY --from=builder --chown=tezoslinkuser tezosLink/node_modules ./node_modules
COPY --from=builder --chown=tezoslinkuser tezosLink/dist/api ./dist/api
COPY --from=builder --chown=tezoslinkuser tezosLink/dist/entries ./dist/entries
COPY --from=builder --chown=tezoslinkuser tezosLink/dist/common ./dist/common
#COPY --from=builder --chown=tezoslinkuser tezosLink/src/common/databases/ ./src/common/databases/
COPY --from=builder --chown=tezoslinkuser tezosLink/package.json ./package.json
COPY --from=builder --chown=lecoffreuser leCoffre/node_modules ./node_modules
COPY --from=builder --chown=lecoffreuser leCoffre/dist/api ./dist/api
COPY --from=builder --chown=lecoffreuser leCoffre/dist/entries ./dist/entries
COPY --from=builder --chown=lecoffreuser leCoffre/dist/common ./dist/common
COPY --from=builder --chown=lecoffreuser leCoffre/src/common/databases/ ./src/common/databases/
COPY --from=builder --chown=lecoffreuser leCoffre/package.json ./package.json
USER tezoslinkuser
USER lecoffreuser
CMD ["npm", "run", "api:start"]
EXPOSE 3001

View File

@ -1,10 +0,0 @@
# Install dependencies only when needed
FROM node:19-alpine AS deps
WORKDIR tezosLink
COPY . .
RUN npm i
RUN npm run build
CMD ["npm", "run", "web:start"]
EXPOSE 3000

View File

@ -5,7 +5,7 @@ volumes:
services:
postgres:
image: postgres:11
image: lecoffrelocal
restart: always
environment:
- POSTGRES_USER

8
id_ed25519 Executable file
View File

@ -0,0 +1,8 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACDyIUEbyS+lqxsmtJ/nKJ0M11tZ0fA1/MxpoU5//r5kHwAAAKh4md+XeJnf
lwAAAAtzc2gtZWQyNTUxOQAAACDyIUEbyS+lqxsmtJ/nKJ0M11tZ0fA1/MxpoU5//r5kHw
AAAEAlhxwZbtCgVmJ1olIGIaHdD9QBtGHJndiB2LsaNfJefPIhQRvJL6WrGya0n+conQzX
W1nR8DX8zGmhTn/+vmQfAAAAH3ZpbmNlbnQuYWxhbWVsbGVAc21hcnQtY2hhaW4uZnIBAg
MEBQY=
-----END OPENSSH PRIVATE KEY-----

1305
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,13 @@
{
"name": "tezoslink",
"name": "lecoffre",
"version": "1.0.0",
"description": "tezosLink project",
"description": "lecoffre project",
"_moduleAliases": {
"@Api": "./dist/api",
"@App": "./dist/app",
"@Api": "./dist/app/api",
"@Pages": "./dist/pages",
"@Common": "./dist/common",
"@Services": "./dist/common/services",
"@Services": "./dist/services",
"@Repositories": "./dist/common/repositories",
"@Entries": "./dist/common/entries",
"@Config": "./dist/common/config",
@ -16,7 +17,8 @@
},
"scripts": {
"build": "tsc",
"api:start": "node ./dist/entries/Api.js",
"api:start": "node ./dist/entries/App.js",
"start": "tsc && npm run api:start",
"dev": "nodemon -V",
"api:dev": "nodemon -V --exec 'tsc && npm run api:start'",
"build:test": "tsc && mocha ./dist/entries/Test.js",
@ -42,11 +44,10 @@
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"le-coffre-ressources": "github:smart-chain-fr/leCoffre-resources#v0.2",
"le-coffre-ressources": "github.com:smart-chain-fr/leCoffre-resources.git",
"module-alias": "^2.2.2",
"next": "^13.1.5",
"node-schedule": "^2.1.1",
"prisma": "^4.9.0",
"prisma-query": "^2.0.0",
"reflect-metadata": "^0.1.13",
"ts-node": "^10.9.1",
@ -62,7 +63,8 @@
"@types/node-schedule": "^2.1.0",
"@types/uuid": "^9.0.0",
"nodemon": "^2.0.20",
"prettier": "2.8.4"
"prettier": "2.8.4",
"prisma": "^4.11.0"
},
"prisma": {
"schema": "src/common/databases/schema.prisma"

View File

@ -1,63 +0,0 @@
import { type Response, type Request } from "express";
import { Controller, Get, Post } from "@ControllerPattern/index";
import { Service } from "typedi";
import { ProjectEntity } from "@Common/ressources";
import { IsNotEmpty, IsString, IsUUID, validateOrReject } from "class-validator";
import ProjectService from "@Services/_TemplateService/_TemplateService";
import ObjectHydrate from "@Common/helpers/ObjectHydrate";
import ApiController from "@Common/system/controller-pattern/ApiController";
class Params {
@IsString()
@IsNotEmpty()
@IsUUID()
public uuid!: string;
}
@Controller()
@Service()
export default class ProjectController extends ApiController {
constructor(private projectService: ProjectService) {
super();
}
@Get("/projects")
protected async get(req: Request, res: Response) {
// const query = processFindManyQuery(req.query);
// this.httpSuccess(res, await this.projectService.getByCrite@rias(query));
}
@Get("/projects/:uuid")
protected async getByUUID(req: Request, res: Response) {
const { uuid } = req.params as Partial<Params>;
const params = new Params();
params.uuid = uuid!;
try {
await validateOrReject(params, { forbidUnknownValues: true });
} catch (error) {
this.httpBadRequest(res, error);
return;
}
const project = await this.projectService.getByUUID(params);
// if (!project) {
// this.httpNotFoundRequest(res);
// return;
// }
this.httpSuccess(res, project);
}
@Post("/projects")
protected async post(req: Request, res: Response) {
const projectEntity = new ProjectEntity();
ObjectHydrate.hydrate(projectEntity, req.body);
try {
await validateOrReject(projectEntity, { whitelist: true, forbidNonWhitelisted: true, groups: ["create"] });
} catch (error) {
this.httpBadRequest(res, error);
return;
}
this.httpCreated(res, await this.projectService.create(projectEntity));
}
}

View File

@ -1,8 +0,0 @@
import { Container } from "typedi";
import ProjectController from "./ProjectController";
export default {
start: () => {
Container.get(ProjectController);
}
}

17
src/app/HomeController.ts Normal file
View File

@ -0,0 +1,17 @@
import { type Response, type Request } from "express";
import { Controller, Get } from "@ControllerPattern/index";
import { Service } from "typedi";
import ApiController from "@Common/system/controller-pattern/ApiController";
@Controller()
@Service()
export default class HomeController extends ApiController {
@Get("/")
protected async get(req: Request, res: Response) {
// const query = processFindManyQuery(req.query);
this.httpSuccess(res, "Welcome to the home page!");
}
}

View File

@ -0,0 +1,81 @@
import { type Response, type Request } from "express";
import { Controller, Get, Post, Put } from "@ControllerPattern/index";
import ApiController from "@Common/system/controller-pattern/ApiController";
import CustomersService from "@Services/CustomersService/CustomersService";
import { Service } from "typedi";
// import { IsNotEmpty, IsString, IsUUID } from "class-validator";
// class Params {
// @IsString()
// @IsNotEmpty()
// @IsUUID()
// public uuid!: string;
// }
@Controller()
@Service()
export default class CustomersController extends ApiController {
constructor(private customersService: CustomersService) {
super();
}
/**
* @description Get all customers
* @returns ICustomer[] list of customers
*/
@Get("/api/customers")
protected async get(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.customersService.get());
}
/**
* @description Create a new customer
* @returns ICustomer created
*/
@Post("/api/customers")
protected async post(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.customersService.create());
}
/**
* @description Modify a specific customer by uid
* @returns ICustomer modified
*/
@Put("/api/customers/:uid")
protected async put(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.customersService.put());
}
/**
* @description Get a specific customer by uid
* @returns ICustomer
*/
@Get("/api/customers/:uid")
protected async getOneByUid(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.customersService.getByUid("uid"));
}
}

View File

@ -0,0 +1,81 @@
import { type Response, type Request } from "express";
import { Controller, Get, Post, Put } from "@ControllerPattern/index";
import ApiController from "@Common/system/controller-pattern/ApiController";
import { Service } from "typedi";
import DeedTypesService from "@Services/DeedTypesService/DeedTypesService";
// import { IsNotEmpty, IsString, IsUUID } from "class-validator";
// class Params {
// @IsString()
// @IsNotEmpty()
// @IsUUID()
// public uuid!: string;
// }
@Controller()
@Service()
export default class DeedTypesController extends ApiController {
constructor(private deedTypesService: DeedTypesService) {
super();
}
/**
* @description Get all deedtypes
* @returns IDeedtype[] list of deedtypes
*/
@Get("/api/deed-types")
protected async get(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.deedTypesService.get());
}
/**
* @description Create a new deedtype
* @returns IDeedtype created
*/
@Post("/api/deed-types")
protected async post(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.deedTypesService.create());
}
/**
* @description Modify a specific deedtype by uid
* @returns IDeedtype modified
*/
@Put("/api/deed-types/:uid")
protected async put(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.deedTypesService.put());
}
/**
* @description Get a specific deedtype by uid
* @returns IDeedtype
*/
@Get("/api/deed-types/:uid")
protected async getOneByUid(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.deedTypesService.getByUid("uid"));
}
}

View File

@ -0,0 +1,81 @@
import { type Response, type Request } from "express";
import { Controller, Get, Post, Put } from "@ControllerPattern/index";
import ApiController from "@Common/system/controller-pattern/ApiController";
import DeedsService from "@Services/DeedsService/DeedsService";
import { Service } from "typedi";
// import { IsNotEmpty, IsString, IsUUID } from "class-validator";
// class Params {
// @IsString()
// @IsNotEmpty()
// @IsUUID()
// public uuid!: string;
// }
@Controller()
@Service()
export default class DeedsController extends ApiController {
constructor(private deedsService: DeedsService) {
super();
}
/**
* @description Get all deeds
* @returns IDeed[] list of deeds
*/
@Get("/api/deeds")
protected async get(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.deedsService.get());
}
/**
* @description Create a new deed
* @returns IDeed created
*/
@Post("/api/deeds")
protected async post(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.deedsService.create());
}
/**
* @description Modify a specific deed by uid
* @returns IDeed modified
*/
@Put("/api/deeds/:uid")
protected async put(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.deedsService.put());
}
/**
* @description Get a specific deed by uid
* @returns IDeed
*/
@Get("/api/deeds/:uid")
protected async getOneByUid(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.deedsService.getByUid("uid"));
}
}

View File

@ -0,0 +1,81 @@
import { type Response, type Request } from "express";
import { Controller, Get, Post, Put } from "@ControllerPattern/index";
import ApiController from "@Common/system/controller-pattern/ApiController";
import { Service } from "typedi";
import DocumentTypesService from "@Services/DocumentTypesService/DocumentTypesService";
// import { IsNotEmpty, IsString, IsUUID } from "class-validator";
// class Params {
// @IsString()
// @IsNotEmpty()
// @IsUUID()
// public uuid!: string;
// }
@Controller()
@Service()
export default class DocumentTypesController extends ApiController {
constructor(private documentTypesService: DocumentTypesService) {
super();
}
/**
* @description Get all document-types
* @returns IFolder[] list of document-types
*/
@Get("/api/document-types")
protected async get(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.documentTypesService.get());
}
/**
* @description Create a new documentType
* @returns IFolder created
*/
@Post("/api/document-types")
protected async post(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.documentTypesService.create());
}
/**
* @description Modify a specific documentType by uid
* @returns IFolder modified
*/
@Put("/api/document-types/:uid")
protected async put(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.documentTypesService.put());
}
/**
* @description Get a specific documentType by uid
* @returns IFolder
*/
@Get("/api/document-types/:uid")
protected async getOneByUid(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.documentTypesService.getByUid("uid"));
}
}

View File

@ -0,0 +1,81 @@
import { type Response, type Request } from "express";
import { Controller, Get, Post, Put } from "@ControllerPattern/index";
import ApiController from "@Common/system/controller-pattern/ApiController";
import { Service } from "typedi";
import DocumentsService from "@Services/DocumentsService/DocumentsService";
// import { IsNotEmpty, IsString, IsUUID } from "class-validator";
// class Params {
// @IsString()
// @IsNotEmpty()
// @IsUUID()
// public uuid!: string;
// }
@Controller()
@Service()
export default class DocumentsController extends ApiController {
constructor(private documentsService: DocumentsService) {
super();
}
/**
* @description Get all documents
* @returns IDocument[] list of documents
*/
@Get("/api/documents")
protected async get(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.documentsService.get());
}
/**
* @description Create a new document
* @returns IDocument created
*/
@Post("/api/documents")
protected async post(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.documentsService.create());
}
/**
* @description Modify a specific document by uid
* @returns IDocument modified
*/
@Put("/api/documents/:uid")
protected async put(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.documentsService.put());
}
/**
* @description Get a specific document by uid
* @returns IDocument
*/
@Get("/api/documents/:uid")
protected async getOneByUid(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.documentsService.getByUid("uid"));
}
}

View File

@ -0,0 +1,81 @@
import { type Response, type Request } from "express";
import { Controller, Get, Post, Put } from "@ControllerPattern/index";
import ApiController from "@Common/system/controller-pattern/ApiController";
import FoldersService from "@Services/FoldersService/FoldersService";
import { Service } from "typedi";
// import { IsNotEmpty, IsString, IsUUID } from "class-validator";
// class Params {
// @IsString()
// @IsNotEmpty()
// @IsUUID()
// public uuid!: string;
// }
@Controller()
@Service()
export default class FolderController extends ApiController {
constructor(private foldersService: FoldersService) {
super();
}
/**
* @description Get all folders
* @returns IFolder[] list of folders
*/
@Get("/api/folders")
protected async get(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.foldersService.get());
}
/**
* @description Create a new folder
* @returns IFolder created
*/
@Post("/api/folders")
protected async post(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.foldersService.create());
}
/**
* @description Modify a specific folder by uid
* @returns IFolder modified
*/
@Put("/api/folders/:uid")
protected async put(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.foldersService.put());
}
/**
* @description Get a specific folder by uid
* @returns IFolder
*/
@Get("/api/folders/:uid")
protected async getOneByUid(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.foldersService.getByUid("uid"));
}
}

View File

@ -0,0 +1,81 @@
import { type Response, type Request } from "express";
import { Controller, Get, Post, Put } from "@ControllerPattern/index";
import ApiController from "@Common/system/controller-pattern/ApiController";
import OfficesService from "@Services/OfficesService/OfficesService";
import { Service } from "typedi";
// import { IsNotEmpty, IsString, IsUUID } from "class-validator";
// class Params {
// @IsString()
// @IsNotEmpty()
// @IsUUID()
// public uuid!: string;
// }
@Controller()
@Service()
export default class OfficesController extends ApiController {
constructor(private officesService: OfficesService) {
super();
}
/**
* @description Get all offices
* @returns IOffice[] list of offices
*/
@Get("/api/offices")
protected async get(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.officesService.get());
}
/**
* @description Create a new office
* @returns IOffice created
*/
@Post("/api/offices")
protected async post(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.officesService.create());
}
/**
* @description Modify a specific office by uid
* @returns IOffice modified
*/
@Put("/api/offices/:uid")
protected async put(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.officesService.put());
}
/**
* @description Get a specific office by uid
* @returns IOffice
*/
@Get("/api/offices/:uid")
protected async getOneByUid(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.officesService.getByUid("uid"));
}
}

View File

@ -0,0 +1,81 @@
import { type Response, type Request } from "express";
import { Controller, Get, Post, Put } from "@ControllerPattern/index";
import ApiController from "@Common/system/controller-pattern/ApiController";
import UsersService from "@Services/UsersService/UsersService";
import { Service } from "typedi";
// import { IsNotEmpty, IsString, IsUUID } from "class-validator";
// class Params {
// @IsString()
// @IsNotEmpty()
// @IsUUID()
// public uuid!: string;
// }
@Controller()
@Service()
export default class UsersController extends ApiController {
constructor(private usersService: UsersService) {
super();
}
/**
* @description Get all users
* @returns IUser[] list of users
*/
@Get("/api/users")
protected async get(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.usersService.get());
}
/**
* @description Create a new user
* @returns IUser created
*/
@Post("/api/users")
protected async post(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.usersService.create());
}
/**
* @description Modify a specific user by uid
* @returns IUser modified
*/
@Put("/api/users/:uid")
protected async put(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.usersService.put());
}
/**
* @description Get a specific user by uid
* @returns IUser
*/
@Get("/api/users/:uid")
protected async getOneByUid(req: Request, response: Response) {
try {
// TODO
} catch (error) {
this.httpBadRequest(response, error);
return;
}
this.httpSuccess(response, await this.usersService.getByUid("uid"));
}
}

View File

@ -0,0 +1,18 @@
import { type Response, type Request } from "express";
import { Controller, Get } from "@ControllerPattern/index";
import { Service } from "typedi";
import ApiController from "@Common/system/controller-pattern/ApiController";
@Controller()
@Service()
export default class ProjectController extends ApiController {
@Get("/api/projects/users")
protected async get(req: Request, res: Response) {
// const query = processFindManyQuery(req.query);
this.httpSuccess(res, { message: "get" });
}
}

27
src/app/index.ts Normal file
View File

@ -0,0 +1,27 @@
import { Container } from "typedi";
import HomeController from "./HomeController";
import UsersController from "./api/UsersController";
import FoldersController from "./api/FoldersController";
import CustomersController from "./api/CustomersController";
import OfficesController from "./api/OfficesController";
import DeedsController from "./api/DeedsController";
import DeedTypesController from "./api/DeedTypesController";
import DocumentsController from "./api/DocumentsController";
import DocumentTypesController from "./api/DocumentTypesController";
/**
* @description This allow to declare all controllers used in the application
*/
export default {
start: () => {
Container.get(HomeController);
Container.get(UsersController);
Container.get(FoldersController);
Container.get(CustomersController);
Container.get(OfficesController);
Container.get(DeedsController);
Container.get(DeedTypesController);
Container.get(DocumentsController);
Container.get(DocumentTypesController);
},
};

View File

@ -19,41 +19,17 @@ export class BackendVariables {
@IsNotEmpty()
public readonly DATABASE_NAME!: string;
@IsNotEmpty()
public readonly API_HOSTNAME!: string;
@IsOptional()
public readonly API_LABEL!: string;
@IsNotEmpty()
public readonly API_PORT!: string;
@IsNotEmpty()
public readonly API_ROOT_URL!: string;
@IsOptional()
public readonly RPC_GATEWAY_LABEL!: string;
public readonly APP_LABEL!: string;
@IsNotEmpty()
public readonly RPC_GATEWAY_PORT!: string;
public readonly APP_PORT!: string;
@IsNotEmpty()
public readonly RPC_GATEWAY_ROOT_URL!: string;
@IsNotEmpty()
public readonly ARCHIVE_NODES_URL!: string;
@IsNotEmpty()
public readonly ARCHIVE_NODES_PORT!: string;
@IsNotEmpty()
public readonly ROLLING_NODES_URL!: string;
@IsNotEmpty()
public readonly ROLLING_NODES_PORT!: string;
@IsNotEmpty()
public readonly TEZOS_NETWORK!: string;
public readonly APP_ROOT_URL!: string;
public readonly NODE_ENV = process.env.NODE_ENV;
@ -64,18 +40,10 @@ export class BackendVariables {
this.DATABASE_USER = process.env["DATABASE_USER"]!;
this.DATABASE_PASSWORD = process.env["DATABASE_PASSWORD"]!;
this.DATABASE_NAME = process.env["DATABASE_NAME"]!;
this.API_HOSTNAME = process.env["API_HOSTNAME"]!;
this.API_LABEL = process.env["API_LABEL"]!;
this.API_PORT = process.env["API_PORT"]!;
this.API_ROOT_URL = process.env["API_ROOT_URL"]!;
this.RPC_GATEWAY_LABEL = process.env["RPC_GATEWAY_LABEL"]!;
this.RPC_GATEWAY_PORT = process.env["RPC_GATEWAY_PORT"]!;
this.RPC_GATEWAY_ROOT_URL = process.env["RPC_GATEWAY_ROOT_URL"]!;
this.ARCHIVE_NODES_URL = process.env["ARCHIVE_NODES_URL"]!;
this.ARCHIVE_NODES_PORT = process.env["ARCHIVE_NODES_PORT"]!;
this.ROLLING_NODES_URL = process.env["ROLLING_NODES_URL"]!;
this.ROLLING_NODES_PORT = process.env["ROLLING_NODES_PORT"]!;
this.TEZOS_NETWORK = process.env["TEZOS_NETWORK"]!;
this.APP_PORT = process.env["APP_PORT"]!;
this.APP_ROOT_URL = process.env["APP_ROOT_URL"]!;
this.APP_LABEL = process.env["APP_LABEL"]!;
}
public async validate() {
await validateOrReject(this);

View File

@ -1,41 +0,0 @@
// import ProjectsRepository from "@Common/repositories/projects/ProjectsRepository";
import BaseService from "@Services/BaseService";
import { Service } from "typedi";
@Service()
export default class ProjectsService extends BaseService {
constructor() {
super();
}
/**
* @throws {Error} If projects are undefined
* @returns : Promise<T[]>
* @param : query: ReturnType<typeof processFindManyQuery>
*/
public async getByCriterias() {
// return this.projectRepository.findMany(query);
}
/**
* @throws {Error} If project is undefined
* @returns : Partial<T>
* @param : t : T
*/
public async getByUUID() {
// const project = await this.projectRepository.findOne(projectEntity);
// if (!project) Promise.reject(new Error("Cannot get project by uuid"));
// return project;
}
/**
*
* @throws {Error} If project cannot be created
* @returns : T
* @param : projectEntity: Partial<ProjectEntity>
*/
public async create() {
// const project = await this.projectRepository.create(projectEntity);
// if (!project) Promise.reject(new Error("Cannot create project"));
// return project;
}
}

View File

@ -2,20 +2,20 @@ import "module-alias/register";
import "reflect-metadata";
import { Container } from "typedi";
import ExpressServer from "@Common/system/ExpressServer";
import routes from "@Api/controllers/index";
import routes from "@App/index";
import cors from "cors";
import bodyParser from "body-parser";
// import TezosLink from "@Common/databases/TezosLink";
import errorHandler from "@Api/middlewares/ErrorHandler";
import errorHandler from "@App/middlewares/ErrorHandler";
import { BackendVariables } from "@Common/config/variables/Variables";
(async () => {
try {
const variables = await Container.get(BackendVariables).validate();
const port = variables.API_PORT;
const rootUrl = variables.API_ROOT_URL;
const label = variables.API_LABEL ?? "Unknown Service";
const port = variables.APP_PORT;
const rootUrl = variables.APP_ROOT_URL;
const label = variables.APP_LABEL ?? "Unknown Service";
// Container.get(TezosLink).connect();
Container.get(ExpressServer).init({

View File

@ -0,0 +1,57 @@
import BaseService from "@Services/BaseService";
import { Service } from "typedi";
@Service()
export default class AddressesService extends BaseService {
constructor() {
super();
}
/**
* @description : Get all addresses
* @returns : T
* @throws {Error} If addresses cannot be get
* @param : projectEntity: Partial<ProjectEntity>
*/
public async get() {
// const address = await this.usersRepository.findOne(uuid);
// if (!address) Promise.reject(new Error("Cannot get address by uuid"));
return { response: "/api/addresses > GET : All addresses > Not implemented yet" };
}
/**
* @description : Create a new address
* @returns : T
* @throws {Error} If address cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async create() {
// const address = await this.projectRepository.create(projectEntity);
// if (!address) Promise.reject(new Error("Cannot create project"));
return { response: "/api/addresses > POST : Create address > Not implemented yet" };
}
/**
* @description : Modify a new address
* @returns : T
* @throws {Error} If address cannot be modified
* @param : projectEntity: Partial<ProjectEntity>
*/
public async put() {
// const address = await this.projectRepository.create(projectEntity);
// if (!address) Promise.reject(new Error("Cannot create project"));
return { response: "/api/addresses > PUT : Modified address > Not implemented yet" };
}
/**
* @description : Get a address by uid
* @returns : T
* @throws {Error} If address cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async getByUid(uuid: string) {
// const address = await this.usersRepository.findOne(uuid);
// if (!address) Promise.reject(new Error("Cannot get address by uuid"));
return { response: "/api/addresses/:uuid > GET : address by uid > Not implemented yet" };
}
}

View File

@ -1,11 +1,8 @@
import { BackendVariables } from "@Common/config/variables/Variables";
import Container from "typedi";
export default abstract class BaseService {
/** @TODO place methods in a config file */
public static readonly whitelisted: string[] = ["/chains/main/blocks"];
public static readonly blacklisted: string[] = ["/context/contracts", "/monitor", "/network"];
public static readonly rollingPatterns: string[] = ["/head", "/injection/operation"];
public static readonly network: string = Container.get(BackendVariables).TEZOS_NETWORK;
}

View File

@ -0,0 +1,57 @@
import BaseService from "@Services/BaseService";
import { Service } from "typedi";
@Service()
export default class ContactsService extends BaseService {
constructor() {
super();
}
/**
* @description : Get all contacts
* @returns : T
* @throws {Error} If contacts cannot be get
* @param : projectEntity: Partial<ProjectEntity>
*/
public async get() {
// const contact = await this.usersRepository.findOne(uuid);
// if (!contact) Promise.reject(new Error("Cannot get contact by uuid"));
return { response: "/api/contacts > GET : All contacts > Not implemented yet" };
}
/**
* @description : Create a new contact
* @returns : T
* @throws {Error} If contact cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async create() {
// const contact = await this.projectRepository.create(projectEntity);
// if (!contact) Promise.reject(new Error("Cannot create project"));
return { response: "/api/contacts > POST : Create contact > Not implemented yet" };
}
/**
* @description : Modify a new contact
* @returns : T
* @throws {Error} If contact cannot be modified
* @param : projectEntity: Partial<ProjectEntity>
*/
public async put() {
// const contact = await this.projectRepository.create(projectEntity);
// if (!contact) Promise.reject(new Error("Cannot create project"));
return { response: "/api/contacts > PUT : Modified contact > Not implemented yet" };
}
/**
* @description : Get a contact by uid
* @returns : T
* @throws {Error} If project cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async getByUid(uuid: string) {
// const contact = await this.usersRepository.findOne(uuid);
// if (!contact) Promise.reject(new Error("Cannot get contact by uuid"));
return { response: "/api/contacts/:uuid > GET : contact by uid > Not implemented yet" };
}
}

View File

@ -0,0 +1,57 @@
import BaseService from "@Services/BaseService";
import { Service } from "typedi";
@Service()
export default class CustomersService extends BaseService {
constructor() {
super();
}
/**
* @description : Get all Customers
* @returns : T
* @throws {Error} If Customers cannot be get
* @param : projectEntity: Partial<ProjectEntity>
*/
public async get() {
// const customer = await this.customersRepository.findOne(uuid);
// if (!customer) Promise.reject(new Error("Cannot get customer by uuid"));
return { response: "/api/customers > GET : All customers > Not implemented yet" };
}
/**
* @description : Create a new customer
* @returns : T
* @throws {Error} If customer cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async create() {
// const customer = await this.projectRepository.create(projectEntity);
// if (!customer) Promise.reject(new Error("Cannot create project"));
return { response: "/api/customers > POST : Create customer > Not implemented yet" };
}
/**
* @description : Modify a customer
* @returns : T
* @throws {Error} If customer cannot be modified
* @param : projectEntity: Partial<ProjectEntity>
*/
public async put() {
// const customer = await this.projectRepository.create(projectEntity);
// if (!customer) Promise.reject(new Error("Cannot create project"));
return { response: "/api/customers > PUT : Modified customer > Not implemented yet" };
}
/**
* @description : Get a customer by uid
* @returns : T
* @throws {Error} If customer cannot be get by uid
* @param : projectEntity: Partial<ProjectEntity>
*/
public async getByUid(uid: string) {
// const customer = await this.customersRepository.findOne(uid);
// if (!customer) Promise.reject(new Error("Cannot get customer by uid"));
return { response: "/api/customers/:uid > GET : customer by uid > Not implemented yet" };
}
}

View File

@ -0,0 +1,57 @@
import BaseService from "@Services/BaseService";
import { Service } from "typedi";
@Service()
export default class DeedTypesService extends BaseService {
constructor() {
super();
}
/**
* @description : Get all deed-types
* @returns : T
* @throws {Error} If deed-types cannot be get
* @param : projectEntity: Partial<ProjectEntity>
*/
public async get() {
// const deedtype = await this.customersRepository.findOne(uuid);
// if (!deedtype) Promise.reject(new Error("Cannot get deedtype by uuid"));
return { response: "/api/deed-types > GET : All deed-types > Not implemented yet" };
}
/**
* @description : Create a new deed-type
* @returns : T
* @throws {Error} If deed-type cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async create() {
// const project = await this.projectRepository.create(projectEntity);
// if (!project) Promise.reject(new Error("Cannot create project"));
return { response: "/api/deed-types > POST : Create deed-type > Not implemented yet" };
}
/**
* @description : Modify a deed-type
* @returns : T
* @throws {Error} If deed-type cannot be modifified
* @param : projectEntity: Partial<ProjectEntity>
*/
public async put() {
// const project = await this.projectRepository.create(projectEntity);
// if (!project) Promise.reject(new Error("Cannot create project"));
return { response: "/api/deed-types > PUT : Modified deed-type > Not implemented yet" };
}
/**
* @description : Get a deedtype by uid
* @returns : T
* @throws {Error} If deed-type cannot be get by uid
* @param : projectEntity: Partial<ProjectEntity>
*/
public async getByUid(uid: string) {
// const deedtype = await this.customersRepository.findOne(uuid);
// if (!deedtype) Promise.reject(new Error("Cannot get deedtype by uid"));
return { response: "/api/deed-types/:uid > GET : deed-type by uid > Not implemented yet" };
}
}

View File

@ -0,0 +1,57 @@
import BaseService from "@Services/BaseService";
import { Service } from "typedi";
@Service()
export default class DeedsService extends BaseService {
constructor() {
super();
}
/**
* @description : Get all deeds
* @returns : T
* @throws {Error} If deeds cannot be get
* @param : projectEntity: Partial<ProjectEntity>
*/
public async get() {
// const deed = await this.usersRepository.findOne(uuid);
// if (!deed) Promise.reject(new Error("Cannot get deed by uuid"));
return { response: "/api/deeds > GET : All deeds > Not implemented yet" };
}
/**
* @description : Create a new deed
* @returns : T
* @throws {Error} If deeds cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async create() {
// const deeds = await this.projectRepository.create(projectEntity);
// if (!deeds) Promise.reject(new Error("Cannot create project"));
return { response: "/api/deeds > POST : Create deed > Not implemented yet" };
}
/**
* @description : Modify a new deed
* @returns : T
* @throws {Error} If deeds cannot be modified
* @param : projectEntity: Partial<ProjectEntity>
*/
public async put() {
// const deeds = await this.projectRepository.create(projectEntity);
// if (!deeds) Promise.reject(new Error("Cannot create project"));
return { response: "/api/deeds > PUT : Modified deed > Not implemented yet" };
}
/**
* @description : Get a deed by uid
* @returns : T
* @throws {Error} If project cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async getByUid(uuid: string) {
// const deed = await this.usersRepository.findOne(uuid);
// if (!deed) Promise.reject(new Error("Cannot get deed by uuid"));
return { response: "/api/deeds/:uuid > GET : deed by uid > Not implemented yet" };
}
}

View File

@ -0,0 +1,57 @@
import BaseService from "@Services/BaseService";
import { Service } from "typedi";
@Service()
export default class DocumentTypesService extends BaseService {
constructor() {
super();
}
/**
* @description : Get all document-types
* @returns : T
* @throws {Error} If document-types cannot be get
* @param : projectEntity: Partial<ProjectEntity>
*/
public async get() {
// const documentType = await this.foldersRepository.findOne(uuid);
// if (!documentType) Promise.reject(new Error("Cannot get document-type by uuid"));
return { response: "/api/document-types > GET : All document-types > Not implemented yet" };
}
/**
* @description : Create a new document-type
* @returns : T
* @throws {Error} If document-types cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async create() {
// const project = await this.projectRepository.create(projectEntity);
// if (!project) Promise.reject(new Error("Cannot create project"));
return { response: "/api/document-types > POST : Create document-type > Not implemented yet" };
}
/**
* @description : Modify a document-type
* @returns : T
* @throws {Error} If document-type cannot be modified
* @param : projectEntity: Partial<ProjectEntity>
*/
public async put() {
// const documentType = await this.projectRepository.create(projectEntity);
// if (!documentType) Promise.reject(new Error("Cannot create documentType"));
return { response: "/api/document-types > PUT : Modified document-type > Not implemented yet" };
}
/**
* @description : Get a document-type by uid
* @returns : T
* @throws {Error} If document-type cannot be get bu uid
* @param : projectEntity: Partial<ProjectEntity>
*/
public async getByUid(uid: string) {
// const documentType = await this.foldersRepository.findOne(uid);
// if (!documentType) Promise.reject(new Error("Cannot get document-type by uid"));
return { response: "/api/document-types/:uid > GET : document-type by uid > Not implemented yet" };
}
}

View File

@ -0,0 +1,57 @@
import BaseService from "@Services/BaseService";
import { Service } from "typedi";
@Service()
export default class DocumentsService extends BaseService {
constructor() {
super();
}
/**
* @description : Get all documents
* @returns : T
* @throws {Error} If documents cannot be get
* @param : projectEntity: Partial<ProjectEntity>
*/
public async get() {
// const document = await this.customersRepository.findOne(uuid);
// if (!document) Promise.reject(new Error("Cannot get documents"));
return { response: "/api/documents > GET : All documents > Not implemented yet" };
}
/**
* @description : Create a new document
* @returns : T
* @throws {Error} If document cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async create() {
// const document = await this.projectRepository.create(projectEntity);
// if (!document) Promise.reject(new Error("Cannot create document"));
return { response: "/api/documents > POST : Create document > Not implemented yet" };
}
/**
* @description : Modify a document
* @returns : T
* @throws {Error} If document cannot be modified
* @param : projectEntity: Partial<ProjectEntity>
*/
public async put() {
// const document = await this.projectRepository.create(projectEntity);
// if (!document) Promise.reject(new Error("Cannot create document"));
return { response: "/api/documents > PUT : Modified document > Not implemented yet" };
}
/**
* @description : Get a document by uid
* @returns : T
* @throws {Error} If document cannot be get by uid
* @param : projectEntity: Partial<ProjectEntity>
*/
public async getByUid(uid: string) {
// const document = await this.customersRepository.findOne(uid);
// if (!document) Promise.reject(new Error("Cannot get document by uid"));
return { response: "/api/documents/:uid > GET : document by uid > Not implemented yet" };
}
}

View File

@ -0,0 +1,57 @@
import BaseService from "@Services/BaseService";
import { Service } from "typedi";
@Service()
export default class FilesService extends BaseService {
constructor() {
super();
}
/**
* @description : Get all files
* @returns : T
* @throws {Error} If files cannot be get
* @param : projectEntity: Partial<ProjectEntity>
*/
public async get() {
// const files = await this.usersRepository.findOne(uuid);
// if (!files) Promise.reject(new Error("Cannot get files"));
return { response: "/api/files > GET : All files > Not implemented yet" };
}
/**
* @description : Create a new file
* @returns : T
* @throws {Error} If file cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async create() {
// const file = await this.projectRepository.create(projectEntity);
// if (!file) Promise.reject(new Error("Cannot create project"));
return { response: "/api/files > POST : Create file > Not implemented yet" };
}
/**
* @description : Modify a new file
* @returns : T
* @throws {Error} If file cannot be modified
* @param : projectEntity: Partial<ProjectEntity>
*/
public async put() {
// const file = await this.projectRepository.create(projectEntity);
// if (!file) Promise.reject(new Error("Cannot create project"));
return { response: "/api/files > PUT : Modified file > Not implemented yet" };
}
/**
* @description : Get a file by uid
* @returns : T
* @throws {Error} If project cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async getByUid(uid: string) {
// const file = await this.usersRepository.findOne(uid);
// if (!file) Promise.reject(new Error("Cannot get file by uid"));
return { response: "/api/files/:uid > GET : file by uid > Not implemented yet" };
}
}

View File

@ -0,0 +1,57 @@
import BaseService from "@Services/BaseService";
import { Service } from "typedi";
@Service()
export default class FoldersService extends BaseService {
constructor() {
super();
}
/**
* @description : Get all folders
* @returns : T
* @throws {Error} If folders cannot be get
* @param : projectEntity: Partial<ProjectEntity>
*/
public async get() {
// const folder = await this.foldersRepository.findOne(uuid);
// if (!folder) Promise.reject(new Error("Cannot get folder by uuid"));
return { response: "/api/folders > GET : All folders > Not implemented yet" };
}
/**
* @description : Create a new folder
* @returns : T
* @throws {Error} If folder cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async create() {
// const folder = await this.projectRepository.create(projectEntity);
// if (!folder) Promise.reject(new Error("Cannot create folder"));
return { response: "/api/folders > POST : Create folder > Not implemented yet" };
}
/**
* @description : Modify a folder
* @returns : T
* @throws {Error} If folder cannot be modified
* @param : projectEntity: Partial<ProjectEntity>
*/
public async put() {
// const folder = await this.projectRepository.create(projectEntity);
// if (!folder) Promise.reject(new Error("Cannot create folder"));
return { response: "/api/folders > PUT : Modified folder > Not implemented yet" };
}
/**
* @description : Get a folder by uid
* @returns : T
* @throws {Error} If folder cannot be get by uid
* @param : projectEntity: Partial<ProjectEntity>
*/
public async getByUid(uid: string) {
// const folder = await this.foldersRepository.findOne(uid);
// if (!folder) Promise.reject(new Error("Cannot get folder by uid"));
return { response: "/api/folders/:uid > GET : folder by uid > Not implemented yet" };
}
}

View File

@ -0,0 +1,57 @@
import BaseService from "@Services/BaseService";
import { Service } from "typedi";
@Service()
export default class NotificationsService extends BaseService {
constructor() {
super();
}
/**
* @description : Get all notifications
* @returns : T
* @throws {Error} If notifications cannot be get
* @param : projectEntity: Partial<ProjectEntity>
*/
public async get() {
// const notifications = await this.usersRepository.findOne(uuid);
// if (!notifications) Promise.reject(new Error("Cannot get notifications"));
return { response: "/api/notifications > GET : All notifications > Not implemented yet" };
}
/**
* @description : Create a new notification
* @returns : T
* @throws {Error} If notification cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async create() {
// const notification = await this.projectRepository.create(projectEntity);
// if (!notification) Promise.reject(new Error("Cannot create project"));
return { response: "/api/notifications > POST : Create notification > Not implemented yet" };
}
/**
* @description : Modify a new notification
* @returns : T
* @throws {Error} If notification cannot be modified
* @param : projectEntity: Partial<ProjectEntity>
*/
public async put() {
// const notification = await this.projectRepository.create(projectEntity);
// if (!notification) Promise.reject(new Error("Cannot create project"));
return { response: "/api/notifications > PUT : Modified notification > Not implemented yet" };
}
/**
* @description : Get a notification by uid
* @returns : T
* @throws {Error} If project cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async getByUid(uid: string) {
// const notification = await this.usersRepository.findOne(uid);
// if (!notification) Promise.reject(new Error("Cannot get notification by uid"));
return { response: "/api/notifications/:uid > GET : notification by uid > Not implemented yet" };
}
}

View File

@ -0,0 +1,58 @@
// import ProjectsRepository from "@Common/repositories/projects/ProjectsRepository";
import BaseService from "@Services/BaseService";
import { Service } from "typedi";
@Service()
export default class OfficesService extends BaseService {
constructor() {
super();
}
/**
* @description : Get all office
* @returns : T
* @throws {Error} If offices cannot be get
* @param : projectEntity: Partial<ProjectEntity>
*/
public async get() {
// const office = await this.usersRepository.findOne(uuid);
// if (!office) Promise.reject(new Error("Cannot get office by uuid"));
return { response: "/api/office > GET : All office > Not implemented yet" };
}
/**
* @description : Create a new office
* @returns : T
* @throws {Error} If office cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async create() {
// const project = await this.projectRepository.create(projectEntity);
// if (!project) Promise.reject(new Error("Cannot create project"));
return { response: "/api/office > POST : Create office > Not implemented yet" };
}
/**
* @description : Modify an office
* @returns : T
* @throws {Error} If office cannot be modified
* @param : projectEntity: Partial<ProjectEntity>
*/
public async put() {
// const project = await this.projectRepository.create(projectEntity);
// if (!project) Promise.reject(new Error("Cannot create project"));
return { response: "/api/office > PUT : Modified office > Not implemented yet" };
}
/**
* @description : Get a office by uid
* @returns : T
* @throws {Error} If office cannot be get
* @param : projectEntity: Partial<ProjectEntity>
*/
public async getByUid(uid: string) {
// const office = await this.usersRepository.findOne(uuid);
// if (!office) Promise.reject(new Error("Cannot get office by uuid"));
return { response: "/api/office/:uid > GET : office by uid > Not implemented yet" };
}
}

View File

@ -0,0 +1,57 @@
import BaseService from "@Services/BaseService";
import { Service } from "typedi";
@Service()
export default class UsersService extends BaseService {
constructor() {
super();
}
/**
* @description : Get all users
* @returns : T
* @throws {Error} If users cannot be get
* @param : projectEntity: Partial<ProjectEntity>
*/
public async get() {
// const user = await this.usersRepository.findOne(uuid);
// if (!user) Promise.reject(new Error("Cannot get user by uuid"));
return { response: "/api/users > GET : All users > Not implemented yet" };
}
/**
* @description : Create a new user
* @returns : T
* @throws {Error} If user cannot be created
* @param : projectEntity: Partial<ProjectEntity>
*/
public async create() {
// const project = await this.projectRepository.create(projectEntity);
// if (!project) Promise.reject(new Error("Cannot create project"));
return { response: "/api/users > POST : Create user > Not implemented yet" };
}
/**
* @description : Modify a user
* @returns : T
* @throws {Error} If user cannot be modififed
* @param : projectEntity: Partial<ProjectEntity>
*/
public async put() {
// const project = await this.projectRepository.create(projectEntity);
// if (!project) Promise.reject(new Error("Cannot create project"));
return { response: "/api/users > PUT : Modified user > Not implemented yet" };
}
/**
* @description : Get a user by uid
* @returns : T
* @throws {Error} If user cannot be get bu uid
* @param : projectEntity: Partial<ProjectEntity>
*/
public async getByUid(uid: string) {
// const user = await this.usersRepository.findOne(uuid);
// if (!user) Promise.reject(new Error("Cannot get user by uuid"));
return { response: "/api/users/:uid > GET : user by uid > Not implemented yet" };
}
}

View File

@ -38,11 +38,14 @@
"moduleResolution": "node",
"baseUrl": ".",
"paths": {
"@App/*": [
"src/app/*"
],
"@Api/*": [
"src/api/*"
"src/app/api/*"
],
"@Services/*": [
"src/common/services/*"
"src/services/*"
],
"@Repositories/*": [
"src/common/repositories/*"
@ -87,7 +90,8 @@
},
"include": [
"**/*.ts",
"**/*.tsx"
"**/*.tsx",
"src/app/api/UsersController.ts"
],
"exclude": [
"node_modules"