Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435import type { Did } from "@atcute/lexicons/syntax";import type { OAuthUserAgent } from "@atcute/oauth-browser-client";import { getOrCreateDelegatedSession } from "$lib/api/actAs";import { PROFILE_COLLECTION } from "$lib/api/profile";import type { BobbinContext } from "$lib/api/client";import { saveAvatar, writeProfile } from "$lib/api/profileSettings";import type { ProfileRecord } from "$lib/api/records";
export const saveOrganizationProfile = async ( ctx: BobbinContext, controllerAgent: OAuthUserAgent, orgDid: Did, record: ProfileRecord): Promise<ProfileRecord> => { const written: ProfileRecord = { ...record, isOrganization: true }; const orgAgent = await getOrCreateDelegatedSession(controllerAgent, orgDid); return writeProfile(ctx, orgAgent, written);};
export const saveOrganizationAvatar = async ( ctx: BobbinContext, controllerAgent: OAuthUserAgent, orgDid: Did, image: Blob | null, current: ProfileRecord | null): Promise<ProfileRecord> => { const orgAgent = await getOrCreateDelegatedSession(controllerAgent, orgDid); return saveAvatar(ctx, orgAgent, image, { $type: PROFILE_COLLECTION, bluesky: false, ...current, isOrganization: true });};