Merge dev to main #1

Open
kibin wants to merge 33 commits from dev into main
5 changed files with 13 additions and 10 deletions
Showing only changes of commit 40f30b4a5d - Show all commits

View File

@@ -40,6 +40,7 @@
"@nestjs/testing": "^11.0.0",
"@types/bcrypt": "^5.0.2",
"@types/express": "^5.0.0",
"@types/multer": "^1.4.12",
"@types/passport-jwt": "^4.0.1",
"typescript": "^5.7.0",
"vitest": "^3.1.0"

View File

@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "users" ADD COLUMN "mustChangePassword" BOOLEAN NOT NULL DEFAULT false;

View File

@@ -44,7 +44,8 @@ model User {
password String
firstName String
lastName String
isActive Boolean @default(true)
isActive Boolean @default(true)
mustChangePassword Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
@@ -203,6 +204,8 @@ model Client {
address String
areaId String?
status String @default("active") // active, inactive, suspended
latitude Float?
longitude Float?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?

View File

@@ -2,8 +2,6 @@ import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core';
import { ThrottlerModule, ThrottlerGuard } from '@nestjs/throttler';
import { ServeStaticModule } from '@nestjs/serve-static';
import { join } from 'path';
import { HealthModule } from './health/health.module';
import { PrismaModule } from './prisma/prisma.module';
import { AuthModule } from './auth/auth.module';
@@ -73,10 +71,6 @@ import { AccessGuard } from './common/guards/access.guard';
PayrollModule,
RoleModule,
CommentModule,
ServeStaticModule.forRoot({
rootPath: join(__dirname, '..', 'uploads'),
serveRoot: '/uploads',
}),
],
providers: [
{ provide: APP_FILTER, useClass: GlobalExceptionFilter },

View File

@@ -1,11 +1,14 @@
import { MulterOptions } from '@nestjs/platform-express/multer/interfaces/multer-options.interface';
import { diskStorage } from 'multer';
import { extname } from 'path';
import { Request } from 'express';
export const multerOptions: MulterOptions = {
storage: diskStorage({
destination: './uploads',
filename: (_req, file, cb) => {
destination: (_req: Request, _file: Express.Multer.File, cb: (error: Error | null, destination: string) => void) => {
cb(null, './uploads');
},
filename: (_req: Request, file: Express.Multer.File, cb: (error: Error | null, filename: string) => void) => {
const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1e9);
cb(null, uniqueSuffix + extname(file.originalname));
},
@@ -13,7 +16,7 @@ export const multerOptions: MulterOptions = {
limits: {
fileSize: 5 * 1024 * 1024, // 5MB per file
},
fileFilter: (_req, file, cb) => {
fileFilter: (_req: Request, file: Express.Multer.File, cb: (error: Error | null, acceptFile: boolean) => void) => {
const allowed = [
'image/jpeg',
'image/png',