Skip to content

Commit

Permalink
Merge pull request #117 from AZhiKai/feature/ug-dg
Browse files Browse the repository at this point in the history
v1.2: Update to UGDG
  • Loading branch information
azhikai authored Oct 18, 2018
2 parents fcf7210 + 2ad91ad commit cb09817
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 13 deletions.
61 changes: 60 additions & 1 deletion docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,66 @@ image::UndoRedoActivityDiagram.png[width="650"]
** Cons: Requires dealing with commands that have already been undone: We must remember to skip these commands. Violates Single Responsibility Principle and Separation of Concerns as `HistoryManager` now needs to do two different things.
// end::undoredo[]

=== User account feature
==== Current Implementation

The user account mechanism is facilitated by `AddressBook`. Additionally, it implements the following operations:

* `AddressBook#getAccount(Account)` -- Retrieves the account.
* `AddressBook#addAccount(Account)` -- Saves the new account.
* `AddressBook#updateAccount(Account, Account)` -- Update the existing account's detail(s).
* `AddressBook#removeAccount(Account)` -- Removes the account.

These operations are exposed in the `Model` interface as `Model#getAccount(Account)`, `Model#addAccount(Account)`,
`Model#updateAccount(Account, Account)` and `Model#removeAccount(Account)` respectively.

Given below is an example usage scenario and how `AddressBook#addAccount(Account)` behaves at each step.

Step 1. The user launches the application and logs in to an existing account.

Step 2. The user executes `register id/azhikai pw/1122qq` command to create a new user account.

[NOTE]
If the username already exists, a warning message will be shown to the user

The following sequence diagram shows how the `register` command works:

image::RegisterSequenceDiagram.png[width="800"]

=== User session feature
==== Current Implementation

[NOTE]
If a private command is executed when a session is not set, it won't be processed. The only commands that can
be executed without a session being set are `help`, `login` and `exit`.

The user session is facilitated by `UserSession` which stores the authentication state of the application.
This is triggered by raising a `Login` and `Logout` event upon executing either the `Command#LoginCommand()` or
`Command#LogoutCommand()`. +

Additionally, it implements the following operations:

* `UserSession#login()` -- Creates a login session.
* `UserSession#logout()` -- Removes the existing login session.
* `UserSession#isAuthenticated()` -- Checks if there is an existing login session.

Given below is an example usage scenario and how the user session mechanism behaves at each step.

The following activity diagram summarizes what happens when a user logs in or out:

image::UserSessionActivityDiagram.png[width="650"]

==== Design Considerations
===== Aspect: How user session is handled

* **Alternative 1 (current choice):** Use a static flag.
** Pros: Easy to implement.
** Cons: Can only support one user.
* **Alternative 2:** Store a list of user sessions, allowing multiple login.
** Pros: More user can login and manage the systems.
** Cons: More memory usage to track each user session.


// tag::displaySales[]
=== Display sales report feature
==== Current Implementation
Expand Down Expand Up @@ -1690,4 +1750,3 @@ These instructions only provide a starting point for testers to work on; testers
Expected: The most recent window size and location is retained.

_{ more test cases ... }_

38 changes: 26 additions & 12 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ endif::[]
By: `Team CS2103-AY1819S1-F10-4`      Since: `Sep 2018`      Licence: `MIT`

== Introduction
link:{repoURL}[MeNUS] empowers you to improve the Management(M) and efficiency(e) of your
restaurants in NUS.
link:{repoURL}[MeNUS] empowers you to improve the Management(M) and efficiency(e) of your restaurants in NUS.

As long as you feel like your restaurants are using too many overcomplicated and expensive systems,
link:{repoURL}[MeNUS] is here for you!


MeNUS is designed for restaurant owners who prefer to use a desktop application to manage their restaurants. More
importantly,
MeNUS is *optimized for users who prefer to work with a Command Line Interface (CLI) while still having the benefits
of a Graphical User Interface (GUI)*. If you can type fast, MeNUS allows you to manage aspects of your eatery
-- menu, ingredient, sales and reservations management -- all from a single location !
Introducing link:{repoURL}[MeNUS], a revolutionary restaurant management desktop application that is *optimized for
users who prefer to work with a Command Line Interface (CLI) while still having
the benefits of a Graphical User Interface (GUI)*. If you can type fast, MeNUS allows you to manage aspects of your
eatery -- menu, ingredient, sales and reservations management -- all from a single location !

Let's get started!

== Quick Start

Expand All @@ -46,7 +50,7 @@ image::Ui.png[width="790"]
. Type the command in the command box and press kbd:[Enter] to execute it. +
e.g. typing *`help`* and pressing kbd:[Enter] will open the help window.
. Some example commands you can try:

* * `login id/root pw/root` : logs into the root account
* *`list`* : lists all contacts
* **`add`**`n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01` : adds a contact named `John Doe` to the Address Book.
* **`delete`**`3` : deletes the 3rd contact shown in the current list
Expand Down Expand Up @@ -217,7 +221,7 @@ Format: `history`

[NOTE]
====
Pressing the kbd:[↑] and kbd:[↓] arrows will display the previous and next input respectively in the command box.
Pressing the kbd:[↑] and kbd:[↓] arrows will display the previous and next input respectively in the command box
====

// tag::undoredo[]
Expand All @@ -228,7 +232,7 @@ Format: `undo`

[NOTE]
====
Undoable commands: those commands that modify the address book's content (`add`, `delete`, `edit` and `clear`).
Undoable commands: those commands that modify the address book's content (`add`, `delete`, `edit` and `clear`)
====

Examples:
Expand Down Expand Up @@ -309,10 +313,10 @@ Examples:
* `register id/azhikai pw/p@55w0rd`
* `reg id/azhikai pw/p@55w0rd`

=== Editing user account: `edit-acc` or `ea`
=== Editing user account: `edit-account` or `ea`

Edits an existing user account. +
Format: `edit-acc id/USERNAME [nid/NEW_USERNAME] [pw/NEW_PASSWORD]`
Format: `edit-account id/USERNAME [nid/NEW_USERNAME] [pw/NEW_PASSWORD]`

****
* The account's data will remain intact if none of the optional fields are provided.
Expand All @@ -336,6 +340,16 @@ Examples:
* `deregister id/azhikai`
* `dereg id/azhikai`

=== List user accounts: `list-accounts` or `la`

List all user accounts. +
Format: `list-accounts`

[IMPORTANT]
====
Password is masked by default and should never be shown
====

=== User roles `[coming in v2.0]`
With user role, each user will only be able to execute certain commands, other than the administrator and/or
restaurant owner who is able to execute all commands.
Expand Down
Binary file added docs/diagrams/RegisterSequenceDiagram.pptx
Binary file not shown.
Binary file added docs/diagrams/UserSessionActivityDiagram.pptx
Binary file not shown.
Binary file added docs/images/RegisterSequenceDiagram.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 added docs/images/UserSessionActivityDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cb09817

Please sign in to comment.