-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: code reference API #1395
feat: code reference API #1395
Conversation
c73147d
to
762205c
Compare
53057e8
to
2929f7f
Compare
6264d91
to
a4d5fe8
Compare
9c810ff
to
68f2265
Compare
EnvironmentId: *environmentID, | ||
} | ||
_, err = client.GetCodeReference(context.Background(), getReq) | ||
assert.Error(t, err) // Should return error as code reference is deleted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We must check the response code in case the backend returns any other error than not found.
pkg/coderef/api/code_reference.go
Outdated
id, err := uuid.NewUUID() | ||
if err != nil { | ||
s.logger.Error( | ||
"Failed to generate uuid", | ||
log.FieldsFromImcomingContext(ctx).AddFields( | ||
zap.Error(err), | ||
)..., | ||
) | ||
dt, err := statusInternal.WithDetails(&errdetails.LocalizedMessage{ | ||
Locale: localizer.GetLocale(), | ||
Message: localizer.MustLocalize(locale.InternalServerError), | ||
}) | ||
if err != nil { | ||
return nil, statusInternal.Err() | ||
} | ||
return nil, dt.Err() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the UUID logic to the domain.NewCodeReference
as we do for the other entities.
pkg/coderef/api/code_reference.go
Outdated
) | ||
if err != nil { | ||
s.logger.Error( | ||
"Failed to update code reference", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Failed to update code reference", | |
"Failed to update code reference domain object", |
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package v2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is new, we don't need the v2.
package v2 | |
package storage |
return codeRefs, nextOffset, total, nil | ||
} | ||
|
||
func (s *codeReferenceStorage) DeleteCodeReference(ctx context.Context, id, environmentID string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are using UUID, we don't need the environment ID in the storage layer.
func (s *codeReferenceStorage) DeleteCodeReference(ctx context.Context, id, environmentID string) error { | |
func (s *codeReferenceStorage) DeleteCodeReference(ctx context.Context, id string) error { |
…statement for better clarity
…clarity in code_reference table
…d update related logic
5b77abb
to
bf6b77c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work 🎉
Partf of #888
Add Code Reference API
This PR adds new gRPC service endpoints and related message types for managing code references in the Bucketeer system.
Changes
New Service Endpoints
Added new CodeReferenceService with the following methods:
GetCodeReference
ListCodeReferences
CreateCodeReference
UpdateCodeReference
DeleteCodeReference
New Event Types
Added new event types for code reference operations:
CODE_REFERENCE_CREATED
CODE_REFERENCE_UPDATED
CODE_REFERENCE_DELETED
New Domain Events
Added corresponding domain event message types:
CodeReferenceCreatedEvent
CodeReferenceUpdatedEvent
CodeReferenceDeletedEvent