aboutsummaryrefslogtreecommitdiff
path: root/src/content/repositories/MarkRepository.ts
blob: 678abc42a742851bda03f22b0e9a7a59faab357b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import Mark from '../domains/Mark';

export default interface MarkRepository {
  set(key: string, mark: Mark): void;

  get(key: string): Mark | null;
}

const saved: {[key: string]: Mark} = {};

export class MarkRepositoryImpl implements MarkRepository {
  set(key: string, mark: Mark): void {
    saved[key] = mark;
  }

  get(key: string): Mark | null {
    let v = saved[key];
    if (!v) {
      return null;
    }
    return { ...v };
  }
}