diff --git a/back/domain/moneypool.go b/back/domain/moneypool.go index 0ef4eec..d108f27 100644 --- a/back/domain/moneypool.go +++ b/back/domain/moneypool.go @@ -3,6 +3,7 @@ package domain import ( "fmt" "log" + "time" "github.com/pkg/errors" ) @@ -116,8 +117,8 @@ func (d *dbImpl) ShareMoneyPoolWithUserGroups(moneyPoolID string, shareUserGroup } func (d *dbImpl) DeleteMoneyPool(id string) error { - query := `UPDATE money_pool SET is_deleted = true WHERE id = $1` - result, err := d.db.Exec(query, id) + query := `UPDATE money_pool SET is_deleted = true, deleted_at = $2 WHERE id = $1` + result, err := d.db.Exec(query, id, time.Now()) if err != nil { return fmt.Errorf("could not delete money pool: %v", err) } diff --git a/back/infra/psql/init.sql b/back/infra/psql/init.sql index 7c2cf03..f5209ec 100644 --- a/back/infra/psql/init.sql +++ b/back/infra/psql/init.sql @@ -28,6 +28,7 @@ CREATE TABLE IF NOT EXISTS money_pool ( owner_id BIGINT NOT NULL, emoji VARCHAR(255) NOT NULL, is_deleted BOOLEAN NOT NULL, + deleted_at DATE, FOREIGN KEY (owner_id) REFERENCES users(id) );