catalogue
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { BusinessService } from './business.service';
|
import { BusinessService } from './business.service';
|
||||||
import { BusinessController } from './business.controller';
|
import { BusinessController } from './business.controller';
|
||||||
|
import { MikroOrmModule } from '@mikro-orm/nestjs';
|
||||||
|
import { Business } from './entities/business.entity';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
|
imports:[MikroOrmModule.forFeature([Business])],
|
||||||
controllers: [BusinessController],
|
controllers: [BusinessController],
|
||||||
providers: [BusinessService],
|
providers: [BusinessService],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Type } from 'class-transformer';
|
|||||||
|
|
||||||
export class CreateBusinessDto {
|
export class CreateBusinessDto {
|
||||||
@IsString()
|
@IsString()
|
||||||
@ApiProperty({ example: 'ایرانی' })
|
@ApiProperty({ example: '01619684-aebc-47d4-acc4-2e912a3d9dce' })
|
||||||
danakSubscriptionId: string;
|
danakSubscriptionId: string;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { CatalogueService } from './catalogue.service';
|
import { CatalogueService } from './catalogue.service';
|
||||||
import { CatalogueController } from './catalogue.controller';
|
import { CatalogueController } from './catalogue.controller';
|
||||||
|
import { MikroOrmModule } from '@mikro-orm/nestjs';
|
||||||
|
import { Catalogue } from './entities/catalogue.entity';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
|
imports: [MikroOrmModule.forFeature([Catalogue])],
|
||||||
controllers: [CatalogueController],
|
controllers: [CatalogueController],
|
||||||
providers: [CatalogueService],
|
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 { EntityManager } from '@mikro-orm/postgresql';
|
||||||
import { Catalogue } from './entities/catalogue.entity';
|
import { Catalogue } from './entities/catalogue.entity';
|
||||||
import { Business } from '../business/entities/business.entity';
|
import { Business } from '../business/entities/business.entity';
|
||||||
|
import { CatalogueStatus } from './enums/company-status.enum';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CatalogueService {
|
export class CatalogueService {
|
||||||
@@ -16,7 +17,8 @@ export class CatalogueService {
|
|||||||
if (!business) {
|
if (!business) {
|
||||||
throw new BadRequestException()
|
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)
|
return this.em.persistAndFlush(catalogue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,13 +15,8 @@ export class CreateCatalogueDto {
|
|||||||
content: string;
|
content: string;
|
||||||
|
|
||||||
|
|
||||||
@IsEnum(() => CatalogueStatus)
|
@IsEnum(CatalogueSize)
|
||||||
@ApiProperty()
|
@ApiProperty({ enum: CatalogueSize, example: CatalogueSize.A4 })
|
||||||
status: CatalogueStatus;
|
size: CatalogueSize
|
||||||
|
|
||||||
|
|
||||||
@IsEnum(() => CatalogueSize)
|
|
||||||
@ApiProperty()
|
|
||||||
size: CatalogueSize;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user