Add vendor compliance reports UI

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-04-10 09:31:44 -07:00
parent 9b4b3cc222
commit c63e2756ba
7 changed files with 828 additions and 23 deletions

View File

@@ -63,6 +63,7 @@ func (vcs *VendorComplianceReports) LoadForVendorID(
q := `
SELECT
id,
vendor_id,
report_date,
valid_until,
report_name,
@@ -199,7 +200,8 @@ func (vcr *VendorComplianceReport) Delete(
scope Scoper,
) error {
q := `
DELETE FROM
DELETE
FROM
vendor_compliance_reports
WHERE
%s
@@ -208,7 +210,8 @@ WHERE
q = fmt.Sprintf(q, scope.SQLFragment())
args := pgx.NamedArgs{"id": vcr.ID}
args := pgx.StrictNamedArgs{"id": vcr.ID}
maps.Copy(args, scope.SQLArguments())
_, err := conn.Exec(ctx, q, args)
return err

View File

@@ -186,10 +186,16 @@ func (s VendorComplianceReportService) Delete(
) error {
vendorComplianceReport := &coredata.VendorComplianceReport{ID: vendorComplianceReportID}
return s.svc.pg.WithConn(
err := s.svc.pg.WithConn(
ctx,
func(conn pg.Conn) error {
return vendorComplianceReport.Delete(ctx, conn, s.svc.scope)
},
)
if err != nil {
return fmt.Errorf("cannot delete vendor compliance report: %w", err)
}
return nil
}