REFACTOR: rename props

This commit is contained in:
marcos-silva-rodrigues
2025-01-26 16:44:31 -03:00
parent cf99acc682
commit b896b1a9b8
6 changed files with 25 additions and 25 deletions
+2 -2
View File
@@ -27,9 +27,9 @@ export class CustomerTheme implements Theme {
@ApiProperty()
textColor: string;
@ApiProperty()
logoWhite: string;
logo: string;
@ApiProperty()
logoBlack: string;
logoLogin: string;
}
export class CustomerThemeResponse {
+8 -8
View File
@@ -59,19 +59,19 @@ export class ThemeController {
id,
}));
const logoWhite = files.find(file => file.fieldname === 'logoWhite');
const logoBlack = files.find(file => file.fieldname === 'logoBlack');
const logo = files.find(file => file.fieldname === 'logo');
const logoLogin = files.find(file => file.fieldname === 'logoLogin');
this.validFileSize(logoWhite);
this.validFileSize(logoBlack);
this.validMimeType(logoWhite);
this.validMimeType(logoBlack);
this.validFileSize(logo);
this.validFileSize(logoLogin);
this.validMimeType(logo);
this.validMimeType(logoLogin);
try {
const theme = await this.themeService.createThemeByCustomer(id, {
...data,
logoWhite,
logoBlack
logo,
logoLogin
});
this.logger.info('saveCustomertheme' + JSON.stringify(theme));
return theme;
+6 -6
View File
@@ -21,8 +21,8 @@ import { resolve } from 'path';
import { Readable } from 'stream';
type Files = {
logoWhite: Express.Multer.File,
logoBlack: Express.Multer.File,
logo: Express.Multer.File,
logoLogin: Express.Multer.File,
}
@Injectable()
@@ -62,12 +62,12 @@ export class ThemeService implements OnModuleInit {
chunk: Buffer.alloc(0)
})
if(theme.logoBlack) {
await this.sendFile(theme.logoBlack, customerThemeRequest$);
if(theme.logo) {
await this.sendFile(theme.logo, customerThemeRequest$);
}
if(theme.logoWhite) {
await this.sendFile(theme.logoWhite, customerThemeRequest$);
if(theme.logoLogin) {
await this.sendFile(theme.logoLogin, customerThemeRequest$);
}
customerThemeRequest$.complete();