-
-
Notifications
You must be signed in to change notification settings - Fork 1
Add POST endpoint for artifact registration under groups #169
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
base: dev
Are you sure you want to change the base?
Conversation
Co-authored-by: gabizou <1203877+gabizou@users.noreply.github.com>
…create-artifact-registration-endpoint
Co-authored-by: gabizou <1203877+gabizou@users.noreply.github.com>
Co-authored-by: gabizou <1203877+gabizou@users.noreply.github.com>
|
@copilot internal/app/service.go:89 - Should be a 404 error from the api contract that if the group doesn't exist, return a 404 openapi.yaml:440-444 - should likely be an array of accepted repositories |
…for git repositories Co-authored-by: gabizou <1203877+gabizou@users.noreply.github.com>
Fixed both issues in commit aa7173d:
|
| }) | ||
| } | ||
|
|
||
| func (s *Service) RegisterArtifact(ctx context.Context, artifact *domain.Artifact) 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.
@copilot Let's add unit tests for this service method
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.
Added comprehensive unit tests for RegisterArtifact in commit 5a76885 (squashed). Tests cover:
- Successful artifact registration (single and multiple git repos)
- Group not found error (ErrGroupNotFound)
- Artifact already exists error (ErrArtifactAlreadyExists)
- Database error scenarios (group check, artifact check, creation)
All 7 test cases pass. Also squashed all commits into a single clean commit that excludes the binary file.
Co-authored-by: gabizou <1203877+gabizou@users.noreply.github.com>
Implements
POST /groups/{groupId}/artifactsto register artifacts within a group.API Contract
Request:
{ "artifactId": "spongeforge", "displayName": "SpongeForge", "gitRepository": ["https://github.com/SpongePowered/Sponge"], "website": "https://spongepowered.org/", // optional "issues": "https://github.com/.../issues" // optional }Response (201):
{ "type": "latest", "coordinates": {"groupId": "...", "artifactId": "..."}, "displayName": "...", "gitRepository": ["..."], "website": "...", "issues": "...", "tags": {} }Error Response (404):
Returns
ErrGroupNotFoundwhen the specified group does not exist.Changes
ArtifactRegistrationschemaArtifactmodel with required and nullable fieldsRegisterArtifactwith transactional validation (group existence, duplicate prevention)ErrGroupNotFound(404) when group doesn't existRegisterArtifactservice method covering success scenarios, error cases (group not found, artifact already exists), and database error handlingOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.