Adapt to new sql model

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-10-02 00:20:04 +02:00
parent 7d7acbcf14
commit 7a4046ad65
4 changed files with 11 additions and 24 deletions

View File

@@ -130,10 +130,8 @@ func (p *Provisioner) provisionDomainCertificate(
return err
}
// Update domain with challenge details and set to PROVISIONING
scope := coredata.NewScope(domain.OrganizationID.TenantID())
fullDomain := &coredata.CustomDomain{}
if err := fullDomain.LoadByIDForUpdate(ctx, conn, scope, p.encryptionKey, domain.ID); err != nil {
if err := fullDomain.LoadByIDForUpdate(ctx, conn, coredata.NewNoScope(), p.encryptionKey, domain.ID); err != nil {
return fmt.Errorf("cannot load domain for update: %w", err)
}
@@ -143,7 +141,7 @@ func (p *Provisioner) provisionDomainCertificate(
fullDomain.HTTPOrderURL = &challenge.OrderURL
fullDomain.SSLStatus = coredata.CustomDomainSSLStatusProvisioning
if err := fullDomain.Update(ctx, conn, scope, p.encryptionKey); err != nil {
if err := fullDomain.Update(ctx, conn, coredata.NewNoScope(), p.encryptionKey); err != nil {
return fmt.Errorf("failed to update domain with challenge: %w", err)
}
@@ -157,7 +155,6 @@ func (p *Provisioner) provisionDomainCertificate(
return nil
}
// Domain already has challenge details, complete it
challenge := &HTTPChallenge{
Domain: domain.Domain,
Token: *domain.HTTPChallengeToken,
@@ -185,9 +182,8 @@ func (p *Provisioner) provisionDomainCertificate(
log.Time("expires_at", cert.ExpiresAt),
)
scope := coredata.NewScope(domain.OrganizationID.TenantID())
fullDomain := &coredata.CustomDomain{}
if err := fullDomain.LoadByID(ctx, conn, scope, p.encryptionKey, domain.ID); err != nil {
if err := fullDomain.LoadByID(ctx, conn, coredata.NewNoScope(), p.encryptionKey, domain.ID); err != nil {
return fmt.Errorf("cannot load domain: %w", err)
}
@@ -203,7 +199,7 @@ func (p *Provisioner) provisionDomainCertificate(
fullDomain.HTTPChallengeURL = nil
fullDomain.HTTPOrderURL = nil
if err := fullDomain.Update(ctx, conn, scope, p.encryptionKey); err != nil {
if err := fullDomain.Update(ctx, conn, coredata.NewNoScope(), p.encryptionKey); err != nil {
return fmt.Errorf("cannot update domain: %w", err)
}