Skip to content

Commit

Permalink
Delete Client implemented
Browse files Browse the repository at this point in the history
DeleteClientCommand and DelteClientCommandParser classes added

Repackaged Delete commands to follow team convention
  • Loading branch information
Mahidharah committed Oct 31, 2023
1 parent ba0ceae commit 1fdca40
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package seedu.address.logic.commands;
package seedu.address.logic.commands.delete;

import seedu.address.commons.core.index.Index;
import seedu.address.commons.util.ToStringBuilder;
import seedu.address.logic.Messages;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.TabIndex;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.client.Client;
Expand Down Expand Up @@ -42,7 +45,7 @@ public CommandResult execute(Model model) throws CommandException {

Client clientToDelete = lastShownList.get(targetIndex.getZeroBased());
model.deleteClient(clientToDelete);
return new CommandResult(String.format(MESSAGE_DELETE_CLIENT_SUCCESS, Messages.format(clientToDelete)),TabIndex.Client);
return new CommandResult(String.format(MESSAGE_DELETE_CLIENT_SUCCESS, Messages.format(clientToDelete)), TabIndex.Client);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package seedu.address.logic.commands;
package seedu.address.logic.commands.delete;

import static java.util.Objects.requireNonNull;

Expand All @@ -7,6 +7,9 @@
import seedu.address.commons.core.index.Index;
import seedu.address.commons.util.ToStringBuilder;
import seedu.address.logic.Messages;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.TabIndex;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.developer.Developer;
Expand Down Expand Up @@ -42,7 +45,7 @@ public CommandResult execute(Model model) throws CommandException {

Developer developerToDelete = lastShownList.get(targetIndex.getZeroBased());
model.deleteDeveloper(developerToDelete);
return new CommandResult(String.format(MESSAGE_DELETE_DEVELOPER_SUCCESS, Messages.format(developerToDelete)),TabIndex.Developer);
return new CommandResult(String.format(MESSAGE_DELETE_DEVELOPER_SUCCESS, Messages.format(developerToDelete)), TabIndex.Developer);
}

@Override
Expand Down
14 changes: 5 additions & 9 deletions src/main/java/seedu/address/logic/parser/AddressBookParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,12 @@
import java.util.regex.Pattern;

import seedu.address.commons.core.LogsCenter;
import seedu.address.logic.commands.ClearCommand;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.DeleteDeveloperCommand;
import seedu.address.logic.commands.ExitCommand;
import seedu.address.logic.commands.*;
import seedu.address.logic.commands.delete.DeleteClientCommand;
import seedu.address.logic.commands.delete.DeleteDeveloperCommand;
import seedu.address.logic.commands.find.FindClientCommand;
import seedu.address.logic.commands.find.FindDeveloperCommand;
import seedu.address.logic.commands.find.FindProjectCommand;
import seedu.address.logic.commands.HelpCommand;
import seedu.address.logic.commands.ImportCommand;
import seedu.address.logic.commands.ListClientCommand;
import seedu.address.logic.commands.ListDeveloperCommand;
import seedu.address.logic.commands.ListProjectCommand;
import seedu.address.logic.commands.add.AddClientCommand;
import seedu.address.logic.commands.add.AddDeveloperCommand;
import seedu.address.logic.commands.add.AddProjectCommand;
Expand All @@ -31,6 +25,8 @@
import seedu.address.logic.parser.add.AddClientCommandParser;
import seedu.address.logic.parser.add.AddDeveloperCommandParser;
import seedu.address.logic.parser.add.AddProjectCommandParser;
import seedu.address.logic.parser.delete.DeleteClientCommandParser;
import seedu.address.logic.parser.delete.DeleteDeveloperCommandParser;
import seedu.address.logic.parser.edit.EditClientCommandParser;
import seedu.address.logic.parser.edit.EditDeveloperCommandParser;
import seedu.address.logic.parser.edit.EditProjectCommandParser;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package seedu.address.logic.parser;
package seedu.address.logic.parser.delete;

import seedu.address.commons.core.index.Index;
import seedu.address.logic.commands.DeleteClientCommand;
import seedu.address.logic.commands.DeleteDeveloperCommand;
import seedu.address.logic.commands.delete.DeleteClientCommand;
import seedu.address.logic.parser.Parser;
import seedu.address.logic.parser.ParserUtil;
import seedu.address.logic.parser.exceptions.ParseException;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package seedu.address.logic.parser;
package seedu.address.logic.parser.delete;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import seedu.address.commons.core.index.Index;
import seedu.address.logic.commands.DeleteDeveloperCommand;
import seedu.address.logic.commands.delete.DeleteDeveloperCommand;
import seedu.address.logic.parser.Parser;
import seedu.address.logic.parser.ParserUtil;
import seedu.address.logic.parser.exceptions.ParseException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import seedu.address.commons.core.index.Index;
import seedu.address.logic.Messages;
import seedu.address.logic.commands.delete.DeleteDeveloperCommand;
import seedu.address.model.Model;
import seedu.address.model.ModelManager;
import seedu.address.model.UserPrefs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import seedu.address.logic.commands.add.AddDeveloperCommand;
import seedu.address.logic.commands.ClearCommand;
import seedu.address.logic.commands.DeleteDeveloperCommand;
import seedu.address.logic.commands.delete.DeleteDeveloperCommand;
import seedu.address.logic.commands.ExitCommand;
import seedu.address.logic.commands.find.FindDeveloperCommand;
import seedu.address.logic.commands.HelpCommand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

import org.junit.jupiter.api.Test;

import seedu.address.logic.commands.DeleteDeveloperCommand;
import seedu.address.logic.commands.delete.DeleteDeveloperCommand;
import seedu.address.logic.parser.delete.DeleteDeveloperCommandParser;

/**
* As we are only doing white-box testing, our test cases do not cover path variations
Expand Down

0 comments on commit 1fdca40

Please sign in to comment.