new table for settings and store blocked date there;

non admins can't enter avs before the blocked date
new table for survey
This commit is contained in:
Dobromir Popov
2024-06-16 23:33:49 +03:00
parent 901d577b9c
commit 8ca2000ee4
12 changed files with 205 additions and 50 deletions

View File

@ -270,7 +270,7 @@ export const getServerSideProps = async (context) => {
}
});
cartEvents = common.convertDatesToISOStrings(cartEvents);
const lastPublishedDate = (await prisma.shift.findFirst({
let lastPublishedDate = (await prisma.shift.findFirst({
where: {
isPublished: true,
},
@ -280,7 +280,17 @@ export const getServerSideProps = async (context) => {
orderBy: {
endTime: 'desc'
}
})).endTime;
}))?.endTime || new Date();
let blockedDate = await prisma.settings.findUnique({
where: {
key: "AvailabilityBlockDate"
}
});
if (blockedDate)
blockedDate.value = new Date(blockedDate.value);
lastPublishedDate = lastPublishedDate > blockedDate.value ? lastPublishedDate : blockedDate.value;
return {
props: {