Skip to content

Commit

Permalink
fix: make comparing foodId work (#304)
Browse files Browse the repository at this point in the history
it should use equal() method, but it doesn't work even though it compares same id
  • Loading branch information
taniguchiiqqq authored Feb 20, 2024
1 parent 9156a3e commit f6a2297
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions backend/main/src/Group/Domain/Entities/Container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,7 @@ export class Container extends AggregateRoot<string, IContainerProps> {
* @param foodId
*/
public removeFood(foodId: FoodId): Result<Container, ContainerDomainError> {
const foods = this.props.foods.filter((f) => {
if (!f.id.equal(foodId)) return true;
});
const foods = this.props.foods.filter((f) => f.id.id !== foodId.id);
if (foods.length === this.props.foods.length) {
return Err(
new ContainerDomainError(
Expand Down

0 comments on commit f6a2297

Please # to comment.