diff --git a/.eslintrc.json b/.eslintrc.json index 61d0849..3b19439 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,16 +1,16 @@ { - "env": { - "es2021": true, - "node": true - }, - "extends": ["standard-with-typescript", "prettier"], - "overrides": [], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module", - "project": "./tsconfig.json" - }, - "rules": {}, - "ignorePatterns": ["coverage", "dist"] - } \ No newline at end of file + "env": { + "es2021": true, + "node": true + }, + "extends": ["standard-with-typescript", "prettier"], + "overrides": [], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module", + "project": "./tsconfig.json" + }, + "rules": {}, + "ignorePatterns": ["coverage", "dist"] +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f0212e..7c09b05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,4 +6,4 @@ jobs: ci: uses: TogetherCrew/operations/.github/workflows/ci.yml@main secrets: - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} \ No newline at end of file + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} diff --git a/.prettierrc.json b/.prettierrc.json index 4ddba9a..a0d1c9a 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -2,4 +2,4 @@ "printWidth": 120, "trailingComma": "all", "singleQuote": true -} \ No newline at end of file +} diff --git a/README.md b/README.md index 88282d5..db2f177 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,9 @@ docker compose -f docker-compose.test.yml up --exit-code-from app --build Note: This will create a /coverage folder where you can review the coverage details. - ## Schema for rawinfo -``` +```ts rawinfo { type?: string, author: string, @@ -46,7 +45,7 @@ rawinfo { ### Schema for user -``` +```ts User { discordId: Snowflake, username?: string, @@ -68,8 +67,7 @@ User { ### Schema for heatmap -``` - +```ts HeatMap { date?: string,(format: "YYYY-MM-DD") thr_messages: Array, @@ -90,7 +88,7 @@ HeatMap { ### Schema for guildMembers -``` +```ts GuildMember { discordId: Snowflake, username: string, @@ -105,8 +103,7 @@ GuildMember { ### Schema for memberactivities -``` - +```ts memberactivities { date: Date, all_active: Array, @@ -130,8 +127,7 @@ memberactivities { ### Schema for channels -``` - +```ts Channels { channel: string, channelId: Snowflake, @@ -139,10 +135,9 @@ Channels { } ``` - ### Schema for token -``` +```ts Token { token: string, user: Snowflake, @@ -154,7 +149,7 @@ Token { ### Schema for guild -``` +```ts Guild { guildId: Snowflake, user: Snowflake, diff --git a/__tests__/unit/models/guildMember.model.test.ts b/__tests__/unit/models/guildMember.model.test.ts index 6d0a2fa..71ea0b0 100644 --- a/__tests__/unit/models/guildMember.model.test.ts +++ b/__tests__/unit/models/guildMember.model.test.ts @@ -1,6 +1,6 @@ import { GuildMember } from '../../../src/models'; import { IGuildMember } from '../../../src/interfaces/GuildMember.interface'; -import moment from "moment"; +import moment from 'moment'; describe('Account model', () => { describe('account validation', () => { @@ -10,10 +10,10 @@ describe('Account model', () => { discordId: '123', username: 'Behzad#11', roles: ['admin'], - joinedAt: moment("2022-02-01 08:30:26.127Z").toDate(), - avatar: "100", + joinedAt: moment('2022-02-01 08:30:26.127Z').toDate(), + avatar: '100', isBot: true, - discriminator: 'str' + discriminator: 'str', }; }); test('should correctly validate a valid guildMember data', async () => { diff --git a/__tests__/unit/models/heatMap.model.test.ts b/__tests__/unit/models/heatMap.model.test.ts index d781078..e07ef31 100644 --- a/__tests__/unit/models/heatMap.model.test.ts +++ b/__tests__/unit/models/heatMap.model.test.ts @@ -1,31 +1,36 @@ import { HeatMap } from '../../../src/models'; -import { IHeatMap } from '../../../src/interfaces/HeatMap.interface' +import { IHeatMap } from '../../../src/interfaces/HeatMap.interface'; describe('HeatMap model', () => { - describe('heatMap validation', () => { - let heatMap: IHeatMap; - beforeEach(() => { - heatMap = { - date: "2022-02-01", - thr_messages: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], - lone_messages: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], - replier: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], - replied_per_acc: [{account: "Magic", count: 4}], - replied: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], - mentioner: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], - mentioner_per_acc: [{account: "Behzad", count: 4}, {account: "Magic", count: 2}], - mentioned: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], - reacter: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], - reacted_per_acc: [{account: "End", count: 2}, {account: "Magic", count: 2}], - reacted: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], - channelId: "123123123123", - account_name: "MagicPalm" - } - }); - - test('should correctly validate a valid heatMap', async () => { - await expect(new HeatMap(heatMap).validate()).resolves.toBeUndefined(); - }); + describe('heatMap validation', () => { + let heatMap: IHeatMap; + beforeEach(() => { + heatMap = { + date: '2022-02-01', + thr_messages: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], + lone_messages: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], + replier: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], + replied_per_acc: [{ account: 'Magic', count: 4 }], + replied: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], + mentioner: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], + mentioner_per_acc: [ + { account: 'Behzad', count: 4 }, + { account: 'Magic', count: 2 }, + ], + mentioned: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], + reacter: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], + reacted_per_acc: [ + { account: 'End', count: 2 }, + { account: 'Magic', count: 2 }, + ], + reacted: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], + channelId: '123123123123', + account_name: 'MagicPalm', + }; + }); + test('should correctly validate a valid heatMap', async () => { + await expect(new HeatMap(heatMap).validate()).resolves.toBeUndefined(); }); -}); \ No newline at end of file + }); +}); diff --git a/__tests__/unit/models/token.model.test.ts b/__tests__/unit/models/token.model.test.ts index 7485c38..38658e0 100644 --- a/__tests__/unit/models/token.model.test.ts +++ b/__tests__/unit/models/token.model.test.ts @@ -1,27 +1,26 @@ import { Token } from '../../../src/models'; -import { IToken } from '../../../src/interfaces/Token.interface' -import moment from "moment"; +import { IToken } from '../../../src/interfaces/Token.interface'; +import moment from 'moment'; describe('Token model', () => { - describe('Token validation', () => { - let token: IToken; - beforeEach(() => { - token = { - user: "681946187490000906", - token: "716384", - type: "access", - expires: moment("2022-02-01 08:30:26.127Z").toDate() - }; - }); - - test('should correctly validate a valid token', async () => { - await expect(new Token(token).validate()).resolves.toBeUndefined(); - }); + describe('Token validation', () => { + let token: IToken; + beforeEach(() => { + token = { + user: '1234', + token: '4321', + type: 'access', + expires: moment('2022-02-01 08:30:26.127Z').toDate(), + }; + }); - test('should throw a validation error if type is invalid', async () => { - token.type = 'invalidToken'; - await expect(new Token(token).validate()).rejects.toThrow(); - }); + test('should correctly validate a valid token', async () => { + await expect(new Token(token).validate()).resolves.toBeUndefined(); + }); + test('should throw a validation error if type is invalid', async () => { + token.type = 'invalidToken'; + await expect(new Token(token).validate()).rejects.toThrow(); }); -}); \ No newline at end of file + }); +}); diff --git a/__tests__/unit/models/user.model.test.ts b/__tests__/unit/models/user.model.test.ts index 7b35968..63ae0c1 100644 --- a/__tests__/unit/models/user.model.test.ts +++ b/__tests__/unit/models/user.model.test.ts @@ -1,22 +1,22 @@ import { User } from '../../../src/models'; -import { IUser } from '../../../src/interfaces/User.interface' +import { IUser } from '../../../src/interfaces/User.interface'; describe('User model', () => { - describe('User validation', () => { - let user: IUser; - beforeEach(() => { - user = { - discordId: "681946187490000906", - }; - }); + describe('User validation', () => { + let user: IUser; + beforeEach(() => { + user = { + discordId: '1234', + }; + }); - test('should correctly validate a valid user', async () => { - await expect(new User(user).validate()).resolves.toBeUndefined(); - }); + test('should correctly validate a valid user', async () => { + await expect(new User(user).validate()).resolves.toBeUndefined(); + }); - test('should throw a validation error if email is invalid', async () => { - user.email = 'invalidEmail'; - await expect(new User(user).validate()).rejects.toThrow(); - }); + test('should throw a validation error if email is invalid', async () => { + user.email = 'invalidEmail'; + await expect(new User(user).validate()).rejects.toThrow(); }); -}); \ No newline at end of file + }); +}); diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 3eda614..8157439 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -1,4 +1,4 @@ -version: "3.9" +version: '3.9' services: app: @@ -7,4 +7,4 @@ services: target: test dockerfile: Dockerfile volumes: - - ./coverage:/project/coverage \ No newline at end of file + - ./coverage:/project/coverage diff --git a/jest.config.ts b/jest.config.ts index 3a09892..3745fc2 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -1,5 +1,5 @@ /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { - preset: "ts-jest", - testEnvironment: "node", -}; \ No newline at end of file + preset: 'ts-jest', + testEnvironment: 'node', +}; diff --git a/package.json b/package.json index 6dbf413..36a75b5 100644 --- a/package.json +++ b/package.json @@ -55,4 +55,4 @@ "files": [ "lib/**/*" ] -} \ No newline at end of file +} diff --git a/src/index.ts b/src/index.ts index 2541ef6..f1fbd13 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,13 @@ import { User, Token, Guild, HeatMap, RawInfo, MemberActivity } from './models'; -import { guildMemberSchema, guildSchema, heatMapSchema, MemberActivitySchema, rawInfoSchema, tokenSchema, userSchema } from './models/schemas'; +import { + guildMemberSchema, + guildSchema, + heatMapSchema, + MemberActivitySchema, + rawInfoSchema, + tokenSchema, + userSchema, +} from './models/schemas'; import { IDiscordGuild, IDiscordOathBotCallback, @@ -14,10 +22,7 @@ import { IGuildMember, IGuildMemberUpdateBody, GuildMemberModel } from './interf import { IRawInfo, RawInfoModel } from './interfaces/RawInfo.interface'; import { IMemberActivity, MemberActivityModel } from './interfaces/MemberActivity.interface'; -import { - databaseService, - heatmapService, -} from './service'; +import { databaseService, heatmapService } from './service'; export { User, @@ -55,5 +60,5 @@ export { MemberActivitySchema, rawInfoSchema, tokenSchema, - userSchema + userSchema, }; diff --git a/src/interfaces/Discord.interface.ts b/src/interfaces/Discord.interface.ts index 334e9f9..818a135 100644 --- a/src/interfaces/Discord.interface.ts +++ b/src/interfaces/Discord.interface.ts @@ -1,141 +1,104 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -import { Snowflake } from 'discord.js'; -import { IUser } from './User.interface'; +import { type Snowflake } from 'discord.js'; +import { type IUser } from './User.interface'; export interface IDiscordUser { - id: Snowflake; - username: string; - discriminator: string; - avatar: string | null; - bot?: boolean; - system?: boolean; - mfa_enabled?: boolean; - banner?: string | null; - accent_color?: number | null; - locale?: string; - verified?: boolean; - email?: string | null; - flags?: number; - premium_type?: number; - public_flags?: number; + id: Snowflake; + username: string; + discriminator: string; + avatar: string | null; + bot?: boolean; + system?: boolean; + mfa_enabled?: boolean; + banner?: string | null; + accent_color?: number | null; + locale?: string; + verified?: boolean; + email?: string | null; + flags?: number; + premium_type?: number; + public_flags?: number; } -export interface IDiscordGuild { - id: Snowflake; - name: string; - icon: string | null; - icon_hash?: string | null; - splash: string | null; - discovery_splash: string | null; - owner?: boolean; - owner_id: Snowflake; - permissions?: string; - region?: string | null; - afk_channel_id: Snowflake | null; - afk_timeout: number; - widget_enabled?: boolean; - widget_channel_id?: Snowflake | null; - verification_level: number; - default_message_notifications: number; - explicit_content_filter: number; - roles: Array; - emojis: Array; - features: Array; - application_id: Snowflake | null; - system_channel_id: Snowflake | null; - system_channel_flags: number; - rules_channel_id: Snowflake | null; - max_presences?: number | null; - max_members?: number; - vanity_url_code: string | null; - description: string | null; - banner: string | null; - premium_tier: number; - premium_subscription_count?: number; - preferred_locale: string; - public_updates_channel_id: Snowflake | null; - max_video_channel_users?: number; - approximate_member_count?: number; - approximate_presence_count?: number; - welcome_screen?: Record; - nsfw_level: number; - stickers?: Array; - premium_progress_bar_enabled: boolean; +export interface IDiscordGuild extends IDiscordCore { + id: Snowflake; + name: string; + icon: string | null; } -export interface IDiscordChannel { - id: Snowflake; - type: number; - guild_id?: Snowflake; - position?: number; - permission_overwrites?: Array; - name?: string | null; - topic?: string | null; - nsfw?: boolean; - last_message_id?: Snowflake | null; - bitrate?: number; - user_limit?: number; - - icon_hash?: string | null; - splash: string | null; - discovery_splash: string | null; - owner?: boolean; - owner_id: Snowflake; - permissions?: string; - region?: string | null; - afk_channel_id: Snowflake | null; - afk_timeout: number; - widget_enabled?: boolean; - widget_channel_id?: Snowflake | null; - verification_level: number; - default_message_notifications: number; - explicit_content_filter: number; - roles: Array; - emojis: Array; - features: Array; - application_id: Snowflake | null; - system_channel_id: Snowflake | null; - system_channel_flags: number; - rules_channel_id: Snowflake | null; - max_presences?: number | null; - max_members?: number; - vanity_url_code: string | null; - description: string | null; - banner: string | null; - premium_tier: number; - premium_subscription_count?: number; - preferred_locale: string; - public_updates_channel_id: Snowflake | null; - max_video_channel_users?: number; - approximate_member_count?: number; - approximate_presence_count?: number; - welcome_screen?: Record; - nsfw_level: number; - stickers?: Array; - premium_progress_bar_enabled: boolean; +export interface IDiscordChannel extends IDiscordCore { + id: Snowflake; + type: number; + guild_id?: Snowflake; + position?: number; + permission_overwrites?: any[]; + name?: string | null; + topic?: string | null; + nsfw?: boolean; + last_message_id?: Snowflake | null; + bitrate?: number; + user_limit?: number; } export interface IDiscordOathBotCallback { - access_token: string; - token_type: string; - expires_in: number; - refresh_token: string; - scope: string; - guild: IDiscordGuild; + access_token: string; + token_type: string; + expires_in: number; + refresh_token: string; + scope: string; + guild: IDiscordGuild; } export interface IDiscordGuildMember { - user?: IUser; - nick?: string; - avatar?: string; - roles: Snowflake[]; - joined_at: string; - premium_since?: string; - deaf: boolean; - mute: boolean; - flags: number; - pending?: boolean; - permissions?: string; - communication_disabled_until?: string; + user?: IUser; + nick?: string; + avatar?: string; + roles: Snowflake[]; + joined_at: string; + premium_since?: string; + deaf: boolean; + mute: boolean; + flags: number; + pending?: boolean; + permissions?: string; + communication_disabled_until?: string; } +interface IDiscordCore { + icon_hash?: string | null; + splash: string | null; + discovery_splash: string | null; + owner?: boolean; + owner_id: Snowflake; + permissions?: string; + region?: string | null; + afk_channel_id: Snowflake | null; + afk_timeout: number; + widget_enabled?: boolean; + widget_channel_id?: Snowflake | null; + verification_level: number; + default_message_notifications: number; + explicit_content_filter: number; + roles: any[]; + emojis: any[]; + features: any[]; + application_id: Snowflake | null; + system_channel_id: Snowflake | null; + system_channel_flags: number; + rules_channel_id: Snowflake | null; + max_presences?: number | null; + max_members?: number; + vanity_url_code: string | null; + description: string | null; + banner: string | null; + premium_tier: number; + premium_subscription_count?: number; + preferred_locale: string; + public_updates_channel_id: Snowflake | null; + max_video_channel_users?: number; + approximate_member_count?: number; + approximate_presence_count?: number; + welcome_screen?: Record; + nsfw_level: number; + stickers?: any[]; + premium_progress_bar_enabled: boolean; +} diff --git a/src/interfaces/Guild.interface.ts b/src/interfaces/Guild.interface.ts index 3685d74..1d5ee9a 100644 --- a/src/interfaces/Guild.interface.ts +++ b/src/interfaces/Guild.interface.ts @@ -23,14 +23,14 @@ export interface IGuild { export interface IGuildUpdateBody { selectedChannels?: [ { - channelId: Snowflake, - channelName?: string, + channelId: Snowflake; + channelName?: string; }, ]; - period?: Date, - isDisconnected?: boolean, - isInProgress?: boolean, - icon?: string | null, + period?: Date; + isDisconnected?: boolean; + isInProgress?: boolean; + icon?: string | null; } export interface GuildModel extends Model { diff --git a/src/interfaces/GuildMember.interface.ts b/src/interfaces/GuildMember.interface.ts index 4ebbfba..7681174 100644 --- a/src/interfaces/GuildMember.interface.ts +++ b/src/interfaces/GuildMember.interface.ts @@ -2,21 +2,21 @@ import { Snowflake } from 'discord.js'; import { Model } from 'mongoose'; export interface IGuildMember { - discordId: Snowflake, - username: string, - avatar?: string | null, - roles: Snowflake[], - joinedAt: Date | null, - isBot?: boolean, - discriminator: string + discordId: Snowflake; + username: string; + avatar?: string | null; + roles: Snowflake[]; + joinedAt: Date | null; + isBot?: boolean; + discriminator: string; } export interface IGuildMemberUpdateBody { - username?: string, - avatar?: string | null, - roles?: Snowflake[], - discriminator?: string, - joinedAt?: Date | null + username?: string; + avatar?: string | null; + roles?: Snowflake[]; + discriminator?: string; + joinedAt?: Date | null; } export interface GuildMemberModel extends Model { diff --git a/src/interfaces/Token.interface.ts b/src/interfaces/Token.interface.ts index eddec1e..747f088 100644 --- a/src/interfaces/Token.interface.ts +++ b/src/interfaces/Token.interface.ts @@ -10,7 +10,7 @@ export interface IToken { } export interface ITokenUpdateBody { - blacklisted?: boolean + blacklisted?: boolean; } export interface TokenModel extends Model { diff --git a/src/interfaces/User.interface.ts b/src/interfaces/User.interface.ts index eefdfc5..99cfa9c 100644 --- a/src/interfaces/User.interface.ts +++ b/src/interfaces/User.interface.ts @@ -20,9 +20,9 @@ export interface IUser { } export interface IUserUpdateBody { - avatar?: string, - email?: string, - verified?: boolean, + avatar?: string; + email?: string; + verified?: boolean; } export interface UserModel extends Model { diff --git a/src/interfaces/index.ts b/src/interfaces/index.ts index 4cc7305..a3306ce 100644 --- a/src/interfaces/index.ts +++ b/src/interfaces/index.ts @@ -4,4 +4,14 @@ import { IHeatMap } from './HeatMap.interface'; import { IToken, ITokenUpdateBody } from './Token.interface'; import { IMemberActivity } from './MemberActivity.interface'; import { IGuildMember, IGuildMemberUpdateBody } from './GuildMember.interface'; -export { IGuild, IGuildUpdateBody, IRawInfo, IToken, ITokenUpdateBody, IHeatMap, IMemberActivity, IGuildMember, IGuildMemberUpdateBody }; +export { + IGuild, + IGuildUpdateBody, + IRawInfo, + IToken, + ITokenUpdateBody, + IHeatMap, + IMemberActivity, + IGuildMember, + IGuildMemberUpdateBody, +}; diff --git a/src/models/schemas/GuildMember.schema.ts b/src/models/schemas/GuildMember.schema.ts index cebe36a..7f66306 100644 --- a/src/models/schemas/GuildMember.schema.ts +++ b/src/models/schemas/GuildMember.schema.ts @@ -22,11 +22,11 @@ const guildMemberSchema = new Schema({ type: String, }, isBot: { - type: Boolean + type: Boolean, }, discriminator: { - type: String - } + type: String, + }, }); // Plugins diff --git a/src/models/schemas/MemberActivity.schema.ts b/src/models/schemas/MemberActivity.schema.ts index 434709c..e3f55a2 100644 --- a/src/models/schemas/MemberActivity.schema.ts +++ b/src/models/schemas/MemberActivity.schema.ts @@ -6,54 +6,86 @@ const MemberActivitySchema = new Schema({ date: { type: Date, }, - all_active: [{ - type: String - }], - all_consistent: [{ - type: String - }], - all_vital: [{ - type: String - }], - all_connected: [{ - type: String - }], - all_paused: [{ - type: String - }], - all_new_disengaged: [{ - type: String - }], - all_disengaged: [{ - type: String - }], - all_unpaused: [{ - type: String - }], - all_returned: [{ - type: String - }], - all_new_active: [{ - type: String - }], - all_still_active: [{ - type: String - }], - all_dropped: [{ - type: String - }], - all_joined: [{ - type: String - }], - all_disengaged_were_newly_active: [{ - type: String - }], - all_disengaged_were_consistenly_active: [{ - type: String - }], - all_disengaged_were_vital: [{ - type: String - }], + all_active: [ + { + type: String, + }, + ], + all_consistent: [ + { + type: String, + }, + ], + all_vital: [ + { + type: String, + }, + ], + all_connected: [ + { + type: String, + }, + ], + all_paused: [ + { + type: String, + }, + ], + all_new_disengaged: [ + { + type: String, + }, + ], + all_disengaged: [ + { + type: String, + }, + ], + all_unpaused: [ + { + type: String, + }, + ], + all_returned: [ + { + type: String, + }, + ], + all_new_active: [ + { + type: String, + }, + ], + all_still_active: [ + { + type: String, + }, + ], + all_dropped: [ + { + type: String, + }, + ], + all_joined: [ + { + type: String, + }, + ], + all_disengaged_were_newly_active: [ + { + type: String, + }, + ], + all_disengaged_were_consistenly_active: [ + { + type: String, + }, + ], + all_disengaged_were_vital: [ + { + type: String, + }, + ], }); // Plugins diff --git a/src/models/schemas/index.ts b/src/models/schemas/index.ts index 9b51c03..35dca72 100644 --- a/src/models/schemas/index.ts +++ b/src/models/schemas/index.ts @@ -6,12 +6,4 @@ import rawInfoSchema from './RawInfo.schema'; import MemberActivitySchema from './MemberActivity.schema'; import guildMemberSchema from './GuildMember.schema'; -export { - userSchema, - tokenSchema, - guildSchema, - heatMapSchema, - rawInfoSchema, - MemberActivitySchema, - guildMemberSchema, -}; +export { userSchema, tokenSchema, guildSchema, heatMapSchema, rawInfoSchema, MemberActivitySchema, guildMemberSchema }; diff --git a/src/service/guildMember.service.ts b/src/service/guildMember.service.ts index ed760bd..9660a7b 100644 --- a/src/service/guildMember.service.ts +++ b/src/service/guildMember.service.ts @@ -19,7 +19,6 @@ async function createGuildMembers(connection: Connection, guildMembers: IGuildMe return connection.models.GuildMember.insertMany(guildMembers.map((guildMember) => guildMember)); } - /** * update guildMember * @param {Object} filter diff --git a/src/service/index.ts b/src/service/index.ts index 087d7f8..d186da7 100644 --- a/src/service/index.ts +++ b/src/service/index.ts @@ -1,7 +1,4 @@ import databaseService from './database.service'; import heatmapService from './heatMap.service'; -export { - databaseService, - heatmapService, -}; +export { databaseService, heatmapService }; diff --git a/tsconfig.json b/tsconfig.json index de54092..3c54e4c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,22 +1,13 @@ { - "compilerOptions": { - "target": "es2016", - "module": "commonjs", - "outDir": "./dist", - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "skipLibCheck": true - }, - "include": [ - "./src/**/*", - "./__test__/**/*", - ".eslintrc.json", - "jest.config.ts" - ], - "exclude": [ - "./__test__/**/*", - ".eslintrc.json", - "jest.config.ts" - ] - } \ No newline at end of file + "compilerOptions": { + "target": "es2016", + "module": "commonjs", + "outDir": "./dist", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true + }, + "include": ["./src/**/*", "./__test__/**/*", ".eslintrc.json", "jest.config.ts"], + "exclude": ["./__test__/**/*", ".eslintrc.json", "jest.config.ts"] +}