Skip to content

Commit

Permalink
fix: my events
Browse files Browse the repository at this point in the history
  • Loading branch information
SmallhillCZ committed Feb 11, 2024
1 parent 323fd8f commit 3828a1c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions backend/src/models/events/repositories/events.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export class EventsRepository {
.createQueryBuilder("events")
.select(["events.id", "events.name", "events.status", "events.dateFrom", "events.dateTill", "events.type"])
.leftJoinAndSelect("events.attendees", "attendees", "attendees.type = :type", { type: "leader" })
.leftJoinAndSelect("attendees.member", "leaders")
.orderBy("events.dateFrom", "DESC")
.take(options.limit ?? 25)
.skip(options.offset ?? 0);
Expand All @@ -43,9 +42,9 @@ export class EventsRepository {

if (options.search) q.andWhere("name ILIKE :search", { search: `%${options.search}%` });

if (options.memberId) q.andWhere("leaders.member_id = :memberId", { memberId: options.memberId });
if (options.memberId) q.andWhere("attendees.member_id = :memberId", { memberId: options.memberId });

if (options.noleader) q.andWhere("leaders.id IS NULL");
if (options.noleader) q.andWhere("attendees.member_id IS NULL");

return q.getMany();
}
Expand Down

0 comments on commit 3828a1c

Please sign in to comment.