Compare commits

..

1 commit

Author SHA1 Message Date
f3a7de357e
feat(blocked_slots): add blocked slots
Some checks failed
container-scan / Container Scan (pull_request) Failing after 35s
docker-build / docker (pull_request) Failing after 2m12s
tests / Tests (pull_request) Failing after 1m55s
2025-06-30 20:13:56 +02:00
4 changed files with 18 additions and 34 deletions

View file

@ -1,9 +1,5 @@
import BlockedSlotForm from '@/components/forms/blocked-slot-form';
export default function NewBlockedSlotPage({
params,
}: {
params: { slotId?: string };
}) {
export default function NewBlockedSlotPage({ params }: { params: { slotId?: string } }) {
return <BlockedSlotForm existingBlockedSlotId={params.slotId} />;
}

View file

@ -11,9 +11,7 @@ export default function BlockedSlots() {
if (isLoading) return <div className='text-center mt-10'>Loading...</div>;
if (error)
return (
<div className='text-center mt-10 text-red-500'>
Error loading blocked slots
</div>
<div className='text-center mt-10 text-red-500'>Error loading blocked slots</div>
);
const blockedSlots = blockedSlotsData?.data?.blocked_slots || [];

View file

@ -54,15 +54,11 @@ export const GET = auth(async function GET(req, { params }) {
);
}
return returnZodTypeCheckedResponse(
BlockedSlotResponseSchema,
{
return returnZodTypeCheckedResponse(BlockedSlotResponseSchema, {
blocked_slot: blockedSlot,
},
{
}, {
status: 200,
},
);
});
});
export const PATCH = auth(async function PATCH(req, { params }) {

View file

@ -20,10 +20,7 @@ import Logo from '../misc/logo';
import { eventStartTimeSchema } from '@/app/api/event/validation';
import zod from 'zod/v4';
const dateForDateTimeInputValue = (date: Date) =>
new Date(date.getTime() + new Date().getTimezoneOffset() * -60 * 1000)
.toISOString()
.slice(0, 19);
const dateForDateTimeInputValue = (date: Date) => new Date(date.getTime() + new Date().getTimezoneOffset() * -60 * 1000).toISOString().slice(0, 19)
export default function BlockedSlotForm({
existingBlockedSlotId,
@ -112,21 +109,18 @@ export default function BlockedSlotForm({
]);
const onUpdateSubmit = handleUpdateSubmit(async (data) => {
await updateBlockedSlot(
{
await updateBlockedSlot({
data: {
...data,
start_time: new Date(data.start_time).toISOString(),
end_time: new Date(data.end_time).toISOString(),
},
slotID: existingBlockedSlotId || '',
},
{
}, {
onSuccess: () => {
router.back();
},
},
);
});
});
const onDeleteSubmit = async () => {