♻️ (record) time range instead of step recordable
This commit is contained in:
@@ -1,14 +1,10 @@
|
||||
import type { ISODate } from '@/shared/types/date'
|
||||
import type { StepRecordable } from './step-recordable'
|
||||
import type { TimeRange } from './time-range'
|
||||
|
||||
export interface Recordable {
|
||||
taskId: string
|
||||
/**
|
||||
* @deprecated
|
||||
* TODO: Compute this data from step records
|
||||
*/
|
||||
start: ISODate
|
||||
end?: ISODate
|
||||
stepRecords: Record<string, StepRecordable>
|
||||
stepRecords: Record<string, TimeRange>
|
||||
notes: string
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ISODate } from '@/shared/types/date'
|
||||
|
||||
export interface StepRecordable {
|
||||
export interface TimeRange {
|
||||
start: ISODate
|
||||
end?: ISODate
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
import { toISODate, type ISODate } from '@/shared/types/date'
|
||||
import type { Recordable } from '../interfaces/recordable'
|
||||
import type { StepRecordable } from '../interfaces/step-recordable'
|
||||
import type { TimeRange } from '../interfaces/time-range'
|
||||
|
||||
export class TaskRecord implements Recordable {
|
||||
public start: ISODate = toISODate(new Date())
|
||||
public end: ISODate | undefined = undefined
|
||||
public stepRecords: Record<string, StepRecordable> = {}
|
||||
public stepRecords: Record<string, TimeRange> = {}
|
||||
public notes = ''
|
||||
|
||||
public constructor(public readonly taskId: string) {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { toISODate, type ISODate } from '@/shared/types/date'
|
||||
import { defineStore } from 'pinia'
|
||||
import type { Recordable } from '../interfaces/recordable'
|
||||
import type { StepRecordable } from '../interfaces/step-recordable'
|
||||
import type { TimeRange } from '../interfaces/time-range'
|
||||
import { TaskRecord } from '../models/task-record'
|
||||
|
||||
export interface TaskRecordStoreState {
|
||||
@@ -133,7 +133,7 @@ export const useTaskRecordStore = defineStore('task-record-store', {
|
||||
return (taskId: string): Recordable | null => this.records[taskId] ?? null
|
||||
},
|
||||
getStepRecord() {
|
||||
return (taskId: string, stepId: string): StepRecordable | null =>
|
||||
return (taskId: string, stepId: string): TimeRange | null =>
|
||||
this.records[taskId]?.stepRecords[stepId] ?? null
|
||||
},
|
||||
getRecordNotes() {
|
||||
|
||||
Reference in New Issue
Block a user