46 lines
983 B
TypeScript
46 lines
983 B
TypeScript
import { uuidV4, base58UUID } from "../util/uuid"
|
|
import { defaults } from "./params";
|
|
|
|
export type TaskID = string
|
|
|
|
export enum EstimationConfidence {
|
|
Optimistic = "optimistic",
|
|
Likely = "likely",
|
|
Pessimistic = "pessimistic"
|
|
}
|
|
|
|
export interface Task {
|
|
id: TaskID
|
|
label: string
|
|
category: TaskCategoryID
|
|
estimations: { [confidence in EstimationConfidence]: number }
|
|
}
|
|
|
|
export type TaskCategoryID = string
|
|
|
|
export interface TaskCategory {
|
|
id: TaskCategoryID
|
|
label: string
|
|
costPerTimeUnit: number
|
|
}
|
|
|
|
export function newTask(label: string, category: TaskCategoryID): Task {
|
|
return {
|
|
id: base58UUID(),
|
|
label,
|
|
category,
|
|
estimations: {
|
|
[EstimationConfidence.Optimistic]: 0,
|
|
[EstimationConfidence.Likely]: 0,
|
|
[EstimationConfidence.Pessimistic]: 0,
|
|
}
|
|
};
|
|
}
|
|
|
|
export function createTaskCategory(): TaskCategory {
|
|
return {
|
|
id: base58UUID(),
|
|
costPerTimeUnit: defaults.costPerTimeUnit,
|
|
label: ""
|
|
};
|
|
} |