build: add makefile, dockerfile, ci and development stack

- build: add makefile, dockerfile, ci and development stack
- feat(config): add environment configuration and logger
- feat(server): add server lifecycle with health and version routes
- feat(db): add connection, contract check, migrations and stores
- feat(cli): add command dispatch and user management
- test(db): add integration tests against mysql
This commit is contained in:
bryanpedini committed 2026-11-19 15:46:12 +01:00
1 parent 45d1e307c6
commit 7089a6f408
46 files changed
+8456

No files matched your search

+71
View File
@@ -0,0 +1,71 @@
-- SPDX-License-Identifier: GPL-2.0-or-later
-- Copyright (C) 2026 Bryan Joshua Pedini
CREATE TABLE IF NOT EXISTS `{prefix}webui_schema` (
`id` TINYINT NOT NULL,
`version` INT NOT NULL,
PRIMARY KEY (`id`),
CHECK (`id` = 1)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci;
CREATE TABLE `{prefix}webui_users` (
`id` INT NOT NULL AUTO_INCREMENT,
`username` VARCHAR(64) NOT NULL,
`role` VARCHAR(8) NOT NULL,
`password_hash` VARCHAR(255) NOT NULL,
`created_at` DATETIME(6) NOT NULL,
`updated_at` DATETIME(6) NOT NULL,
`last_login_at` DATETIME(6) NULL,
`deleted_at` DATETIME(6) NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
CHECK (`role` IN ('admin', 'user'))
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci;
CREATE TABLE `{prefix}webui_sessions` (
`token_hash` BINARY(32) NOT NULL,
`user_id` INT NOT NULL,
`created_at` DATETIME(6) NOT NULL,
`last_seen_at` DATETIME(6) NOT NULL,
`expires_at` DATETIME(6) NOT NULL,
`origin` VARCHAR(45) NOT NULL,
`user_agent` VARCHAR(255) NOT NULL,
PRIMARY KEY (`token_hash`),
KEY `user_id` (`user_id`),
KEY `expires_at` (`expires_at`),
FOREIGN KEY (`user_id`) REFERENCES `{prefix}webui_users` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci;
CREATE TABLE `{prefix}webui_zone_delegations` (
`zone` VARCHAR(255) NOT NULL,
`user_id` INT NOT NULL,
`created_at` DATETIME(6) NOT NULL,
`created_by` INT NOT NULL,
PRIMARY KEY (`zone`, `user_id`),
KEY `user_id` (`user_id`),
FOREIGN KEY (`user_id`) REFERENCES `{prefix}webui_users` (`id`),
FOREIGN KEY (`created_by`) REFERENCES `{prefix}webui_users` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci;
CREATE TABLE `{prefix}webui_audit` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`time` DATETIME(6) NOT NULL,
`user_id` INT NULL,
`actor` VARCHAR(64) NOT NULL,
`origin` VARCHAR(45) NOT NULL,
`operation` VARCHAR(32) NOT NULL,
`status` SMALLINT NULL,
`error` VARCHAR(255) NULL,
`zone` VARCHAR(255) NULL,
`record_id` INT NULL,
`target_user_id` INT NULL,
`before_value` JSON NULL,
`after_value` JSON NULL,
PRIMARY KEY (`id`),
KEY `time` (`time`),
KEY `zone_time` (`zone`, `time`),
KEY `user_time` (`user_id`, `time`),
KEY `operation_time` (`operation`, `time`),
FOREIGN KEY (`user_id`) REFERENCES `{prefix}webui_users` (`id`),
FOREIGN KEY (`target_user_id`) REFERENCES `{prefix}webui_users` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci;