Skip to content

Commit

Permalink
add description field
Browse files Browse the repository at this point in the history
  • Loading branch information
bahram1249 committed Jun 18, 2024
1 parent 73bdc6d commit 4d496ab
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ApiProperty } from '@nestjs/swagger';
import { AutoMap } from 'automapper-classes';
import { Type } from 'class-transformer';
import { IsInt, IsNumber } from 'class-validator';
import { IsInt, IsNumber, IsOptional, IsString } from 'class-validator';

export class EntityTypeDto {
@IsInt()
Expand All @@ -12,4 +13,14 @@ export class EntityTypeDto {
description: 'entityTypeId',
})
entityTypeId: number;

@AutoMap()
@IsOptional()
@IsString()
@ApiProperty({
required: true,
type: String,
description: 'description',
})
public description?: string;
}
5 changes: 5 additions & 0 deletions apps/e-commerce/src/brand/brand.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export class BrandService {
'metaTitle',
'metaKeywords',
'metaDescription',
'description',
'createdAt',
'updatedAt',
])
Expand Down Expand Up @@ -160,6 +161,7 @@ export class BrandService {
'metaTitle',
'metaKeywords',
'metaDescription',
'description',
'createdAt',
'updatedAt',
]),
Expand Down Expand Up @@ -224,6 +226,7 @@ export class BrandService {
'metaTitle',
'metaKeywords',
'metaDescription',
'description',
'createdAt',
'updatedAt',
]),
Expand Down Expand Up @@ -257,6 +260,7 @@ export class BrandService {
'metaTitle',
'metaKeywords',
'metaDescription',
'description',
'createdAt',
'updatedAt',
]),
Expand All @@ -273,6 +277,7 @@ export class BrandService {
'metaTitle',
'metaKeywords',
'metaDescription',
'description',
'createdAt',
'updatedAt',
])
Expand Down
10 changes: 10 additions & 0 deletions apps/e-commerce/src/brand/dto/brand.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,14 @@ export class BrandDto {
description: 'metaDescription',
})
public metaDescription?: string;

@AutoMap()
@IsOptional()
@IsString()
@ApiProperty({
required: true,
type: String,
description: 'description',
})
public description?: string;
}
7 changes: 4 additions & 3 deletions apps/eav/src/admin/entity-type/entity-type.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ export class EntityTypeService {
'slug',
'parentEntityTypeId',
'entityModelId',
'metaTitle',
'metaKeywords',
'metaDescription',
'createdAt',
'updatedAt',
])
Expand All @@ -158,6 +155,7 @@ export class EntityTypeService {
'metaTitle',
'metaKeywords',
'metaDescription',
'description',
'createdAt',
'updatedAt',
])
Expand Down Expand Up @@ -214,6 +212,7 @@ export class EntityTypeService {
'metaTitle',
'metaKeywords',
'metaDescription',
'description',
'createdAt',
'updatedAt',
])
Expand Down Expand Up @@ -263,6 +262,7 @@ export class EntityTypeService {
'metaTitle',
'metaKeywords',
'metaDescription',
'description',
'createdAt',
'updatedAt',
])
Expand Down Expand Up @@ -369,6 +369,7 @@ export class EntityTypeService {
'metaTitle',
'metaKeywords',
'metaDescription',
'description',
'createdAt',
'updatedAt',
])
Expand Down
38 changes: 37 additions & 1 deletion apps/main/src/sql/core-v1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,23 @@ END

GO

IF NOT EXISTS (SELECT 1 FROM Migrations WHERE version = 'eav-entitytype-v4'
)
AND EXISTS (
SELECT 1 FROM Settings
WHERE ([key] = 'SITE_NAME' AND [value] IN ('ecommerce'))
)
BEGIN

ALTER TABLE EAVEntityTypes
ADD [description] nvarchar(max) NULL

INSERT INTO Migrations(version, createdAt, updatedAt)
SELECT 'eav-entitytype-v4', GETDATE(), GETDATE()
END

GO


IF NOT EXISTS (SELECT 1 FROM Migrations WHERE version = 'eav-attributetype-v1'
)
Expand Down Expand Up @@ -1646,6 +1663,25 @@ END
GO


IF NOT EXISTS (SELECT 1 FROM Migrations WHERE version = 'ecommerce-brands-v4'
)
AND EXISTS (
SELECT 1 FROM Settings
WHERE ([key] = 'SITE_NAME' AND [value] IN ('ecommerce'))
)
BEGIN

ALTER TABLE ECBrands
ADD [description] nvarchar(max) NULL


INSERT INTO Migrations(version, createdAt, updatedAt)
SELECT 'ecommerce-brands-v4', GETDATE(), GETDATE()
END

GO


IF NOT EXISTS (SELECT 1 FROM Migrations WHERE version = 'ecommerce-guarantees-v1'
)
AND EXISTS (
Expand Down Expand Up @@ -2125,7 +2161,7 @@ BEGIN
CONSTRAINT FK_ECProducts_BrandId
FOREIGN KEY REFERENCES ECBrands(id),
colorBased bit NULL,
description ntext NULL,
description nvarchar(max) NULL,
viewCount bigint NULL,
userId bigint NULL
CONSTRAINT FK_ECProducts_UserId
Expand Down
12 changes: 12 additions & 0 deletions libs/database/src/models/eav/eav-entity-type.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
import { EAVEntityModel } from './eav-entity-model.entity';
import { AutoMap } from 'automapper-classes';
import { Attachment } from '../core/attachment.entity';
import { IsOptional, IsString } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

@Table({ tableName: 'EAVEntityTypes' })
export class EAVEntityType extends Model {
Expand Down Expand Up @@ -98,4 +100,14 @@ export class EAVEntityType extends Model {
})
@AutoMap()
metaDescription?: string;

@AutoMap()
@IsOptional()
@IsString()
@ApiProperty({
required: true,
type: String,
description: 'description',
})
public description?: string;
}
7 changes: 7 additions & 0 deletions libs/database/src/models/ecommerce-eav/ec-brand.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,11 @@ export class ECBrand extends Model {
})
@AutoMap()
metaDescription?: string;

@AutoMap()
@Column({
type: DataType.STRING,
allowNull: true,
})
description?: string;
}

0 comments on commit 4d496ab

Please sign in to comment.