2024-09-04 23:04:41 +00:00
|
|
|
import type { Publishers } from '$db/schema'
|
|
|
|
|
import { getPublisher, updatePublisher } from '$lib/utils/db/publisherUtils.js'
|
2024-02-21 01:47:37 +00:00
|
|
|
|
|
|
|
|
export async function GET({ locals, params }) {
|
|
|
|
|
try {
|
2024-09-04 23:04:41 +00:00
|
|
|
return await getPublisher(locals, params.id)
|
2024-02-21 01:47:37 +00:00
|
|
|
} catch (e) {
|
2024-09-04 23:04:41 +00:00
|
|
|
console.error(e)
|
|
|
|
|
return new Response('Could not get publishersTable', {
|
2024-05-08 00:19:13 +00:00
|
|
|
status: 500,
|
2024-09-04 23:04:41 +00:00
|
|
|
})
|
2024-02-21 01:47:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function PUT({ locals, params, request }) {
|
2024-09-04 23:04:41 +00:00
|
|
|
const data: Publishers = await request.json()
|
|
|
|
|
const publisherId = params.id
|
|
|
|
|
return await updatePublisher(locals, data, publisherId)
|
2024-05-08 00:19:13 +00:00
|
|
|
}
|