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

@@ -128,10 +128,8 @@ func (r *Renewer) checkAndRenew(ctx context.Context) error {
}
func (r *Renewer) renewDomain(ctx context.Context, conn pg.Conn, domain *coredata.CustomDomain) error {
scope := coredata.NewScope(domain.OrganizationID.TenantID())
lockedDomain := &coredata.CustomDomain{}
if err := lockedDomain.LoadByIDForUpdate(ctx, conn, scope, r.encryptionKey, domain.ID); err != nil {
if err := lockedDomain.LoadByIDForUpdate(ctx, conn, coredata.NewNoScope(), r.encryptionKey, domain.ID); err != nil {
return fmt.Errorf("cannot lock domain for renewal: %w", err)
}
@@ -166,7 +164,7 @@ func (r *Renewer) renewDomain(ctx context.Context, conn pg.Conn, domain *coredat
lockedDomain.HTTPOrderURL = &challenge.OrderURL
lockedDomain.SSLStatus = coredata.CustomDomainSSLStatusRenewing
if err := lockedDomain.Update(ctx, conn, scope, r.encryptionKey); err != nil {
if err := lockedDomain.Update(ctx, conn, coredata.NewNoScope(), r.encryptionKey); err != nil {
return fmt.Errorf("cannot update domain with renewal challenge: %w", err)
}
@@ -195,7 +193,7 @@ func (r *Renewer) renewDomain(ctx context.Context, conn pg.Conn, domain *coredat
lockedDomain.HTTPChallengeURL = nil
lockedDomain.HTTPOrderURL = nil
if err := lockedDomain.Update(ctx, conn, scope, r.encryptionKey); err != nil {
if err := lockedDomain.Update(ctx, conn, coredata.NewNoScope(), r.encryptionKey); err != nil {
return fmt.Errorf("cannot update domain with renewed certificate: %w", err)
}