se agrego drive correctamente
This commit is contained in:
+1
-1
@@ -12,7 +12,7 @@ services:
|
||||
- '3306:3306'
|
||||
volumes:
|
||||
- mariadb_data:/var/lib/mysql
|
||||
- ./initdb:/docker-entrypoint-initdb.d
|
||||
- ./initdb2:/docker-entrypoint-initdb.dP
|
||||
|
||||
volumes:
|
||||
mariadb_data:
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
|
||||
import { diskStorage } from 'multer';
|
||||
import { extname } from 'path';
|
||||
|
||||
export const multerConfig = {
|
||||
storage: diskStorage({
|
||||
destination: './server/uploads',
|
||||
filename: (req, file, cb) => {
|
||||
const uniqueName =
|
||||
Date.now() + '-' + Math.round(Math.random() * 1e9);
|
||||
cb(null, uniqueName + extname(file.originalname));
|
||||
},
|
||||
}),
|
||||
};
|
||||
@@ -25,6 +25,7 @@ import { Response } from 'express';
|
||||
import { ServiciosAdminDto } from './dto/servicios-admin.dto';
|
||||
import { ServiciosResponsableDto } from './dto/servicios-responsable.dto';
|
||||
import { RegistroValidadoDto } from './dto/registro-validado.dto';
|
||||
import { multerConfig } from './multer';
|
||||
|
||||
@Controller('servicio')
|
||||
export class ServicioController {
|
||||
@@ -147,7 +148,7 @@ export class ServicioController {
|
||||
@Body('data') dataJson: string,
|
||||
) {
|
||||
const body = JSON.parse(dataJson);
|
||||
console.log("file", file);
|
||||
console.log("file", file);
|
||||
return this.servicioService.subirCartaTermino(body.idServicio, file);
|
||||
}
|
||||
|
||||
@@ -192,20 +193,22 @@ export class ServicioController {
|
||||
}
|
||||
|
||||
@Put('update')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
//@UseGuards(AuthGuard('jwt'))
|
||||
@UseInterceptors(
|
||||
FileFieldsInterceptor([
|
||||
{ name: 'cartaAceptacion', maxCount: 1 },
|
||||
{ name: 'cartaTermino', maxCount: 1 },
|
||||
{ name: 'informeGlobal', maxCount: 1 },
|
||||
]),
|
||||
], multerConfig,),
|
||||
|
||||
)
|
||||
async actualizarServicio(
|
||||
@UploadedFiles() files: Record<string, Express.Multer.File[]>,
|
||||
@Body('data') dataJson: string,
|
||||
) {
|
||||
const data = JSON.parse(dataJson);
|
||||
console.log('Archivos recibidos:', files);
|
||||
|
||||
return this.servicioService.update(data, files);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user