Skip to content

Commit 2b3e85d

Browse files
author
DylanBulmer
committed
fix build and typing errors
1 parent ba4efbb commit 2b3e85d

14 files changed

Lines changed: 27 additions & 26 deletions

File tree

src/__tests__/Config.Project.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Types } from "mongoose";
12
import { Config } from "..";
23
import options from "../constants/project.json";
34
import { DisplayConfig } from "../entities/Config/Project/types/Display";
@@ -8,6 +9,7 @@ describe("Project Configuration", () => {
89
display: <DisplayConfig>options.display,
910
sample: options.sample,
1011
verison: "v2",
12+
createdBy: new Types.ObjectId(0),
1113
});
1214

1315
expect(config.display.inputs[1]).toEqual({

src/entities/Annotation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Types } from "mongoose";
2-
import { Base, IBase } from "./Base";
2+
import { Base, IBaseMinimal } from "./Base";
33

4-
export interface IAnnotation extends IBase {
4+
export interface IAnnotation extends IBaseMinimal {
55
projectId: Types.ObjectId;
66
datasetId: Types.ObjectId;
77
sampleId: Types.ObjectId;

src/entities/Audit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { Types } from "mongoose";
2-
import type { IBase } from "./Base";
2+
import type { IBaseMinimal } from "./Base";
33
import type { ActionType, EntityType } from "../types";
44

5-
export interface IAudit extends Omit<IBase, "createdBy" | "updatedBy"> {
5+
export interface IAudit extends Omit<IBaseMinimal, "createdBy"> {
66
entityType: EntityType; // (where) what entity got modified
77
action: ActionType; // action taken
88
userId: Types.ObjectId; // who

src/entities/Base.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Types } from "mongoose";
2+
import { AtLeast } from "../types";
23

34
export interface IBase {
45
__v?: number;
@@ -9,6 +10,8 @@ export interface IBase {
910
updatedBy: Types.ObjectId;
1011
}
1112

13+
export type IBaseMinimal = AtLeast<IBase, 'createdBy'>
14+
1215
export class Base {
1316
readonly __v: IBase["__v"];
1417
readonly _id: IBase["_id"];

src/entities/Config/BaseConfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Base, IBase } from "../Base";
1+
import { Base, IBaseMinimal } from "../Base";
22

3-
export interface IBaseConfig extends IBase {
3+
export interface IBaseConfig extends IBaseMinimal {
44
verison?: string;
55
flags?: { isDeleted: boolean };
66
}

src/entities/Group.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { Types } from "mongoose";
2-
import { Base, IBase } from "./Base";
2+
import { Base, IBaseMinimal } from "./Base";
33
import { Flags } from "../types/Flags";
44

5-
export interface IGroup<F = object> extends IBase {
5+
export interface IGroup<F = object> extends IBaseMinimal {
66
createdBy: Types.ObjectId;
77
members: Types.ObjectId[];
88
name: string;
@@ -11,7 +11,6 @@ export interface IGroup<F = object> extends IBase {
1111
}
1212

1313
export class Group extends Base {
14-
createdBy: Types.ObjectId;
1514
members: Types.ObjectId[];
1615
name: string;
1716
teams: Types.ObjectId[];

src/entities/Message.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import type { Types } from "mongoose";
22
import type { MessageType } from "../types";
3-
import { Base, IBase } from "./Base";
3+
import { Base, IBaseMinimal } from "./Base";
44

5-
export interface IMessage extends IBase {
6-
createdBy: Types.ObjectId;
5+
export interface IMessage extends IBaseMinimal {
76
type: MessageType;
87
subject: string;
98
body: string;
109
to: Types.ObjectId[];
1110
}
1211

1312
export class Message extends Base {
14-
createdBy: Types.ObjectId;
1513
type: MessageType;
1614
subject: string;
1715
body: string;

src/entities/Profile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Types } from "mongoose";
2-
import { Base, IBase } from "./Base";
2+
import { Base, IBaseMinimal } from "./Base";
33

4-
export interface IProfile extends IBase {
4+
export interface IProfile extends IBaseMinimal {
55
name: {
66
first: string;
77
last: string;

src/entities/Project.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { Types } from "mongoose";
22
import { Flags, TaskType } from "../types";
3-
import { Base, IBase } from "./Base";
3+
import { Base, IBaseMinimal } from "./Base";
44

5-
export interface IProject extends IBase {
5+
export interface IProject extends IBaseMinimal {
66
name: string;
77
type: TaskType;
88
slug: string;
@@ -12,8 +12,6 @@ export interface IProject extends IBase {
1212
flags: Flags & {
1313
isAnonymized: boolean;
1414
};
15-
createdBy;
16-
updatedBy;
1715
}
1816

1917
export class Project extends Base {
@@ -51,7 +49,6 @@ export class Project extends Base {
5149
this.slug = slug;
5250
this.name = name;
5351
this.type = type;
54-
this.createdBy = createdBy;
5552
}
5653

5754
toJSON() {

src/entities/Sample.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Types } from "mongoose";
2-
import { Base, IBase } from "./Base";
2+
import { Base, IBaseMinimal } from "./Base";
33

4-
export interface ISample extends IBase {
4+
export interface ISample extends IBaseMinimal {
55
projectId: Types.ObjectId;
66
datasetId: Types.ObjectId;
77
payload: any;

0 commit comments

Comments
 (0)