Skip to content

Commit

Permalink
Merge pull request #70 from RnDAO/update-rawInfo-schema
Browse files Browse the repository at this point in the history
Update raw info schema
  • Loading branch information
cyri113 authored May 26, 2023
2 parents 8c7fce3 + 05bef04 commit b9bdbbb
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 34 deletions.
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ All interactions with DB

```
rawinfo {
type?: string,
author: string,
content: string,
user_mentions?: Array<string>,
role_mentions?: Array<string>,
reactions?: Array<string>,
replied_user?: string,
channelId: Snowflake,
messageId: Snowflake,(unique)
threadId: Snowflake,
thread: string,
datetime: string (format: "YYYY-MM-DD")
type: number,
author: Snowflake,
content: string,
createdDate: Date,
user_mentions: Array<Snowflake>,
role_mentions: Array<Snowflake>,
reactions: Array<Snowflake>,
replied_user: Snowflake | null | undefined,
messageId: Snowflake,
channelId: Snowflake,
channelName: string | null,
threadId: Snowflake | null,
threadName: string | null,
}
```

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tc_dbcomm",
"version": "2.2.3",
"version": "2.3.0",
"description": "All interactions with DB",
"main": "./lib/index.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { IUser, IUserUpdateBody, UserModel } from './interfaces/User.interface';
import { IToken, ITokenUpdateBody, TokenModel } from './interfaces/Token.interface';
import { IGuild, IGuildUpdateBody, GuildModel } from './interfaces/Guild.interface';
import { IGuildMember, IGuildMemberUpdateBody, GuildMemberModel } from './interfaces/GuildMember.interface';
import { IRawInfo, RawInfoModel } from './interfaces/RawInfo.interface';
import { IRawInfo, IRawInfoUpdateBody, RawInfoModel } from './interfaces/RawInfo.interface';

import { IMemberActivity, MemberActivityModel } from './interfaces/MemberActivity.interface';
import {
Expand All @@ -33,6 +33,7 @@ export {
IDiscordChannel,
IUser,
IRawInfo,
IRawInfoUpdateBody,
IUserUpdateBody,
IMemberActivity,
MemberActivityModel,
Expand Down
33 changes: 21 additions & 12 deletions src/interfaces/RawInfo.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,27 @@ import { Model } from 'mongoose';
import { Snowflake } from 'discord.js';

export interface IRawInfo {
type?: string;
author?: Snowflake;
content?: string;
datetime?: string;
user_mentions?: Array<Snowflake>;
role_mentions?: Array<string>;
reactions?: Array<Snowflake>;
replied_user?: Snowflake;
channelId?: string;
messageId: string;
threadId: string;
thread?: string;
type: number,
author: Snowflake,
content: string,
createdDate: Date,
user_mentions: Array<Snowflake>,
role_mentions: Array<Snowflake>,
reactions: Array<Snowflake>,
replied_user: Snowflake | null | undefined,
messageId: Snowflake,
channelId: Snowflake,
channelName: string | null,
threadId: Snowflake | null,
threadName: string | null,
}

export interface IRawInfoUpdateBody {
channelId?: Snowflake,
channelName?: string | null,
threadId?: Snowflake | null,
threadName?: string | null,
content?: string,
}

export interface RawInfoModel extends Model<IRawInfo> {
Expand Down
16 changes: 10 additions & 6 deletions src/models/schemas/RawInfo.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import mongooseUniqueValidator from 'mongoose-unique-validator';

const rawInfoSchema = new Schema<IRawInfo>({
type: {
type: String,
type: Number,
},
author: {
type: String,
Expand All @@ -31,20 +31,24 @@ const rawInfoSchema = new Schema<IRawInfo>({
replied_user: {
type: String,
},
datetime: {
createdDate: {
type: Date,
},
messageId: {
type: String,
unique: true,
},
channelId: {
type: String,
},
messageId: {
type: String,
unique: true,
channelName: {
type: String
},

threadId: {
type: String,
},
thread: {
threadName: {
type: String,
},
});
Expand Down

0 comments on commit b9bdbbb

Please sign in to comment.