Skip to content

Commit

Permalink
fix: change returned type to LeanDocument<Team>
Browse files Browse the repository at this point in the history
  • Loading branch information
CatiaAntunes96 committed Nov 15, 2022
1 parent dbfd5e3 commit 4d0697a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { LeanDocument } from 'mongoose';

import { TeamQueryParams } from 'libs/dto/param/team.query.params';

import Team, { TeamDocument } from '../../schemas/teams.schema';
import { TeamDocument } from '../../schemas/teams.schema';

export interface GetTeamApplicationInterface {
countTeams(userId: string): Promise<number>;
Expand All @@ -14,5 +14,5 @@ export interface GetTeamApplicationInterface {
teamQueryParams?: TeamQueryParams
): Promise<LeanDocument<TeamDocument> | null>;

getTeamsOfUser(userId: string): Promise<Team[]>;
getTeamsOfUser(userId: string): Promise<LeanDocument<TeamDocument>[]>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { LeanDocument } from 'mongoose';
import { TeamQueryParams } from 'libs/dto/param/team.query.params';

import { TeamUserDocument } from '../../schemas/team.user.schema';
import Team, { TeamDocument } from '../../schemas/teams.schema';
import { TeamDocument } from '../../schemas/teams.schema';

export interface GetTeamServiceInterface {
countTeams(userId: string): Promise<number>;

countAllTeams(): Promise<number>;

getTeamsOfUser(userId: string): Promise<Team[]>;
getTeamsOfUser(userId: string): Promise<LeanDocument<TeamDocument>[]>;

getTeam(
teamId: string,
Expand Down
5 changes: 0 additions & 5 deletions backend/src/modules/teams/schemas/teams.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Document } from 'mongoose';
import * as leanVirtualsPlugin from 'mongoose-lean-virtuals';

import Board from '../../boards/schemas/board.schema';
import TeamUser from './team.user.schema';

export type TeamDocument = Team & Document;

Expand All @@ -16,10 +15,6 @@ export default class Team {
@Prop({ nullable: false })
name!: string;

boardsCount?: number;

users?: TeamUser[];

boards?: Board[];
}

Expand Down
2 changes: 1 addition & 1 deletion backend/src/modules/teams/services/get.team.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default class GetTeamService implements GetTeamServiceInterface {
return teamModel.exec();
}

async getTeamsOfUser(userId: string): Promise<Team[]> {
async getTeamsOfUser(userId: string) {
const teamsUser = await this.teamUserModel.find({ user: userId }).distinct('team');

const teams: LeanDocument<TeamDocument>[] = await this.teamModel
Expand Down

0 comments on commit 4d0697a

Please sign in to comment.