Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- +goose Up
-- +goose StatementBegin
ALTER TABLE applications
ADD COLUMN submitted_at TIMESTAMPTZ;
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
ALTER TABLE applications
DROP COLUMN submitted_at;
-- +goose StatementEnd
3 changes: 2 additions & 1 deletion apps/api/internal/db/queries/applications.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ WHERE user_id = $1 AND event_id = $2;
UPDATE applications
SET
status = CASE WHEN @status_do_update::boolean THEN @status::application_status ELSE status END,
application = CASE WHEN @application_do_update::boolean THEN @application::JSONB ELSE application END
application = CASE WHEN @application_do_update::boolean THEN @application::JSONB ELSE application END,
submitted_at = CASE WHEN @submitted_at_do_update::boolean THEN @submitted_at::timestamptz ELSE submitted_at END
WHERE
user_id = @user_id AND event_id = @event_id;

Expand Down
3 changes: 3 additions & 0 deletions apps/api/internal/db/repository/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"errors"
"time"

"github.com/google/uuid"
"github.com/jackc/pgx/v5"
Expand Down Expand Up @@ -77,6 +78,8 @@ func (r *ApplicationRepository) SubmitApplication(ctx context.Context, data any,
Status: sqlc.ApplicationStatusSubmitted,
ApplicationDoUpdate: true,
Application: jsonBytes,
SubmittedAtDoUpdate: true,
SubmittedAt: time.Now(),
UserID: userId,
EventID: eventId,
})
Expand Down
16 changes: 12 additions & 4 deletions apps/api/internal/db/sqlc/applications.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apps/api/internal/db/sqlc/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading