-
- mdi-fire
- {{ $t("contributors.start.button.premium") }}
+
+
+ mdi-fire
+ {{ $t('contributors.start.button.premium') }}
-
- mdi-hammer-wrench
- {{ $t("contributors.start.button.jobs") }}
+
+ mdi-hammer-wrench
+ {{ $t('contributors.start.button.jobs') }}
-
-
diff --git a/apps/web/app/pages/status.vue b/apps/web/app/pages/status.vue
deleted file mode 100644
index 46a2d0e3..00000000
--- a/apps/web/app/pages/status.vue
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
diff --git a/apps/web/app/store/index.ts b/apps/web/app/store/index.ts
index 2fa17de6..9c72b943 100644
--- a/apps/web/app/store/index.ts
+++ b/apps/web/app/store/index.ts
@@ -1,3 +1,2 @@
-import { namespace } from 'nuxt-property-decorator';
-
-export const AuthStore = namespace('auth');
+/* eslint-disable import/extensions */
+/* eslint-disable import/no-unresolved */
diff --git a/apps/web/package.json b/apps/web/package.json
index 1aa3adb1..2c27ab8a 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -3,8 +3,8 @@
"version": "1.0.0",
"private": true,
"scripts": {
- "build": "tsc --build ./tsconfig.package.json && yarn run build:app",
- "build:app": "SET NODE_ENV=production& nuxt build -c ./lib/nuxt.config.js",
+ "compile": "tsc --build ./tsconfig.package.json",
+ "build": "SET NODE_ENV=production& nuxt build -c ./lib/nuxt.config.js",
"start": "node ./lib"
},
"dependencies": {
@@ -15,6 +15,7 @@
"@nuxtjs/sentry": "5.0.3",
"@nuxtjs/sitemap": "2.4.0",
"@nuxtjs/toast": "3.3.1",
+ "@nuxtjs/vuetify": "1.12.1",
"core-js": "^3.9.1",
"nuxt": "2.15.6",
"nuxt-i18n": "6.27.0",
@@ -28,13 +29,10 @@
"@nuxtjs/google-fonts": "1.3.0",
"@nuxtjs/moment": "1.6.1",
"@nuxtjs/pwa": "3.3.5",
- "@nuxtjs/vuetify": "1.11.3",
+ "@nuxtjs/vuetify": "1.12.1",
"@types/terser-webpack-plugin": "5.0.3",
"fibers": "5.0.0",
- "sass": "1.34.0",
+ "sass": "~1.32.13",
"sass-loader": "10.1.1"
- },
- "peerDependencies": {
- "@miko/config": "*"
}
}
diff --git a/apps/web/src/config/build.ts b/apps/web/src/config/build.ts
index 9b7dd374..356fa244 100644
--- a/apps/web/src/config/build.ts
+++ b/apps/web/src/config/build.ts
@@ -1,3 +1,5 @@
+import type { Context, NuxtConfig } from '@nuxt/types';
+
export default {
cache: true,
ssr: true,
@@ -6,5 +8,8 @@ export default {
client: {
overlay: false
}
+ },
+ extend(config: any, { isClient }: Context) {
+ config.devtool = isClient ? 'eval-source-map' : 'inline-source-map';
}
};
diff --git a/apps/web/src/config/head.ts b/apps/web/src/config/head.ts
index 8166c0d4..3d44defe 100644
--- a/apps/web/src/config/head.ts
+++ b/apps/web/src/config/head.ts
@@ -17,7 +17,7 @@ export default {
],
meta: [
{ charset: 'utf-8' },
- { name: 'viewport', content: 'width=device-width, initial-scale=1' },
+ { name: 'viewport', content: 'width=device-width, initial-scale=1, shrink-to-fit=no' },
{
hid: 'application-name',
name: 'application-name',
@@ -26,12 +26,12 @@ export default {
{
hid: 'author',
name: 'author',
- content: 'https://mikoapp.xyz'
+ content: 'Miko'
},
{
hid: 'publisher',
name: 'publisher',
- content: 'https://mikoapp.xyz'
+ content: 'Miko'
},
{
hid: 'theme-color',
@@ -77,6 +77,16 @@ export default {
property: 'og:site_name',
content: 'Miko'
},
+ {
+ hid: 'og:site',
+ property: 'og:site',
+ content: 'https://mikoapp.xyz'
+ },
+ {
+ hid: 'og:url',
+ property: 'og:url',
+ content: 'https://mikoapp.xyz'
+ },
{
hid: 'og:title',
property: 'og:title',
diff --git a/apps/web/src/config/index.ts b/apps/web/src/config/index.ts
index ce8abf34..341bfdc4 100644
--- a/apps/web/src/config/index.ts
+++ b/apps/web/src/config/index.ts
@@ -1,4 +1,3 @@
-import { config } from '@miko/config';
import { join } from 'path';
const rootDir = join(__dirname, '../..');
@@ -12,7 +11,7 @@ export default {
telemetry: false,
- dev: config.isDev,
+ dev: process.env.NODE_ENV !== 'production',
css: ['~/assets/scss/root'],
@@ -20,9 +19,5 @@ export default {
router: {
middleware: ['auth']
- },
-
- build: {
- transpile: ['vue-i18n']
}
};
diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json
index 432f75e0..0aac9447 100644
--- a/apps/web/tsconfig.json
+++ b/apps/web/tsconfig.json
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "ES2018",
- "module": "ESNext",
+ "module": "CommonJS",
"moduleResolution": "Node",
"lib": [
"ESNext",
diff --git a/apps/web/tsconfig.package.json b/apps/web/tsconfig.package.json
index 943d3879..6087f105 100644
--- a/apps/web/tsconfig.package.json
+++ b/apps/web/tsconfig.package.json
@@ -13,9 +13,5 @@
"test",
"lib"
],
- "references": [
- {
- "path": "..\\..\\packages\\config\\tsconfig.package.json"
- }
- ]
+ "references": []
}
\ No newline at end of file
diff --git a/ormconfig.js b/ormconfig.js
new file mode 100644
index 00000000..ea10a95f
--- /dev/null
+++ b/ormconfig.js
@@ -0,0 +1,16 @@
+module.exports = {
+ type: 'postgres',
+ host: process.env.DATABASE_HOST || 'localhost',
+ port: Number(process.env.DATABASE_PORT) || 5432,
+ username: process.env.DATABASE_USERNAME || 'postgres',
+ password: process.env.DATABASE_PASSWORD || null,
+ database: process.env.DATABASE || 'miko-dev',
+ synchronize: process.env.NODE_ENV !== 'production',
+ logging: true,
+ entities: [`${__dirname}/packages/**/lib/database/entities/*.entity.js`],
+ migrations: [`${__dirname}/packages/**/lib/migrations`],
+ cli: {
+ entitiesDir: 'src/database/entities',
+ migrationsDir: 'src/migration'
+ }
+};
diff --git a/package.json b/package.json
index 5affd59e..54c401aa 100644
--- a/package.json
+++ b/package.json
@@ -1,93 +1,86 @@
{
- "private": true,
- "license": "MIT",
"name": "miko-monorepo",
+ "license": "MIT",
+ "private": true,
"description": "Miko is simple, multipurpose bot that will help you with your server, which you can manage using the dashboard on our website.",
- "workspaces": [
- "apps/*",
- "packages/*"
- ],
- "scripts": {
- "build": "yarn run typescript:build",
- "watch": "yarn run typescript:watch",
- "clean": "yarn run typescript:clean",
- "test": "yarn run test:eslint && yarn run test:jest",
- "test:jest": "jest --no-cache --config test/jest.config.json",
- "test:eslint": "eslint --fix --ignore-path .gitignore {apps,packages,scripts}/*/src/**/*.ts",
- "typescript:build": "tsc --build ./typescript/tsconfig.project.json",
- "typescript:watch": "yarn run typescript:build --watch",
- "typescript:clean": "rimraf -rf ./{apps,packages}/*/{lib,*.tsbuildinfo}",
- "update:tsconfig": "ts-node scripts/update-package-tsconfig.ts",
- "update:languages": "ts-node scripts/update-languages.ts"
+ "homepage": "https://mikoapp.xyz/",
+ "bugs": {
+ "url": "https://github.com/SocketSomeone/Miko/issues",
+ "email": "socket.someone@gmail.com"
},
"repository": {
"type": "git",
"url": "git+https://github.com/SocketSomeone/Miko.git"
},
- "keywords": [
- "discord",
- "discord-js",
- "nuxt",
- "nodejs",
- "javascript",
- "typescript",
- "typeorm",
- "rabbitmq",
- "postgresql",
- "nestjs-backend",
- "prometheus",
- "grafana"
- ],
- "engines": {
- "node": ">=12.0.0"
- },
"author": {
- "email": "socket.someone@gmail.com",
"name": "Alexey | someone#6191",
+ "email": "socket.someone@gmail.com",
"url": "https://github.com/SocketSomeone"
},
- "bugs": {
- "email": "socket.someone@gmail.com",
- "url": "https://github.com/SocketSomeone/Miko/issues"
+ "workspaces": [
+ "apps/*",
+ "packages/*"
+ ],
+ "scripts": {
+ "prebuild": "rimraf -rf ./{apps,packages}/*/{lib,*.tsbuildinfo}",
+ "build": "tsc --build ./typescript/tsconfig.project.json",
+ "test": "jest --no-cache --config test/jest.config.json",
+ "update:tsconfig": "ts-node scripts/update-package-tsconfig.ts",
+ "update:languages": "ts-node scripts/update-languages.ts",
+ "prepare": "husky install .github/husky"
},
- "homepage": "https://mikoapp.xyz/",
- "config": {
- "commitizen": {
- "path": "cz-conventional-changelog"
- }
+ "lint-staged": {
+ "{apps,packages,scripts}/*/src/**/*.ts": [
+ "eslint --fix --ignore-path .gitignore {apps,packages,scripts}/*/src/**/*.ts"
+ ]
},
- "devDependencies": {
+ "dependencies": {
"@crowdin/crowdin-api-client": "1.11.0",
+ "@nestjs/common": "^7.0.0",
+ "@nestjs/config": "0.6.3",
+ "@nestjs/core": "^7.0.0",
+ "@nestjs/schedule": "0.4.3",
"@types/jest": "26.0.23",
+ "@types/supertest": "2.0.11",
+ "discord.js": "12.5.3",
+ "extract-zip": "2.0.1",
+ "glob": "7.1.7",
+ "jest": "27.0.5",
+ "moment": "2.29.1",
+ "reflect-metadata": "0.1.13",
+ "rxjs": "^6.5.4",
+ "supertest": "6.1.3",
+ "ts-jest": "27.0.3",
+ "tslib": "2.3.0"
+ },
+ "devDependencies": {
+ "@commitlint/cli": "12.1.4",
+ "@commitlint/config-angular": "12.1.4",
+ "@nestjs/cli": "^7.0.0",
+ "@nestjs/schematics": "^7.0.0",
+ "@nestjs/testing": "7.6.17",
+ "@types/cron": "1.7.2",
+ "@types/i18n": "0.13.0",
"@types/moment": "2.13.0",
"@types/node": "14.14.35",
- "@types/uuid": "8.3.0",
"@types/ws": "7.4.4",
"@typescript-eslint/eslint-plugin": "4.26.0",
"@typescript-eslint/parser": "4.26.0",
- "cz-conventional-changelog": "3.3.0",
"eslint": "7.27.0",
"eslint-config-airbnb-base": "14.2.1",
"eslint-config-prettier": "8.1.0",
"eslint-plugin-import": "2.23.4",
"eslint-plugin-prettier": "3.3.1",
- "extract-zip": "2.0.1",
- "glob": "7.1.7",
- "husky": "6",
- "jest": "26.6.3",
+ "husky": "^6.0.0",
+ "lint-staged": "11.0.0",
"mockdate": "3.0.5",
"prettier": "2.3.0",
"rimraf": "3.0.2",
- "ts-jest": "26.5.4",
+ "ts-loader": "8.3.0",
"ts-node": "9.1.1",
"tsconfig-paths": "3.9.0"
},
- "dependencies": {
- "discord.js": "12.5.3",
- "moment": "2.29.1",
- "reflect-metadata": "0.1.13",
- "tslib": "2.1.0",
- "tsyringe": "4.5.0",
- "uuid": "8.3.2"
+ "engines": {
+ "node": ">=12.0.0"
}
}
diff --git a/packages/common/package.json b/packages/common/package.json
index ad6409d6..da1107f4 100644
--- a/packages/common/package.json
+++ b/packages/common/package.json
@@ -3,24 +3,18 @@
"version": "1.0.0",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
- "dependencies": {
- "@sentry/node": "6.5.1",
- "@sentry/tracing": "6.5.1",
- "amqplib": "0.8.0",
- "pg": "8.6.0",
- "tslog": "3.2.0",
- "typeorm": "0.2.33"
- },
- "devDependencies": {
- "@types/amqplib": "0.5.17"
- },
- "peerDependencies": {
- "@miko/config": "*"
- },
"scripts": {
"build": "tsc --build ./tsconfig.package.json",
"typeorm": "node --require ts-node/register ../../node_modules/typeorm/cli.js",
"migration:generate": "yarn run typeorm migration:generate --config '../../ormconfig.json' -c production -n ",
"migration:run": "yarn run typeorm migration:run -c production"
- }
+ },
+ "dependencies": {
+ "@nestjs/typeorm": "7.1.5",
+ "@sentry/node": "6.5.1",
+ "@sentry/tracing": "6.5.1",
+ "pg": "8.6.0",
+ "typeorm": "0.2.34"
+ },
+ "devDependencies": {}
}
diff --git a/packages/common/src/cache/index.ts b/packages/common/src/cache/index.ts
deleted file mode 100644
index 96be4bd9..00000000
--- a/packages/common/src/cache/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './cache';
-export * from './manager';
diff --git a/packages/common/src/common.module.ts b/packages/common/src/common.module.ts
new file mode 100644
index 00000000..6085112d
--- /dev/null
+++ b/packages/common/src/common.module.ts
@@ -0,0 +1,22 @@
+import { Global, Module } from '@nestjs/common';
+import { ConfigModule } from '@nestjs/config';
+import { ScheduleModule } from '@nestjs/schedule';
+import { TypeOrmModule } from '@nestjs/typeorm';
+
+import * as repositories from './database/repositories';
+import * as services from './services';
+
+@Global()
+@Module({
+ imports: [
+ ScheduleModule.forRoot(),
+ ConfigModule.forRoot({
+ isGlobal: true
+ }),
+ TypeOrmModule.forRoot(),
+ TypeOrmModule.forFeature(Object.values(repositories))
+ ],
+ providers: Object.values(services),
+ exports: Object.values(services)
+})
+export class CommonModule {}
diff --git a/packages/common/src/database/entity/base/ChannelEntity.ts b/packages/common/src/database/entities/base/channel.base.ts
similarity index 78%
rename from packages/common/src/database/entity/base/ChannelEntity.ts
rename to packages/common/src/database/entities/base/channel.base.ts
index 7f0125c8..af092882 100644
--- a/packages/common/src/database/entity/base/ChannelEntity.ts
+++ b/packages/common/src/database/entities/base/channel.base.ts
@@ -1,5 +1,5 @@
import { Column } from 'typeorm';
-import { BaseGuildEntity } from './GuildEntity';
+import { BaseGuildEntity } from './guild.base';
export abstract class BaseChannelEntity extends BaseGuildEntity {
@Column('bigint', { name: 'channel_id' })
diff --git a/packages/common/src/database/entity/base/BaseEntity.ts b/packages/common/src/database/entities/base/entity.base.ts
similarity index 100%
rename from packages/common/src/database/entity/base/BaseEntity.ts
rename to packages/common/src/database/entities/base/entity.base.ts
diff --git a/packages/common/src/database/entity/base/GuildEntity.ts b/packages/common/src/database/entities/base/guild.base.ts
similarity index 78%
rename from packages/common/src/database/entity/base/GuildEntity.ts
rename to packages/common/src/database/entities/base/guild.base.ts
index 28730738..8bb4f36d 100644
--- a/packages/common/src/database/entity/base/GuildEntity.ts
+++ b/packages/common/src/database/entities/base/guild.base.ts
@@ -1,5 +1,5 @@
import { Column } from 'typeorm';
-import { BaseEntity } from './BaseEntity';
+import { BaseEntity } from './entity.base';
export abstract class BaseGuildEntity extends BaseEntity {
@Column('bigint', { name: 'guild_id' })
diff --git a/packages/common/src/database/entities/base/index.ts b/packages/common/src/database/entities/base/index.ts
new file mode 100644
index 00000000..25ef746a
--- /dev/null
+++ b/packages/common/src/database/entities/base/index.ts
@@ -0,0 +1,4 @@
+export * from './channel.base';
+export * from './guild.base';
+export * from './member.base';
+export * from './user.base';
diff --git a/packages/common/src/database/entity/base/MemberEntity.ts b/packages/common/src/database/entities/base/member.base.ts
similarity index 77%
rename from packages/common/src/database/entity/base/MemberEntity.ts
rename to packages/common/src/database/entities/base/member.base.ts
index 0ac4644b..43b67dd7 100644
--- a/packages/common/src/database/entity/base/MemberEntity.ts
+++ b/packages/common/src/database/entities/base/member.base.ts
@@ -1,5 +1,5 @@
import { Column } from 'typeorm';
-import { BaseGuildEntity } from './GuildEntity';
+import { BaseGuildEntity } from './guild.base';
export abstract class BaseMemberEntity extends BaseGuildEntity {
@Column('bigint', { name: 'user_id' })
diff --git a/packages/common/src/database/entity/base/UserEntity.ts b/packages/common/src/database/entities/base/user.base.ts
similarity index 78%
rename from packages/common/src/database/entity/base/UserEntity.ts
rename to packages/common/src/database/entities/base/user.base.ts
index 3a5f6532..d9a7283f 100644
--- a/packages/common/src/database/entity/base/UserEntity.ts
+++ b/packages/common/src/database/entities/base/user.base.ts
@@ -1,5 +1,5 @@
import { Column } from 'typeorm';
-import { BaseEntity } from './BaseEntity';
+import { BaseEntity } from './entity.base';
export abstract class BaseUserEntity extends BaseEntity {
@Column('bigint', { name: 'user_id' })
diff --git a/packages/common/src/database/entity/GuildConfig.ts b/packages/common/src/database/entities/guild-config.entity.ts
similarity index 78%
rename from packages/common/src/database/entity/GuildConfig.ts
rename to packages/common/src/database/entities/guild-config.entity.ts
index 35a1eb8c..49d12dd2 100644
--- a/packages/common/src/database/entity/GuildConfig.ts
+++ b/packages/common/src/database/entities/guild-config.entity.ts
@@ -1,9 +1,9 @@
import { Column, Entity } from 'typeorm';
-import { BaseGuildEntity } from './base/GuildEntity';
+import { BaseGuildEntity } from './base/guild.base';
@Entity({ name: 'guild_config' })
export class GuildConfig extends BaseGuildEntity {
- @Column('varchar')
+ @Column('varchar', { length: 100, nullable: true })
public name!: string;
@Column('varchar', { name: 'icon_url', nullable: true })
diff --git a/packages/common/src/database/entities/index.ts b/packages/common/src/database/entities/index.ts
new file mode 100644
index 00000000..b3719690
--- /dev/null
+++ b/packages/common/src/database/entities/index.ts
@@ -0,0 +1,5 @@
+export * from './base';
+
+export * from './member.entity';
+export * from './user.entity';
+export * from './guild-config.entity';
diff --git a/packages/common/src/database/entity/Member.ts b/packages/common/src/database/entities/member.entity.ts
similarity index 77%
rename from packages/common/src/database/entity/Member.ts
rename to packages/common/src/database/entities/member.entity.ts
index 832b319f..134b0d8d 100644
--- a/packages/common/src/database/entity/Member.ts
+++ b/packages/common/src/database/entities/member.entity.ts
@@ -1,6 +1,6 @@
import { Column, Entity, JoinColumn, ManyToOne } from 'typeorm';
-import { BaseGuildEntity } from './base/GuildEntity';
-import { User } from './User';
+import { BaseGuildEntity } from './base/guild.base';
+import { User } from './user.entity';
@Entity({ name: 'members' })
export class Member extends BaseGuildEntity {
diff --git a/packages/common/src/database/entity/User.ts b/packages/common/src/database/entities/user.entity.ts
similarity index 82%
rename from packages/common/src/database/entity/User.ts
rename to packages/common/src/database/entities/user.entity.ts
index 360c4eb2..f3559d36 100644
--- a/packages/common/src/database/entity/User.ts
+++ b/packages/common/src/database/entities/user.entity.ts
@@ -1,5 +1,5 @@
import { Column, Entity } from 'typeorm';
-import { BaseUserEntity } from './base/UserEntity';
+import { BaseUserEntity } from './base';
@Entity({ name: 'users' })
export class User extends BaseUserEntity {
diff --git a/packages/common/src/database/entity/Contributor.ts b/packages/common/src/database/entity/Contributor.ts
deleted file mode 100644
index 30fba411..00000000
--- a/packages/common/src/database/entity/Contributor.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { Column, Entity } from 'typeorm';
-import { BaseEntity } from './base/BaseEntity';
-
-interface ILink {
- emoji: string;
- url: string;
-}
-
-@Entity()
-export class Contributor extends BaseEntity {
- @Column('varchar')
- public avatarUrl: string;
-
- @Column('varchar')
- public username: string;
-
- @Column('varchar')
- public specialization: string;
-
- @Column('json')
- public links: ILink[];
-}
diff --git a/packages/common/src/database/entity/base/index.ts b/packages/common/src/database/entity/base/index.ts
deleted file mode 100644
index d16697ae..00000000
--- a/packages/common/src/database/entity/base/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from './ChannelEntity';
-export * from './GuildEntity';
-export * from './MemberEntity';
-export * from './UserEntity';
diff --git a/packages/common/src/database/entity/index.ts b/packages/common/src/database/entity/index.ts
deleted file mode 100644
index 7a56ceb4..00000000
--- a/packages/common/src/database/entity/index.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-export * from './base';
-
-export * from './Member';
-export * from './User';
-export * from './GuildConfig';
-export * from './Contributor';
diff --git a/packages/common/src/database/index.ts b/packages/common/src/database/index.ts
index 09d6fa17..1cfdcb6c 100644
--- a/packages/common/src/database/index.ts
+++ b/packages/common/src/database/index.ts
@@ -1,4 +1,2 @@
-export * from './entity';
-export * from './repository';
-
-export { createConnection } from 'typeorm';
+export * from './entities';
+export * from './repositories';
diff --git a/packages/common/src/database/repository/base/ChannelRepository.ts b/packages/common/src/database/repositories/base/channel.base.ts
similarity index 91%
rename from packages/common/src/database/repository/base/ChannelRepository.ts
rename to packages/common/src/database/repositories/base/channel.base.ts
index 3e1b631a..242447ad 100644
--- a/packages/common/src/database/repository/base/ChannelRepository.ts
+++ b/packages/common/src/database/repositories/base/channel.base.ts
@@ -1,6 +1,6 @@
import type { DeleteResult, FindConditions } from 'typeorm';
import { Repository } from 'typeorm';
-import type { BaseChannelEntity } from '../..';
+import type { BaseChannelEntity } from '../../entities';
export abstract class BaseChannelRepository extends Repository {
public findByChannelId(channelId: string): Promise {
diff --git a/packages/common/src/database/repository/base/GuildRepository.ts b/packages/common/src/database/repositories/base/guild.base.ts
similarity index 90%
rename from packages/common/src/database/repository/base/GuildRepository.ts
rename to packages/common/src/database/repositories/base/guild.base.ts
index 226a3817..81b873cc 100644
--- a/packages/common/src/database/repository/base/GuildRepository.ts
+++ b/packages/common/src/database/repositories/base/guild.base.ts
@@ -1,5 +1,5 @@
import { Repository } from 'typeorm';
-import type { BaseGuildEntity } from '../..';
+import type { BaseGuildEntity } from '../../entities';
export abstract class BaseGuildRepository extends Repository {
public findByGuildId(guildId: string): Promise {
diff --git a/packages/common/src/database/repositories/base/index.ts b/packages/common/src/database/repositories/base/index.ts
new file mode 100644
index 00000000..b41316e3
--- /dev/null
+++ b/packages/common/src/database/repositories/base/index.ts
@@ -0,0 +1,4 @@
+export * from './guild.base';
+export * from './channel.base';
+export * from './member.base';
+export * from './user.base';
diff --git a/packages/common/src/database/repository/base/MemberRepository.ts b/packages/common/src/database/repositories/base/member.base.ts
similarity index 92%
rename from packages/common/src/database/repository/base/MemberRepository.ts
rename to packages/common/src/database/repositories/base/member.base.ts
index 26af09fa..f459c3c9 100644
--- a/packages/common/src/database/repository/base/MemberRepository.ts
+++ b/packages/common/src/database/repositories/base/member.base.ts
@@ -1,6 +1,6 @@
import type { DeleteResult, FindConditions } from 'typeorm';
import { Repository } from 'typeorm';
-import type { BaseMemberEntity } from '../..';
+import type { BaseMemberEntity } from '../../entities';
export abstract class BaseMemberRepository extends Repository {
public findByGuildIdAndUserId(guildId: string, userId: string): Promise {
diff --git a/packages/common/src/database/repository/base/UserRepository.ts b/packages/common/src/database/repositories/base/user.base.ts
similarity index 81%
rename from packages/common/src/database/repository/base/UserRepository.ts
rename to packages/common/src/database/repositories/base/user.base.ts
index 057622b8..d4d1bcc9 100644
--- a/packages/common/src/database/repository/base/UserRepository.ts
+++ b/packages/common/src/database/repositories/base/user.base.ts
@@ -1,5 +1,5 @@
import { Repository } from 'typeorm';
-import type { BaseUserEntity } from '../..';
+import type { BaseUserEntity } from '../../entities';
export abstract class BaseUserRepository extends Repository {
public findByUserId(userId: string): Promise {
diff --git a/packages/common/src/database/repository/GuildConfigRepository.ts b/packages/common/src/database/repositories/guildConfig.repository.ts
similarity index 93%
rename from packages/common/src/database/repository/GuildConfigRepository.ts
rename to packages/common/src/database/repositories/guildConfig.repository.ts
index a31cbb6a..0713b78f 100644
--- a/packages/common/src/database/repository/GuildConfigRepository.ts
+++ b/packages/common/src/database/repositories/guildConfig.repository.ts
@@ -1,5 +1,5 @@
import { EntityRepository } from 'typeorm';
-import { GuildConfig } from '../entity';
+import { GuildConfig } from '../entities';
import { BaseGuildRepository } from './base';
@EntityRepository(GuildConfig)
diff --git a/packages/common/src/database/repositories/index.ts b/packages/common/src/database/repositories/index.ts
new file mode 100644
index 00000000..46791abf
--- /dev/null
+++ b/packages/common/src/database/repositories/index.ts
@@ -0,0 +1 @@
+export * from './guildConfig.repository';
diff --git a/packages/common/src/database/repository/ContributorRepository.ts b/packages/common/src/database/repository/ContributorRepository.ts
deleted file mode 100644
index 7ab86d4a..00000000
--- a/packages/common/src/database/repository/ContributorRepository.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { EntityRepository, Repository } from 'typeorm';
-import { Contributor } from '../entity';
-
-@EntityRepository(Contributor)
-export class ContributorRepository extends Repository {}
diff --git a/packages/common/src/database/repository/base/index.ts b/packages/common/src/database/repository/base/index.ts
deleted file mode 100644
index 74008128..00000000
--- a/packages/common/src/database/repository/base/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from './GuildRepository';
-export * from './ChannelRepository';
-export * from './MemberRepository';
-export * from './UserRepository';
diff --git a/packages/common/src/database/repository/index.ts b/packages/common/src/database/repository/index.ts
deleted file mode 100644
index 3e7ba155..00000000
--- a/packages/common/src/database/repository/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from './base';
-
-export * from './GuildConfigRepository';
-export * from './ContributorRepository';
diff --git a/packages/common/src/decorators/Autowired.ts b/packages/common/src/decorators/Autowired.ts
deleted file mode 100644
index f2215b5a..00000000
--- a/packages/common/src/decorators/Autowired.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { container } from 'tsyringe';
-
-export function AutoWired(): PropertyDecorator {
- return (target: unknown, propertyKey: string | symbol): void => {
- if (target && propertyKey) {
- const type = Reflect.getMetadata('design:type', target, propertyKey);
-
- if (type === undefined) {
- throw new Error(`failed to get design type of ${target.constructor.name}:${String(propertyKey)}`);
- }
-
- const clazz = container.resolve(type);
-
- Object.defineProperty(target, propertyKey, {
- get: () => clazz
- });
- }
- };
-}
diff --git a/packages/common/src/decorators/Interval.ts b/packages/common/src/decorators/Interval.ts
deleted file mode 100644
index ba0072b9..00000000
--- a/packages/common/src/decorators/Interval.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-export function Interval(timeout: number): MethodDecorator {
- return (target: Object, propertyKey: string | symbol): void => {
- if (typeof target[propertyKey] !== 'function') {
- throw new Error('Interval decorator can only be applied to methods');
- }
-
- const list = Reflect.getOwnMetadata('SCHEDULER_INTERVALS', target) || [];
-
- list.push({
- propertyKey,
- timeout
- });
-
- Reflect.defineMetadata('SCHEDULER_INTERVALS', list, target);
- };
-}
diff --git a/packages/common/src/decorators/PostConstruct.ts b/packages/common/src/decorators/PostConstruct.ts
deleted file mode 100644
index f1c77f4d..00000000
--- a/packages/common/src/decorators/PostConstruct.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
-/* eslint-disable @typescript-eslint/no-explicit-any */
-import { container } from 'tsyringe';
-
-export const PostConstruct = (target: any, propertyKey: string | symbol): void =>
- container.afterResolution(target.constructor, (_, result) => result[propertyKey](), { frequency: 'Once' });
diff --git a/packages/common/src/decorators/Repository.ts b/packages/common/src/decorators/Repository.ts
deleted file mode 100644
index 4acf2758..00000000
--- a/packages/common/src/decorators/Repository.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { getCustomRepository } from 'typeorm';
-
-export function Repository(): PropertyDecorator {
- return (target: unknown, propertyKey: string | symbol): void => {
- if (target && propertyKey) {
- const type = Reflect.getMetadata('design:type', target, propertyKey);
-
- if (type === undefined) {
- throw new Error(`failed to get design type of ${target.constructor.name}:${String(propertyKey)}`);
- }
-
- Object.defineProperty(target, propertyKey, {
- get: () => {
- return getCustomRepository(type, process.env.NODE_ENV);
- }
- });
- }
- };
-}
diff --git a/packages/common/src/decorators/Schedulable.ts b/packages/common/src/decorators/Schedulable.ts
deleted file mode 100644
index 34d5cab1..00000000
--- a/packages/common/src/decorators/Schedulable.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-export function Schedulable(): ClassDecorator {
- return target => {
- return class extends target.prototype.constructor {
- constructor(...args: unknown[]) {
- super(...args);
-
- const intervals = Reflect.getOwnMetadata('SCHEDULER_INTERVALS', target.prototype);
-
- for (const { propertyKey, timeout } of intervals) setInterval(this[propertyKey].bind(this), timeout);
- }
- } as never;
- };
-}
diff --git a/packages/common/src/decorators/index.ts b/packages/common/src/decorators/index.ts
deleted file mode 100644
index 82baadb3..00000000
--- a/packages/common/src/decorators/index.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import 'reflect-metadata';
-
-export * from './Autowired';
-export * from './Interval';
-export * from './Schedulable';
-export * from './PostConstruct';
-export * from './Repository';
diff --git a/apps/api/src/contributors/dto/contributor.ts b/packages/common/src/extensions/array.extension.ts
similarity index 100%
rename from apps/api/src/contributors/dto/contributor.ts
rename to packages/common/src/extensions/array.extension.ts
diff --git a/packages/common/src/database/transformers/index.ts b/packages/common/src/extensions/string.extension.ts
similarity index 100%
rename from packages/common/src/database/transformers/index.ts
rename to packages/common/src/extensions/string.extension.ts
diff --git a/packages/common/src/utils/index.ts b/packages/common/src/helpers/array.helper.ts
similarity index 67%
rename from packages/common/src/utils/index.ts
rename to packages/common/src/helpers/array.helper.ts
index 030ee05d..4b07bb5b 100644
--- a/packages/common/src/utils/index.ts
+++ b/packages/common/src/helpers/array.helper.ts
@@ -1,3 +1,3 @@
-import type { AllowArray } from '../types';
+import type { AllowArray } from '../interfaces';
export const arrarify = (value: AllowArray): T[] => (Array.isArray(value) ? value : [value]);
diff --git a/packages/common/src/cache/cache.ts b/packages/common/src/helpers/cache.helper.ts
similarity index 97%
rename from packages/common/src/cache/cache.ts
rename to packages/common/src/helpers/cache.helper.ts
index cfd80bd5..5133f5c4 100644
--- a/packages/common/src/cache/cache.ts
+++ b/packages/common/src/helpers/cache.helper.ts
@@ -1,7 +1,7 @@
import { duration } from 'moment';
-import { arrarify } from '../utils';
-import { MetricsCache, MetadataCache } from '../models';
-import type { ICacheEntry, ICacheOptions, AllowArray } from '../types';
+import { arrarify } from '.';
+import { MetricsCache, MetadataCache } from '../interfaces';
+import type { ICacheEntry, ICacheOptions, AllowArray } from '../interfaces';
export class LoadingCache {
public readonly metrics = new MetricsCache();
diff --git a/packages/common/src/helpers/func.helper.ts b/packages/common/src/helpers/func.helper.ts
new file mode 100644
index 00000000..7401c16b
--- /dev/null
+++ b/packages/common/src/helpers/func.helper.ts
@@ -0,0 +1,22 @@
+import type { IFunctionParameter } from '../interfaces';
+
+const STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;
+const ARGUMENT_NAMES = /([^,]+)/g;
+
+export const getParamNames = (func: Function): IFunctionParameter[] => {
+ const fnStr = func.toString().replace(STRIP_COMMENTS, '');
+ const args = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES);
+
+ if (args === null) {
+ return [];
+ }
+
+ return args.map(arg => {
+ const parsed = arg.trim().split(' ');
+
+ return {
+ name: parsed[0],
+ optional: !!parsed[1]
+ };
+ });
+};
diff --git a/packages/common/src/helpers/index.ts b/packages/common/src/helpers/index.ts
new file mode 100644
index 00000000..8b7113f1
--- /dev/null
+++ b/packages/common/src/helpers/index.ts
@@ -0,0 +1,3 @@
+export * from './array.helper';
+export * from './cache.helper';
+export * from './func.helper';
diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts
index 128804ef..2b909897 100644
--- a/packages/common/src/index.ts
+++ b/packages/common/src/index.ts
@@ -1,9 +1,6 @@
-import 'reflect-metadata';
-
-export * from './cache';
+export * from './helpers';
+export * from './interfaces';
export * from './database';
-export * from './decorators';
export * from './services';
-export * from './models';
-export * from './utils';
-export * from './types';
+
+export * from './common.module';
diff --git a/packages/common/src/interfaces/allow-array.interface.ts b/packages/common/src/interfaces/allow-array.interface.ts
new file mode 100644
index 00000000..0de6993e
--- /dev/null
+++ b/packages/common/src/interfaces/allow-array.interface.ts
@@ -0,0 +1 @@
+export type AllowArray = T | T[];
diff --git a/packages/common/src/interfaces/awaited.interface.ts b/packages/common/src/interfaces/awaited.interface.ts
new file mode 100644
index 00000000..ec0cdfb4
--- /dev/null
+++ b/packages/common/src/interfaces/awaited.interface.ts
@@ -0,0 +1 @@
+export type Awaited = PromiseLike | T;
diff --git a/packages/common/src/interfaces/cache/cache-entry.interface.ts b/packages/common/src/interfaces/cache/cache-entry.interface.ts
new file mode 100644
index 00000000..691cdc2d
--- /dev/null
+++ b/packages/common/src/interfaces/cache/cache-entry.interface.ts
@@ -0,0 +1,6 @@
+import type { MetadataCache } from './cache-metadata.interface';
+
+export interface ICacheEntry {
+ data: V;
+ meta: MetadataCache;
+}
diff --git a/packages/common/src/models/cache/metadata.ts b/packages/common/src/interfaces/cache/cache-metadata.interface.ts
similarity index 100%
rename from packages/common/src/models/cache/metadata.ts
rename to packages/common/src/interfaces/cache/cache-metadata.interface.ts
diff --git a/packages/common/src/models/cache/metrics.ts b/packages/common/src/interfaces/cache/cache-metrics.interface.ts
similarity index 100%
rename from packages/common/src/models/cache/metrics.ts
rename to packages/common/src/interfaces/cache/cache-metrics.interface.ts
diff --git a/packages/common/src/interfaces/cache/cache-options.interface.ts b/packages/common/src/interfaces/cache/cache-options.interface.ts
new file mode 100644
index 00000000..fdd82e98
--- /dev/null
+++ b/packages/common/src/interfaces/cache/cache-options.interface.ts
@@ -0,0 +1,10 @@
+import type { Duration } from 'moment';
+
+export interface ICacheOptions {
+ maxSize?: number;
+ expireAfter?: Duration;
+ refreshAfter?: Duration;
+ cleanupInterval?: number;
+ refreshInterval?: number;
+ load?: (key: K) => Promise;
+}
diff --git a/packages/common/src/interfaces/constructor.interface.ts b/packages/common/src/interfaces/constructor.interface.ts
new file mode 100644
index 00000000..0ac2ad11
--- /dev/null
+++ b/packages/common/src/interfaces/constructor.interface.ts
@@ -0,0 +1 @@
+export type Constructor = new (...args: unknown[]) => T;
diff --git a/packages/common/src/interfaces/function-parameter.interface.ts b/packages/common/src/interfaces/function-parameter.interface.ts
new file mode 100644
index 00000000..6417daa8
--- /dev/null
+++ b/packages/common/src/interfaces/function-parameter.interface.ts
@@ -0,0 +1,4 @@
+export interface IFunctionParameter {
+ name: string;
+ optional: boolean;
+}
diff --git a/packages/common/src/interfaces/index.ts b/packages/common/src/interfaces/index.ts
new file mode 100644
index 00000000..9185c8cd
--- /dev/null
+++ b/packages/common/src/interfaces/index.ts
@@ -0,0 +1,9 @@
+export * from './cache/cache-entry.interface';
+export * from './cache/cache-options.interface';
+export * from './cache/cache-metadata.interface';
+export * from './cache/cache-metrics.interface';
+
+export * from './allow-array.interface';
+export * from './awaited.interface';
+export * from './constructor.interface';
+export * from './function-parameter.interface';
diff --git a/packages/common/src/models/cache/index.ts b/packages/common/src/models/cache/index.ts
deleted file mode 100644
index d35a3671..00000000
--- a/packages/common/src/models/cache/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './metadata';
-export * from './metrics';
diff --git a/packages/common/src/models/gateway/CacheDeleteRequest.ts b/packages/common/src/models/gateway/CacheDeleteRequest.ts
deleted file mode 100644
index 27ccecf8..00000000
--- a/packages/common/src/models/gateway/CacheDeleteRequest.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export interface ICacheDeleteRequest {
- cacheName: string;
-
- guildId: string;
-}
diff --git a/packages/common/src/models/gateway/CommandsGetRequest.ts b/packages/common/src/models/gateway/CommandsGetRequest.ts
deleted file mode 100644
index ed14d541..00000000
--- a/packages/common/src/models/gateway/CommandsGetRequest.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export type CommandsGetDTO = {
- groups: string[];
- commands: unknown[];
-};
diff --git a/packages/common/src/models/gateway/GatewayCallback.ts b/packages/common/src/models/gateway/GatewayCallback.ts
deleted file mode 100644
index b8679034..00000000
--- a/packages/common/src/models/gateway/GatewayCallback.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import type { Awaited } from '../../types';
-import type { IRabbitEvents } from '.';
-
-export type GatewayCallback = (
- payload?: IRabbitEvents[Q]
-) => Awaited