✨ created Services and Controllers for Customers, Offices, Users, Deeds, Folders returning not implemented yet
This commit is contained in:
parent
961a8b991d
commit
00a2ca9d7d
82
src/app/api/CustomersController.ts
Normal file
82
src/app/api/CustomersController.ts
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
import { type Response, type Request } from "express";
|
||||||
|
import { Controller, Get, Post, Put } from "@ControllerPattern/index";
|
||||||
|
import { Service } from "typedi";
|
||||||
|
import ApiController from "@Common/system/controller-pattern/ApiController";
|
||||||
|
import CustomersService from "@Services/CustomersService/CustomersService";
|
||||||
|
// import { IsNotEmpty, IsString, IsUUID } from "class-validator";
|
||||||
|
|
||||||
|
// class Params {
|
||||||
|
// @IsString()
|
||||||
|
// @IsNotEmpty()
|
||||||
|
// @IsUUID()
|
||||||
|
// public uuid!: string;
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Controller()
|
||||||
|
@Service()
|
||||||
|
export default class CustomersController extends ApiController {
|
||||||
|
tokensService: any;
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
}
|
82
src/app/api/DeedsController.ts
Normal file
82
src/app/api/DeedsController.ts
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
import { type Response, type Request } from "express";
|
||||||
|
import { Controller, Get, Post, Put } from "@ControllerPattern/index";
|
||||||
|
import { Service } from "typedi";
|
||||||
|
import ApiController from "@Common/system/controller-pattern/ApiController";
|
||||||
|
import DeedsService from "@Services/DeedsService/DeedsService";
|
||||||
|
// import { IsNotEmpty, IsString, IsUUID } from "class-validator";
|
||||||
|
|
||||||
|
// class Params {
|
||||||
|
// @IsString()
|
||||||
|
// @IsNotEmpty()
|
||||||
|
// @IsUUID()
|
||||||
|
// public uuid!: string;
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Controller()
|
||||||
|
@Service()
|
||||||
|
export default class DeedsController extends ApiController {
|
||||||
|
tokensService: any;
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
}
|
82
src/app/api/FoldersController.ts
Normal file
82
src/app/api/FoldersController.ts
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
import { type Response, type Request } from "express";
|
||||||
|
import { Controller, Get, Post, Put } from "@ControllerPattern/index";
|
||||||
|
import { Service } from "typedi";
|
||||||
|
import ApiController from "@Common/system/controller-pattern/ApiController";
|
||||||
|
import FoldersService from "@Services/FoldersService/FoldersService";
|
||||||
|
// import { IsNotEmpty, IsString, IsUUID } from "class-validator";
|
||||||
|
|
||||||
|
// class Params {
|
||||||
|
// @IsString()
|
||||||
|
// @IsNotEmpty()
|
||||||
|
// @IsUUID()
|
||||||
|
// public uuid!: string;
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Controller()
|
||||||
|
@Service()
|
||||||
|
export default class FolderController extends ApiController {
|
||||||
|
tokensService: any;
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
}
|
82
src/app/api/OfficesController.ts
Normal file
82
src/app/api/OfficesController.ts
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
import { type Response, type Request } from "express";
|
||||||
|
import { Controller, Get, Post, Put } from "@ControllerPattern/index";
|
||||||
|
import { Service } from "typedi";
|
||||||
|
import ApiController from "@Common/system/controller-pattern/ApiController";
|
||||||
|
import OfficesService from "@Services/OfficesService/OfficesService";
|
||||||
|
// import { IsNotEmpty, IsString, IsUUID } from "class-validator";
|
||||||
|
|
||||||
|
// class Params {
|
||||||
|
// @IsString()
|
||||||
|
// @IsNotEmpty()
|
||||||
|
// @IsUUID()
|
||||||
|
// public uuid!: string;
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Controller()
|
||||||
|
@Service()
|
||||||
|
export default class OfficesController extends ApiController {
|
||||||
|
tokensService: any;
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
}
|
@ -1,49 +0,0 @@
|
|||||||
import { type Response, type Request } from "express";
|
|
||||||
import { Controller, Get } from "@ControllerPattern/index";
|
|
||||||
import { Service } from "typedi";
|
|
||||||
import { IsNotEmpty, IsString, IsUUID, validateOrReject } from "class-validator";
|
|
||||||
// import ProjectService from "@Services/_TemplateService/_TemplateService";
|
|
||||||
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() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Get("/api/projects")
|
|
||||||
protected async get(req: Request, res: Response) {
|
|
||||||
|
|
||||||
// const query = processFindManyQuery(req.query);
|
|
||||||
this.httpSuccess(res, { message: "get" });
|
|
||||||
}
|
|
||||||
|
|
||||||
@Get("/api/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();
|
|
||||||
// if (!project) {
|
|
||||||
// this.httpNotFoundRequest(res);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// this.httpSuccess(res, project);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -14,9 +14,9 @@ import UsersService from "@Services/UsersService/UsersService";
|
|||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
@Service()
|
@Service()
|
||||||
export default class UserController extends ApiController {
|
export default class UsersController extends ApiController {
|
||||||
tokensService: any;
|
tokensService: any;
|
||||||
constructor(private userService: UsersService) {
|
constructor(private usersService: UsersService) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ export default class UserController extends ApiController {
|
|||||||
this.httpBadRequest(response, error);
|
this.httpBadRequest(response, error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.httpSuccess(response, await this.userService.get());
|
this.httpSuccess(response, await this.usersService.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,7 +47,7 @@ export default class UserController extends ApiController {
|
|||||||
this.httpBadRequest(response, error);
|
this.httpBadRequest(response, error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.httpSuccess(response, await this.userService.create());
|
this.httpSuccess(response, await this.usersService.create());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,7 +62,7 @@ export default class UserController extends ApiController {
|
|||||||
this.httpBadRequest(response, error);
|
this.httpBadRequest(response, error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.httpSuccess(response, await this.userService.create());
|
this.httpSuccess(response, await this.usersService.put());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,6 +77,6 @@ export default class UserController extends ApiController {
|
|||||||
this.httpBadRequest(response, error);
|
this.httpBadRequest(response, error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.httpSuccess(response, await this.userService.getByUid("uid"));
|
this.httpSuccess(response, await this.usersService.getByUid("uid"));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,13 +1,21 @@
|
|||||||
import { Container } from "typedi";
|
import { Container } from "typedi";
|
||||||
import HomeController from "./HomeController";
|
import HomeController from "./HomeController";
|
||||||
import ProjectController from "./api/ProjectController";
|
import UsersController from "./api/UsersController";
|
||||||
import UserController from "./api/UserController";
|
import FoldersController from "./api/FoldersController";
|
||||||
|
import CustomersController from "./api/CustomersController";
|
||||||
|
import OfficesController from "./api/OfficesController";
|
||||||
|
import DeedsController from "./api/DeedsController";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description This allow to declare all controllers used in the application
|
||||||
|
*/
|
||||||
export default {
|
export default {
|
||||||
start: () => {
|
start: () => {
|
||||||
Container.get(HomeController);
|
Container.get(HomeController);
|
||||||
Container.get(ProjectController);
|
Container.get(UsersController);
|
||||||
Container.get(UserController);
|
Container.get(FoldersController);
|
||||||
}
|
Container.get(CustomersController);
|
||||||
}
|
Container.get(OfficesController);
|
||||||
|
Container.get(DeedsController);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
57
src/services/CustomersService/CustomersService.ts
Normal file
57
src/services/CustomersService/CustomersService.ts
Normal 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 project cannot be created
|
||||||
|
* @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 project 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/customers > POST : Create User > Not implemented yet" };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Create a new customer
|
||||||
|
* @returns : T
|
||||||
|
* @throws {Error} If project cannot be created
|
||||||
|
* @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/customers > POST : Create User > Not implemented yet" };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Get a customer by uid
|
||||||
|
* @returns : T
|
||||||
|
* @throws {Error} If project cannot be created
|
||||||
|
* @param : projectEntity: Partial<ProjectEntity>
|
||||||
|
*/
|
||||||
|
public async getByUid(uuid: string) {
|
||||||
|
// const customer = await this.customersRepository.findOne(uuid);
|
||||||
|
// if (!customer) Promise.reject(new Error("Cannot get customer by uuid"));
|
||||||
|
return { response: "/api/customers/:uuid > GET : User by uid > Not implemented yet" };
|
||||||
|
}
|
||||||
|
}
|
57
src/services/DeedsService/DeedsService.ts
Normal file
57
src/services/DeedsService/DeedsService.ts
Normal 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 project cannot be created
|
||||||
|
* @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 project 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/deeds > POST : Create User > Not implemented yet" };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Create a new deed
|
||||||
|
* @returns : T
|
||||||
|
* @throws {Error} If project cannot be created
|
||||||
|
* @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/deeds > POST : Create User > 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 : User by uid > Not implemented yet" };
|
||||||
|
}
|
||||||
|
}
|
57
src/services/FoldersService/FoldersService.ts
Normal file
57
src/services/FoldersService/FoldersService.ts
Normal 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 project cannot be created
|
||||||
|
* @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 project 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/folders > POST : Create folder > Not implemented yet" };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Create a new folder
|
||||||
|
* @returns : T
|
||||||
|
* @throws {Error} If project cannot be created
|
||||||
|
* @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/folders > POST : Create folder > Not implemented yet" };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Get a folder by uid
|
||||||
|
* @returns : T
|
||||||
|
* @throws {Error} If project cannot be created
|
||||||
|
* @param : projectEntity: Partial<ProjectEntity>
|
||||||
|
*/
|
||||||
|
public async getByUid(uuid: string) {
|
||||||
|
// const folder = await this.foldersRepository.findOne(uuid);
|
||||||
|
// if (!folder) Promise.reject(new Error("Cannot get folder by uuid"));
|
||||||
|
return { response: "/api/folders/:uuid > GET : folder by uid > Not implemented yet" };
|
||||||
|
}
|
||||||
|
}
|
58
src/services/OfficesService/OfficesService.ts
Normal file
58
src/services/OfficesService/OfficesService.ts
Normal 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 project cannot be created
|
||||||
|
* @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 project 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 User > Not implemented yet" };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Create a new office
|
||||||
|
* @returns : T
|
||||||
|
* @throws {Error} If project cannot be created
|
||||||
|
* @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 > POST : Create User > Not implemented yet" };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Get a office by uid
|
||||||
|
* @returns : T
|
||||||
|
* @throws {Error} If project cannot be created
|
||||||
|
* @param : projectEntity: Partial<ProjectEntity>
|
||||||
|
*/
|
||||||
|
public async getByUid(uuid: string) {
|
||||||
|
// const office = await this.usersRepository.findOne(uuid);
|
||||||
|
// if (!office) Promise.reject(new Error("Cannot get office by uuid"));
|
||||||
|
return { response: "/api/office/:uuid > GET : User by uid > Not implemented yet" };
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,3 @@
|
|||||||
// import ProjectsRepository from "@Common/repositories/projects/ProjectsRepository";
|
|
||||||
import BaseService from "@Services/BaseService";
|
import BaseService from "@Services/BaseService";
|
||||||
import { Service } from "typedi";
|
import { Service } from "typedi";
|
||||||
|
|
||||||
@ -19,7 +18,7 @@ export default class UsersService extends BaseService {
|
|||||||
// 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 > GET : All users > Not implemented yet" };
|
return { response: "/api/users > GET : All users > Not implemented yet" };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description : Create a new user
|
* @description : Create a new user
|
||||||
* @returns : T
|
* @returns : T
|
||||||
|
@ -91,7 +91,7 @@
|
|||||||
"include": [
|
"include": [
|
||||||
"**/*.ts",
|
"**/*.ts",
|
||||||
"**/*.tsx",
|
"**/*.tsx",
|
||||||
"src/app/api/UserController.ts"
|
"src/app/api/UsersController.ts"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules"
|
"node_modules"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user