cmd/server/main.go: replace stub router with full wiring — UserRepo, SessionRepo, AuthService, AuthMiddleware, AuthHandler, NewRouter; use postgres.NewPool instead of pgxpool.New directly. migrations/001_init_schemas.sql: wrap uuid_v7 and uuid_extract_timestamp function bodies with goose StatementBegin/End so semicolons inside dollar-quoted strings are not treated as statement separators. migrations/007_seed_data.sql: add seed admin user (admin/admin, bcrypt cost 10, is_admin=true, can_create=true) for manual testing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
37 lines
1.1 KiB
SQL
37 lines
1.1 KiB
SQL
-- +goose Up
|
|
|
|
INSERT INTO core.object_types (name) VALUES
|
|
('file'), ('tag'), ('category'), ('pool');
|
|
|
|
INSERT INTO activity.action_types (name) VALUES
|
|
-- Auth
|
|
('user_login'), ('user_logout'),
|
|
-- Files
|
|
('file_create'), ('file_edit'), ('file_delete'), ('file_restore'),
|
|
('file_permanent_delete'), ('file_replace'),
|
|
-- Tags
|
|
('tag_create'), ('tag_edit'), ('tag_delete'),
|
|
-- Categories
|
|
('category_create'), ('category_edit'), ('category_delete'),
|
|
-- Pools
|
|
('pool_create'), ('pool_edit'), ('pool_delete'),
|
|
-- Relations
|
|
('file_tag_add'), ('file_tag_remove'),
|
|
('file_pool_add'), ('file_pool_remove'),
|
|
-- ACL
|
|
('acl_change'),
|
|
-- Admin
|
|
('user_create'), ('user_delete'), ('user_block'), ('user_unblock'),
|
|
('user_role_change'),
|
|
-- Sessions
|
|
('session_terminate');
|
|
|
|
INSERT INTO core.users (name, password, is_admin, can_create) VALUES
|
|
('admin', '$2a$10$zk.VTFjRRxbkTE7cKfc7KOWeZfByk1VEkbkgZMJggI1fFf.yDEHZy', true, true);
|
|
|
|
-- +goose Down
|
|
|
|
DELETE FROM core.users WHERE name = 'admin';
|
|
DELETE FROM activity.action_types;
|
|
DELETE FROM core.object_types;
|