Skip to content

Commit d578bc5

Browse files
committed
fix(api): load group avatar relation in fetch groups query flow
1 parent 153c06b commit d578bc5

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

services/api/src/entities/Media.entity.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ import {
99
ManyToMany,
1010
ManyToOne,
1111
OneToMany,
12-
OneToOne,
1312
PrimaryGeneratedColumn,
1413
UpdateDateColumn,
1514
type Relation,
1615
} from "typeorm";
17-
import { ActorEntity } from "./Actor.entity.js";
1816
import { AreaEntity } from "./Area.entity.js";
1917
import { EventV2Entity } from "./Event.v2.entity.js";
2018
import { KeywordEntity } from "./Keyword.entity.js";
@@ -95,18 +93,6 @@ export class MediaEntity {
9593
})
9694
keywords: Relation<KeywordEntity[]>;
9795

98-
@OneToOne(() => ActorEntity, (a) => a.avatar, {
99-
cascade: false,
100-
nullable: true,
101-
})
102-
actor?: Relation<ActorEntity> | null;
103-
104-
// @OneToOne(() => GroupEntity, {
105-
// cascade: false,
106-
// nullable: true,
107-
// })
108-
// group?: Relation<GroupEntity>;
109-
11096
socialPosts?: SocialPostEntity[];
11197

11298
@CreateDateColumn()

services/api/src/queries/groups/fetchGroups.query.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export const fetchGroups =
4040
return pipe(
4141
db.manager
4242
.createQueryBuilder(GroupEntity, "group")
43+
.leftJoinAndSelect("group.avatar", "avatar")
4344
.leftJoinAndSelect("group.members", "members")
4445
.leftJoinAndSelect("members.actor", "actor"),
4546
(q) => {

0 commit comments

Comments
 (0)