feat: MyEasyCMS v2 — Full SaaS rebuild
Complete rebuild of 22-year-old PHP CMS as modern SaaS: Database (15 migrations, 42+ tables): - Foundation: account_settings, audit_log, GDPR register, cms_files - Module Engine: modules, fields, records, permissions, relations + RPC - Members: 45+ field member profiles, departments, roles, honors, SEPA mandates - Courses: courses, sessions, categories, instructors, locations, attendance - Bookings: rooms, guests, bookings with availability - Events: events, registrations, holiday passes - Finance: SEPA batches/items (pain.008/001 XML), invoices - Newsletter: campaigns, templates, recipients, subscriptions - Site Builder: site_pages (Puck JSON), site_settings, cms_posts - Portal Auth: member_portal_invitations, user linking Feature Packages (9): - @kit/module-builder — dynamic low-code CRUD engine - @kit/member-management — 31 API methods, 21 actions, 8 components - @kit/course-management, @kit/booking-management, @kit/event-management - @kit/finance — SEPA XML generator + IBAN validator - @kit/newsletter — campaigns + dispatch - @kit/document-generator — PDF/Excel/Word - @kit/site-builder — Puck visual editor, 15 blocks, public rendering Pages (60+): - Dashboard with real stats from all APIs - Full CRUD for all 8 domains with react-hook-form + Zod - Recharts statistics - German i18n throughout - Member portal with auth + invitation system - Public club websites via Puck at /club/[slug] Infrastructure: - Dockerfile (multi-stage, standalone output) - docker-compose.yml (Supabase self-hosted + Next.js) - Kong API gateway config - .env.production.example
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
'use server';
|
||||
|
||||
import { z } from 'zod';
|
||||
import { authActionClient } from '@kit/next/safe-action';
|
||||
import { getLogger } from '@kit/shared/logger';
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
import {
|
||||
CreateCourseSchema,
|
||||
EnrollParticipantSchema,
|
||||
CreateSessionSchema,
|
||||
CreateCategorySchema,
|
||||
CreateInstructorSchema,
|
||||
CreateLocationSchema,
|
||||
} from '../../schema/course.schema';
|
||||
import { createCourseManagementApi } from '../api';
|
||||
|
||||
export const createCourse = authActionClient
|
||||
.inputSchema(CreateCourseSchema)
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createCourseManagementApi(client);
|
||||
|
||||
logger.info({ name: 'course.create' }, 'Creating course...');
|
||||
const result = await api.createCourse(input);
|
||||
logger.info({ name: 'course.create' }, 'Course created');
|
||||
return { success: true, data: result };
|
||||
});
|
||||
|
||||
export const enrollParticipant = authActionClient
|
||||
.inputSchema(EnrollParticipantSchema)
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createCourseManagementApi(client);
|
||||
|
||||
logger.info({ name: 'course.enrollParticipant' }, 'Enrolling participant...');
|
||||
const result = await api.enrollParticipant(input);
|
||||
logger.info({ name: 'course.enrollParticipant' }, 'Participant enrolled');
|
||||
return { success: true, data: result };
|
||||
});
|
||||
|
||||
export const cancelEnrollment = authActionClient
|
||||
.inputSchema(
|
||||
z.object({
|
||||
participantId: z.string().uuid(),
|
||||
}),
|
||||
)
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createCourseManagementApi(client);
|
||||
|
||||
logger.info({ name: 'course.cancelEnrollment' }, 'Cancelling enrollment...');
|
||||
const result = await api.cancelEnrollment(input.participantId);
|
||||
logger.info({ name: 'course.cancelEnrollment' }, 'Enrollment cancelled');
|
||||
return { success: true, data: result };
|
||||
});
|
||||
|
||||
export const markAttendance = authActionClient
|
||||
.inputSchema(
|
||||
z.object({
|
||||
sessionId: z.string().uuid(),
|
||||
participantId: z.string().uuid(),
|
||||
present: z.boolean(),
|
||||
}),
|
||||
)
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createCourseManagementApi(client);
|
||||
|
||||
logger.info({ name: 'course.markAttendance' }, 'Marking attendance...');
|
||||
const result = await api.markAttendance(input.sessionId, input.participantId, input.present);
|
||||
logger.info({ name: 'course.markAttendance' }, 'Attendance marked');
|
||||
return { success: true, data: result };
|
||||
});
|
||||
|
||||
export const createCategory = authActionClient
|
||||
.inputSchema(CreateCategorySchema)
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createCourseManagementApi(client);
|
||||
|
||||
logger.info({ name: 'course.createCategory' }, 'Creating category...');
|
||||
const result = await api.createCategory(input);
|
||||
logger.info({ name: 'course.createCategory' }, 'Category created');
|
||||
return { success: true, data: result };
|
||||
});
|
||||
|
||||
export const createInstructor = authActionClient
|
||||
.inputSchema(CreateInstructorSchema)
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createCourseManagementApi(client);
|
||||
|
||||
logger.info({ name: 'course.createInstructor' }, 'Creating instructor...');
|
||||
const result = await api.createInstructor(input);
|
||||
logger.info({ name: 'course.createInstructor' }, 'Instructor created');
|
||||
return { success: true, data: result };
|
||||
});
|
||||
|
||||
export const createLocation = authActionClient
|
||||
.inputSchema(CreateLocationSchema)
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createCourseManagementApi(client);
|
||||
|
||||
logger.info({ name: 'course.createLocation' }, 'Creating location...');
|
||||
const result = await api.createLocation(input);
|
||||
logger.info({ name: 'course.createLocation' }, 'Location created');
|
||||
return { success: true, data: result };
|
||||
});
|
||||
|
||||
export const createSession = authActionClient
|
||||
.inputSchema(CreateSessionSchema)
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createCourseManagementApi(client);
|
||||
|
||||
logger.info({ name: 'course.createSession' }, 'Creating session...');
|
||||
const result = await api.createSession(input);
|
||||
logger.info({ name: 'course.createSession' }, 'Session created');
|
||||
return { success: true, data: result };
|
||||
});
|
||||
Reference in New Issue
Block a user