catalogue
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { BusinessService } from './business.service';
|
||||
import { BusinessController } from './business.controller';
|
||||
import { MikroOrmModule } from '@mikro-orm/nestjs';
|
||||
import { Business } from './entities/business.entity';
|
||||
|
||||
@Module({
|
||||
imports:[MikroOrmModule.forFeature([Business])],
|
||||
controllers: [BusinessController],
|
||||
providers: [BusinessService],
|
||||
})
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Type } from 'class-transformer';
|
||||
|
||||
export class CreateBusinessDto {
|
||||
@IsString()
|
||||
@ApiProperty({ example: 'ایرانی' })
|
||||
@ApiProperty({ example: '01619684-aebc-47d4-acc4-2e912a3d9dce' })
|
||||
danakSubscriptionId: string;
|
||||
|
||||
|
||||
|
||||
@@ -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