- 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
49 lines
976 B
Go
49 lines
976 B
Go
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
// Copyright (C) 2026 Bryan Joshua Pedini
|
|
|
|
package main
|
|
|
|
import (
|
|
"database/sql"
|
|
"errors"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
type recordRow struct {
|
|
ID int64
|
|
Zone string
|
|
Name string
|
|
TTL sql.NullInt64
|
|
Content sql.NullString
|
|
RecordType string
|
|
}
|
|
|
|
type auditEntry struct {
|
|
ID int64
|
|
Time time.Time
|
|
UserID sql.NullInt64
|
|
Actor string
|
|
Origin string
|
|
Operation string
|
|
Status sql.NullInt64
|
|
Error sql.NullString
|
|
Zone sql.NullString
|
|
RecordID sql.NullInt64
|
|
TargetUserID sql.NullInt64
|
|
Before []byte
|
|
After []byte
|
|
}
|
|
|
|
func stubHashPassword(password string) (string, error) {
|
|
return "", errors.New("password hashing is not available")
|
|
}
|
|
|
|
func stubNormalizeZone(zone string) (string, error) {
|
|
zone = strings.ToLower(strings.TrimSuffix(zone, "."))
|
|
if zone == "" {
|
|
return "", errors.New("invalid zone")
|
|
}
|
|
return zone + ".", nil
|
|
}
|