update first - 84

This commit is contained in:
thanhnv
2026-06-30 02:21:39 +09:00
commit 07ac1bdcdd
561 changed files with 88164 additions and 0 deletions
@@ -0,0 +1,46 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
import { Body, Controller, Inject, Post, Res, ValidationPipe } from '@nestjs/common';
import { ok } from '../common/api-response.js';
import { AuthService } from './auth.service.js';
import { LoginDto } from './dto/login.dto.js';
let AuthController = class AuthController {
authService;
constructor(authService) {
this.authService = authService;
}
async login(dto, response) {
const result = await this.authService.login(dto.username, dto.password);
response.cookie('okr_token', result.token, {
httpOnly: true,
sameSite: 'lax',
secure: false,
maxAge: 2 * 60 * 60 * 1000,
});
return ok(result);
}
};
__decorate([
Post('login'),
__param(0, Body(new ValidationPipe({ expectedType: LoginDto, whitelist: true, forbidNonWhitelisted: true }))),
__param(1, Res({ passthrough: true })),
__metadata("design:type", Function),
__metadata("design:paramtypes", [LoginDto, Object]),
__metadata("design:returntype", Promise)
], AuthController.prototype, "login", null);
AuthController = __decorate([
Controller('auth'),
__param(0, Inject(AuthService)),
__metadata("design:paramtypes", [AuthService])
], AuthController);
export { AuthController };