Refactor ID generarion
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -87,11 +87,7 @@ func (s *ConnectorService) CreateOrUpdate(
|
|||||||
return nil, fmt.Errorf("connection configuration is required")
|
return nil, fmt.Errorf("connection configuration is required")
|
||||||
}
|
}
|
||||||
|
|
||||||
connectorID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.ConnectorEntityType)
|
connectorID := gid.New(s.svc.scope.GetTenantID(), coredata.ConnectorEntityType)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot create connector global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
connector := &coredata.Connector{
|
connector := &coredata.Connector{
|
||||||
@@ -104,7 +100,7 @@ func (s *ConnectorService) CreateOrUpdate(
|
|||||||
UpdatedAt: now,
|
UpdatedAt: now,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.svc.pg.WithConn(
|
err := s.svc.pg.WithConn(
|
||||||
ctx,
|
ctx,
|
||||||
func(conn pg.Conn) error {
|
func(conn pg.Conn) error {
|
||||||
if err := connector.Upsert(ctx, conn, s.svc.scope, s.svc.encryptionKey); err != nil {
|
if err := connector.Upsert(ctx, conn, s.svc.scope, s.svc.encryptionKey); err != nil {
|
||||||
|
|||||||
@@ -85,11 +85,7 @@ func (s EvidenceService) Request(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req RequestEvidenceRequest,
|
req RequestEvidenceRequest,
|
||||||
) (*coredata.Evidence, error) {
|
) (*coredata.Evidence, error) {
|
||||||
evidenceID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.EvidenceEntityType)
|
evidenceID := gid.New(s.svc.scope.GetTenantID(), coredata.EvidenceEntityType)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot create evidence global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
evidence := &coredata.Evidence{
|
evidence := &coredata.Evidence{
|
||||||
@@ -103,7 +99,7 @@ func (s EvidenceService) Request(
|
|||||||
UpdatedAt: now,
|
UpdatedAt: now,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.svc.pg.WithConn(
|
err := s.svc.pg.WithConn(
|
||||||
ctx,
|
ctx,
|
||||||
func(conn pg.Conn) error {
|
func(conn pg.Conn) error {
|
||||||
return evidence.Insert(ctx, conn, s.svc.scope)
|
return evidence.Insert(ctx, conn, s.svc.scope)
|
||||||
@@ -192,10 +188,7 @@ func (s EvidenceService) Create(
|
|||||||
req CreateEvidenceRequest,
|
req CreateEvidenceRequest,
|
||||||
) (*coredata.Evidence, error) {
|
) (*coredata.Evidence, error) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
evidenceID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.EvidenceEntityType)
|
evidenceID := gid.New(s.svc.scope.GetTenantID(), coredata.EvidenceEntityType)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot create evidence global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
referenceID, err := uuid.NewV4()
|
referenceID, err := uuid.NewV4()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -61,10 +61,7 @@ func (s FrameworkService) Create(
|
|||||||
req CreateFrameworkRequest,
|
req CreateFrameworkRequest,
|
||||||
) (*coredata.Framework, error) {
|
) (*coredata.Framework, error) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
frameworkID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.FrameworkEntityType)
|
frameworkID := gid.New(s.svc.scope.GetTenantID(), coredata.FrameworkEntityType)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot create global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
framework := &coredata.Framework{
|
framework := &coredata.Framework{
|
||||||
ID: frameworkID,
|
ID: frameworkID,
|
||||||
@@ -76,7 +73,7 @@ func (s FrameworkService) Create(
|
|||||||
UpdatedAt: now,
|
UpdatedAt: now,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.svc.pg.WithConn(
|
err := s.svc.pg.WithConn(
|
||||||
ctx,
|
ctx,
|
||||||
func(conn pg.Conn) error {
|
func(conn pg.Conn) error {
|
||||||
return framework.Insert(ctx, conn, s.svc.scope)
|
return framework.Insert(ctx, conn, s.svc.scope)
|
||||||
@@ -187,10 +184,7 @@ func (s FrameworkService) Import(
|
|||||||
organizationID gid.GID,
|
organizationID gid.GID,
|
||||||
req ImportFrameworkRequest,
|
req ImportFrameworkRequest,
|
||||||
) (*coredata.Framework, error) {
|
) (*coredata.Framework, error) {
|
||||||
frameworkID, err := gid.NewGID(organizationID.TenantID(), coredata.FrameworkEntityType)
|
frameworkID := gid.New(organizationID.TenantID(), coredata.FrameworkEntityType)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot create global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
framework := &coredata.Framework{
|
framework := &coredata.Framework{
|
||||||
@@ -204,10 +198,7 @@ func (s FrameworkService) Import(
|
|||||||
|
|
||||||
importedControls := coredata.Controls{}
|
importedControls := coredata.Controls{}
|
||||||
for _, control := range req.Framework.Controls {
|
for _, control := range req.Framework.Controls {
|
||||||
controlID, err := gid.NewGID(organizationID.TenantID(), coredata.ControlEntityType)
|
controlID := gid.New(organizationID.TenantID(), coredata.ControlEntityType)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot create global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
control := &coredata.Control{
|
control := &coredata.Control{
|
||||||
@@ -224,12 +215,10 @@ func (s FrameworkService) Import(
|
|||||||
importedControls = append(importedControls, control)
|
importedControls = append(importedControls, control)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.svc.pg.WithTx(
|
err := s.svc.pg.WithTx(
|
||||||
ctx,
|
ctx,
|
||||||
func(tx pg.Conn) error {
|
func(tx pg.Conn) error {
|
||||||
|
if err := framework.Insert(ctx, tx, s.svc.scope); err != nil {
|
||||||
err := framework.Insert(ctx, tx, s.svc.scope)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("cannot insert framework: %w", err)
|
return fmt.Errorf("cannot insert framework: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -144,10 +144,7 @@ func (s MeasureService) Import(
|
|||||||
for i := range req.Measures {
|
for i := range req.Measures {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
measureID, err := gid.NewGID(organizationID.TenantID(), coredata.MeasureEntityType)
|
measureID := gid.New(organizationID.TenantID(), coredata.MeasureEntityType)
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("cannot create global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
measure := &coredata.Measure{
|
measure := &coredata.Measure{
|
||||||
ID: measureID,
|
ID: measureID,
|
||||||
@@ -168,10 +165,7 @@ func (s MeasureService) Import(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for j := range req.Measures[i].Tasks {
|
for j := range req.Measures[i].Tasks {
|
||||||
taskID, err := gid.NewGID(organizationID.TenantID(), coredata.TaskEntityType)
|
taskID := gid.New(organizationID.TenantID(), coredata.TaskEntityType)
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("cannot create global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
task := &coredata.Task{
|
task := &coredata.Task{
|
||||||
ID: taskID,
|
ID: taskID,
|
||||||
@@ -189,10 +183,7 @@ func (s MeasureService) Import(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for k := range req.Measures[i].Tasks[j].RequestedEvidences {
|
for k := range req.Measures[i].Tasks[j].RequestedEvidences {
|
||||||
evidenceID, err := gid.NewGID(organizationID.TenantID(), coredata.EvidenceEntityType)
|
evidenceID := gid.New(organizationID.TenantID(), coredata.EvidenceEntityType)
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("cannot create global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
evidence := &coredata.Evidence{
|
evidence := &coredata.Evidence{
|
||||||
State: coredata.EvidenceStateRequested,
|
State: coredata.EvidenceStateRequested,
|
||||||
@@ -332,10 +323,7 @@ func (s MeasureService) Create(
|
|||||||
req CreateMeasureRequest,
|
req CreateMeasureRequest,
|
||||||
) (*coredata.Measure, error) {
|
) (*coredata.Measure, error) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
measureID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.MeasureEntityType)
|
measureID := gid.New(s.svc.scope.GetTenantID(), coredata.MeasureEntityType)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot create measure global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
referenceID, err := uuid.NewV4()
|
referenceID, err := uuid.NewV4()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -50,10 +50,7 @@ func (s OrganizationService) Create(
|
|||||||
req CreateOrganizationRequest,
|
req CreateOrganizationRequest,
|
||||||
) (*coredata.Organization, error) {
|
) (*coredata.Organization, error) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
organizationID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.OrganizationEntityType)
|
organizationID := gid.New(s.svc.scope.GetTenantID(), coredata.OrganizationEntityType)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot create organization global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
organization := &coredata.Organization{
|
organization := &coredata.Organization{
|
||||||
ID: organizationID,
|
ID: organizationID,
|
||||||
@@ -63,7 +60,7 @@ func (s OrganizationService) Create(
|
|||||||
UpdatedAt: now,
|
UpdatedAt: now,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.svc.pg.WithConn(
|
err := s.svc.pg.WithConn(
|
||||||
ctx,
|
ctx,
|
||||||
func(tx pg.Conn) error {
|
func(tx pg.Conn) error {
|
||||||
if err := organization.Insert(ctx, tx); err != nil {
|
if err := organization.Insert(ctx, tx); err != nil {
|
||||||
|
|||||||
@@ -165,10 +165,7 @@ func (s PeopleService) Create(
|
|||||||
req CreatePeopleRequest,
|
req CreatePeopleRequest,
|
||||||
) (*coredata.People, error) {
|
) (*coredata.People, error) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
peopleID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.PeopleEntityType)
|
peopleID := gid.New(s.svc.scope.GetTenantID(), coredata.PeopleEntityType)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot create people global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
organization := &coredata.Organization{}
|
organization := &coredata.Organization{}
|
||||||
people := &coredata.People{
|
people := &coredata.People{
|
||||||
@@ -183,7 +180,7 @@ func (s PeopleService) Create(
|
|||||||
UpdatedAt: now,
|
UpdatedAt: now,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.svc.pg.WithTx(
|
err := s.svc.pg.WithTx(
|
||||||
ctx,
|
ctx,
|
||||||
func(conn pg.Conn) error {
|
func(conn pg.Conn) error {
|
||||||
if err := organization.LoadByID(ctx, conn, s.svc.scope, req.OrganizationID); err != nil {
|
if err := organization.LoadByID(ctx, conn, s.svc.scope, req.OrganizationID); err != nil {
|
||||||
|
|||||||
@@ -124,15 +124,8 @@ func (s *PolicyService) Create(
|
|||||||
req CreatePolicyRequest,
|
req CreatePolicyRequest,
|
||||||
) (*coredata.Policy, *coredata.PolicyVersion, error) {
|
) (*coredata.Policy, *coredata.PolicyVersion, error) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
policyID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.PolicyEntityType)
|
policyID := gid.New(s.svc.scope.GetTenantID(), coredata.PolicyEntityType)
|
||||||
if err != nil {
|
policyVersionID := gid.New(s.svc.scope.GetTenantID(), coredata.PolicyVersionEntityType)
|
||||||
return nil, nil, fmt.Errorf("cannot create policy global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
policyVersionID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.PolicyVersionEntityType)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, fmt.Errorf("cannot create policy version global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
policy := &coredata.Policy{
|
policy := &coredata.Policy{
|
||||||
ID: policyID,
|
ID: policyID,
|
||||||
@@ -153,7 +146,7 @@ func (s *PolicyService) Create(
|
|||||||
CreatedAt: now,
|
CreatedAt: now,
|
||||||
UpdatedAt: now,
|
UpdatedAt: now,
|
||||||
}
|
}
|
||||||
err = s.svc.pg.WithTx(
|
err := s.svc.pg.WithTx(
|
||||||
ctx,
|
ctx,
|
||||||
func(conn pg.Conn) error {
|
func(conn pg.Conn) error {
|
||||||
if err := policy.Insert(ctx, conn, s.svc.scope); err != nil {
|
if err := policy.Insert(ctx, conn, s.svc.scope); err != nil {
|
||||||
@@ -235,10 +228,7 @@ func (s *PolicyService) SendSigningNotifications(
|
|||||||
for _, people := range peoples {
|
for _, people := range peoples {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
emailID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.EmailEntityType)
|
emailID := gid.New(s.svc.scope.GetTenantID(), coredata.EmailEntityType)
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("cannot create email global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
token, err := statelesstoken.NewToken(
|
token, err := statelesstoken.NewToken(
|
||||||
s.svc.tokenSecret,
|
s.svc.tokenSecret,
|
||||||
@@ -398,10 +388,7 @@ func (s *PolicyService) RequestSignature(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req RequestSignatureRequest,
|
req RequestSignatureRequest,
|
||||||
) (*coredata.PolicyVersionSignature, error) {
|
) (*coredata.PolicyVersionSignature, error) {
|
||||||
policyVersionSignatureID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.PolicyVersionSignatureEntityType)
|
policyVersionSignatureID := gid.New(s.svc.scope.GetTenantID(), coredata.PolicyVersionSignatureEntityType)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot create policy version signature global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
policyVersion, err := s.GetVersion(ctx, req.PolicyVersionID)
|
policyVersion, err := s.GetVersion(ctx, req.PolicyVersionID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -469,16 +456,13 @@ func (s *PolicyService) CreateDraft(
|
|||||||
policyID gid.GID,
|
policyID gid.GID,
|
||||||
createdBy gid.GID,
|
createdBy gid.GID,
|
||||||
) (*coredata.PolicyVersion, error) {
|
) (*coredata.PolicyVersion, error) {
|
||||||
draftVersionID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.PolicyVersionEntityType)
|
draftVersionID := gid.New(s.svc.scope.GetTenantID(), coredata.PolicyVersionEntityType)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot create policy version global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
latestVersion := &coredata.PolicyVersion{}
|
latestVersion := &coredata.PolicyVersion{}
|
||||||
draftVersion := &coredata.PolicyVersion{}
|
draftVersion := &coredata.PolicyVersion{}
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
err = s.svc.pg.WithTx(
|
err := s.svc.pg.WithTx(
|
||||||
ctx,
|
ctx,
|
||||||
func(conn pg.Conn) error {
|
func(conn pg.Conn) error {
|
||||||
if err := latestVersion.LoadLatestVersion(ctx, conn, s.svc.scope, policyID); err != nil {
|
if err := latestVersion.LoadLatestVersion(ctx, conn, s.svc.scope, policyID); err != nil {
|
||||||
|
|||||||
@@ -165,10 +165,7 @@ func (s RiskService) Create(
|
|||||||
req CreateRiskRequest,
|
req CreateRiskRequest,
|
||||||
) (*coredata.Risk, error) {
|
) (*coredata.Risk, error) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
riskID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.RiskEntityType)
|
riskID := gid.New(s.svc.scope.GetTenantID(), coredata.RiskEntityType)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot create global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
risk := &coredata.Risk{
|
risk := &coredata.Risk{
|
||||||
ID: riskID,
|
ID: riskID,
|
||||||
@@ -198,7 +195,7 @@ func (s RiskService) Create(
|
|||||||
risk.ResidualImpact = *req.ResidualImpact
|
risk.ResidualImpact = *req.ResidualImpact
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.svc.pg.WithConn(
|
err := s.svc.pg.WithConn(
|
||||||
ctx,
|
ctx,
|
||||||
func(conn pg.Conn) error {
|
func(conn pg.Conn) error {
|
||||||
return risk.Insert(ctx, conn, s.svc.scope)
|
return risk.Insert(ctx, conn, s.svc.scope)
|
||||||
|
|||||||
@@ -53,10 +53,7 @@ func (s TaskService) Create(
|
|||||||
req CreateTaskRequest,
|
req CreateTaskRequest,
|
||||||
) (*coredata.Task, error) {
|
) (*coredata.Task, error) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
taskID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.TaskEntityType)
|
taskID := gid.New(s.svc.scope.GetTenantID(), coredata.TaskEntityType)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot generate id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
referenceID, err := uuid.NewV4()
|
referenceID, err := uuid.NewV4()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -98,10 +98,7 @@ func (s VendorComplianceReportService) Upload(
|
|||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
vendorComplianceReportID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.VendorComplianceReportEntityType)
|
vendorComplianceReportID := gid.New(s.svc.scope.GetTenantID(), coredata.VendorComplianceReportEntityType)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot generate vendor compliance report ID: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
vendorComplianceReport := &coredata.VendorComplianceReport{
|
vendorComplianceReport := &coredata.VendorComplianceReport{
|
||||||
ID: vendorComplianceReportID,
|
ID: vendorComplianceReportID,
|
||||||
|
|||||||
@@ -267,10 +267,7 @@ func (s VendorService) Create(
|
|||||||
req CreateVendorRequest,
|
req CreateVendorRequest,
|
||||||
) (*coredata.Vendor, error) {
|
) (*coredata.Vendor, error) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
vendorID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.VendorEntityType)
|
vendorID := gid.New(s.svc.scope.GetTenantID(), coredata.VendorEntityType)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot create vendor global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
organization := &coredata.Organization{}
|
organization := &coredata.Organization{}
|
||||||
vendor := &coredata.Vendor{
|
vendor := &coredata.Vendor{
|
||||||
@@ -301,7 +298,7 @@ func (s VendorService) Create(
|
|||||||
vendor.Category = "Other"
|
vendor.Category = "Other"
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.svc.pg.WithTx(
|
err := s.svc.pg.WithTx(
|
||||||
ctx,
|
ctx,
|
||||||
func(conn pg.Conn) error {
|
func(conn pg.Conn) error {
|
||||||
if err := organization.LoadByID(ctx, conn, s.svc.scope, req.OrganizationID); err != nil {
|
if err := organization.LoadByID(ctx, conn, s.svc.scope, req.OrganizationID); err != nil {
|
||||||
@@ -348,10 +345,7 @@ func (s VendorService) CreateRiskAssessment(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req CreateVendorRiskAssessmentRequest,
|
req CreateVendorRiskAssessmentRequest,
|
||||||
) (*coredata.VendorRiskAssessment, error) {
|
) (*coredata.VendorRiskAssessment, error) {
|
||||||
vendorRiskAssessmentID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.VendorRiskAssessmentEntityType)
|
vendorRiskAssessmentID := gid.New(s.svc.scope.GetTenantID(), coredata.VendorRiskAssessmentEntityType)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot create vendor risk assessment global id: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
@@ -372,7 +366,7 @@ func (s VendorService) CreateRiskAssessment(
|
|||||||
return nil, fmt.Errorf("expiresAt %v must be in the future", req.ExpiresAt)
|
return nil, fmt.Errorf("expiresAt %v must be in the future", req.ExpiresAt)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.svc.pg.WithTx(
|
err := s.svc.pg.WithTx(
|
||||||
ctx,
|
ctx,
|
||||||
func(tx pg.Conn) error {
|
func(tx pg.Conn) error {
|
||||||
vendor := coredata.Vendor{ID: req.VendorID}
|
vendor := coredata.Vendor{ID: req.VendorID}
|
||||||
|
|||||||
Reference in New Issue
Block a user