feat(models): add new models for public API, event log, hook, session, user, and whatsapp account
Some checks failed
CI / Test (1.23) (push) Failing after -22m31s
CI / Test (1.22) (push) Failing after -22m34s
CI / Build (push) Failing after -22m43s
CI / Lint (push) Failing after -22m27s

* Introduced ModelPublicAPIKey, ModelPublicEventLog, ModelPublicHook, ModelPublicSession, ModelPublicUser, and ModelPublicWhatsappAccount
* Removed deprecated ModelPublicUsers
* Updated database schema definitions to reflect new model structure
* Adjusted seed data to use correct types for timestamps
This commit is contained in:
Hein
2026-02-20 16:19:49 +02:00
parent 524bc4179b
commit 3b6d0f81d2
10 changed files with 157 additions and 167 deletions

View File

@@ -1,7 +1,7 @@
// WhatsHooked Database Schema
// This file defines the database schema for WhatsHooked Phase 2
Table users {
Table user {
id varchar(36) [primary key, note: 'UUID']
username varchar(255) [unique, not null]
email varchar(255) [unique, not null]
@@ -18,7 +18,7 @@ Table users {
}
}
Table api_keys {
Table api_key {
id varchar(36) [primary key, note: 'UUID']
user_id varchar(36) [not null, ref: > users.id]
name varchar(255) [not null, note: 'Friendly name for the API key']
@@ -38,7 +38,7 @@ Table api_keys {
}
}
Table hooks {
Table hook {
id varchar(36) [primary key, note: 'UUID']
user_id varchar(36) [not null, ref: > users.id]
name varchar(255) [not null]
@@ -62,7 +62,7 @@ Table hooks {
}
}
Table whatsapp_accounts {
Table whatsapp_account {
id varchar(36) [primary key, note: 'UUID']
user_id varchar(36) [not null, ref: > users.id]
account_type varchar(50) [not null, note: 'whatsmeow or business-api']
@@ -83,7 +83,7 @@ Table whatsapp_accounts {
}
}
Table event_logs {
Table event_log {
id varchar(36) [primary key, note: 'UUID']
user_id varchar(36) [ref: > users.id, note: 'Optional user reference']
event_type varchar(100) [not null]
@@ -106,7 +106,7 @@ Table event_logs {
}
}
Table sessions {
Table session {
id varchar(36) [primary key, note: 'UUID']
user_id varchar(36) [not null, ref: > users.id]
token varchar(255) [unique, not null, note: 'Session token hash']