43 lines
1001 B
TypeScript
43 lines
1001 B
TypeScript
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,
|
|
})
|
|
})
|
|
}
|
|
}
|