Bin
2025-12-17 21f0498f62ada55651f4d232327e15fc47f498b1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { types } from "mobx-state-tree";
import { guidGenerator } from "../../utils/unique";
import { Annotation } from "./Annotation";
 
// const HistoryActionTypes = types.enumeration([
//   'prediction',
//   'imported',
//   'submitted',
//   'updated',
//   'skipped',
//   'accepted',
//   'rejected',
//   'fixed_and_accepted',
//   'deleted_review',
//   'propagated_annotation',
// ])
 
export const HistoryItem = types
  .compose(
    "HistoryItem",
    Annotation,
    types.model({
      /**
       * Optional comment
       */
      comment: types.optional(types.maybeNull(types.string), null),
 
      /**
       * Action associated with the history item
       */
      actionType: types.optional(types.maybeNull(types.string), null),
    }),
  )
  .preProcessSnapshot((snapshot) => {
    return {
      ...snapshot,
      pk: guidGenerator(),
      user: snapshot.created_by,
      createdDate: snapshot.created_at,
      actionType: snapshot.action ?? snapshot.action_type ?? snapshot.actionType,
      readonly: true,
      editable: false,
    };
  });