diff --git a/apps/backend/src/app/groups/groups.service.ts b/apps/backend/src/app/groups/groups.service.ts index a120625..b8565a6 100644 --- a/apps/backend/src/app/groups/groups.service.ts +++ b/apps/backend/src/app/groups/groups.service.ts @@ -1,24 +1,23 @@ -import { Injectable } from "@nestjs/common"; +import { Injectable } from '@nestjs/common'; import { DbService } from 'apps/backend/src/app/db/db.service'; import { FilesGroupTable } from 'apps/backend/src/app/db/schema'; import { ilike } from 'drizzle-orm'; + @Injectable() export class GroupsService { constructor(private readonly database: DbService) {} //TODO a method to fetch groups in the database by a specific search with limit, offset and a search field (can be blank) async getGroupsByName(limit: number, offset: number, search: string) { - const result = await this.database.use() + return await this.database.use() .select() .from(FilesGroupTable) .where(ilike(FilesGroupTable.groupName, search)) .limit(limit) .offset(offset) .prepare("getGroupsByName") - .execute() - console.log(`Found ${result.length} groups for search :\n > "${search}"`) - return result; + .execute(); } //TODO The method to create a group