in src/models/subscription.ts [23:47]
constructor(contract?: SubscriptionContract) {
if (!contract) {
return;
}
this.id = contract.id;
this.name = contract.name || "Unnamed";
this.createdDate = new Date(contract.createdDate);
this.endDate = (contract.endDate && new Date(contract.endDate)) || undefined;
this.expirationDate = (contract.expirationDate && new Date(contract.expirationDate)) || undefined;
this.notificationDate = (contract.notificationDate && new Date(contract.notificationDate)) || undefined;
this.primaryKey = contract.primaryKey;
this.scope = contract.scope;
this.secondaryKey = contract.secondaryKey;
this.startDate = (contract.startDate && contract.startDate.split("T")[0]) || undefined;
this.stateComment = contract.stateComment;
this.userId = contract.ownerId;
this.state = SubscriptionState[contract.state];
this.isExpired = this.state === SubscriptionState.expired;
this.isAwaitingApproval = this.state === SubscriptionState.submitted;
this.isActive = this.state === SubscriptionState.active;
}