init project portal web
This commit is contained in:
42
lib/price-plan/model/menu-model.ts
Normal file
42
lib/price-plan/model/menu-model.ts
Normal file
@ -0,0 +1,42 @@
|
||||
interface Props {
|
||||
parentName: string;
|
||||
pricePlanTypeDto: Array<PricePlanMenuItem>;
|
||||
}
|
||||
|
||||
export interface PricePlanMenuItem {
|
||||
id: string;
|
||||
pricePlanTypeName: string;
|
||||
}
|
||||
|
||||
export class PricePlanMenuModel {
|
||||
private parentName: string
|
||||
private pricePlanTypeDto: Array<PricePlanMenuItem>
|
||||
|
||||
constructor({
|
||||
parentName,
|
||||
pricePlanTypeDto,
|
||||
}: Props) {
|
||||
this.parentName = parentName
|
||||
this.pricePlanTypeDto = pricePlanTypeDto
|
||||
}
|
||||
|
||||
getParentName(): string {
|
||||
return this.parentName
|
||||
}
|
||||
|
||||
getPricePlanTypeDto(): Array<PricePlanMenuItem> {
|
||||
return this.pricePlanTypeDto
|
||||
}
|
||||
|
||||
static fromJSON = (data: any) => {
|
||||
return data.data.map((item: {
|
||||
parentName: string,
|
||||
pricePlanTypeDto: Array<PricePlanMenuItem>,
|
||||
}) => {
|
||||
return new PricePlanMenuModel({
|
||||
parentName: item.parentName,
|
||||
pricePlanTypeDto: item.pricePlanTypeDto,
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user