diff --git a/package.json b/package.json index 7c33029..2137315 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@togethercrew.dev/db", - "version": "3.0.77", + "version": "3.0.78", "description": "All interactions with DB", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/src/config/enums.ts b/src/config/enums.ts index 5668f65..d31a483 100644 --- a/src/config/enums.ts +++ b/src/config/enums.ts @@ -36,4 +36,5 @@ export enum TokenTypeNames { GOOGLE_ACCESS = 'google_access', GOOGLE_REFRESH = 'google_refresh', NOTION_ACCESS = 'notion_access', + TELEGRAM_VERIFICATION = 'telegram_verification', } diff --git a/src/interfaces/Token.interface.ts b/src/interfaces/Token.interface.ts index d235655..8ebbf91 100644 --- a/src/interfaces/Token.interface.ts +++ b/src/interfaces/Token.interface.ts @@ -4,6 +4,7 @@ import { type TokenTypeNames } from '../config/enums'; export interface IToken { token: string; user: Types.ObjectId; + community?: Types.ObjectId; type: TokenTypeNames; expires: Date; blacklisted?: boolean; diff --git a/src/models/schemas/Token.schema.ts b/src/models/schemas/Token.schema.ts index fb8b7d6..6b00b0e 100644 --- a/src/models/schemas/Token.schema.ts +++ b/src/models/schemas/Token.schema.ts @@ -15,6 +15,10 @@ const tokenSchema = new Schema( ref: 'User', required: true, }, + community: { + type: Schema.Types.ObjectId, + ref: 'Community', + }, type: { type: String, enum: Object.values(TokenTypeNames),