init record notion
This commit is contained in:
22
src/modules/record/models/task-record.ts
Normal file
22
src/modules/record/models/task-record.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import type { Recordable } from '../interfaces/recordable'
|
||||
|
||||
export class TaskRecord implements Recordable {
|
||||
public start: Date = new Date()
|
||||
public end: Date | undefined = undefined
|
||||
public stepRecords: Record<string, { minutes: number }> = {}
|
||||
|
||||
public constructor(
|
||||
public readonly id: string,
|
||||
public readonly taskId: string
|
||||
) {}
|
||||
|
||||
public get duration(): number | null {
|
||||
if (!this.end) {
|
||||
return null
|
||||
}
|
||||
|
||||
const durationMilliseconds = this.end.getTime() - this.start.getTime()
|
||||
|
||||
return Math.round(durationMilliseconds / (1000 * 60))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user