feat(server): Loader/Recorder на Store, wiring cmd/server (config→migrate→pool→api)

This commit is contained in:
2026-07-03 14:41:09 +07:00
parent 05dc586646
commit 763919d23f
5 changed files with 232 additions and 0 deletions
+28
View File
@@ -9,6 +9,7 @@ import (
"context"
"github.com/google/uuid"
dto "github.com/vasyakrg/dns-autoresolver/internal/store/dto"
)
const createDomain = `-- name: CreateDomain :one
@@ -117,3 +118,30 @@ func (q *Queries) ListDomains(ctx context.Context, projectID uuid.UUID) ([]Domai
}
return items, nil
}
const loadDomainFull = `-- name: LoadDomainFull :one
SELECT d.zone_id, a.provider, a.secret_enc, t.doc
FROM domains d
JOIN provider_accounts a ON a.id = d.provider_account_id
LEFT JOIN templates t ON t.id = d.template_id
WHERE d.id = $1
`
type LoadDomainFullRow struct {
ZoneID string `json:"zone_id"`
Provider string `json:"provider"`
SecretEnc string `json:"secret_enc"`
Doc *dto.TemplateDoc `json:"doc"`
}
func (q *Queries) LoadDomainFull(ctx context.Context, id uuid.UUID) (LoadDomainFullRow, error) {
row := q.db.QueryRow(ctx, loadDomainFull, id)
var i LoadDomainFullRow
err := row.Scan(
&i.ZoneID,
&i.Provider,
&i.SecretEnc,
&i.Doc,
)
return i, err
}