Skip to content

create assignSponsorToProject#113

Open
HMS-Victory wants to merge 27 commits into
mainfrom
Talbot/add-assign-sponsor-command
Open

create assignSponsorToProject#113
HMS-Victory wants to merge 27 commits into
mainfrom
Talbot/add-assign-sponsor-command

Conversation

@HMS-Victory

Copy link
Copy Markdown
Contributor

This PR accomplishes the following:

  1. adds a new command to assign a sponsor to a project, along with testing
  2. adds support, and basic testing to search for a user by ID, necessitated in order to check whether or not the supplied user Id exists in the assignSponsorToProject command, which does not throw an exception when this happens.
  3. adds the aforementioned manual checks for both the project id, and user id to counter a flaw in the API
  4. adds an annotation for a separate test that is failing because of a different API problem

Comment thread cli/src/main/java/org/justserve/command/AssignSponsorToProject.java Outdated
ZeterTheDuck

This comment was marked as off-topic.

@Valid Project project = projectClient.getProject(projectId, " ", new GetProjectRequest()).block();
if (user == null || project == null) {
throw new IllegalArgumentException("User API returned null for sponsorId = " + sponsorId + "projectId = "+projectId);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we leave this as is, this will result in a big stack trace in the console, which we don't want. use PrintErr and then log.err so that the ui is maintained, but we can still see all info in the logs.

Comment thread core/src/main/resources/schema.yml Outdated
Comment on lines +355 to +378
"/api/v1/users/{userId}/limited":
get:
tags:
- User
parameters:
- name: userId
in: path
required: true
schema:
type: string
format: uuid
responses:
"200":
description: OK
content:
text/plain:
schema:
$ref: "#/components/schemas/UserResultLimited"
application/json:
schema:
$ref: "#/components/schemas/UserResultLimited"
text/json:
schema:
$ref: "#/components/schemas/UserResultLimited"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this, let's use the userslimsearch which is already available

Comment thread cli/src/main/java/org/justserve/command/AssignSponsorToProject.java Outdated
Comment thread cli/src/main/java/org/justserve/command/AssignSponsorToProject.java Outdated
Comment thread cli/src/main/java/org/justserve/command/AssignSponsorToProject.java Outdated
printNormal("Successfully assigned sponsor %s to project %s", sponsorId, projectId);
log.atTrace().log("Successfully assigned sponsor to project");
} catch (HttpClientResponseException e) {
printError("Failed to assign sponsor %s to project %s. (%s: %s)",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make the print error clear what it is printing in the case the string interpolation fails or is formatted poorly,
printError("Failed to assign sponsor %s to project %s. %n%t Error Code %s: Error Message: %s",

the print error method will take multiline error prints and format it so the first line is a title and the following lines are formatted as a text body

Comment thread cli/src/test/groovy/org/justserve/cli/command/AssignSponsorToProjectSpec.groovy Outdated
Comment thread core/src/test/groovy/org/justserve/ProjectClientSpec.groovy
Comment thread core/src/test/groovy/org/justserve/UserClientSpec.groovy
Comment thread core/src/test/groovy/org/justserve/UserClientSpec.groovy
HMS-Victory and others added 25 commits July 10, 2026 20:26
….java

Co-authored-by: ZeterTheDuck <126122462+ZeterTheDuck@users.noreply.github.com>
Signed-off-by: HMS-Victory <90852625+HMS-Victory@users.noreply.github.com>
Co-authored-by: ZeterTheDuck <126122462+ZeterTheDuck@users.noreply.github.com>
Signed-off-by: HMS-Victory <90852625+HMS-Victory@users.noreply.github.com>
Signed-off-by: HMS-Victory <90852625+HMS-Victory@users.noreply.github.com>
change testuser property name from UUID to ID
@Jonathan-Zollinger
Jonathan-Zollinger force-pushed the Talbot/add-assign-sponsor-command branch from 0ed44a0 to be502bd Compare July 11, 2026 02:26
@Jonathan-Zollinger

Copy link
Copy Markdown
Member

@HMS-Victory will you @ me when you're ready for my review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants