makes profiles public

This commit is contained in:
Christian Beutel
2024-11-16 15:13:22 +01:00
parent 2e8d7f5e82
commit dcc8da83e7
19 changed files with 364 additions and 41 deletions

View File

@@ -11,6 +11,16 @@ export async function GET(event: RequestEvent) {
sort: "+date",
filter: filter
})
for (const t of r) {
if (!t.author || !pb.authStore.model) {
continue;
}
if (!t.expand) {
t.expand = {} as any
}
t.expand.author = await pb.collection("users_anonymous").getOne(t.author);
}
return json(r)
} catch (e: any) {
throw error(e.status, e);

View File

@@ -7,6 +7,12 @@ export async function GET(event: RequestEvent) {
try {
const r = await pb.collection('summit_logs')
.getOne<SummitLog>(event.params.id as string)
if (!r.expand) {
r.expand = {} as any
}
r.expand.author = await pb.collection("users_anonymous").getOne(r.author!);
return json(r)
} catch (e: any) {
throw error(e.status, e);

View File

@@ -21,9 +21,15 @@ export async function GET(event: RequestEvent) {
r.date = r.date?.substring(0, 10) ?? ""
for (const log of r.expand?.summit_logs ?? []) {
log.date = log.date.substring(0, 10)
if (!log.expand) {
log.expand = {} as any
}
log.expand.author = await pb.collection("users_anonymous").getOne(log.author!);
}
return json(r)
} catch (e: any) {
console.error(e)
throw error(e.status || 500, e);
}
}