pack(Many) の me が optional にならないように

This commit is contained in:
riku6460 2023-10-11 04:59:17 +09:00
parent 1a5ba39329
commit df0a663283
No known key found for this signature in database
GPG key ID: 27414FA27DB94CF6
26 changed files with 36 additions and 35 deletions

View file

@ -32,7 +32,7 @@ export class GalleryPostEntityService {
@bindThis
public async pack(
src: MiGalleryPost['id'] | MiGalleryPost,
me?: { id: MiUser['id'] } | null | undefined,
me: { id: MiUser['id'] } | null | undefined,
): Promise<Packed<'GalleryPost'>> {
const meId = me ? me.id : null;
const post = typeof src === 'object' ? src : await this.galleryPostsRepository.findOneByOrFail({ id: src });
@ -58,7 +58,7 @@ export class GalleryPostEntityService {
@bindThis
public async packMany(
posts: MiGalleryPost[],
me?: { id: MiUser['id'] } | null | undefined,
me: { id: MiUser['id'] } | null | undefined,
) : Promise<Packed<'GalleryPost'>[]> {
return (await Promise.allSettled(posts.map(x => this.pack(x, me))))
.filter(result => result.status === 'fulfilled')