Endpoints and private services for each entities, remains link tables btwn ManyMany entities

This commit is contained in:
Hugo Lextrait 2023-03-20 15:31:02 +01:00
parent 00a2ca9d7d
commit 9d6e5044c6
22 changed files with 713 additions and 70 deletions

4
package-lock.json generated
View File

@ -1,11 +1,11 @@
{ {
"name": "tezoslink", "name": "lecoffre",
"version": "1.0.0", "version": "1.0.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "tezoslink", "name": "lecoffre",
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {

View File

@ -1,8 +1,8 @@
import { type Response, type Request } from "express"; import { type Response, type Request } from "express";
import { Controller, Get, Post, Put } from "@ControllerPattern/index"; import { Controller, Get, Post, Put } from "@ControllerPattern/index";
import { Service } from "typedi";
import ApiController from "@Common/system/controller-pattern/ApiController"; import ApiController from "@Common/system/controller-pattern/ApiController";
import CustomersService from "@Services/CustomersService/CustomersService"; import CustomersService from "@Services/CustomersService/CustomersService";
import { Service } from "typedi";
// import { IsNotEmpty, IsString, IsUUID } from "class-validator"; // import { IsNotEmpty, IsString, IsUUID } from "class-validator";
// class Params { // class Params {
@ -15,7 +15,6 @@ import CustomersService from "@Services/CustomersService/CustomersService";
@Controller() @Controller()
@Service() @Service()
export default class CustomersController extends ApiController { export default class CustomersController extends ApiController {
tokensService: any;
constructor(private customersService: CustomersService) { constructor(private customersService: CustomersService) {
super(); super();
} }

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

@ -1,8 +1,8 @@
import { type Response, type Request } from "express"; import { type Response, type Request } from "express";
import { Controller, Get, Post, Put } from "@ControllerPattern/index"; import { Controller, Get, Post, Put } from "@ControllerPattern/index";
import { Service } from "typedi";
import ApiController from "@Common/system/controller-pattern/ApiController"; import ApiController from "@Common/system/controller-pattern/ApiController";
import DeedsService from "@Services/DeedsService/DeedsService"; import DeedsService from "@Services/DeedsService/DeedsService";
import { Service } from "typedi";
// import { IsNotEmpty, IsString, IsUUID } from "class-validator"; // import { IsNotEmpty, IsString, IsUUID } from "class-validator";
// class Params { // class Params {
@ -15,7 +15,6 @@ import DeedsService from "@Services/DeedsService/DeedsService";
@Controller() @Controller()
@Service() @Service()
export default class DeedsController extends ApiController { export default class DeedsController extends ApiController {
tokensService: any;
constructor(private deedsService: DeedsService) { constructor(private deedsService: DeedsService) {
super(); super();
} }

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

@ -1,8 +1,8 @@
import { type Response, type Request } from "express"; import { type Response, type Request } from "express";
import { Controller, Get, Post, Put } from "@ControllerPattern/index"; import { Controller, Get, Post, Put } from "@ControllerPattern/index";
import { Service } from "typedi";
import ApiController from "@Common/system/controller-pattern/ApiController"; import ApiController from "@Common/system/controller-pattern/ApiController";
import FoldersService from "@Services/FoldersService/FoldersService"; import FoldersService from "@Services/FoldersService/FoldersService";
import { Service } from "typedi";
// import { IsNotEmpty, IsString, IsUUID } from "class-validator"; // import { IsNotEmpty, IsString, IsUUID } from "class-validator";
// class Params { // class Params {
@ -15,7 +15,6 @@ import FoldersService from "@Services/FoldersService/FoldersService";
@Controller() @Controller()
@Service() @Service()
export default class FolderController extends ApiController { export default class FolderController extends ApiController {
tokensService: any;
constructor(private foldersService: FoldersService) { constructor(private foldersService: FoldersService) {
super(); super();
} }

View File

@ -1,8 +1,8 @@
import { type Response, type Request } from "express"; import { type Response, type Request } from "express";
import { Controller, Get, Post, Put } from "@ControllerPattern/index"; import { Controller, Get, Post, Put } from "@ControllerPattern/index";
import { Service } from "typedi";
import ApiController from "@Common/system/controller-pattern/ApiController"; import ApiController from "@Common/system/controller-pattern/ApiController";
import OfficesService from "@Services/OfficesService/OfficesService"; import OfficesService from "@Services/OfficesService/OfficesService";
import { Service } from "typedi";
// import { IsNotEmpty, IsString, IsUUID } from "class-validator"; // import { IsNotEmpty, IsString, IsUUID } from "class-validator";
// class Params { // class Params {
@ -15,7 +15,6 @@ import OfficesService from "@Services/OfficesService/OfficesService";
@Controller() @Controller()
@Service() @Service()
export default class OfficesController extends ApiController { export default class OfficesController extends ApiController {
tokensService: any;
constructor(private officesService: OfficesService) { constructor(private officesService: OfficesService) {
super(); super();
} }

View File

@ -1,8 +1,8 @@
import { type Response, type Request } from "express"; import { type Response, type Request } from "express";
import { Controller, Get, Post, Put } from "@ControllerPattern/index"; import { Controller, Get, Post, Put } from "@ControllerPattern/index";
import { Service } from "typedi";
import ApiController from "@Common/system/controller-pattern/ApiController"; import ApiController from "@Common/system/controller-pattern/ApiController";
import UsersService from "@Services/UsersService/UsersService"; import UsersService from "@Services/UsersService/UsersService";
import { Service } from "typedi";
// import { IsNotEmpty, IsString, IsUUID } from "class-validator"; // import { IsNotEmpty, IsString, IsUUID } from "class-validator";
// class Params { // class Params {
@ -15,7 +15,6 @@ import UsersService from "@Services/UsersService/UsersService";
@Controller() @Controller()
@Service() @Service()
export default class UsersController extends ApiController { export default class UsersController extends ApiController {
tokensService: any;
constructor(private usersService: UsersService) { constructor(private usersService: UsersService) {
super(); super();
} }

View File

@ -5,6 +5,9 @@ import FoldersController from "./api/FoldersController";
import CustomersController from "./api/CustomersController"; import CustomersController from "./api/CustomersController";
import OfficesController from "./api/OfficesController"; import OfficesController from "./api/OfficesController";
import DeedsController from "./api/DeedsController"; 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 * @description This allow to declare all controllers used in the application
@ -17,5 +20,8 @@ export default {
Container.get(CustomersController); Container.get(CustomersController);
Container.get(OfficesController); Container.get(OfficesController);
Container.get(DeedsController); Container.get(DeedsController);
Container.get(DeedTypesController);
Container.get(DocumentsController);
Container.get(DocumentTypesController);
}, },
}; };

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

@ -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

@ -10,7 +10,7 @@ export default class CustomersService extends BaseService {
/** /**
* @description : Get all Customers * @description : Get all Customers
* @returns : T * @returns : T
* @throws {Error} If project cannot be created * @throws {Error} If Customers cannot be get
* @param : projectEntity: Partial<ProjectEntity> * @param : projectEntity: Partial<ProjectEntity>
*/ */
public async get() { public async get() {
@ -22,36 +22,36 @@ export default class CustomersService extends BaseService {
/** /**
* @description : Create a new customer * @description : Create a new customer
* @returns : T * @returns : T
* @throws {Error} If project cannot be created * @throws {Error} If customer cannot be created
* @param : projectEntity: Partial<ProjectEntity> * @param : projectEntity: Partial<ProjectEntity>
*/ */
public async create() { public async create() {
// const project = await this.projectRepository.create(projectEntity); // const customer = await this.projectRepository.create(projectEntity);
// if (!project) Promise.reject(new Error("Cannot create project")); // if (!customer) Promise.reject(new Error("Cannot create project"));
return { response: "/api/customers > POST : Create User > Not implemented yet" }; return { response: "/api/customers > POST : Create customer > Not implemented yet" };
} }
/** /**
* @description : Create a new customer * @description : Modify a customer
* @returns : T * @returns : T
* @throws {Error} If project cannot be created * @throws {Error} If customer cannot be modified
* @param : projectEntity: Partial<ProjectEntity> * @param : projectEntity: Partial<ProjectEntity>
*/ */
public async put() { public async put() {
// const project = await this.projectRepository.create(projectEntity); // const customer = await this.projectRepository.create(projectEntity);
// if (!project) Promise.reject(new Error("Cannot create project")); // if (!customer) Promise.reject(new Error("Cannot create project"));
return { response: "/api/customers > POST : Create User > Not implemented yet" }; return { response: "/api/customers > PUT : Modified customer > Not implemented yet" };
} }
/** /**
* @description : Get a customer by uid * @description : Get a customer by uid
* @returns : T * @returns : T
* @throws {Error} If project cannot be created * @throws {Error} If customer cannot be get by uid
* @param : projectEntity: Partial<ProjectEntity> * @param : projectEntity: Partial<ProjectEntity>
*/ */
public async getByUid(uuid: string) { public async getByUid(uid: string) {
// const customer = await this.customersRepository.findOne(uuid); // const customer = await this.customersRepository.findOne(uid);
// if (!customer) Promise.reject(new Error("Cannot get customer by uuid")); // if (!customer) Promise.reject(new Error("Cannot get customer by uid"));
return { response: "/api/customers/:uuid > GET : User by uid > Not implemented yet" }; 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

@ -10,7 +10,7 @@ export default class DeedsService extends BaseService {
/** /**
* @description : Get all deeds * @description : Get all deeds
* @returns : T * @returns : T
* @throws {Error} If project cannot be created * @throws {Error} If deeds cannot be get
* @param : projectEntity: Partial<ProjectEntity> * @param : projectEntity: Partial<ProjectEntity>
*/ */
public async get() { public async get() {
@ -22,25 +22,25 @@ export default class DeedsService extends BaseService {
/** /**
* @description : Create a new deed * @description : Create a new deed
* @returns : T * @returns : T
* @throws {Error} If project cannot be created * @throws {Error} If deeds cannot be created
* @param : projectEntity: Partial<ProjectEntity> * @param : projectEntity: Partial<ProjectEntity>
*/ */
public async create() { public async create() {
// const project = await this.projectRepository.create(projectEntity); // const deeds = await this.projectRepository.create(projectEntity);
// if (!project) Promise.reject(new Error("Cannot create project")); // if (!deeds) Promise.reject(new Error("Cannot create project"));
return { response: "/api/deeds > POST : Create User > Not implemented yet" }; return { response: "/api/deeds > POST : Create deed > Not implemented yet" };
} }
/** /**
* @description : Create a new deed * @description : Modify a new deed
* @returns : T * @returns : T
* @throws {Error} If project cannot be created * @throws {Error} If deeds cannot be modified
* @param : projectEntity: Partial<ProjectEntity> * @param : projectEntity: Partial<ProjectEntity>
*/ */
public async put() { public async put() {
// const project = await this.projectRepository.create(projectEntity); // const deeds = await this.projectRepository.create(projectEntity);
// if (!project) Promise.reject(new Error("Cannot create project")); // if (!deeds) Promise.reject(new Error("Cannot create project"));
return { response: "/api/deeds > POST : Create User > Not implemented yet" }; return { response: "/api/deeds > PUT : Modified deed > Not implemented yet" };
} }
/** /**
@ -52,6 +52,6 @@ export default class DeedsService extends BaseService {
public async getByUid(uuid: string) { public async getByUid(uuid: string) {
// const deed = await this.usersRepository.findOne(uuid); // const deed = await this.usersRepository.findOne(uuid);
// if (!deed) Promise.reject(new Error("Cannot get deed by uuid")); // if (!deed) Promise.reject(new Error("Cannot get deed by uuid"));
return { response: "/api/deeds/:uuid > GET : User by uid > Not implemented yet" }; 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

@ -10,7 +10,7 @@ export default class FoldersService extends BaseService {
/** /**
* @description : Get all folders * @description : Get all folders
* @returns : T * @returns : T
* @throws {Error} If project cannot be created * @throws {Error} If folders cannot be get
* @param : projectEntity: Partial<ProjectEntity> * @param : projectEntity: Partial<ProjectEntity>
*/ */
public async get() { public async get() {
@ -22,36 +22,36 @@ export default class FoldersService extends BaseService {
/** /**
* @description : Create a new folder * @description : Create a new folder
* @returns : T * @returns : T
* @throws {Error} If project cannot be created * @throws {Error} If folder cannot be created
* @param : projectEntity: Partial<ProjectEntity> * @param : projectEntity: Partial<ProjectEntity>
*/ */
public async create() { public async create() {
// const project = await this.projectRepository.create(projectEntity); // const folder = await this.projectRepository.create(projectEntity);
// if (!project) Promise.reject(new Error("Cannot create project")); // if (!folder) Promise.reject(new Error("Cannot create folder"));
return { response: "/api/folders > POST : Create folder > Not implemented yet" }; return { response: "/api/folders > POST : Create folder > Not implemented yet" };
} }
/** /**
* @description : Create a new folder * @description : Modify a folder
* @returns : T * @returns : T
* @throws {Error} If project cannot be created * @throws {Error} If folder cannot be modified
* @param : projectEntity: Partial<ProjectEntity> * @param : projectEntity: Partial<ProjectEntity>
*/ */
public async put() { public async put() {
// const project = await this.projectRepository.create(projectEntity); // const folder = await this.projectRepository.create(projectEntity);
// if (!project) Promise.reject(new Error("Cannot create project")); // if (!folder) Promise.reject(new Error("Cannot create folder"));
return { response: "/api/folders > POST : Create folder > Not implemented yet" }; return { response: "/api/folders > PUT : Modified folder > Not implemented yet" };
} }
/** /**
* @description : Get a folder by uid * @description : Get a folder by uid
* @returns : T * @returns : T
* @throws {Error} If project cannot be created * @throws {Error} If folder cannot be get by uid
* @param : projectEntity: Partial<ProjectEntity> * @param : projectEntity: Partial<ProjectEntity>
*/ */
public async getByUid(uuid: string) { public async getByUid(uid: string) {
// const folder = await this.foldersRepository.findOne(uuid); // const folder = await this.foldersRepository.findOne(uid);
// if (!folder) Promise.reject(new Error("Cannot get folder by uuid")); // if (!folder) Promise.reject(new Error("Cannot get folder by uid"));
return { response: "/api/folders/:uuid > GET : folder by uid > Not implemented yet" }; 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

@ -11,7 +11,7 @@ export default class OfficesService extends BaseService {
/** /**
* @description : Get all office * @description : Get all office
* @returns : T * @returns : T
* @throws {Error} If project cannot be created * @throws {Error} If offices cannot be get
* @param : projectEntity: Partial<ProjectEntity> * @param : projectEntity: Partial<ProjectEntity>
*/ */
public async get() { public async get() {
@ -23,36 +23,36 @@ export default class OfficesService extends BaseService {
/** /**
* @description : Create a new office * @description : Create a new office
* @returns : T * @returns : T
* @throws {Error} If project cannot be created * @throws {Error} If office cannot be created
* @param : projectEntity: Partial<ProjectEntity> * @param : projectEntity: Partial<ProjectEntity>
*/ */
public async create() { public async create() {
// const project = await this.projectRepository.create(projectEntity); // const project = await this.projectRepository.create(projectEntity);
// if (!project) Promise.reject(new Error("Cannot create project")); // if (!project) Promise.reject(new Error("Cannot create project"));
return { response: "/api/office > POST : Create User > Not implemented yet" }; return { response: "/api/office > POST : Create office > Not implemented yet" };
} }
/** /**
* @description : Create a new office * @description : Modify an office
* @returns : T * @returns : T
* @throws {Error} If project cannot be created * @throws {Error} If office cannot be modified
* @param : projectEntity: Partial<ProjectEntity> * @param : projectEntity: Partial<ProjectEntity>
*/ */
public async put() { public async put() {
// const project = await this.projectRepository.create(projectEntity); // const project = await this.projectRepository.create(projectEntity);
// if (!project) Promise.reject(new Error("Cannot create project")); // if (!project) Promise.reject(new Error("Cannot create project"));
return { response: "/api/office > POST : Create User > Not implemented yet" }; return { response: "/api/office > PUT : Modified office > Not implemented yet" };
} }
/** /**
* @description : Get a office by uid * @description : Get a office by uid
* @returns : T * @returns : T
* @throws {Error} If project cannot be created * @throws {Error} If office cannot be get
* @param : projectEntity: Partial<ProjectEntity> * @param : projectEntity: Partial<ProjectEntity>
*/ */
public async getByUid(uuid: string) { public async getByUid(uid: string) {
// const office = await this.usersRepository.findOne(uuid); // const office = await this.usersRepository.findOne(uuid);
// if (!office) Promise.reject(new Error("Cannot get office by uuid")); // if (!office) Promise.reject(new Error("Cannot get office by uuid"));
return { response: "/api/office/:uuid > GET : User by uid > Not implemented yet" }; return { response: "/api/office/:uid > GET : office by uid > Not implemented yet" };
} }
} }

View File

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