diff --git a/internal/training/postgres_repository.go b/internal/training/postgres_repository.go index fd99641..2d817b0 100644 --- a/internal/training/postgres_repository.go +++ b/internal/training/postgres_repository.go @@ -26,7 +26,7 @@ func (r *PostgresRepository) Create(ctx context.Context, training *Training) err queryErr := tx.QueryRow(ctx, ` INSERT INTO training.trainings (name, days, published) - VALUES ($1, $2, $3, $4, $5) + VALUES ($1, $2, $3) RETURNING id `, training.name, training.days, training.published).Scan(&training.id) if queryErr != nil { @@ -41,7 +41,7 @@ func (r *PostgresRepository) Create(ctx context.Context, training *Training) err func (r *PostgresRepository) Update(ctx context.Context, training *Training) error { _, err := r.pg.Exec(ctx, ` UPDATE training.trainings - SET title = $2 + SET name = $2 WHERE id = $1 `, training.ID, training.name) if err != nil { @@ -54,7 +54,7 @@ func (r *PostgresRepository) Update(ctx context.Context, training *Training) err func (r *PostgresRepository) FindByID(ctx context.Context, id ID) (*Training, error) { var t Training err := r.pg.QueryRow(ctx, ` - SELECT id, title, published, retired + SELECT id, name, published, retired FROM training.trainings WHERE id = $1 `, id).Scan(&t.id, &t.name, &t.published, &t.retired) @@ -67,7 +67,7 @@ func (r *PostgresRepository) FindByID(ctx context.Context, id ID) (*Training, er func (r *PostgresRepository) FindAll(ctx context.Context) ([]Training, error) { rows, err := r.pg.Query(ctx, ` - SELECT id, title, published, retired + SELECT id, name, published, retired FROM training.trainings `) if err != nil {