boredgame/src/routes/api/publisher/+server.ts

21 lines
521 B
TypeScript
Raw Normal View History

import { createPublisher } from '$lib/utils/db/publisherUtils.js';
import type { Publishers } from '../../../schema.js';
type PublisherCreate = {
publisher: Publishers;
externalId: string;
}
export async function POST({ request, locals }) {
const data: PublisherCreate = await request.json();
console.log('data', data);
try {
return await createPublisher(locals, data.publisher, data.externalId);
} catch (e) {
console.error(e);
return new Response('Could not create publisher', {
status: 500
});
}
}