feat: 新增客户端作品展示模块
This commit is contained in:
@@ -38,11 +38,18 @@ export class PublicTraceService {
|
||||
@Inject(REDIS_CLIENT) private readonly redis: Redis,
|
||||
) {}
|
||||
|
||||
private mapMedia(items: unknown) {
|
||||
private mapMedia(
|
||||
items: unknown,
|
||||
): Array<{ name?: string; type?: string; description?: string; url: string }> {
|
||||
if (!Array.isArray(items)) return [];
|
||||
return (items as Array<{ key: string; name?: string; type?: string }>)
|
||||
return (items as Array<{ key: string; name?: string; type?: string; description?: string }>)
|
||||
.filter((i) => i && i.key)
|
||||
.map((i) => ({ name: i.name, type: i.type, url: this.storage.getUrl(i.key) }));
|
||||
.map((i) => ({
|
||||
name: i.name,
|
||||
type: i.type,
|
||||
description: i.description,
|
||||
url: this.storage.getUrl(i.key),
|
||||
}));
|
||||
}
|
||||
|
||||
private buildTimeline(
|
||||
@@ -320,6 +327,7 @@ export class PublicTraceService {
|
||||
artist: artwork.artist,
|
||||
archiveNo: artwork.archiveNo,
|
||||
images: this.mapMedia(artwork.images),
|
||||
showcaseImages: this.mapMedia(artwork.showcaseImages),
|
||||
showOutboundTimeline: artwork.showOutboundTimeline,
|
||||
fields: this.buildFields(artwork.template.fields, artwork.dynamicFields),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user