fix: conultation interests and datetime

This commit is contained in:
RizqiSyahrendra 2025-02-04 03:05:23 +07:00
parent 8ec9dd5556
commit 845cbdb4e3
3 changed files with 83 additions and 1 deletions

View File

@ -0,0 +1,16 @@
import type { CollectionConfig } from "payload";
export const Interests: CollectionConfig = {
slug: "interests",
fields: [
{
name: "interest",
type: "text",
required: true,
},
],
admin: {
group: "Consultation",
description: "This is the procedure interests that can be selected when request a consultation",
},
};

View File

@ -0,0 +1,63 @@
import type { GlobalConfig } from "payload";
export const ConsultationDateTime: GlobalConfig = {
slug: "consultation-datetime",
label: "Consultation Date & Time",
fields: [
{
name: "day",
type: "group",
fields: [
{
type: "checkbox",
name: "monday",
},
{
type: "checkbox",
name: "tuesday",
},
{
type: "checkbox",
name: "wednesday",
},
{
type: "checkbox",
name: "thursday",
},
{
type: "checkbox",
name: "friday",
},
{
type: "checkbox",
name: "saturday",
},
],
},
{
name: "time",
type: "array",
fields: [
{
name: "name",
type: "text",
required: true,
},
{
name: "start",
type: "text",
required: true,
},
{
name: "end",
type: "text",
required: true,
},
],
},
],
admin: {
group: "Consultation",
description: "Date and time available for consultation",
},
};

View File

@ -10,6 +10,8 @@ import sharp from "sharp";
import { Users } from "./collections/Users"; import { Users } from "./collections/Users";
import { Media } from "./collections/Media"; import { Media } from "./collections/Media";
import { Blogs } from "./collections/Blogs"; import { Blogs } from "./collections/Blogs";
import { Interests } from "./collections/consultations/Interests";
import { ConsultationDateTime } from "./collections/consultations/consultation-datetime";
const filename = fileURLToPath(import.meta.url); const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename); const dirname = path.dirname(filename);
@ -21,7 +23,8 @@ export default buildConfig({
baseDir: path.resolve(dirname), baseDir: path.resolve(dirname),
}, },
}, },
collections: [Users, Media, Blogs], collections: [Users, Media, Blogs, Interests],
globals: [ConsultationDateTime],
secret: process.env.PAYLOAD_SECRET || "", secret: process.env.PAYLOAD_SECRET || "",
typescript: { typescript: {
outputFile: path.resolve(dirname, "payload-types.ts"), outputFile: path.resolve(dirname, "payload-types.ts"),