-
Notifications
You must be signed in to change notification settings - Fork 0
CMS Service
Baran Baygan edited this page Jan 21, 2021
·
3 revisions
LIST_CONTENTS = 'rbs.cms.request.LIST_CONTENTS',
UPSERT_CONTENT = 'rbs.cms.request.UPSERT_CONTENT',
GET_CONTENT = 'rbs.cms.request.GET_CONTENT',
DELETE_CONTENT = 'rbs.cms.request.DELETE_CONTENT',
LIST_TEMPLATES = 'rbs.cms.request.LIST_TEMPLATES',
UPSERT_TEMPLATE = 'rbs.cms.request.UPSERT_TEMPLATE',
GET_TEMPLATE = 'rbs.cms.request.GET_TEMPLATE',
DELETE_TEMPLATE = 'rbs.cms.request.DELETE_TEMPLATE',
SET_CONFIG = 'rbs.cms.request.SET_CONFIG',
GET_CONFIG = 'rbs.cms.request.GET_CONFIG',
export class Template {
@IsDefined()
@IsUUID()
id: string
@IsDefined()
@IsString()
name: string
@IsDefined()
@ValidateNested()
// @Type(() => ContentItem)
templateItem: ContentItem
@IsArray()
parentTemplates: Array<string>
}
export class RelatedItem {
@IsDefined()
@IsString()
modelName: string
@IsDefined()
@IsString()
id: string
}
export class ContentItem {
@IsDefined()
@IsUUID()
id: string
@IsDefined()
@IsString()
@MinLength(2)
@MaxLength(50)
name: string
@IsDefined()
@IsString()
itemType: string
@IsDefined()
@IsArray()
@ValidateNested({ each: true })
@Type(() => ContentItemAttribute)
attributes: Array<ContentItemAttribute>
@IsDefined()
@IsArray()
@ValidateNested({ each: true })
@Type(() => ContentItem)
children: Array<ContentItem>
@IsOptional()
@IsString()
@IsUUID()
parentId?: string
@IsDefined()
@IsArray()
@ValidateNested({ each: true })
@Type(() => RelatedItem)
relatedItems: Array<RelatedItem>
}
export class ContentItemAttribute {
@IsDefined()
@IsString()
@MinLength(2)
groupId: string // style
@IsDefined()
@IsString()
@MinLength(2)
type: string // alignment
@IsDefined()
@IsArray()
@ValidateNested({ each: true })
@Type(() => LocalizedValue)
value: Array<LocalizedValue> // left
}
export class LocalizedValue {
@IsDefined()
@IsString()
@IsLocale()
locale: string // tr_TR
@IsOptional()
@IsString()
value: string // left
@IsOptional()
@ValidateNested()
@Type(() => Image)
image: Image
}
export class Image {
@IsDefined()
@IsString()
contentType: string
@IsDefined()
@IsString()
contentEncoding: string
@IsDefined()
@IsString()
alias: string
@IsDefined()
@IsArray()
@ValidateNested({ each: true })
@Type(() => ResizeConfig)
@ArrayNotEmpty()
resizeConfigs: ResizeConfig[]
}
export class ResizeConfig {
url?: string
@IsDefined()
@IsString()
guid: string
@IsDefined()
@IsNumber()
width: number
@IsDefined()
@IsNumber()
height: number
@IsDefined()
@IsNumber({maxDecimalPlaces: 0})
@Min(0)
@Max(100)
quality: number
}
export class CMSConfigAttributeType {
@IsDefined()
name: string
@IsDefined()
@IsArray()
possibleValues: Array<string>
}
export class CMSConfig {
@IsDefined()
@IsArray()
@ValidateNested({ each: true })
@Type(() => CMSConfigAttributeType)
@ArrayNotEmpty()
attributeTypes: Array<CMSConfigAttributeType>
}