Merge dev to main #1
@@ -40,6 +40,7 @@
|
|||||||
"@nestjs/testing": "^11.0.0",
|
"@nestjs/testing": "^11.0.0",
|
||||||
"@types/bcrypt": "^5.0.2",
|
"@types/bcrypt": "^5.0.2",
|
||||||
"@types/express": "^5.0.0",
|
"@types/express": "^5.0.0",
|
||||||
|
"@types/multer": "^1.4.12",
|
||||||
"@types/passport-jwt": "^4.0.1",
|
"@types/passport-jwt": "^4.0.1",
|
||||||
"typescript": "^5.7.0",
|
"typescript": "^5.7.0",
|
||||||
"vitest": "^3.1.0"
|
"vitest": "^3.1.0"
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "users" ADD COLUMN "mustChangePassword" BOOLEAN NOT NULL DEFAULT false;
|
||||||
@@ -45,6 +45,7 @@ model User {
|
|||||||
firstName String
|
firstName String
|
||||||
lastName String
|
lastName String
|
||||||
isActive Boolean @default(true)
|
isActive Boolean @default(true)
|
||||||
|
mustChangePassword Boolean @default(false)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
deletedAt DateTime?
|
deletedAt DateTime?
|
||||||
@@ -203,6 +204,8 @@ model Client {
|
|||||||
address String
|
address String
|
||||||
areaId String?
|
areaId String?
|
||||||
status String @default("active") // active, inactive, suspended
|
status String @default("active") // active, inactive, suspended
|
||||||
|
latitude Float?
|
||||||
|
longitude Float?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
deletedAt DateTime?
|
deletedAt DateTime?
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import { Module } from '@nestjs/common';
|
|||||||
import { ConfigModule } from '@nestjs/config';
|
import { ConfigModule } from '@nestjs/config';
|
||||||
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core';
|
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core';
|
||||||
import { ThrottlerModule, ThrottlerGuard } from '@nestjs/throttler';
|
import { ThrottlerModule, ThrottlerGuard } from '@nestjs/throttler';
|
||||||
import { ServeStaticModule } from '@nestjs/serve-static';
|
|
||||||
import { join } from 'path';
|
|
||||||
import { HealthModule } from './health/health.module';
|
import { HealthModule } from './health/health.module';
|
||||||
import { PrismaModule } from './prisma/prisma.module';
|
import { PrismaModule } from './prisma/prisma.module';
|
||||||
import { AuthModule } from './auth/auth.module';
|
import { AuthModule } from './auth/auth.module';
|
||||||
@@ -73,10 +71,6 @@ import { AccessGuard } from './common/guards/access.guard';
|
|||||||
PayrollModule,
|
PayrollModule,
|
||||||
RoleModule,
|
RoleModule,
|
||||||
CommentModule,
|
CommentModule,
|
||||||
ServeStaticModule.forRoot({
|
|
||||||
rootPath: join(__dirname, '..', 'uploads'),
|
|
||||||
serveRoot: '/uploads',
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: APP_FILTER, useClass: GlobalExceptionFilter },
|
{ provide: APP_FILTER, useClass: GlobalExceptionFilter },
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
import { MulterOptions } from '@nestjs/platform-express/multer/interfaces/multer-options.interface';
|
import { MulterOptions } from '@nestjs/platform-express/multer/interfaces/multer-options.interface';
|
||||||
import { diskStorage } from 'multer';
|
import { diskStorage } from 'multer';
|
||||||
import { extname } from 'path';
|
import { extname } from 'path';
|
||||||
|
import { Request } from 'express';
|
||||||
|
|
||||||
export const multerOptions: MulterOptions = {
|
export const multerOptions: MulterOptions = {
|
||||||
storage: diskStorage({
|
storage: diskStorage({
|
||||||
destination: './uploads',
|
destination: (_req: Request, _file: Express.Multer.File, cb: (error: Error | null, destination: string) => void) => {
|
||||||
filename: (_req, file, cb) => {
|
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);
|
const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1e9);
|
||||||
cb(null, uniqueSuffix + extname(file.originalname));
|
cb(null, uniqueSuffix + extname(file.originalname));
|
||||||
},
|
},
|
||||||
@@ -13,7 +16,7 @@ export const multerOptions: MulterOptions = {
|
|||||||
limits: {
|
limits: {
|
||||||
fileSize: 5 * 1024 * 1024, // 5MB per file
|
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 = [
|
const allowed = [
|
||||||
'image/jpeg',
|
'image/jpeg',
|
||||||
'image/png',
|
'image/png',
|
||||||
|
|||||||
Reference in New Issue
Block a user