Address production-readiness review: clearer errors, safer votes, and ops hardening.
Distinguish auth/lookup failures, make votes idempotent on visible questions, bound shutdown, page admin users, LRU throttle, trusted-proxy CIDRs, avatar cleanup, versioned migrations, and session cleanup logging.
This commit is contained in:
@@ -71,7 +71,7 @@ func (p *Postgres) CreateUser(ctx context.Context, u *User) error {
|
||||
Role: string(role),
|
||||
CreatedAt: u.CreatedAt,
|
||||
}); err != nil {
|
||||
return err
|
||||
return mapUniqueViolation(err)
|
||||
}
|
||||
if err := tx.Commit(); err != nil {
|
||||
return err
|
||||
@@ -89,8 +89,8 @@ func (p *Postgres) UserByUsername(ctx context.Context, username string) (*User,
|
||||
return UserByUsername(ctx, p.db, username)
|
||||
}
|
||||
|
||||
func (p *Postgres) ListUsers(ctx context.Context) ([]User, error) {
|
||||
return ListUsers(ctx, p.db)
|
||||
func (p *Postgres) ListUsers(ctx context.Context, q ListUsersQuery) ([]User, string, string, error) {
|
||||
return ListUsers(ctx, p.db, q)
|
||||
}
|
||||
|
||||
func (p *Postgres) CountAdmins(ctx context.Context) (int, error) {
|
||||
|
||||
Reference in New Issue
Block a user