Skip to content

Commit

Permalink
Merge pull request #124 from TogetherCrew/123-add-tcaat-to-user-commu…
Browse files Browse the repository at this point in the history
…nity-schemas-and-isinprogress-to-platform-schema

123 add tcaat to user community schemas and isinprogress to platform schema
  • Loading branch information
cyri113 authored Oct 31, 2023
2 parents f23904c + 48b871b commit 3972940
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ User {
discordId: Snowflake,
email?: string,
communities?: [Types.ObjectId]
tcaAt?: Date;
}
```

Expand All @@ -54,6 +55,7 @@ Community {
avatarURL?: string,
users?: [Types.ObjectId],
platforms?: [Types.ObjectId],
tcaAt?: Date;
}
```

Expand All @@ -65,6 +67,7 @@ Platform {
community: Types.ObjectId,
metadata?: Record<string, any>, // dynamic object since structure can change
disconnectedAt?: Date | null,
isInProgress?: boolean;
}
```
### Heatmap interface
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@togethercrew.dev/db",
"version": "3.0.12",
"version": "3.0.13",
"description": "All interactions with DB",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/Community.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ export interface ICommunity {
avatarURL?: string;
users: Types.ObjectId[];
platforms?: Types.ObjectId[];
tcaAt?: Date;
}

export interface ICommunityUpdateBody {
name?: string;
avatarURL?: string;
users?: Types.ObjectId[];
platforms?: Types.ObjectId[];
tcaAt?: Date;
}

export interface CommunityModel extends Model<ICommunity> {
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/Platfrom.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ export interface IPlatform {
community: Types.ObjectId;
metadata?: Record<string, any>; // dynamic object since structure can change
disconnectedAt?: Date | null;
isInProgress?: boolean;
}

export interface IPlatformUpdateBody {
name?: string;
community?: Types.ObjectId;
metadata?: Record<string, any>;
disconnectedAt?: Date | null;
isInProgress?: boolean;
}

export interface PlatformModel extends Model<IPlatform> {
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/User.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ export interface IUser {
discordId: Snowflake;
email?: string;
communities?: Types.ObjectId[];
tcaAt?: Date;
}

export interface IUserUpdateBody {
email?: string;
communities?: Types.ObjectId[];
tcaAt?: Date;
}

export interface UserModel extends Model<IUser> {
Expand Down
3 changes: 3 additions & 0 deletions src/models/schemas/Community.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const communitySchema = new Schema<ICommunity, CommunityModel>(
ref: 'Platform',
},
],
tcaAt: {
type: Date,
},
},

{ timestamps: true },
Expand Down
4 changes: 4 additions & 0 deletions src/models/schemas/Platform.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ const platformSchema = new Schema<IPlatform, PlatformModel>(
type: Date,
default: null,
},
isInProgress: {
type: Boolean,
default: true,
},
},

{ timestamps: true },
Expand Down
3 changes: 3 additions & 0 deletions src/models/schemas/User.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const userSchema = new Schema<IUser, UserModel>(
ref: 'Community',
},
],
tcaAt: {
type: Date,
},
},
{ timestamps: true },
);
Expand Down

0 comments on commit 3972940

Please sign in to comment.