enhance(backend): UserListMembershipにユーザーリストの作成者IDを非正規化
This commit is contained in:
parent
ca022cbbdf
commit
5601ed0914
5 changed files with 47 additions and 1 deletions
|
@ -228,7 +228,7 @@ export class AccountMoveService {
|
|||
},
|
||||
}).then(memberships => memberships.map(membership => membership.userListId));
|
||||
|
||||
const newMemberships: Map<string, { createdAt: Date; userId: string; userListId: string; }> = new Map();
|
||||
const newMemberships: Map<string, { createdAt: Date; userId: string; userListId: string; userListUserId: string; }> = new Map();
|
||||
|
||||
// 重複しないようにIDを生成
|
||||
const genId = (): string => {
|
||||
|
@ -244,6 +244,7 @@ export class AccountMoveService {
|
|||
createdAt: new Date(),
|
||||
userId: dst.id,
|
||||
userListId: membership.userListId,
|
||||
userListUserId: membership.userListUserId,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -97,6 +97,7 @@ export class UserListService implements OnApplicationShutdown {
|
|||
createdAt: new Date(),
|
||||
userId: target.id,
|
||||
userListId: list.id,
|
||||
userListUserId: list.userId,
|
||||
} as MiUserListMembership);
|
||||
|
||||
this.globalEventService.publishInternalEvent('userListMemberAdded', { userListId: list.id, memberId: target.id });
|
||||
|
|
|
@ -50,4 +50,11 @@ export class MiUserListMembership {
|
|||
default: false,
|
||||
})
|
||||
public withReplies: boolean;
|
||||
|
||||
//#region Denormalized fields
|
||||
@Column({
|
||||
...id(),
|
||||
})
|
||||
public userListUserId: MiUser['id'];
|
||||
//#endregion
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue