Skip to content

Commit

Permalink
Merge remote-tracking branch 'sharedRepo/master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Elgoh committed Oct 4, 2020
2 parents a2480e3 + 4023172 commit ee75a5b
Show file tree
Hide file tree
Showing 46 changed files with 896 additions and 360 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ src/main/resources/docs/
/.idea/
/out/
/*.iml
*.iml

# Storage/log files
/data/
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# NUStorage

[![CI Status](https://github.com/se-edu/addressbook-level3/workflows/Java%20CI/badge.svg)](https://github.com/se-edu/addressbook-level3/actions)
[![codecov](https://codecov.io/gh/se-edu/addressbook-level3/branch/master/graph/badge.svg)](https://codecov.io/gh/se-edu/addressbook-level3)
[![Java CI](https://github.com/AY2021S1-CS2103T-T11-3/tp/workflows/Java%20CI/badge.svg)](https://github.com/AY2021S1-CS2103T-T11-3/tp/actions)

![Ui](docs/images/Ui.png)

Expand All @@ -17,7 +16,7 @@

**Acknowledgements**

* Libraries used: [JavaFX](https://openjfx.io/), [Jackson](https://github.com/FasterXML/jackson), [JUnit5](https://github.com/junit-team/junit5)
* Libraries used: [JavaFX](https://openjfx.io/), [Jackson](https://github.com/FasterXML/jackson), [JUnit5](https://github.com/junit-team/junit5).
* This project is based on the AddressBook-Level3 project created by the [SE-EDU initiative](https://se-education.org).

**License: [MIT](LICENSE)**
149 changes: 116 additions & 33 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,44 +236,56 @@ _{Explain here how the data archiving feature will be implemented}_

**Target user profile**:

* has a need to manage a significant number of contacts
* prefer desktop apps over other types
* has a need to manage a significant number of varying inventories, as well as their finances
* prefer desktop apps over other traditional modes of managing inventories/finances, such as pen and paper
* can type fast
* prefers typing to mouse interactions
* is reasonably comfortable using CLI apps
* Proficient in english to allow them to check the user guide when they are having trouble with the app

**Value proposition**: manage contacts faster than a typical mouse/GUI driven app

**Value proposition**: manage inventories and finances faster than the typical paper and pen


### User stories

Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unlikely to have) - `*`

| Priority | As a …​ | I want to …​ | So that I can…​ |
| Priority | As a …​ | I want to …​ | So that I can…​ |
| -------- | ------------------------------------------ | ------------------------------ | ---------------------------------------------------------------------- |
| `* * *` | new user | see usage instructions | refer to instructions when I forget how to use the App |
| `* * *` | user | add a new person | |
| `* * *` | user | delete a person | remove entries that I no longer need |
| `* * *` | user | find a person by name | locate details of persons without having to go through the entire list |
| `* *` | user | hide private contact details | minimize chance of someone else seeing them by accident |
| `*` | user with many persons in the address book | sort persons by name | locate a person easily |
| `* * *` | inventory keeper | view inventory records | keep track of the amount of products I have left |
| `* * *` | small business owner | view finance records | plan the next steps of my business |
| `* * *` | forgetful business owner | save my records | track my financial records more easily |
| `* * *` | small business owner | add and remove inventories | update my inventory status |
| `* *` | accountant | edit my financial records | update my financial status |
| `*` | user | be able to exit the app safely | |

*{More to be added}*

### Use cases
For all use cases (unless specified otherwise):
- The **System** is `NUStorage`
- The **Actor** is `User`

(For all use cases below, the **System** is the `AddressBook` and the **Actor** is the `user`, unless specified otherwise)

**Use case: Delete a person**
**Use case: Add an inventory item**

**MSS**

1. User requests to list persons
2. AddressBook shows a list of persons
3. User requests to delete a specific person in the list
4. AddressBook deletes the person
1. User requests to list inventory
2. NUStorage shows the inventory list
3. User requests to add a specific inventory item into the list
4. NUStorage adds the item to the list

Use case ends.

**Use case: Remove an inventory item**

**MSS**

1. User requests to list inventory
2. NUStorage shows the inventory list
3. User requests to remove a specific inventory item into the list
4. NUStorage removes the item from the list at the specified index

**Extensions**

Expand All @@ -283,24 +295,83 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli

* 3a. The given index is invalid.

* 3a1. AddressBook shows an error message.
* 3a1. NUStorage shows an error message.

Use case resumes at step 2.

*{More to be added}*
**Use case: Add a finance record**

**MSS**

1. User requests to list finances
2. NUStorage shows the finance record list
3. User requests to add a specific finance record into the list
4. NUStorage adds the record to the list

Use case ends.

**Use case: Remove a finance record**

**MSS**

1. User requests to list finances
2. NUStorage shows the finance record list
3. User requests to remove a specific financial record into the list
4. NUStorage removes the record from the list at the specified index

**Extensions**

* 2a. The list is empty.

Use case ends.

* 3a. The given index is invalid.

* 3a1. NUStorage shows an error message.

Use case resumes at step 2.

**Use case: List finance/inventory records**

**MSS**

1. User requests to list finances / inventories
2. NUStorage shows the finance record / inventory list

* 2a. The list is empty.

Use case ends.

**Use case: Save finance / inventory records**

**MSS**

1. User requests to save the current data stored
2. NUStorage saves both finance and inventory records and shows a success message

**Use case: Exiting the application**

**MSS**

1. User requests to exit NUStorage
2. NUStorage saves both finance and inventory records and shows a goodbye message
3. NUStorage terminates after 1.5 seconds



### Non-Functional Requirements

1. Should work on any _mainstream OS_ as long as it has Java `11` or above installed.
2. Should be able to hold up to 1000 persons without a noticeable sluggishness in performance for typical usage.
2. Should be able to hold up to 100 financial records and 100 inventory items without a noticeable sluggishness in performance for typical usage.
3. A user with above average typing speed for regular English text (i.e. not code, not system admin commands) should be able to accomplish most of the tasks faster using commands than using the mouse.

*{More to be added}*

### Glossary

* **Mainstream OS**: Windows, Linux, Unix, OS-X
* **Private contact detail**: A contact detail that is not meant to be shared with others
* **Inventory**: An item that a user wishes to record. An inventory item can refer to any existing object
* **Finances**: A record that allows a user to monitor his earnings and spending.

--------------------------------------------------------------------------------------------------------------------

Expand All @@ -319,7 +390,8 @@ testers are expected to do more *exploratory* testing.

1. Download the jar file and copy into an empty folder

1. Double-click the jar file Expected: Shows the GUI with a set of sample contacts. The window size may not be optimum.
1. Double-click the jar file<br>
Expected: Shows the GUI with an introductory message. The window size may not be optimum.

1. Saving window preferences

Expand All @@ -328,29 +400,40 @@ testers are expected to do more *exploratory* testing.
1. Re-launch the app by double-clicking the jar file.<br>
Expected: The most recent window size and location is retained.

1. _{ more test cases …​ }_
1. Shutting Down

1. If you would like to save your records prior to shutting down, remember to enter the `save` command

1. Close the app by simply clicking on the close button or enter the `exit` command.

### Deleting a person
### Deleting a record

1. Deleting a person while all persons are being shown
1. Deleting a record while all inventory/financial records are being shown

1. Prerequisites: List all persons using the `list` command. Multiple persons in the list.
1. Prerequisites: List all inventory/financial records using the `list_inventory` or `list_financial` commands respectively. Multiple records in the list.

1. Test case: `delete 1`<br>
Expected: First contact is deleted from the list. Details of the deleted contact shown in the status message. Timestamp in the status bar is updated.
Expected: First record is deleted from the list. Details of the deleted record shown in the status message.

1. Test case: `delete 0`<br>
Expected: No person is deleted. Error details shown in the status message. Status bar remains the same.
Expected: No record is deleted. Error details shown in the status message.

1. Other incorrect delete commands to try: `delete`, `delete x`, `...` (where x is larger than the list size)<br>
Expected: Similar to previous.

1. _{ more test cases …​ }_
### Adding a record

### Saving data
1. Adding a financial/inventory record.

1. Dealing with missing/corrupted data files
1. Prerequisites: None

1. Test case: `add_inventory i/MacBook n/10`<br>
Expected: An inventory item 'MacBook' is added with the quantity of 10. Details of the added record shown in the status message.

1. Test case: `add_finance op/in amt/1000`
Expected: A finance record of an increase by $1000.00 is added. Details of the added record shown in status message.

1. Other incorrect add commands to try: `add`, `add_record`, `add_inventory i/MacBook` <br>
Expected: No record is added. Error details shown in the status message.

1. _{explain how to simulate a missing/corrupted file, and the expected behavior}_

1. _{ more test cases …​ }_
4 changes: 2 additions & 2 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
title: "AB-3"
title: "NUStorage"
theme: minima

header_pages:
Expand All @@ -8,7 +8,7 @@ header_pages:

markdown: kramdown

repository: "se-edu/addressbook-level3"
repository: "AY2021S1-CS2103T-T11-3/tp"
github_icon: "images/github-icon.png"

plugins:
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/nustorage/logic/commands/AddFinanceCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import nustorage.model.Model;
import nustorage.model.record.FinanceRecord;

/**
* Adds a finance record to the address book.
*/
public class AddFinanceCommand extends Command {

public static final String COMMAND_WORD = "add_finance";
Expand Down
22 changes: 15 additions & 7 deletions src/main/java/nustorage/logic/commands/AddInventoryCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,39 @@

import nustorage.logic.commands.exceptions.CommandException;
import nustorage.model.Model;
import nustorage.model.record.FinanceRecord;
import nustorage.model.record.InventoryRecord;

/**
* An add inventory command class
*/
public class AddInventoryCommand extends Command {

public static final String COMMAND_WORD = "add_inventory";

public static final String MESSAGE_SUCCESS = "New Inventory record added: %1$s";

private final InventoryRecord newRecord;
private final InventoryRecord newInventoryRecord;
private final FinanceRecord newFinanceRecord;

/**
* Constructs an AddInventoryCommand class using a new inventory record.
* @param newRecord New inventory record.
* @param newInventoryRecord New inventory record.
* @param newFinanceRecord New finance record.
*/
public AddInventoryCommand(InventoryRecord newRecord) {
requireNonNull(newRecord);
this.newRecord = newRecord;
public AddInventoryCommand(InventoryRecord newInventoryRecord, FinanceRecord newFinanceRecord) {
requireNonNull(newInventoryRecord);
this.newInventoryRecord = newInventoryRecord;
this.newFinanceRecord = newFinanceRecord;
}

@Override
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);

model.addInventoryRecord(newRecord);
return new CommandResult(String.format(MESSAGE_SUCCESS, newRecord));
model.addInventoryRecord(newInventoryRecord);
model.addFinanceRecord(newFinanceRecord);
return new CommandResult(String.format(MESSAGE_SUCCESS, newInventoryRecord));
}

}
48 changes: 48 additions & 0 deletions src/main/java/nustorage/logic/commands/DeleteFinanceCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package nustorage.logic.commands;

import static java.util.Objects.requireNonNull;

import java.util.Optional;

import nustorage.commons.core.Messages;
import nustorage.commons.core.index.Index;
import nustorage.logic.commands.exceptions.CommandException;
import nustorage.model.Model;
import nustorage.model.record.FinanceRecord;

/**
* Deletes an existing finance record from the address book.
*/
public class DeleteFinanceCommand extends Command {

public static final String COMMAND_WORD = "delete_finance";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Deletes the finance record identified by the index number used in the finance list.\n"
+ "Parameters: INDEX (must be a positive integer)\n"
+ "Example: " + COMMAND_WORD + " 1";

public static final String MESSAGE_SUCCESS = "Finance record deleted: %1$s";

private final Index targetIndex;

/**
* Creates an AddFinanceCommand to add the specified {@code Finance Record}
*/
public DeleteFinanceCommand(Index targetIndex) {
this.targetIndex = targetIndex;
}

@Override
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);

Optional<FinanceRecord> record = model.deleteFinanceRecord(targetIndex);

if (record.isPresent()) {
return new CommandResult(String.format(MESSAGE_SUCCESS, record.get()));
} else {
throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
}
}
}
Loading

0 comments on commit ee75a5b

Please sign in to comment.