types.ts 794 B

1234567891011121314151617181920212223
  1. import type { ObjectId } from 'mongodb'
  2. /** Task data. */
  3. export interface Task<T extends ObjectId | string = ObjectId> {
  4. /** Herd ID. */
  5. _herd: T
  6. /** Account ID reflecting the task assignee. */
  7. _account: T
  8. /** Description. */
  9. description: string
  10. /** Position in herd. */
  11. position: number
  12. /** Flag signifying whether the task is done. */
  13. done: boolean
  14. }
  15. /** Subset of task data when creating a new task. */
  16. export type TaskCreate<T extends ObjectId | string = ObjectId> =
  17. Pick<Task<T>, '_herd' | '_account' | 'description'> &
  18. Partial<Pick<Task<T>, 'position' | 'done'>>
  19. /** Subset of task data when updating a task. */
  20. export type TaskUpdate<T extends ObjectId | string = ObjectId> = Partial<Pick<Task<T>, '_herd' | '_account' | 'description' | 'position' | 'done'>>