Fix non mandatory fields on vendor
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -70,8 +70,8 @@ type (
|
||||
SecurityPageURL *string
|
||||
TrustPageURL *string
|
||||
StatusPageURL *string
|
||||
BusinessOwnerID *gid.GID
|
||||
SecurityOwnerID *gid.GID
|
||||
BusinessOwnerID **gid.GID
|
||||
SecurityOwnerID **gid.GID
|
||||
ShowOnTrustCenter *bool
|
||||
}
|
||||
|
||||
@@ -303,19 +303,27 @@ func (s VendorService) Update(
|
||||
}
|
||||
|
||||
if req.BusinessOwnerID != nil {
|
||||
businessOwner := &coredata.People{}
|
||||
if err := businessOwner.LoadByID(ctx, conn, s.svc.scope, *req.BusinessOwnerID); err != nil {
|
||||
return fmt.Errorf("cannot load business owner: %w", err)
|
||||
if *req.BusinessOwnerID != nil {
|
||||
businessOwner := &coredata.People{}
|
||||
if err := businessOwner.LoadByID(ctx, conn, s.svc.scope, **req.BusinessOwnerID); err != nil {
|
||||
return fmt.Errorf("cannot load business owner: %w", err)
|
||||
}
|
||||
vendor.BusinessOwnerID = &businessOwner.ID
|
||||
} else {
|
||||
vendor.BusinessOwnerID = nil
|
||||
}
|
||||
vendor.BusinessOwnerID = &businessOwner.ID
|
||||
}
|
||||
|
||||
if req.SecurityOwnerID != nil {
|
||||
securityOwner := &coredata.People{}
|
||||
if err := securityOwner.LoadByID(ctx, conn, s.svc.scope, *req.SecurityOwnerID); err != nil {
|
||||
return fmt.Errorf("cannot load security owner: %w", err)
|
||||
if *req.SecurityOwnerID != nil {
|
||||
securityOwner := &coredata.People{}
|
||||
if err := securityOwner.LoadByID(ctx, conn, s.svc.scope, **req.SecurityOwnerID); err != nil {
|
||||
return fmt.Errorf("cannot load security owner: %w", err)
|
||||
}
|
||||
vendor.SecurityOwnerID = &securityOwner.ID
|
||||
} else {
|
||||
vendor.SecurityOwnerID = nil
|
||||
}
|
||||
vendor.SecurityOwnerID = &securityOwner.ID
|
||||
}
|
||||
|
||||
vendor.UpdatedAt = time.Now()
|
||||
|
||||
@@ -1443,8 +1443,8 @@ func (r *mutationResolver) UpdateVendor(ctx context.Context, input types.UpdateV
|
||||
WebsiteURL: input.WebsiteURL,
|
||||
Category: input.Category,
|
||||
Certifications: input.Certifications,
|
||||
BusinessOwnerID: input.BusinessOwnerID,
|
||||
SecurityOwnerID: input.SecurityOwnerID,
|
||||
BusinessOwnerID: &input.BusinessOwnerID,
|
||||
SecurityOwnerID: &input.SecurityOwnerID,
|
||||
ShowOnTrustCenter: input.ShowOnTrustCenter,
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user