Skip to content

Commit

Permalink
Merge pull request #100 from tayian/branch-DG
Browse files Browse the repository at this point in the history
Add DG, UG support for addCompany, deleteCompany
  • Loading branch information
tayian committed Oct 27, 2023
2 parents 47bbb7e + 4f489f4 commit 87e15e8
Show file tree
Hide file tree
Showing 10 changed files with 199 additions and 10 deletions.
67 changes: 64 additions & 3 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ The `ListCompaniesCommand` object invokes `updateFilteredCompanyList` in `ModelM

The `ListAllPeopleCommand` object invokes `updateFilteredPersonList` in `ModelManager` in the `Model` component with the predicates `PREDICATE_SHOW_ALL_PERSONS` to communicate to the Model to display all Persons. Note that this command does not modify the internal list of Persons in the Model, only the displayed list.

If the list is empty, `execute` in the list command returns a `CommandResult` with `EMPTY_LIST_MESSAGE` or `MESSAGE_SUCCESS` otherwise.
If the list is empty, `execute` in the list command returns a `CommandResult` with `EMPTY_LIST_MESSAGE` or `MESSAGE_SUCCESS` otherwise.

The sequence diagram below illustrates the events that take place during the execution of `ListALlCommand`. The other two commands are similar.

Expand Down Expand Up @@ -260,11 +260,11 @@ This feature is facilitated by the `DeletePersonCommand` and `DeletePersonComman

When given valid inputs, `the DeletePersonCommandParser` will delete a `Person` object from a particular company list.

Consider a scenario where the user wishes to delete a person from a particular company list.
Consider a scenario where the user wishes to delete a person from a particular company list.

It requires two `Index` parameters: one for the company and another for the person within that company.

The command first validates company index to ensure the company is present in the system.
The command first validates company index to ensure the company is present in the system.

It then validates person index to ensure that the person selected is indeed in that company's list.

Expand All @@ -288,6 +288,67 @@ The DeletePersonCommand also handles scenarios where a person is not part of a c

<div style="page-break-after: always;"></div>

### Add Company Feature: `addCompany`

#### Implementation

This feature is facilitated by the `AddCompanyCommand` and `AddCompanyCommandParser` in the `Logic` component, and works as described below.

When given valid user input, the `AddCompanyCommandParser` will create a new `Company` object to add to the address book.

Consider a scenario where the user wishes to add a new company with various details. The `AddCompanyCommand` takes in various parameters, such as name, industry, location, description, website, email, phone, address
to create a new `Company` object.

<img src="images/addCompanyObjectDiagram.png" width="600" />

Consider an example of a valid `addCompany` command:

```plaintext
addCompany n/TechCorp i/Technology l/Silicon Valley d/Leading tech company w/www.techcorp.com e/contact@techcorp.com p/12345678 a/123 Tech St, Silicon Valley
```

The new objects in the final internal state after this example has been parsed are shown in the object diagram above.

The following activity diagrams detail the behavior of Connectify when a user inputs an addCompany command with valid syntax to be executed.

The AddCompanyCommand also handles scenarios where a company with the same details already exists in the address book. In such cases, the command throws a CommandException with an error message to inform the user.

<img src="images/addCompanyActivityDiagram.png" width="600" />

<div style="page-break-after: always;"></div>

### Delete Company Feature: `deleteCompany`

#### Implementation

This feature is facilitated by the `DeleteCompanyCommand` and `DeleteCompanyCommandParser` in the `Logic` component, and works as described below.

When given valid inputs, `the DeleteCompanyCommandParser` will delete a `Company` object.

Consider a scenario where the user wishes to delete a company.

It requires a `CompanyIndex` parameter. This validates company index to ensure the company is present in the system.

If valid, the company is removed from the address book.

<img src="images/deleteCompanyObjectDiagram.png" width="600" />

Consider an example of a valid `deleteCompany` command:

```plaintext
deleteCompany 1
```

The new objects in the final internal state after this example has been parsed are shown in the object diagram above.

The following activity diagrams detail the behavior of Connectify when a user inputs an deleteCompany command with valid syntax to be executed.

The DeleteCompanyCommand also handles scenarios where a company index does not exist in the range of companies. In such cases, the command throws a CommandException with an error message to inform the user.

<img src="images/deleteCompanyActivityDiagram.png" width="600" />

<div style="page-break-after: always;"></div>

### \[Proposed\] Undo/redo feature

#### Proposed Implementation
Expand Down
60 changes: 53 additions & 7 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Connectify is a networking platform designed to help professionals efficiently m
* [Features](#features)
* [Adding Contacts](#adding-contacts)
* [Deleting Contacts](#deleting-contacts)
* [Listing Contacts](#listing-contacts)
* [Editing Contacts](#editing-people)
* [Listing Contacts](#listing-all-entities)
* [Exit](#exit)
* [FAQ](#faq)
* [Known issues](#known-issues)
Expand Down Expand Up @@ -81,6 +82,49 @@ Tags: friends, owesMoney
The company index provided is invalid.
```

#### Command: `addCompany`

The **addCompany** command allows you to add new companies to your Connectify database. Follow the format below to add contacts:

`addCompany n/NAME i/INDUSTRY l/LOCATION d/DESCRIPTION w/WEBSITE e/EMAIL p/PHONE a/ADDRESS`

- `n/NAME`: Specify the Company name.
- `i/INDUSTRY`: Add the industry the Company is in.
- `l/LOCATION`: Add the city/locale Company is at.
- `d/DESCRIPTION`: Describe the Company.
- `w/WEBSITE`: Add the Company website.
- `e/EMAIL`: Add the contact email of the Company.
- `p/PHONE`: Add the phone number of the Company.
- `a/ADDRESS`: Include the address of the Company.

**Example:**

To add a Company "Apple Inc", a computer and consumer technology company headquartered in Los Altos, with the website "www.apple.com", email address contact@apple.com, the phone number 98765432, address "1 Apple Park Way, Cupertino, California", use the following command:

```
addCompany n/Apple Inc i/technology l/Los Altos d/computer and consumer technology w/www.apple.com e/contact@apple.com p/98765432 a/1 Apple Park Way, Cupertino, California
```

**Successful Output:**

```
New company added: Apple Inc
Phone: 98765432
Email: contact@apple.com
Address: 1 Apple Park Way, Cupertino, California
Industry: technology
Location: Los Altos
Description: computer and consumer technology
Website: www.apple.com
```

**Unsuccessful Output:**

- If a person with the same details already exists in the address book:
```
This company already exists in the address book.
```

### Deleting Contacts

#### Command: `deletePerson`
Expand Down Expand Up @@ -305,9 +349,11 @@ That is not a valid command.

## Command Summary

| Action | Format, Examples |
|------------------|-------------------------------|
| **AddPerson** | `addPerson n/NAME p/PHONE e/EMAIL a/ADDRESS c/COMPANY [t/TAG]…` <br> e.g., `addPerson n/John Doe p/98765432 e/johndoe@example.com a/311, Clementi Ave 2, #02-25 c/1 t/friends t/owesMoney` |
| **DeletePerson** | `deletePerson INDEX` <br> e.g., `delete 1` |
| **List** | `list` |
| **Exit** | `exit` |
| Action | Format, Examples |
|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **AddPerson** | `addPerson n/NAME p/PHONE e/EMAIL a/ADDRESS c/COMPANY [t/TAG]…` <br> e.g., `addPerson n/John Doe p/98765432 e/johndoe@example.com a/311, Clementi Ave 2, #02-25 c/1 t/friends t/owesMoney` |
| **AddCompany** | `addCompany n/NAME i/INDUSTRY l/LOCATION d/DESCRIPTION w/WEBSITE e/EMAIL p/PHONE a/ADDRESS` <br> e.g., `addCompany n/Apple Inc i/technology l/Los Altos d/computer and consumer technology w/www.apple.com e/contact@apple.com p/98765432 a/1 Apple Park Way, Cupertino, California` |
| **DeletePerson** | `deletePerson INDEX` <br> e.g., `delete 1` |
| **DeleteCompany** | `deleteCompany INDEX` <br> e.g., `delete 1` |
| **List** | `list` |
| **Exit** | `exit` |
14 changes: 14 additions & 0 deletions docs/diagrams/addCompanyActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@startuml
start
: User executes command;
: Parser parses command;

if (Company already exists with same details?) then (yes)
: User is informed that the Company already exists;
stop
else (no)
: Create a new Company object with provided details;
: Update the Model with the new Company;
: User is informed that the Company is added;
stop
@enduml
36 changes: 36 additions & 0 deletions docs/diagrams/addCompanyObjectDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@startuml
!include style.puml
skinparam ClassFontColor #000000
skinparam ClassBorderColor #000000

title Add Company Object Diagram

class AddCompanyCommand as "__:AddCompanyCommand__"
class Company as "__:Company__"
class Name as "__TechCorp:Name__"
class Industry as "__Technology:Industry__"
class Location as "__Silicon Valley:Location__"
class Description as "__Leading tech company:Description__"
class Website as "__www.techcorp.com:Website__"
class Email as "__contact@techcorp.com:Email__"
class Phone as "__12345678:Phone__"
class Address as "__123 Tech St, Silicon Valley:Address__"

AddCompanyCommand --> Company
Company --> Name
Company --> Industry
Company --> Location
Company --> Description
Company --> Website
Company --> Email
Company --> Phone
Company --> Address

Name -[hidden]> Industry
Industry -[hidden]> Location
Location -[hidden]> Description
Description -[hidden]> Website
Website -[hidden]> Email
Email -[hidden]> Phone
Phone -[hidden]> Address
@end
16 changes: 16 additions & 0 deletions docs/diagrams/deleteCompanyActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@startuml
start
: User executes delete command;
: DeleteCompanyCommandParser parses command;

if (Company exists?) then (yes)
' : Remove the Person from the designated Company's list;
' : Update the Model by removing the Person from the address book;
: Remove the Company from the designated Company's list;
: User is informed that the company is deleted;
stop
else (no)
: User is informed that the company index is invalid;
stop
endif
@enduml
16 changes: 16 additions & 0 deletions docs/diagrams/deleteCompanyObjectDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@startuml
!include style.puml
skinparam ClassFontColor #000000
skinparam ClassBorderColor #000000

title Delete Company Object Diagram

class DeleteCompanyCommand as "__:DeleteCompanyCommand__"
class Company as "__:Company__"
class CompanyList as "__:List<Company>__"

DeleteCompanyCommand --> Company
DeleteCompanyCommand --> CompanyList

CompanyList -[hidden]> Company
@end
Binary file added docs/images/addCompanyActivityDiagram.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/addCompanyObjectDiagram.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/deleteCompanyActivityDiagram.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/deleteCompanyObjectDiagram.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 87e15e8

Please sign in to comment.