Skip to content

Commit

Permalink
Merge pull request #127 from calvintanwj/playground
Browse files Browse the repository at this point in the history
Merge playground to Master
  • Loading branch information
calvintanwj authored Oct 21, 2021
2 parents 576eb3f + 3fff86e commit 90c17ca
Show file tree
Hide file tree
Showing 63 changed files with 2,739 additions and 1,642 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ dependencies {
}

shadowJar {
archiveName = 'addressbook.jar'
archiveName = 'PH.jar'
}

defaultTasks 'clean', 'test'
3 changes: 2 additions & 1 deletion docs/AboutUs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
layout: page title: About Us
layout: page
title: About Us
---

We are a team based in the [School of Computing, National University of Singapore](http://www.comp.nus.edu.sg).
Expand Down
85 changes: 62 additions & 23 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Developer Guide

## **Table of Contents**

* Table of Contents
* Table of Contents
{:toc}

--------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -63,7 +63,7 @@ The rest of the App consists of four components.
**How the architecture components interact with each other**

The *Sequence Diagram* below shows how the components interact with each other for the scenario where the user issues
the command `delete 1`.
the command `delete sid/123`.

<img src="images/ArchitectureSequenceDiagram.png" width="574" />

Expand Down Expand Up @@ -123,7 +123,7 @@ How the `Logic` component works:
1. The command can communicate with the `Model` when it is executed (e.g. to add a person).
1. The result of the command execution is encapsulated as a `CommandResult` object which is returned back from `Logic`.

The Sequence Diagram below illustrates the interactions within the `Logic` component for the `execute("delete 1")` API
The Sequence Diagram below illustrates the interactions within the `Logic` component for the `execute("delete sid/123")` API
call.

![Interactions Inside the Logic Component for the `delete 1` Command](images/DeleteSequenceDiagram.png)
Expand Down Expand Up @@ -368,7 +368,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli

**Extensions**

* 3a. User does not confirm to clearing entries.
* 2a. User does not confirm to clearing entries.

Use case ends.

Expand All @@ -386,21 +386,21 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli

**Extensions**

* 2a. Error occurs when saving new contact list
* 1a. Error occurs when saving new contact list

* 2a1. **PH** reverts to old contact list before the execution of the command.

* 2a2. **PH** informs the user that saving the new contact list was unsuccessful.

Use case ends.

#### UC3: Searching for a guest/staff
#### UC3: Searching for a guest

**MSS**

1. User keys in command to search for a specified guest or staff.
1. User keys in command to search for a specified guest.

2. **PH** shows the specified guest/staff that matches the user's query.
2. **PH** shows the specified guest that matches the user's query.

Use case ends.

Expand All @@ -410,19 +410,45 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli

Use case ends.

* 2a. No guest/staff found that matches user's query.
* 1b. No guest found that matches user's query.

* 2a1. **PH** shows message indicating no such guest/staff exists in the list.
* 1b1. **PH** shows message indicating no such guest exists in the list.

Use case ends.

#### UC4: Editing fields of guests/staff
#### UC4: Searching for a staff

Same as UC3 except that guest is replaced with staff.

#### UC4: Searching for a staff

**MSS**

1. User keys in command to search for a specified guest.

2. **PH** shows the specified guest that matches the user's query.

Use case ends.

**Extensions**

* 1a. Contact list is empty.

Use case ends.

* 1b. No guest found that matches user's query.

* 1b1. **PH** shows message indicating no such guest exists in the list.

Use case ends.

#### UC5: Editing fields of guest

**MSS**

1. User keys in command to edit a particular field of a specified guest/ staff.
1. User keys in command to edit a particular field of a specified guest.

2. **PH** shows a success message to user which displays the new details of the guest/ staff.
2. **PH** shows a success message to user which displays the new details of the guest.

Use case ends.

Expand All @@ -432,9 +458,9 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli

Use case ends.

* 1b. No guest/staff found that matches user's query.
* 1b. No guest found that matches user's query.

* 1b1. **PH** shows message indicating no such guest/staff exists in the list.
* 1b1. **PH** shows message indicating no such guest exists in the list.

Use case ends.

Expand All @@ -444,13 +470,17 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli

Use case ends.

#### UC5: Adding guests/staff
#### UC6: Editing fields of staff

Same as UC5 except that guest is replaced with staff.

#### UC7: Adding guests

**MSS**

1. User keys in command to add a guest or staff with unique passport numbers or staff IDs.
1. User keys in command to add a guest.

2. **PH** shows a success message to user which displays the added guest/staff in the list.
2. **PH** shows a success message to user which displays the added guest in the list.

Use case ends.

Expand All @@ -475,24 +505,33 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli

Use case ends.

#### UC6: Deleting guests/ staff
#### UC8: Adding staff

Same as UC7 except that guest is replaced with staff.

#### UC9: Deleting guest

**MSS**

1. User asks **PH** to delete a guest/ staff
1. User asks **PH** to delete a guest

2. **PH** informs user that guest/ staff is deleted
2. **PH** informs user that guest is deleted

Use case ends.

**Extensions**

* 2a. No guest/staff found that matches user's query
* 2a. No guest found that matches user's query

* 2a1. **PH** informs user that the guest/ staff does not exist
* 2a1. **PH** informs user that the guest does not exist

Use case ends.

#### UC10: Deleting staff

Same as UC9 except that guest is replaced with staff.


*{More to be added}*

### Non-Functional Requirements
Expand Down
60 changes: 35 additions & 25 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
layout: page title: User Guide
layout: page
title: User Guide
---

<h3><i>Welcome to the Pocket Hotel User Guide!</i></h3>
Expand All @@ -19,7 +20,7 @@ fully to integrate it within your hotel management system.

## **Table of Contents**

* Table of Contents
* Table of Contents
{:toc}

--------------------------------------------------------------------------------------------------------------------
Expand All @@ -46,16 +47,16 @@ The **GUI** similar to the below should appear in a few seconds. Note how the ap

* **`list`** : Lists all contacts.

* **`add`**`n/John Doe pn/X12345678F r/123 e/[email protected] a/John street, block 123, #01-01` : Adds a guest
* **`add`**`n/John Doe pn/X12345678F r/123 e/[email protected] t/Senior Citizen` : Adds a guest
named `John Doe` to the Address Book.

* **`delete`**`pn/X12345678F` : Deletes the guest with passport number X12345678F.

* **`clear`** : Clears all contacts.
* **`clear`** : Clears all contacts.

* **`exit`** : Exits the app.
You may refer to the [Features](#features) below for details of each command and to get familiarized with the syntax of

You may refer to the [features](#features) below for details of each command and to get familiarized with the syntax of
the commands.

--------------------------------------------------------------------------------------------------------------------
Expand All @@ -68,7 +69,7 @@ correctly.

A quick overview of all the commands can be found in the [command summary.](#command-summary)

Certain commands require parameters, which may have certain constraints. A quick overview of all the underlying
Certain commands require parameters, which may have constraints. A quick overview of all the underlying
constraints can be found in the [parameter constraints.](#parameter-constraints-summary)

<div markdown="block" class="alert alert-info">
Expand All @@ -81,7 +82,7 @@ constraints can be found in the [parameter constraints.](#parameter-constraints-
* Parameter prefixes such as `n/` and `pn/` are special keywords that indicate a start of a parameter.

* Fields with square brackets are optional.<br>
e.g `n/NAME [p/PHONE_NUMBER]` can be used as `n/Bing Cheng p/99999999` or as `n/Bing Cheng`.
e.g `n/NAME [t/TAG]` can be used as `n/Bing Cheng t/VIP` or as `n/Bing Cheng`.

* Parameters can be in any order.<br>
e.g. if the command specifies `n/NAME pn/PASSPORT_NUMBER`, `pn/PASSPORT_NUMBER n/NAME` is also acceptable.
Expand All @@ -93,9 +94,17 @@ constraints can be found in the [parameter constraints.](#parameter-constraints-
* Extraneous parameters for commands that do not take in parameters (such as `help`, `list`, `exit`) will be
ignored.<br>
e.g. if the command specifies `help 123`, it will be interpreted as `help`.
* Only one unique identifier can be used in a command. The unique identifier is used to identify if the contact is a staff or guest.

</div>

### Contacts in Pocket Hotel
There are 2 types of contacts in _PH_, guests and staff. Guests represent guests of the hotel, and staff represent staff in the hotel. Guest are identified by their `PASSPORT_NUMBER`
and Staff are identified by their `STAFF_ID`. These fields are their unique identifier, and no two contacts can have the same unique identifier.

It is possible for guests and staff ot have the same unique identifier for example, STAFF_ID of a guest is 111 and PASSPORT_NUMBER for a guest is 111, as they represent 2 different entities.

Guests and staff have different parameters, which can be found in the [parameter constraints table.](#parameter-constraints-summary)
### Adding guests/staff : `add`

Adds a new **guest** or **staff** and their contact details into **PH**. Each entity has their own unique fields.
Expand All @@ -121,15 +130,15 @@ Example 2 (Add staff):

### Editing fields of guests/staff: `edit`

Edit a **guest** or **staff’s** contact details by their unique identifier (Guest are identified by their `PASSPORT_NUMBER`
and Staff are identified by their `STAFF_ID`). Only edits the fields that have been passed in as parameters.
Edit a **guest** or **staff’s** contact details by their _unique identifier_. Only edits the fields that have been passed in as parameters.

Format:
<br>Guest: `edit pn/<PASSPORT_NUMBER> <FIELD_NAME>/<NEW_FIELD_DETAILS>`
<br>Staff: `edit sid/<STAFF_ID> <FIELD_NAME>/<NEW_FIELD_DETAILS>`

* Existing values will be updated to the input values.
* Note that when changing a guest of staff unique identifier, it is important that there is no pre-existing staff or
* You can edit more than one field at a time (See example below).
* Note that when changing a guest of staff unique identifier, it is important that there is no pre-existing staff or
guest with that unique identifer already.

Example 1 (Edit guest):
Expand All @@ -139,14 +148,14 @@ Example 1 (Edit guest):

Example 2 (Edit staff):

* `edit sid/123 p/99999999` locates the staff Jeremy, by his staff ID, 123 and overwrites the phone number
field with the new phone number provided.
* `edit sid/123 p/99999999 e/[email protected]` locates the staff Jeremy, by his staff ID, 123 and overwrites the phone number
field with the new phone number provided, and the email field with the new email provided.

[Back to Table of Contents](#table-of-contents)

### Deleting guests/staff: `delete`

Deletes an existing **guest** or **staff** using their unique identifier (`PASSPORT_NUMBER` and `STAFF_ID` respectively).
Deletes an existing **guest** or **staff** using their _unique identifier_.

Format:
<br>Guest: `delete pn/<PASSPORT_NUMBER>`
Expand All @@ -155,7 +164,7 @@ Format:
Example 1 (Delete guest):
<br>![GuestDeleteDiagram](images/GuestDeleteDiagram.png)

* `delete pn/XNOO19390 (PASSPORT_NUMBER)`, The guest, Jonny Jonny who has passport number XNOO19390, is deleted from **
* `delete pn/XNOO19390`, The guest, Jonny Jonny who has passport number XNOO19390, is deleted from **
PH**.

Example 2 (Delete staff):
Expand All @@ -178,7 +187,7 @@ Format: `list`

### Viewing a particular guest/guest: `view`

Views the **staff** or **guest** by their unique identifier, `STAFF_ID` or `PASSPORT_NUMBER`. All the details associated with
Views the **staff** or **guest** by their _unique identifier_. All the details associated with
the staff/guest will be shown in the **GUI**.

Format:
Expand Down Expand Up @@ -264,20 +273,20 @@ Action | Format, Examples

Parameter | Prefix | Constraints, Examples
----------|--------|-----------------------
**PASSPORT_NUMBER** | `pn/` | Blank inputs are not allowed<br> Example: `pn/X12345678A`
**NAME** | `n/` | Blank inputs are not allowed, and should only contain alphabetical characters. <br> Example: `n/Bing Cheng`
**EMAIL** | `e/` | Blanks inputs are not allowed, a valid email address should be used. Example: `e/[email protected]`
**ROOM_NUMBER** | `r/` | Blank inputs are not allowed, only numbers greater than 0 are valid. Example: `r/500`
**TAG** | `t/` | Optional field. Example: `t/Vaccinated`
**PASSPORT_NUMBER** | `pn/` | *Unique Identifier*<br>Blank inputs are not allowed<br>Example: `pn/X12345678A`
**NAME** | `n/` | Blank inputs are not allowed, and should only contain alphabetical characters.<br> Example: `n/Bing Cheng`
**EMAIL** | `e/` | Blanks inputs are not allowed, a valid email address should be used.<br>Example: `e/[email protected]`
**ROOM_NUMBER** | `r/` | Blank inputs are not allowed, only numbers greater than 0 are valid.<br>Example: `r/500`
**TAG** | `t/` | Optional field.<br>Example: `t/Vaccinated`

## **Staff Parameter Constraints Summary**

Parameter | Prefix | Constraints, Examples
----------|--------|-----------------------
**STAFF_ID** | `sid/` | Blank inputs are not allowed, not allowed to be used with `pn/` e.g., `sid/2131`
**NAME** | `n/` | Blank inputs are not allowed, and should only contain alphabetical characters. <br> e.g., `n/Bing Cheng`
**EMAIL** | `e/` | Blanks inputs are not allowed, a valid email address should be used. e.g., `e/[email protected]`
**PHONE_NUMBER** | `p/` | Local phone numbers are 8 digits long, and should start with 8 or 9. <br> e.g., `p/99999999`
**STAFF_ID** | `sid/` | *Unique Identifier*<br>Blank inputs are not allowed, not allowed to be used with `pn/`<br>Example: `sid/2131`
**NAME** | `n/` | Blank inputs are not allowed, and should only contain alphabetical characters.<br>Example: `n/Bing Cheng`
**EMAIL** | `e/` | Blanks inputs are not allowed, a valid email address should be used.<br>Example: `e/[email protected]`
**PHONE_NUMBER** | `p/` | Local phone numbers are 8 digits long, and should start with 8 or 9. <br>Example: `p/99999999`
**ADDRESS** | `a/` | Blank inputs are not allowed.
**TAG** | `t/` | Optional field.

Expand All @@ -292,6 +301,7 @@ Parameter | Prefix | Constraints, Examples
* **GUI**: Graphical user interface
* **Guest**: A guest at the hotel
* **Staff**: An employee of the hotel
* **Unique Identifier**: An attribute that uniquely identifies a contact in the address book and the type of fields it has i.e if a contact is a staff or guest

[Back to Table of Contents](#table-of-contents)

Expand Down
8 changes: 4 additions & 4 deletions docs/diagrams/DeleteSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
end box

[-> LogicManager : execute("delete 1")
[-> LogicManager : execute("delete sid/123")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("delete 1")
LogicManager -> AddressBookParser : parseCommand("delete sid/123")
activate AddressBookParser

create DeleteCommandParser
Expand All @@ -26,7 +26,7 @@ activate DeleteCommandParser
DeleteCommandParser --> AddressBookParser
deactivate DeleteCommandParser

AddressBookParser -> DeleteCommandParser : parse("1")
AddressBookParser -> DeleteCommandParser : parse("sid/123")
activate DeleteCommandParser

create DeleteCommand
Expand All @@ -48,7 +48,7 @@ deactivate AddressBookParser
LogicManager -> DeleteCommand : execute()
activate DeleteCommand

DeleteCommand -> Model : deletePerson(1)
DeleteCommand -> Model : delete staff with sid = 123
activate Model

Model --> DeleteCommand
Expand Down
Binary file modified docs/images/DeleteSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/JsonSnippet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 90c17ca

Please sign in to comment.