Skip to content

Conversation

@chpy04
Copy link
Contributor

@chpy04 chpy04 commented Apr 11, 2025

Changes

Added features to the abbreviation table to set abbreviations (existing and new), using set and delete endpoints

Test Cases

  • create a new abbreviation
  • update an existing abbreviation
  • delete an abbreviation
  • only admins can do these things

Screenshots

Screenshot 2025-04-11 at 2 35 30 PM

Postman testing not done because you can test it with the table (add something and then refresh)

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots section)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No yarn.lock changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #3282

@chpy04 chpy04 self-assigned this Apr 11, 2025
Copy link
Contributor

@Zwendle Zwendle left a comment

Choose a reason for hiding this comment

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

Nit: change SetAbbreviationModel file and component name to SetAbbreviationModal

/>
<Typography variant="subtitle1">Project Name Abbreviations</Typography>
<AdminToolTable columns={[{ name: 'Project Name' }, { name: 'Abbreviation' }]} rows={[]} />
<AdminToolTable columns={[{ name: 'Project Name' }, { name: 'Abbreviation' }]} rows={projectTableRows} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: After creating an abbreviation, the first cell in the right-most column doesn't have the same black border as the other cells. If you add a third { name: '' } to the columns prop that should fix the styling issue (not sure if that's the best way to fix it though lol)

}

/**
* Revomves the abbreviation from a given project
Copy link
Member

Choose a reason for hiding this comment

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

typo

const project = await ProjectsService.getSingleProjectWithQueryArgs(wbsNum, organization);

if (!(await userHasPermission(user.userId, organization.organizationId, isAdmin))) {
throw new AccessDeniedAdminOnlyException('delete Abbreviation');
Copy link
Member

Choose a reason for hiding this comment

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

nit: don't capitalize here

* @returns the updated project
*/
static async setAbbreviation(wbsNum: WbsNumber, user: User, organization: Organization, abbreviation: string) {
const project = await ProjectsService.getSingleProjectWithQueryArgs(wbsNum, organization);
Copy link
Member

Choose a reason for hiding this comment

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

Throw if the project isn't found

* @returns the updated project
*/
static async deleteAbbreviation(wbsNum: WbsNumber, user: User, organization: Organization) {
const project = await ProjectsService.getSingleProjectWithQueryArgs(wbsNum, organization);
Copy link
Member

Choose a reason for hiding this comment

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

Same here

@chpy04 chpy04 merged commit 7b51fe8 into feature/cad-project-file-review May 2, 2025
4 checks passed
@chpy04 chpy04 deleted the #3282-abbreviation-endpoint branch May 2, 2025 12:47
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.

4 participants