Landing page cookbook implementation (Weeks 1-4): Domain Infrastructure: - Add project_domains table with migration (013_project_domains.sql) - Add ProjectDomain model with domain types (primary_auto, primary_custom, alias) - Add SlugGenerator and ProjectDomainRepository interfaces - Implement postgres adapters for domain and slug management Service Layer: - Add domain CRUD methods to ProjectInfraService - Generate 8-char random slugs for auto-domains - Support custom subdomains during project creation - Add site_live health check to project status - Trigger CI build after template seeding Handler Updates: - Add DomainService interface and adapter pattern - Rewrite domain handlers to use database-backed service - Add proper error handling for duplicate/missing domains CI Integration: - Add TriggerBuild to CIProvider interface - Implement TriggerBuild in Woodpecker adapter - Manually trigger initial build after template seed Cookbook & Scripts: - Add landing-test.sh script for E2E testing - Add release.sh for version releases - Add logs.sh for quick log access Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
41 lines
1.3 KiB
Go
41 lines
1.3 KiB
Go
// Package handlers provides HTTP handlers for the rdev API.
|
|
package handlers
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/orchard9/rdev/internal/domain"
|
|
"github.com/orchard9/rdev/internal/service"
|
|
)
|
|
|
|
// DomainServiceAdapter adapts ProjectInfraService to the DomainService interface.
|
|
type DomainServiceAdapter struct {
|
|
svc *service.ProjectInfraService
|
|
}
|
|
|
|
// NewDomainServiceAdapter creates an adapter for the ProjectInfraService.
|
|
func NewDomainServiceAdapter(svc *service.ProjectInfraService) *DomainServiceAdapter {
|
|
return &DomainServiceAdapter{svc: svc}
|
|
}
|
|
|
|
// ListDomains returns all domains for a project.
|
|
func (a *DomainServiceAdapter) ListDomains(ctx context.Context, projectID string) ([]*domain.ProjectDomain, error) {
|
|
return a.svc.ListDomains(ctx, projectID)
|
|
}
|
|
|
|
// AddDomain adds a new domain to a project.
|
|
func (a *DomainServiceAdapter) AddDomain(ctx context.Context, req DomainAddRequest) (*domain.ProjectDomain, error) {
|
|
return a.svc.AddDomain(ctx, service.AddDomainRequest{
|
|
ProjectID: req.ProjectID,
|
|
Domain: req.Domain,
|
|
Type: req.Type,
|
|
RecordType: req.RecordType,
|
|
Proxied: req.Proxied,
|
|
})
|
|
}
|
|
|
|
// RemoveDomain removes a domain from a project.
|
|
func (a *DomainServiceAdapter) RemoveDomain(ctx context.Context, projectID, fqdn string) error {
|
|
return a.svc.RemoveDomain(ctx, projectID, fqdn)
|
|
}
|