This commit is contained in:
2025-05-19 03:56:20 +07:00
parent e409a69a54
commit 4b44bad1c0
4 changed files with 44 additions and 4 deletions
+12 -2
View File
@@ -90,9 +90,9 @@ func (r *Repository) GetActions(ctx context.Context, teamId int64) ([]*models.Ac
return actions, nil
}
func (r *Repository) AddActions(ctx context.Context, actions []*models.Action) error {
func (r *Repository) AddActions(ctx context.Context, teamId int64, actions []*models.Action) error {
for _, action := range actions {
_, err := r.db.Exec("insert into actions (place, teamId) values ($1, $2)", action.Place, action.TeamID)
_, err := r.db.Exec("insert into actions (place, teamId) values ($1, $2)", action.Place, teamId)
if err != nil {
return err
}
@@ -152,3 +152,13 @@ func (r *Repository) GetApplications(ctx context.Context, teamId int64, state st
}
return applications, nil
}
func (r *Repository) GiveApplications(ctx context.Context, teamId int64, applications []*models.Application) error {
for _, application := range applications {
_, err := r.db.Exec("update applications set state = \"gave\" where teamId = $1 and id = $2", teamId, application.ID)
if err != nil {
return err
}
}
return nil
}