fix: recording save functionality and authentication

- Fix artist_name null handling in header component with email fallback
- Fix authentication in recording endpoints to use req.accountability
- Change duration field type from integer to double precision for millisecond precision
- Add createRecording service function with proper authentication
- Update play page to use fetch API for recording saves

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Valknar XXX
2025-10-28 05:16:36 +01:00
parent 5bd2d9c215
commit a252da6d9d
5 changed files with 65 additions and 31 deletions

View File

@@ -127,7 +127,7 @@ function isActiveLink(link: any) {
<LogoutButton
user={{
name: authStatus.user!.artist_name,
name: authStatus.user!.artist_name || authStatus.user!.email.split('@')[0] || 'User',
avatar: getAssetUrl(authStatus.user!.avatar?.id, 'mini')!,
email: authStatus.user!.email
}}

View File

@@ -566,6 +566,38 @@ export async function getRecordings(fetch?: typeof globalThis.fetch) {
);
}
export async function createRecording(
recording: {
title: string;
description?: string;
duration: number;
events: unknown[];
device_info: unknown[];
tags?: string[];
status?: string;
},
fetch?: typeof globalThis.fetch,
) {
return loggedApiCall(
"createRecording",
async () => {
const directus = getDirectusInstance(fetch);
const response = await directus.request<Recording>(
customEndpoint({
method: "POST",
path: "/sexy/recordings",
body: JSON.stringify(recording),
headers: {
"Content-Type": "application/json",
},
}),
);
return response;
},
{ title: recording.title, eventCount: recording.events.length },
);
}
export async function deleteRecording(id: string) {
return loggedApiCall(
"deleteRecording",