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,91 @@
|
||||
'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 {
|
||||
CreateNewsletterSchema,
|
||||
CreateTemplateSchema,
|
||||
} from '../../schema/newsletter.schema';
|
||||
import { createNewsletterApi } from '../api';
|
||||
|
||||
export const createNewsletter = authActionClient
|
||||
.inputSchema(CreateNewsletterSchema)
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createNewsletterApi(client);
|
||||
const userId = ctx.user.id;
|
||||
|
||||
logger.info({ name: 'newsletter.create' }, 'Creating newsletter...');
|
||||
const result = await api.createNewsletter(input, userId);
|
||||
logger.info({ name: 'newsletter.create' }, 'Newsletter created');
|
||||
return { success: true, data: result };
|
||||
});
|
||||
|
||||
export const createTemplate = authActionClient
|
||||
.inputSchema(
|
||||
z.object({
|
||||
accountId: z.string().uuid(),
|
||||
name: z.string().min(1),
|
||||
subject: z.string().min(1),
|
||||
bodyHtml: z.string().min(1),
|
||||
bodyText: z.string().optional(),
|
||||
variables: z.array(z.string()).optional(),
|
||||
}),
|
||||
)
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createNewsletterApi(client);
|
||||
|
||||
logger.info({ name: 'newsletter.createTemplate' }, 'Creating template...');
|
||||
const result = await api.createTemplate(input);
|
||||
logger.info({ name: 'newsletter.createTemplate' }, 'Template created');
|
||||
return { success: true, data: result };
|
||||
});
|
||||
|
||||
export const addRecipients = authActionClient
|
||||
.inputSchema(
|
||||
z.object({
|
||||
newsletterId: z.string().uuid(),
|
||||
accountId: z.string().uuid(),
|
||||
filter: z
|
||||
.object({
|
||||
status: z.array(z.string()).optional(),
|
||||
})
|
||||
.optional(),
|
||||
}),
|
||||
)
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createNewsletterApi(client);
|
||||
|
||||
logger.info({ name: 'newsletter.addRecipients' }, 'Adding recipients...');
|
||||
const result = await api.addRecipientsFromMembers(
|
||||
input.newsletterId,
|
||||
input.accountId,
|
||||
input.filter,
|
||||
);
|
||||
logger.info({ name: 'newsletter.addRecipients' }, 'Recipients added');
|
||||
return { success: true, data: result };
|
||||
});
|
||||
|
||||
export const dispatchNewsletter = authActionClient
|
||||
.inputSchema(
|
||||
z.object({
|
||||
newsletterId: z.string().uuid(),
|
||||
}),
|
||||
)
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createNewsletterApi(client);
|
||||
|
||||
logger.info({ name: 'newsletter.dispatch' }, 'Dispatching newsletter...');
|
||||
const result = await api.dispatch(input.newsletterId);
|
||||
logger.info({ name: 'newsletter.dispatch' }, 'Newsletter dispatched');
|
||||
return { success: true, data: result };
|
||||
});
|
||||
Reference in New Issue
Block a user