chore: owner role for album_user

This commit is contained in:
Alex Tran
2026-04-02 14:27:40 +00:00
parent 2166f07b1f
commit c509e5dc73
10 changed files with 173 additions and 55 deletions
+12 -3
View File
@@ -1,5 +1,5 @@
import { Selectable } from 'kysely';
import { AssetOrder } from 'src/enum';
import { AlbumUserRole, AssetOrder } from 'src/enum';
import { AlbumTable } from 'src/schema/tables/album.table';
import { SharedLinkTable } from 'src/schema/tables/shared-link.table';
import { AlbumUserFactory } from 'test/factories/album-user.factory';
@@ -76,11 +76,20 @@ export class AlbumFactory {
}
build() {
const owner = this.#owner.build();
const ownerAlbumUser = AlbumUserFactory.from({
albumId: this.value.id,
userId: owner.id,
role: AlbumUserRole.Owner,
})
.user(owner)
.build();
return {
...this.value,
owner: this.#owner.build(),
owner,
assets: this.#assets.map((asset) => asset.build()),
albumUsers: this.#albumUsers.map((albumUser) => albumUser.build()),
albumUsers: [ownerAlbumUser, ...this.#albumUsers.map((albumUser) => albumUser.build())],
sharedLinks: this.#sharedLinks,
};
}