Changes: - Add FAL_KEY and GEMINI_API_KEY to .env.example - Update picture-it to use ~/.config/opencode/.env (unified creds) - Remove shodh-memory skill (no longer used) - Remove alphaear-* skills (deprecated) - Remove thai-frontend-dev skill (replaced by website-creator) - Remove theme-factory skill - Add mql-developer skill (MQL5 trading) - Add ecommerce-astro skill (Astro e-commerce) - Add website-creator skill (Next.js + Payload CMS) - Update install script for new skills
123 lines
2.8 KiB
TypeScript
123 lines
2.8 KiB
TypeScript
import type { CollectionConfig } from 'payload'
|
|
|
|
export interface ConsentLogData {
|
|
action: 'accept' | 'reject' | 'update'
|
|
purpose: 'analytics' | 'marketing' | 'functional' | 'all'
|
|
userAgent?: string
|
|
ip?: string
|
|
timestamp: string
|
|
previousConsent?: Record<string, boolean>
|
|
newConsent?: Record<string, boolean>
|
|
}
|
|
|
|
const ConsentLogs: CollectionConfig = {
|
|
slug: 'consent-logs',
|
|
admin: {
|
|
useAsTitle: 'timestamp',
|
|
defaultColumns: ['timestamp', 'action', 'purpose', 'ip'],
|
|
description: 'Log of all consent actions for PDPA compliance',
|
|
},
|
|
access: {
|
|
create: () => true, // Allow anyone to create consent logs (public endpoint)
|
|
read: () => true, // Allow reading for compliance purposes
|
|
update: () => false, // Consent logs should not be modified
|
|
delete: () => false, // Consent logs should not be deleted
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'action',
|
|
type: 'select',
|
|
required: true,
|
|
options: [
|
|
{ label: 'Accept', value: 'accept' },
|
|
{ label: 'Reject', value: 'reject' },
|
|
{ label: 'Update', value: 'update' },
|
|
],
|
|
admin: {
|
|
description: 'The type of consent action',
|
|
},
|
|
},
|
|
{
|
|
name: 'purpose',
|
|
type: 'select',
|
|
required: true,
|
|
options: [
|
|
{ label: 'Analytics', value: 'analytics' },
|
|
{ label: 'Marketing', value: 'marketing' },
|
|
{ label: 'Functional', value: 'functional' },
|
|
{ label: 'All', value: 'all' },
|
|
],
|
|
admin: {
|
|
description: 'The purpose of the consent',
|
|
},
|
|
},
|
|
{
|
|
name: 'analytics',
|
|
type: 'checkbox',
|
|
defaultValue: false,
|
|
admin: {
|
|
description: 'Consent for analytics cookies',
|
|
},
|
|
},
|
|
{
|
|
name: 'marketing',
|
|
type: 'checkbox',
|
|
defaultValue: false,
|
|
admin: {
|
|
description: 'Consent for marketing cookies',
|
|
},
|
|
},
|
|
{
|
|
name: 'functional',
|
|
type: 'checkbox',
|
|
defaultValue: false,
|
|
admin: {
|
|
description: 'Consent for functional cookies',
|
|
},
|
|
},
|
|
{
|
|
name: 'userAgent',
|
|
type: 'text',
|
|
admin: {
|
|
readOnly: true,
|
|
description: 'Browser user agent string',
|
|
},
|
|
},
|
|
{
|
|
name: 'ip',
|
|
type: 'text',
|
|
admin: {
|
|
readOnly: true,
|
|
description: 'IP address of the user',
|
|
},
|
|
},
|
|
{
|
|
name: 'timestamp',
|
|
type: 'date',
|
|
required: true,
|
|
admin: {
|
|
readOnly: true,
|
|
description: 'When the consent was given',
|
|
},
|
|
},
|
|
{
|
|
name: 'previousConsent',
|
|
type: 'json',
|
|
admin: {
|
|
readOnly: true,
|
|
description: 'Previous consent state (for updates)',
|
|
},
|
|
},
|
|
{
|
|
name: 'newConsent',
|
|
type: 'json',
|
|
admin: {
|
|
readOnly: true,
|
|
description: 'New consent state',
|
|
},
|
|
},
|
|
],
|
|
}
|
|
|
|
export default ConsentLogs
|