@bitblit/ratchet-misc
Version:
Ratchet miscellaneous tooling that requires smallish dependant libraries
108 lines • 5.57 kB
JavaScript
import { exists } from '../runtime.js';
import { GoalOwnersInnerFromJSON, GoalOwnersInnerToJSON } from './GoalOwnersInner.js';
import { GoalParentGoalFromJSON, GoalParentGoalToJSON } from './GoalParentGoal.js';
export var GoalTypeEnum;
(function (GoalTypeEnum) {
GoalTypeEnum["goal"] = "goal";
})(GoalTypeEnum || (GoalTypeEnum = {}));
export var GoalGoalTypeEnum;
(function (GoalGoalTypeEnum) {
GoalGoalTypeEnum["target"] = "target";
GoalGoalTypeEnum["binary"] = "binary";
GoalGoalTypeEnum["gauge"] = "gauge";
GoalGoalTypeEnum["calculated"] = "calculated";
})(GoalGoalTypeEnum || (GoalGoalTypeEnum = {}));
export var GoalStatusEnum;
(function (GoalStatusEnum) {
GoalStatusEnum["draft"] = "draft";
GoalStatusEnum["active"] = "active";
GoalStatusEnum["done"] = "done";
GoalStatusEnum["archived"] = "archived";
})(GoalStatusEnum || (GoalStatusEnum = {}));
export function instanceOfGoal(value) {
let isInstance = true;
isInstance = isInstance && '_id' in value;
isInstance = isInstance && '_rootId' in value;
isInstance = isInstance && '_createdBy' in value;
isInstance = isInstance && 'name' in value;
return isInstance;
}
export function GoalFromJSON(json) {
return GoalFromJSONTyped(json, false);
}
export function GoalFromJSONTyped(json, ignoreDiscriminator) {
if (json === undefined || json === null) {
return json;
}
return {
_id: json['_id'],
_type: !exists(json, '_type') ? undefined : json['_type'],
_rootId: json['_rootId'],
_createdOn: !exists(json, '_createdOn') ? undefined : new Date(json['_createdOn']),
_createdBy: json['_createdBy'],
_updatedOn: !exists(json, '_updatedOn') ? undefined : new Date(json['_updatedOn']),
_updatedBy: !exists(json, '_updatedBy') ? undefined : json['_updatedBy'],
_archivedOn: !exists(json, '_archivedOn') ? undefined : new Date(json['_archivedOn']),
_archivedBy: !exists(json, '_archivedBy') ? undefined : json['_archivedBy'],
_deletedOn: !exists(json, '_deletedOn') ? undefined : new Date(json['_deletedOn']),
_deletedBy: !exists(json, '_deletedBy') ? undefined : json['_deletedBy'],
_operationId: !exists(json, '_operationId') ? undefined : json['_operationId'],
_isPublic: !exists(json, '_isPublic') ? undefined : json['_isPublic'],
name: json['name'],
description: !exists(json, 'description') ? undefined : json['description'],
startValue: !exists(json, 'startValue') ? undefined : json['startValue'],
targetValue: !exists(json, 'targetValue') ? undefined : json['targetValue'],
valueType: !exists(json, 'valueType') ? undefined : json['valueType'],
currentValue: !exists(json, 'currentValue') ? undefined : json['currentValue'],
currentValueChangedOn: !exists(json, 'currentValueChangedOn') ? undefined : new Date(json['currentValueChangedOn']),
startDate: !exists(json, 'startDate') ? undefined : new Date(json['startDate']),
endDate: !exists(json, 'endDate') ? undefined : new Date(json['endDate']),
_completionDate: !exists(json, '_completionDate') ? undefined : new Date(json['_completionDate']),
goalType: !exists(json, 'goalType') ? undefined : json['goalType'],
templateId: !exists(json, 'templateId') ? undefined : json['templateId'],
status: !exists(json, 'status') ? undefined : json['status'],
order: !exists(json, 'order') ? undefined : json['order'],
owners: !exists(json, 'owners') ? undefined : json['owners'].map(GoalOwnersInnerFromJSON),
parentGoal: !exists(json, 'parentGoal') ? undefined : GoalParentGoalFromJSON(json['parentGoal']),
};
}
export function GoalToJSON(value) {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
_id: value._id,
_type: value._type,
_rootId: value._rootId,
_createdOn: value._createdOn === undefined ? undefined : value._createdOn.toISOString(),
_createdBy: value._createdBy,
_updatedOn: value._updatedOn === undefined ? undefined : value._updatedOn.toISOString(),
_updatedBy: value._updatedBy,
_archivedOn: value._archivedOn === undefined ? undefined : value._archivedOn.toISOString(),
_archivedBy: value._archivedBy,
_deletedOn: value._deletedOn === undefined ? undefined : value._deletedOn.toISOString(),
_deletedBy: value._deletedBy,
_operationId: value._operationId,
_isPublic: value._isPublic,
name: value.name,
description: value.description,
startValue: value.startValue,
targetValue: value.targetValue,
valueType: value.valueType,
currentValue: value.currentValue,
currentValueChangedOn: value.currentValueChangedOn === undefined ? undefined : value.currentValueChangedOn.toISOString(),
startDate: value.startDate === undefined ? undefined : value.startDate.toISOString(),
endDate: value.endDate === undefined ? undefined : value.endDate.toISOString(),
_completionDate: value._completionDate === undefined ? undefined : value._completionDate.toISOString(),
goalType: value.goalType,
templateId: value.templateId,
status: value.status,
order: value.order,
owners: value.owners === undefined ? undefined : value.owners.map(GoalOwnersInnerToJSON),
parentGoal: GoalParentGoalToJSON(value.parentGoal),
};
}
//# sourceMappingURL=Goal.js.map