catalogue
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { CatalogueService } from './catalogue.service';
|
||||
import { CatalogueController } from './catalogue.controller';
|
||||
import { MikroOrmModule } from '@mikro-orm/nestjs';
|
||||
import { Catalogue } from './entities/catalogue.entity';
|
||||
|
||||
@Module({
|
||||
imports: [MikroOrmModule.forFeature([Catalogue])],
|
||||
controllers: [CatalogueController],
|
||||
providers: [CatalogueService],
|
||||
})
|
||||
export class CatalogueModule {}
|
||||
export class CatalogueModule { }
|
||||
|
||||
@@ -4,6 +4,7 @@ import { UpdateCatalogueDto } from './dto/update-catalogue.dto';
|
||||
import { EntityManager } from '@mikro-orm/postgresql';
|
||||
import { Catalogue } from './entities/catalogue.entity';
|
||||
import { Business } from '../business/entities/business.entity';
|
||||
import { CatalogueStatus } from './enums/company-status.enum';
|
||||
|
||||
@Injectable()
|
||||
export class CatalogueService {
|
||||
@@ -16,7 +17,8 @@ export class CatalogueService {
|
||||
if (!business) {
|
||||
throw new BadRequestException()
|
||||
}
|
||||
const catalogue = this.em.create(Catalogue, { ...dto, business })
|
||||
const catalogue = this.em.create(Catalogue,
|
||||
{ ...dto, business, status: CatalogueStatus.PENDING })
|
||||
return this.em.persistAndFlush(catalogue)
|
||||
}
|
||||
|
||||
|
||||
@@ -15,13 +15,8 @@ export class CreateCatalogueDto {
|
||||
content: string;
|
||||
|
||||
|
||||
@IsEnum(() => CatalogueStatus)
|
||||
@ApiProperty()
|
||||
status: CatalogueStatus;
|
||||
|
||||
|
||||
@IsEnum(() => CatalogueSize)
|
||||
@ApiProperty()
|
||||
size: CatalogueSize;
|
||||
@IsEnum(CatalogueSize)
|
||||
@ApiProperty({ enum: CatalogueSize, example: CatalogueSize.A4 })
|
||||
size: CatalogueSize
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user