From c467dac653b4b31c9f7c3e47180fcf93e9b08d9b Mon Sep 17 00:00:00 2001 From: Behzad Rabiei Date: Mon, 22 May 2023 16:56:00 +0400 Subject: [PATCH 1/2] [NPM] --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0a67750..74eb6e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tc_dbcomm", - "version": "1.1.2", + "version": "2.2.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tc_dbcomm", - "version": "1.1.2", + "version": "2.2.3", "license": "ISC", "dependencies": { "@types/mongoose-unique-validator": "^1.0.6", diff --git a/package.json b/package.json index f9a3a14..76802c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tc_dbcomm", - "version": "2.2.3", + "version": "2.2.4", "description": "All interactions with DB", "main": "./lib/index.js", "scripts": { From 05bef04602bdb65692f0c8602cdff8a25291dccb Mon Sep 17 00:00:00 2001 From: Behzad Rabiei Date: Fri, 26 May 2023 18:15:43 +0400 Subject: [PATCH 2/2] [FEATURE]: update rawinfo schema and interfaces --- README.md | 25 +++++++++++---------- package.json | 2 +- src/index.ts | 3 ++- src/interfaces/RawInfo.interface.ts | 33 ++++++++++++++++++---------- src/models/schemas/RawInfo.schema.ts | 16 +++++++++----- 5 files changed, 47 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 1ab38ad..3e151bb 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,19 @@ All interactions with DB ``` rawinfo { - type?: string, - author: string, - content: string, - user_mentions?: Array, - role_mentions?: Array, - reactions?: Array, - 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, + role_mentions: Array, + reactions: Array, + replied_user: Snowflake | null | undefined, + messageId: Snowflake, + channelId: Snowflake, + channelName: string | null, + threadId: Snowflake | null, + threadName: string | null, } ``` diff --git a/package.json b/package.json index 76802c8..4a90c28 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tc_dbcomm", - "version": "2.2.4", + "version": "2.3.0", "description": "All interactions with DB", "main": "./lib/index.js", "scripts": { diff --git a/src/index.ts b/src/index.ts index 2541ef6..cbdb7cc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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 { @@ -33,6 +33,7 @@ export { IDiscordChannel, IUser, IRawInfo, + IRawInfoUpdateBody, IUserUpdateBody, IMemberActivity, MemberActivityModel, diff --git a/src/interfaces/RawInfo.interface.ts b/src/interfaces/RawInfo.interface.ts index 8565f12..b555bd9 100644 --- a/src/interfaces/RawInfo.interface.ts +++ b/src/interfaces/RawInfo.interface.ts @@ -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; - role_mentions?: Array; - reactions?: Array; - replied_user?: Snowflake; - channelId?: string; - messageId: string; - threadId: string; - thread?: string; + type: number, + author: Snowflake, + content: string, + createdDate: Date, + user_mentions: Array, + role_mentions: Array, + reactions: Array, + 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 { diff --git a/src/models/schemas/RawInfo.schema.ts b/src/models/schemas/RawInfo.schema.ts index 1ed6701..7de98e8 100644 --- a/src/models/schemas/RawInfo.schema.ts +++ b/src/models/schemas/RawInfo.schema.ts @@ -5,7 +5,7 @@ import mongooseUniqueValidator from 'mongoose-unique-validator'; const rawInfoSchema = new Schema({ type: { - type: String, + type: Number, }, author: { type: String, @@ -31,20 +31,24 @@ const rawInfoSchema = new Schema({ 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, }, });