config: yaml,packages,entities (4 files)

This commit is contained in:
Richard Ward
2025-12-30 21:32:49 +00:00
parent 78b9ff896f
commit c3c4e134da
4 changed files with 657 additions and 0 deletions

View File

@@ -0,0 +1,98 @@
# Schema definitions owned by audit_log package
# Checksum is auto-generated and validated when multiple packages reference same entity
entities:
- name: AuditLog
version: "1.0"
description: "Audit log entry for tracking user and system actions"
checksum: null # Auto-computed from fields
fields:
id:
type: cuid
primary: true
generated: true
tenantId:
type: string
required: true
index: true
userId:
type: string
nullable: true
index: true
username:
type: string
nullable: true
action:
type: string
required: true
index: true
enum: [create, update, delete, login, logout, access, execute, export, import]
entity:
type: string
required: true
maxLength: 100
entityId:
type: string
nullable: true
oldValue:
type: string
nullable: true
description: "JSON: previous state"
newValue:
type: string
nullable: true
description: "JSON: new state"
ipAddress:
type: string
nullable: true
maxLength: 45
userAgent:
type: string
nullable: true
details:
type: string
nullable: true
description: "JSON: additional context"
timestamp:
type: bigint
required: true
index: true
indexes:
- fields: [tenantId]
- fields: [userId]
- fields: [entity, entityId]
- fields: [action]
- fields: [timestamp]
relations:
- name: tenant
type: belongsTo
entity: Tenant
field: tenantId
onDelete: Cascade
- name: user
type: belongsTo
entity: User
field: userId
onDelete: SetNull
optional: true
acl:
create: [admin, system]
read: [admin, god]
update: [supergod]
delete: [supergod]

View File

@@ -0,0 +1,244 @@
# Schema definitions owned by forum_forge package
entities:
- name: ForumCategory
version: "1.0"
description: "Forum category for organizing discussion threads"
checksum: null
fields:
id:
type: cuid
primary: true
generated: true
tenantId:
type: string
required: true
index: true
name:
type: string
required: true
maxLength: 100
description:
type: string
nullable: true
icon:
type: string
nullable: true
slug:
type: string
required: true
maxLength: 100
sortOrder:
type: int
default: 0
parentId:
type: string
nullable: true
index: true
createdAt:
type: bigint
required: true
indexes:
- fields: [tenantId, slug]
unique: true
- fields: [tenantId]
- fields: [parentId]
relations:
- name: tenant
type: belongsTo
entity: Tenant
field: tenantId
onDelete: Cascade
- name: threads
type: hasMany
entity: ForumThread
foreignKey: categoryId
acl:
create: [admin]
read: [public]
update: [admin]
delete: [admin]
- name: ForumThread
version: "1.0"
description: "Forum discussion thread"
checksum: null
fields:
id:
type: cuid
primary: true
generated: true
tenantId:
type: string
required: true
index: true
categoryId:
type: string
required: true
index: true
authorId:
type: string
required: true
index: true
title:
type: string
required: true
maxLength: 200
content:
type: string
required: true
slug:
type: string
required: true
isPinned:
type: boolean
default: false
isLocked:
type: boolean
default: false
viewCount:
type: int
default: 0
replyCount:
type: int
default: 0
lastReplyAt:
type: bigint
nullable: true
lastReplyBy:
type: string
nullable: true
createdAt:
type: bigint
required: true
updatedAt:
type: bigint
nullable: true
indexes:
- fields: [tenantId, slug]
unique: true
- fields: [tenantId]
- fields: [categoryId]
- fields: [authorId]
- fields: [isPinned, lastReplyAt]
relations:
- name: category
type: belongsTo
entity: ForumCategory
field: categoryId
onDelete: Cascade
- name: author
type: belongsTo
entity: User
field: authorId
onDelete: Cascade
- name: posts
type: hasMany
entity: ForumPost
foreignKey: threadId
acl:
create: [user]
read: [public]
update: [self, moderator]
delete: [self, moderator]
rowLevel: "authorId = $user.id"
- name: ForumPost
version: "1.0"
description: "Forum reply/post within a thread"
checksum: null
fields:
id:
type: cuid
primary: true
generated: true
tenantId:
type: string
required: true
index: true
threadId:
type: string
required: true
index: true
authorId:
type: string
required: true
index: true
content:
type: string
required: true
likes:
type: int
default: 0
isEdited:
type: boolean
default: false
createdAt:
type: bigint
required: true
updatedAt:
type: bigint
nullable: true
indexes:
- fields: [tenantId]
- fields: [threadId]
- fields: [authorId]
relations:
- name: thread
type: belongsTo
entity: ForumThread
field: threadId
onDelete: Cascade
- name: author
type: belongsTo
entity: User
field: authorId
onDelete: Cascade
acl:
create: [user]
read: [public]
update: [self, moderator]
delete: [self, moderator]
rowLevel: "authorId = $user.id"

View File

@@ -0,0 +1,230 @@
# Schema definitions owned by irc_webchat package
entities:
- name: IRCChannel
version: "1.0"
description: "IRC-style chat channel"
checksum: null
fields:
id:
type: cuid
primary: true
generated: true
tenantId:
type: string
required: true
index: true
name:
type: string
required: true
maxLength: 50
topic:
type: string
nullable: true
maxLength: 500
description:
type: string
nullable: true
mode:
type: string
required: true
default: "public"
enum: [public, private, secret]
password:
type: string
nullable: true
maxUsers:
type: int
nullable: true
slowMode:
type: int
nullable: true
description: "Seconds between messages"
isDefault:
type: boolean
default: false
index: true
createdAt:
type: bigint
required: true
createdBy:
type: string
nullable: true
indexes:
- fields: [tenantId, name]
unique: true
- fields: [tenantId]
- fields: [isDefault]
relations:
- name: messages
type: hasMany
entity: IRCMessage
foreignKey: channelId
- name: memberships
type: hasMany
entity: IRCMembership
foreignKey: channelId
acl:
create: [moderator]
read: [user]
update: [moderator]
delete: [admin]
- name: IRCMessage
version: "1.0"
description: "IRC chat message"
checksum: null
fields:
id:
type: cuid
primary: true
generated: true
tenantId:
type: string
required: true
channelId:
type: string
required: true
index: true
userId:
type: string
required: true
index: true
username:
type: string
required: true
type:
type: string
required: true
default: "message"
enum: [message, action, notice, system, join, part, kick, ban]
content:
type: string
required: true
isCommand:
type: boolean
default: false
metadata:
type: string
nullable: true
description: "JSON: mentions, links, etc."
createdAt:
type: bigint
required: true
index: true
indexes:
- fields: [channelId]
- fields: [userId]
- fields: [createdAt]
relations:
- name: channel
type: belongsTo
entity: IRCChannel
field: channelId
onDelete: Cascade
acl:
create: [user]
read: [user]
update: [supergod]
delete: [moderator]
- name: IRCMembership
version: "1.0"
description: "User membership in an IRC channel"
checksum: null
fields:
id:
type: cuid
primary: true
generated: true
channelId:
type: string
required: true
index: true
userId:
type: string
required: true
index: true
username:
type: string
required: true
role:
type: string
required: true
default: "user"
enum: [user, voice, halfop, op, admin, owner]
joinedAt:
type: bigint
required: true
lastActive:
type: bigint
nullable: true
isBanned:
type: boolean
default: false
isKicked:
type: boolean
default: false
kickReason:
type: string
nullable: true
metadata:
type: string
nullable: true
indexes:
- fields: [channelId, userId]
unique: true
- fields: [userId]
relations:
- name: channel
type: belongsTo
entity: IRCChannel
field: channelId
onDelete: Cascade
acl:
create: [user]
read: [user]
update: [moderator]
delete: [moderator]

View File

@@ -0,0 +1,85 @@
# Schema definitions owned by notification_center package
entities:
- name: Notification
version: "1.0"
description: "User notification for alerts, messages, and system events"
checksum: null
fields:
id:
type: cuid
primary: true
generated: true
tenantId:
type: string
required: true
index: true
userId:
type: string
required: true
index: true
type:
type: string
required: true
enum: [info, warning, success, error, mention, reply, follow, like, system]
title:
type: string
required: true
maxLength: 200
message:
type: string
required: true
icon:
type: string
nullable: true
read:
type: boolean
default: false
index: true
data:
type: string
nullable: true
description: "JSON: action URLs, entity refs, etc."
createdAt:
type: bigint
required: true
index: true
expiresAt:
type: bigint
nullable: true
index: true
indexes:
- fields: [tenantId]
- fields: [userId, read]
- fields: [createdAt]
relations:
- name: tenant
type: belongsTo
entity: Tenant
field: tenantId
onDelete: Cascade
- name: user
type: belongsTo
entity: User
field: userId
onDelete: Cascade
acl:
create: [system, admin]
read: [self]
update: [self]
delete: [self]
rowLevel: "userId = $user.id"