AY2425S1-CS2103T-F09-2 / tp

MIT License
1 stars 5 forks source link

Role Implementation #71

Closed jan-kai1 closed 1 day ago

jan-kai1 commented 3 days ago

For #59 and #65

RoleHandler RoleHandler.getRole changed to a static method. Since it accesses static fields which are constant across all RoleHandler instances and isValidRole is static, makes more sense getRole method should be static as well

Person Person constructor takes in a varargs of Role ... (Unsure if should make roles mandatory) Person Constructor takes in a Set

Person instance now has a Set along with methods getRoles() and hasRole In line with existing edit command process (which creates a new Person instance and replaces the existing one in addressBook), Person currently does NOT have any methods to set or change the existing roles. This can be changed based on later implementation of addRole command.

Add and Edit Commands Now supports addition of roles, currently have to input each role individually e.g. /r vendor /r attendee

JsonAdaptedRole Takes in any string with no checks, exception only thrown when toModelType() is called

codecov[bot] commented 3 days ago

Codecov Report

Attention: Patch coverage is 82.60870% with 16 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../java/seedu/address/model/util/SampleDataUtil.java 40.00% 12 Missing :warning:
src/main/java/seedu/address/ui/PersonCard.java 0.00% 3 Missing :warning:
.../seedu/address/logic/parser/EditCommandParser.java 85.71% 0 Missing and 1 partial :warning:
Files with missing lines Coverage Δ Complexity Δ
src/main/java/seedu/address/logic/Messages.java 86.36% <100.00%> (+1.36%) 3.00 <0.00> (ø)
.../java/seedu/address/logic/commands/AddCommand.java 100.00% <ø> (ø) 8.00 <0.00> (ø)
...java/seedu/address/logic/commands/EditCommand.java 97.84% <100.00%> (+1.33%) 13.00 <0.00> (ø)
...a/seedu/address/logic/parser/AddCommandParser.java 100.00% <100.00%> (ø) 5.00 <0.00> (ø)
...in/java/seedu/address/logic/parser/ParserUtil.java 91.07% <100.00%> (+1.07%) 20.00 <2.00> (+2.00)
...rc/main/java/seedu/address/model/ModelManager.java 100.00% <ø> (ø) 23.00 <0.00> (ø)
...c/main/java/seedu/address/model/person/Person.java 100.00% <100.00%> (+2.43%) 27.00 <3.00> (+4.00)
src/main/java/seedu/address/model/role/Role.java 100.00% <100.00%> (ø) 14.00 <1.00> (+1.00)
...ain/java/seedu/address/model/role/RoleHandler.java 100.00% <100.00%> (ø) 10.00 <5.00> (ø)
...ss/model/role/exceptions/InvalidRoleException.java 100.00% <100.00%> (ø) 1.00 <1.00> (ø)
... and 5 more
jan-kai1 commented 1 day ago

Closed, updated with #80