Plug trust center part 1

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-01-09 19:14:17 +01:00
committed by Bryan Frimin
parent 663400c4f6
commit 7322201dab
41 changed files with 1959 additions and 1033 deletions

View File

@@ -44,7 +44,7 @@ type (
TrustCenterAccessRequest struct {
TrustCenterID gid.GID
Email mail.Addr
Name string
FullName string
DocumentIDs []gid.GID
ReportIDs []gid.GID
TrustCenterFileIDs []gid.GID
@@ -63,26 +63,6 @@ func (tcar *TrustCenterAccessRequest) Validate() error {
return v.Error()
}
func (s TrustCenterAccessService) ValidateToken(
ctx context.Context,
trustCenterID gid.GID,
email mail.Addr,
) error {
return s.svc.pg.WithConn(ctx, func(conn pg.Conn) error {
access := &coredata.TrustCenterAccess{}
err := access.LoadByTrustCenterIDAndEmail(ctx, conn, s.svc.scope, trustCenterID, email)
if err != nil {
return fmt.Errorf("cannot load trust center access: %w", err)
}
if !access.Active {
return fmt.Errorf("trust center access is not active")
}
return nil
})
}
func (s TrustCenterAccessService) Request(
ctx context.Context,
req *TrustCenterAccessRequest,
@@ -170,7 +150,7 @@ func (s TrustCenterAccessService) Request(
TenantID: s.svc.scope.GetTenantID(),
TrustCenterID: req.TrustCenterID,
Email: req.Email,
Name: req.Name,
Name: req.FullName,
Active: false,
HasAcceptedNonDisclosureAgreement: false,
CreatedAt: now,