Add OpenAPI docs, frontend, migrations, and API updates
- OpenAPI: add missing endpoints (add-from-url, subscriptions, public availability) - OpenAPI: CalendarSubscription schema, Subscriptions tag - Frontend app - Migrations: count_for_availability, subscriptions_sync, user_preferences, calendar_settings - Config, rate limit, auth, calendar, booking, ICS, availability, user service updates Made-with: Cursor
This commit is contained in:
@@ -55,19 +55,30 @@ func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (CreateU
|
||||
}
|
||||
|
||||
const getUserByEmail = `-- name: GetUserByEmail :one
|
||||
SELECT id, email, password_hash, timezone, is_active, created_at, updated_at
|
||||
SELECT id, email, password_hash, timezone, is_active, week_start_day, date_format, time_format,
|
||||
default_event_duration_minutes, default_reminder_minutes, show_weekends,
|
||||
working_hours_start, working_hours_end, notifications_email, created_at, updated_at
|
||||
FROM users
|
||||
WHERE email = $1 AND deleted_at IS NULL
|
||||
`
|
||||
|
||||
type GetUserByEmailRow struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
Email string `json:"email"`
|
||||
PasswordHash string `json:"password_hash"`
|
||||
Timezone string `json:"timezone"`
|
||||
IsActive bool `json:"is_active"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
||||
ID pgtype.UUID `json:"id"`
|
||||
Email string `json:"email"`
|
||||
PasswordHash string `json:"password_hash"`
|
||||
Timezone string `json:"timezone"`
|
||||
IsActive bool `json:"is_active"`
|
||||
WeekStartDay int16 `json:"week_start_day"`
|
||||
DateFormat string `json:"date_format"`
|
||||
TimeFormat string `json:"time_format"`
|
||||
DefaultEventDurationMinutes int32 `json:"default_event_duration_minutes"`
|
||||
DefaultReminderMinutes int32 `json:"default_reminder_minutes"`
|
||||
ShowWeekends bool `json:"show_weekends"`
|
||||
WorkingHoursStart string `json:"working_hours_start"`
|
||||
WorkingHoursEnd string `json:"working_hours_end"`
|
||||
NotificationsEmail bool `json:"notifications_email"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetUserByEmail(ctx context.Context, email string) (GetUserByEmailRow, error) {
|
||||
@@ -79,6 +90,15 @@ func (q *Queries) GetUserByEmail(ctx context.Context, email string) (GetUserByEm
|
||||
&i.PasswordHash,
|
||||
&i.Timezone,
|
||||
&i.IsActive,
|
||||
&i.WeekStartDay,
|
||||
&i.DateFormat,
|
||||
&i.TimeFormat,
|
||||
&i.DefaultEventDurationMinutes,
|
||||
&i.DefaultReminderMinutes,
|
||||
&i.ShowWeekends,
|
||||
&i.WorkingHoursStart,
|
||||
&i.WorkingHoursEnd,
|
||||
&i.NotificationsEmail,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
)
|
||||
@@ -86,19 +106,30 @@ func (q *Queries) GetUserByEmail(ctx context.Context, email string) (GetUserByEm
|
||||
}
|
||||
|
||||
const getUserByID = `-- name: GetUserByID :one
|
||||
SELECT id, email, password_hash, timezone, is_active, created_at, updated_at
|
||||
SELECT id, email, password_hash, timezone, is_active, week_start_day, date_format, time_format,
|
||||
default_event_duration_minutes, default_reminder_minutes, show_weekends,
|
||||
working_hours_start, working_hours_end, notifications_email, created_at, updated_at
|
||||
FROM users
|
||||
WHERE id = $1 AND deleted_at IS NULL
|
||||
`
|
||||
|
||||
type GetUserByIDRow struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
Email string `json:"email"`
|
||||
PasswordHash string `json:"password_hash"`
|
||||
Timezone string `json:"timezone"`
|
||||
IsActive bool `json:"is_active"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
||||
ID pgtype.UUID `json:"id"`
|
||||
Email string `json:"email"`
|
||||
PasswordHash string `json:"password_hash"`
|
||||
Timezone string `json:"timezone"`
|
||||
IsActive bool `json:"is_active"`
|
||||
WeekStartDay int16 `json:"week_start_day"`
|
||||
DateFormat string `json:"date_format"`
|
||||
TimeFormat string `json:"time_format"`
|
||||
DefaultEventDurationMinutes int32 `json:"default_event_duration_minutes"`
|
||||
DefaultReminderMinutes int32 `json:"default_reminder_minutes"`
|
||||
ShowWeekends bool `json:"show_weekends"`
|
||||
WorkingHoursStart string `json:"working_hours_start"`
|
||||
WorkingHoursEnd string `json:"working_hours_end"`
|
||||
NotificationsEmail bool `json:"notifications_email"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetUserByID(ctx context.Context, id pgtype.UUID) (GetUserByIDRow, error) {
|
||||
@@ -110,6 +141,15 @@ func (q *Queries) GetUserByID(ctx context.Context, id pgtype.UUID) (GetUserByIDR
|
||||
&i.PasswordHash,
|
||||
&i.Timezone,
|
||||
&i.IsActive,
|
||||
&i.WeekStartDay,
|
||||
&i.DateFormat,
|
||||
&i.TimeFormat,
|
||||
&i.DefaultEventDurationMinutes,
|
||||
&i.DefaultReminderMinutes,
|
||||
&i.ShowWeekends,
|
||||
&i.WorkingHoursStart,
|
||||
&i.WorkingHoursEnd,
|
||||
&i.NotificationsEmail,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
)
|
||||
@@ -129,28 +169,69 @@ func (q *Queries) SoftDeleteUser(ctx context.Context, id pgtype.UUID) error {
|
||||
const updateUser = `-- name: UpdateUser :one
|
||||
UPDATE users
|
||||
SET timezone = COALESCE($1::TEXT, timezone),
|
||||
week_start_day = COALESCE($2::SMALLINT, week_start_day),
|
||||
date_format = COALESCE($3::TEXT, date_format),
|
||||
time_format = COALESCE($4::TEXT, time_format),
|
||||
default_event_duration_minutes = COALESCE($5::INTEGER, default_event_duration_minutes),
|
||||
default_reminder_minutes = COALESCE($6::INTEGER, default_reminder_minutes),
|
||||
show_weekends = COALESCE($7::BOOLEAN, show_weekends),
|
||||
working_hours_start = COALESCE($8::TEXT, working_hours_start),
|
||||
working_hours_end = COALESCE($9::TEXT, working_hours_end),
|
||||
notifications_email = COALESCE($10::BOOLEAN, notifications_email),
|
||||
updated_at = now()
|
||||
WHERE id = $2 AND deleted_at IS NULL
|
||||
RETURNING id, email, password_hash, timezone, is_active, created_at, updated_at
|
||||
WHERE id = $11 AND deleted_at IS NULL
|
||||
RETURNING id, email, password_hash, timezone, is_active, week_start_day, date_format, time_format,
|
||||
default_event_duration_minutes, default_reminder_minutes, show_weekends,
|
||||
working_hours_start, working_hours_end, notifications_email, created_at, updated_at
|
||||
`
|
||||
|
||||
type UpdateUserParams struct {
|
||||
Timezone pgtype.Text `json:"timezone"`
|
||||
ID pgtype.UUID `json:"id"`
|
||||
Timezone pgtype.Text `json:"timezone"`
|
||||
WeekStartDay pgtype.Int2 `json:"week_start_day"`
|
||||
DateFormat pgtype.Text `json:"date_format"`
|
||||
TimeFormat pgtype.Text `json:"time_format"`
|
||||
DefaultEventDurationMinutes pgtype.Int4 `json:"default_event_duration_minutes"`
|
||||
DefaultReminderMinutes pgtype.Int4 `json:"default_reminder_minutes"`
|
||||
ShowWeekends pgtype.Bool `json:"show_weekends"`
|
||||
WorkingHoursStart pgtype.Text `json:"working_hours_start"`
|
||||
WorkingHoursEnd pgtype.Text `json:"working_hours_end"`
|
||||
NotificationsEmail pgtype.Bool `json:"notifications_email"`
|
||||
ID pgtype.UUID `json:"id"`
|
||||
}
|
||||
|
||||
type UpdateUserRow struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
Email string `json:"email"`
|
||||
PasswordHash string `json:"password_hash"`
|
||||
Timezone string `json:"timezone"`
|
||||
IsActive bool `json:"is_active"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
||||
ID pgtype.UUID `json:"id"`
|
||||
Email string `json:"email"`
|
||||
PasswordHash string `json:"password_hash"`
|
||||
Timezone string `json:"timezone"`
|
||||
IsActive bool `json:"is_active"`
|
||||
WeekStartDay int16 `json:"week_start_day"`
|
||||
DateFormat string `json:"date_format"`
|
||||
TimeFormat string `json:"time_format"`
|
||||
DefaultEventDurationMinutes int32 `json:"default_event_duration_minutes"`
|
||||
DefaultReminderMinutes int32 `json:"default_reminder_minutes"`
|
||||
ShowWeekends bool `json:"show_weekends"`
|
||||
WorkingHoursStart string `json:"working_hours_start"`
|
||||
WorkingHoursEnd string `json:"working_hours_end"`
|
||||
NotificationsEmail bool `json:"notifications_email"`
|
||||
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
||||
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) (UpdateUserRow, error) {
|
||||
row := q.db.QueryRow(ctx, updateUser, arg.Timezone, arg.ID)
|
||||
row := q.db.QueryRow(ctx, updateUser,
|
||||
arg.Timezone,
|
||||
arg.WeekStartDay,
|
||||
arg.DateFormat,
|
||||
arg.TimeFormat,
|
||||
arg.DefaultEventDurationMinutes,
|
||||
arg.DefaultReminderMinutes,
|
||||
arg.ShowWeekends,
|
||||
arg.WorkingHoursStart,
|
||||
arg.WorkingHoursEnd,
|
||||
arg.NotificationsEmail,
|
||||
arg.ID,
|
||||
)
|
||||
var i UpdateUserRow
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
@@ -158,6 +239,15 @@ func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) (UpdateU
|
||||
&i.PasswordHash,
|
||||
&i.Timezone,
|
||||
&i.IsActive,
|
||||
&i.WeekStartDay,
|
||||
&i.DateFormat,
|
||||
&i.TimeFormat,
|
||||
&i.DefaultEventDurationMinutes,
|
||||
&i.DefaultReminderMinutes,
|
||||
&i.ShowWeekends,
|
||||
&i.WorkingHoursStart,
|
||||
&i.WorkingHoursEnd,
|
||||
&i.NotificationsEmail,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user