Skip to content

Commit

Permalink
formatting and fixing ConfigModule error from test
Browse files Browse the repository at this point in the history
  • Loading branch information
Shpendiiiii committed Jul 31, 2024
1 parent 95b721e commit 7c6f59d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions apps/like/src/prisma/prisma.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { Test, TestingModule } from '@nestjs/testing';
import { PrismaService } from './prisma.service';
import { ConfigModule } from '@nestjs/config';

describe('PrismaService', () => {
let service: PrismaService;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [PrismaService],
imports: [ConfigModule]
}).compile();

service = module.get<PrismaService>(PrismaService);
Expand Down
14 changes: 7 additions & 7 deletions apps/like/src/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@ import {
Get,
Param,
ParseIntPipe,
ValidationPipe
ValidationPipe,
} from '@nestjs/common';
import { UserService } from './user.service';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';

@Controller('user')
@ApiTags('user')
export class UserController {
constructor(private userService: UserService) {
}
constructor(private userService: UserService) {}

@Get(':user_uuid/types/:type_uuid')
@ApiOperation({ summary: 'Get user likes on type by user id'})
@ApiOperation({ summary: 'Get user likes on type by user id' })
@ApiResponse({
status: 200,
description: 'Successfully retrieved user activities',
Expand All @@ -26,9 +25,10 @@ export class UserController {
status: 404,
description: 'Not Found',
})
async handleGetUserLikes(@Param('user_uuid') user_uuid: string, @Param('type_uuid') type_uuid: string) {
async handleGetUserLikes(
@Param('user_uuid') user_uuid: string,
@Param('type_uuid') type_uuid: string
) {
return this.userService.getUserLikesOnType(user_uuid, type_uuid);
}


}
10 changes: 5 additions & 5 deletions apps/like/src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import { PrismaService } from '../prisma/prisma.service';
export class UserService {
constructor(private prismaService: PrismaService) {}

async getUserLikesOnType(user_id_: string, type_id: string){
async getUserLikesOnType(user_id_: string, type_id: string) {
const user_id = Number(user_id_);
return await this.prismaService.like.findMany({
where: {user_id, type_id},
where: { user_id, type_id },
include: {
Type: true
}
})
Type: true,
},
});
}
// async createUser(createUserDto: CreateUserDto) {
// const existedUser = await prisma.user.findFirst({
Expand Down

0 comments on commit 7c6f59d

Please sign in to comment.