Skip to content

Commit

Permalink
Merge pull request #29 from Bricks666/develop
Browse files Browse the repository at this point in the history
v2.4.1
  • Loading branch information
Bricks666 authored Mar 25, 2024
2 parents 71368fc + c0ded7e commit c013639
Show file tree
Hide file tree
Showing 27 changed files with 3,384 additions and 2,988 deletions.
6,114 changes: 3,284 additions & 2,830 deletions package-lock.json

Large diffs are not rendered by default.

74 changes: 38 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "server",
"version": "2.4.0",
"version": "2.4.1",
"description": "",
"main": "./dist/index.js",
"scripts": {
Expand All @@ -18,47 +18,49 @@
"author": "Bricks",
"license": "ISC",
"dependencies": {
"@nestjs-modules/mailer": "^1.8.1",
"@nestjs/common": "^9.3.5",
"@nestjs/config": "^2.3.0",
"@nestjs/core": "^9.3.5",
"@nestjs/jwt": "^10.0.1",
"@nestjs/platform-express": "^9.3.5",
"@nestjs/swagger": "^6.2.1",
"@prisma/client": "^4.10.1",
"bcrypt": "^5.1.0",
"cache-manager": "^5.1.6",
"@bricks-ether/server-utils": "^2.1.0",
"@nestjs-modules/mailer": "^1.10.3",
"@nestjs/cache-manager": "^2.2.1",
"@nestjs/common": "^10.3.3",
"@nestjs/config": "^3.2.0",
"@nestjs/core": "^10.3.3",
"@nestjs/jwt": "^10.2.0",
"@nestjs/platform-express": "^10.3.3",
"@nestjs/swagger": "^7.3.0",
"@prisma/client": "^5.10.2",
"bcrypt": "^5.1.1",
"cache-manager": "^5.4.0",
"cache-manager-redis-store": "^3.0.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"class-validator": "^0.14.1",
"cookie-parser": "^1.4.6",
"express": "^4.18.2",
"handlebars": "^4.7.7",
"nodemailer": "^6.9.1",
"redis": "^4.6.5",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.0",
"swagger-ui-express": "^4.6.0"
"handlebars": "^4.7.8",
"nodemailer": "^6.9.10",
"redis": "^4.6.13",
"reflect-metadata": "^0.2.1",
"rxjs": "^7.8.1",
"swagger-ui-express": "^5.0.0"
},
"devDependencies": {
"@nestjs/cli": "^9.1.8",
"@nestjs/schematics": "^9.0.4",
"@types/bcrypt": "^5.0.0",
"@types/cookie-parser": "^1.4.3",
"@types/express": "^4.17.15",
"@types/node": "^18.11.18",
"@types/nodemailer": "^6.4.7",
"@typescript-eslint/eslint-plugin": "^5.47.1",
"@typescript-eslint/parser": "^5.47.1",
"eslint": "^8.30.0",
"@nestjs/cli": "^10.3.2",
"@nestjs/schematics": "^10.1.1",
"@types/bcrypt": "^5.0.2",
"@types/cookie-parser": "^1.4.6",
"@types/express": "^4.17.21",
"@types/node": "^20.11.20",
"@types/nodemailer": "^6.4.14",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"eslint": "^8.56.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-sonarjs": "^0.17.0",
"husky": "^8.0.2",
"lint-staged": "^13.1.0",
"prettier": "^2.8.1",
"prisma": "^4.10.1",
"typescript": "^4.9.4"
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-sonarjs": "^0.24.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"prisma": "^5.10.2",
"typescript": "^5.3.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Injectable } from '@nestjs/common';
import { DatabaseService } from '@/database/database.service';
import { PrismaDatabaseService } from '@bricks-ether/server-utils/nestjs';
import { ActivityActionDto } from '../../dto';
import { CreateParams, GetOneParams } from './types';

@Injectable()
export class ActivityActionRepository {
constructor(private readonly databaseService: DatabaseService) {}
constructor(private readonly databaseService: PrismaDatabaseService) {}

async getAll(): Promise<ActivityActionDto[]> {
return this.databaseService.activityAction.findMany();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Injectable } from '@nestjs/common';
import { DatabaseService } from '@/database/database.service';
import { PrismaDatabaseService } from '@bricks-ether/server-utils/nestjs';
import { ActivitySphereDto } from '../../dto';
import { CreateParams, GetOneParams } from './types';

@Injectable()
export class ActivitySphereRepository {
constructor(private readonly databaseService: DatabaseService) {}
constructor(private readonly databaseService: PrismaDatabaseService) {}

async getAll(): Promise<ActivitySphereDto[]> {
return this.databaseService.activitySphere.findMany();
Expand Down
4 changes: 2 additions & 2 deletions src/activities/repositories/activity/activity.repository.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@nestjs/common';
import { Prisma } from '@prisma/client';
import { DatabaseService } from '@/database/database.service';
import { PrismaDatabaseService } from '@bricks-ether/server-utils/nestjs';
import { ActivityDto } from '../../dto';
import {
CreateParams,
Expand All @@ -13,7 +13,7 @@ import { select } from './config';

@Injectable()
export class ActivityRepository {
constructor(private readonly databaseService: DatabaseService) {}
constructor(private readonly databaseService: PrismaDatabaseService) {}

async getAllByRoomId(params: GetAllByRoomIdParams): Promise<ActivityDto[]> {
const {
Expand Down
9 changes: 5 additions & 4 deletions src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { APP_GUARD } from '@nestjs/core';
import { CacheModule, CacheStore, Module } from '@nestjs/common';
import { Module } from '@nestjs/common';
import { CacheModule, CacheStore } from '@nestjs/cache-manager';
import { PrismaDatabaseModule } from '@bricks-ether/server-utils/nestjs';
import { ConfigModule } from '@nestjs/config';
import { RedisClientOptions } from 'redis';
import { redisStore } from 'cache-manager-redis-store';
Expand All @@ -12,7 +14,6 @@ import { AuthModule } from '@/auth/auth.module';
import { AuthGuard, IsActivatedGuard } from '@/auth/lib';
import { ProgressModule } from '@/progress/progress.module';
import { CommentsModule } from '@/comments/comments.module';
import { DatabaseModule } from '@/database/database.module';
import { MailModule } from '@/mail/mail.module';
import { TokensModule } from '@/tokens/tokens.module';
import { MembersModule } from '@/members/members.module';
Expand All @@ -25,13 +26,13 @@ const modules = [
store: redisStore as unknown as CacheStore,
isGlobal: true,
max: 50,
ttl: 5,
ttl: +process.env.CACHE_TTL,
url: process.env.REDIS_URL,
}),
ConfigModule.forRoot({
envFilePath: '.env',
}),
DatabaseModule.forRoot({}),
PrismaDatabaseModule.forRoot({}),
AuthModule,
UsersModule,
RoomsModule,
Expand Down
5 changes: 3 additions & 2 deletions src/comments/repositories/comment/comment.repository.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@nestjs/common';
import { Prisma } from '@prisma/client';
import { DatabaseService } from '@/database/database.service';
import { PrismaDatabaseService } from '@bricks-ether/server-utils/nestjs';
import { SECURITY_USER_SELECT } from '@/users/repositories';
import { CommentDto } from '../../dto';
import {
Expand Down Expand Up @@ -29,7 +29,7 @@ const select = {

@Injectable()
export class CommentRepository {
constructor(private readonly databaseService: DatabaseService) {}
constructor(private readonly databaseService: PrismaDatabaseService) {}

async getAll(params: GetAllParams): Promise<CommentDto[]> {
const { limit, offset, roomId, taskId, } = params;
Expand Down Expand Up @@ -91,6 +91,7 @@ export class CommentRepository {
});
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
private static map(comment: any): CommentDto {
const { author, ...rest } = comment;

Expand Down
17 changes: 0 additions & 17 deletions src/database/database.module-definition.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/database/database.module.ts

This file was deleted.

52 changes: 0 additions & 52 deletions src/database/database.service.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/database/index.ts

This file was deleted.

5 changes: 1 addition & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ import * as cookieParser from 'cookie-parser';
import { AppModule } from '@/app.module';
import { StandardResponseInterceptor, __PROD__ } from '@/shared';
import { ORIGIN } from '@/const';
import { DatabaseService } from '@/database';

async function bootstrap() {
const { PORT, } = process.env;
const app = await NestFactory.create(AppModule);

const prismaService = app.get(DatabaseService);
await prismaService.enableShutdownHooks(app);

app.use(cookieParser());
app.enableCors({
credentials: true,
Expand Down Expand Up @@ -49,6 +45,7 @@ async function bootstrap() {
/**
* Для преобразования BigInt в JSON
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(BigInt.prototype as any).toJSON = function () {
return Number(this);
};
Expand Down
2 changes: 1 addition & 1 deletion src/members/controllers/members.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
Get,
Delete,
NotFoundException,
CacheInterceptor,
UseInterceptors
} from '@nestjs/common';
import {
Expand All @@ -12,6 +11,7 @@ import {
ApiOperation,
ApiTags
} from '@nestjs/swagger';
import { CacheInterceptor } from '@nestjs/cache-manager';
import { Auth, CurrentUser } from '@/auth/lib';
import { SecurityUserDto } from '@/users/dto';
import { IntParam } from '@/shared';
Expand Down
4 changes: 2 additions & 2 deletions src/members/repositories/members/members.repository.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@nestjs/common';
import { DatabaseService } from '@/database';
import { PrismaDatabaseService } from '@bricks-ether/server-utils/nestjs';
import { SECURITY_USER_SELECT } from '@/users/repositories';
import { SecurityUserDto } from '@/users/dto';
import {
Expand All @@ -12,7 +12,7 @@ import {

@Injectable()
export class MembersRepository {
constructor(private readonly databaseService: DatabaseService) {}
constructor(private readonly databaseService: PrismaDatabaseService) {}

async getAllActivated(params: GetMembersParams): Promise<SecurityUserDto[]> {
const { roomId, } = params;
Expand Down
4 changes: 2 additions & 2 deletions src/progress/repositories/progress/progress.repository.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Injectable } from '@nestjs/common';
import { Prisma, TaskStatus } from '@prisma/client';
import { DatabaseService } from '@/database/database.service';
import { PrismaDatabaseService } from '@bricks-ether/server-utils/nestjs';
import { map } from '@/shared';
import { TagDto } from '@/tags/dto';
import { ProgressDto, ProgressQueryResult } from '../../dto';
import { GetAllParams } from './types';

@Injectable()
export class ProgressRepository {
constructor(private readonly databaseService: DatabaseService) {}
constructor(private readonly databaseService: PrismaDatabaseService) {}

async getAll(params: GetAllParams): Promise<ProgressDto[]> {
const { roomId, } = params;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@nestjs/common';
import { DatabaseService } from '@/database/database.service';
import { PrismaDatabaseService } from '@bricks-ether/server-utils/nestjs';
import { RoomInvitationDto } from '../../dto';
import { invitationSelect } from '../configs';
import {
Expand All @@ -14,7 +14,7 @@ import {

@Injectable()
export class RoomInvitationsRepository {
constructor(private readonly databaseService: DatabaseService) {}
constructor(private readonly databaseService: PrismaDatabaseService) {}

async getAllActive(
params: GetRoomInvitationsParams
Expand Down
3 changes: 3 additions & 0 deletions src/rooms/controllers/lib.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const getUserRoomsCacheKey = (userId: number): string => {
return `rooms_${userId}`;
};
Loading

0 comments on commit c013639

Please sign in to comment.