MCPcopy
hub / github.com/CapSoftware/Cap / resolveIconUrls

Function resolveIconUrls

apps/web/lib/public-collections.ts:200–226  ·  view source on GitHub ↗
(keys: {
	organizationIconUrl: ImageUpload.ImageUrlOrKey | null;
	collectionLogoUrl: ImageUpload.ImageUrlOrKey | null;
})

Source from the content-addressed store, hash-verified

198}
199
200async function resolveIconUrls(keys: {
201 organizationIconUrl: ImageUpload.ImageUrlOrKey | null;
202 collectionLogoUrl: ImageUpload.ImageUrlOrKey | null;
203}): Promise<{
204 organizationIconUrl: ImageUpload.ImageUrl | null;
205 collectionLogoUrl: ImageUpload.ImageUrl | null;
206}> {
207 const empty = {
208 organizationIconUrl: null,
209 collectionLogoUrl: null,
210 };
211
212 if (!keys.organizationIconUrl && !keys.collectionLogoUrl) {
213 return empty;
214 }
215
216 return Effect.gen(function* () {
217 const imageUploads = yield* ImageUploads;
218 const resolve = (key: ImageUpload.ImageUrlOrKey | null) =>
219 key ? imageUploads.resolveImageUrl(key) : Effect.succeed(null);
220
221 return {
222 organizationIconUrl: yield* resolve(keys.organizationIconUrl),
223 collectionLogoUrl: yield* resolve(keys.collectionLogoUrl),
224 };
225 }).pipe(runPromise);
226}
227
228function collectionLogoKey(
229 publicPage: Required<PublicCollectionDomain.PublicPageSettings>,

Callers 1

Calls 1

resolveFunction · 0.70

Tested by

no test coverage detected