generated from VLADIMIR/template
fix names
This commit is contained in:
@@ -26,7 +26,7 @@ func NewActionsRepo(pool *pgxpool.Pool) *ActionsRepo {
|
||||
}
|
||||
}
|
||||
|
||||
func (r *ActionsRepo) AddAction(ctx context.Context, teamId int, code string, viaMCP bool) (int, error) {
|
||||
func (r *ActionsRepo) AddAction(ctx context.Context, teamID int, code string, viaMCP bool) (int, error) {
|
||||
id := 0
|
||||
err := r.pool.QueryRow(
|
||||
ctx,
|
||||
@@ -34,7 +34,7 @@ func (r *ActionsRepo) AddAction(ctx context.Context, teamId int, code string, vi
|
||||
VALUES ($1, $2, $3)
|
||||
RETURNING id`,
|
||||
code,
|
||||
teamId,
|
||||
teamID,
|
||||
viaMCP,
|
||||
).Scan(&id)
|
||||
|
||||
@@ -44,7 +44,7 @@ func (r *ActionsRepo) AddAction(ctx context.Context, teamId int, code string, vi
|
||||
return id, nil
|
||||
}
|
||||
|
||||
func (r *ActionsRepo) GetActionsByTeamID(ctx context.Context, teamId int) ([]Action, error) {
|
||||
func (r *ActionsRepo) GetActionsByTeamID(ctx context.Context, teamID int) ([]Action, error) {
|
||||
rows, err := r.pool.Query(
|
||||
ctx,
|
||||
`SELECT
|
||||
@@ -53,7 +53,7 @@ func (r *ActionsRepo) GetActionsByTeamID(ctx context.Context, teamId int) ([]Act
|
||||
FROM actions
|
||||
WHERE team_id = $1
|
||||
ORDER BY created_at ASC`,
|
||||
teamId,
|
||||
teamID,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -79,7 +79,7 @@ func (r *ActionsRepo) GetActionsByTeamID(ctx context.Context, teamId int) ([]Act
|
||||
return actions, nil
|
||||
}
|
||||
|
||||
func (r *ActionsRepo) GetActionsCountByTeamIDs(ctx context.Context, teamIds []int) (map[int]int, error) {
|
||||
func (r *ActionsRepo) GetActionsCountByTeamIDs(ctx context.Context, teamIDs []int) (map[int]int, error) {
|
||||
rows, err := r.pool.Query(
|
||||
ctx,
|
||||
`SELECT
|
||||
@@ -88,14 +88,14 @@ func (r *ActionsRepo) GetActionsCountByTeamIDs(ctx context.Context, teamIds []in
|
||||
FROM actions
|
||||
WHERE team_id = ANY($1)
|
||||
GROUP BY team_id`,
|
||||
teamIds,
|
||||
teamIDs,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
res := make(map[int]int, len(teamIds))
|
||||
res := make(map[int]int, len(teamIDs))
|
||||
for rows.Next() {
|
||||
id := 0
|
||||
count := 0
|
||||
@@ -115,7 +115,7 @@ func (r *ActionsRepo) GetActionsCountByTeamIDs(ctx context.Context, teamIds []in
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (r *ActionsRepo) DeleteLastActionByTeamId(ctx context.Context, teamId int) error {
|
||||
func (r *ActionsRepo) DeleteLastActionByTeamID(ctx context.Context, teamID int) error {
|
||||
tag, err := r.pool.Exec(
|
||||
ctx,
|
||||
`DELETE FROM actions
|
||||
@@ -126,7 +126,7 @@ func (r *ActionsRepo) DeleteLastActionByTeamId(ctx context.Context, teamId int)
|
||||
ORDER BY created_at DESC
|
||||
LIMIT 1
|
||||
)`,
|
||||
teamId,
|
||||
teamID,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user