39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { type Response, type Request } from "express";
|
|
import { Controller, Get } from "@ControllerPattern/index";
|
|
// import { IsNotEmpty, IsString, IsUUID } from "class-validator";
|
|
import { Service } from "typedi";
|
|
import ApiController from "@Common/system/controller-pattern/ApiController";
|
|
import UsersService from "@Services/UsersService/UsersService";
|
|
|
|
// class Params {
|
|
// @IsString()
|
|
// @IsNotEmpty()
|
|
// @IsUUID()
|
|
// public uuid!: string;
|
|
// }
|
|
|
|
@Controller()
|
|
@Service()
|
|
export default class UserController extends ApiController {
|
|
tokensService: any;
|
|
constructor(private userService: UsersService) {
|
|
super();
|
|
}
|
|
|
|
@Get("/api/users")
|
|
protected async get(req: Request, response: Response) {
|
|
console.log("UserController > get > response");
|
|
// request: Request
|
|
// const query = this.buildQueryAsObject<Partial<TokenSupportEntity>>(request);
|
|
try {
|
|
// await validateOrReject(QueryService.createFrom<Partial<TokenSupportEntity>>(query), {
|
|
// forbidUnknownValues: true,
|
|
// });
|
|
} catch (error) {
|
|
this.httpBadRequest(response, error);
|
|
return;
|
|
}
|
|
this.httpSuccess(response, await this.userService.getByUid("uid"));
|
|
}
|
|
}
|