refactor: updated profiles

This commit is contained in:
2025-07-18 21:08:18 +03:00
parent 6588190e8b
commit 6f7d8bf244
3 changed files with 20 additions and 20 deletions

View File

@@ -43,11 +43,11 @@ type Profile struct {
ID int64 ID int64
UserID int64 UserID int64
Name string Name string
Bio *string Bio string
AvatarUrl *string AvatarUrl string
Birthday pgtype.Timestamp Birthday pgtype.Timestamp
Color *string Color string
ColorGrad *string ColorGrad string
} }
type ProfileSetting struct { type ProfileSetting struct {

View File

@@ -146,11 +146,11 @@ VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING id, user_id, name, bio, avatar_url
type CreateProfileParams struct { type CreateProfileParams struct {
UserID int64 UserID int64
Name string Name string
Bio *string Bio string
Birthday pgtype.Timestamp Birthday pgtype.Timestamp
AvatarUrl *string AvatarUrl string
Color *string Color string
ColorGrad *string ColorGrad string
} }
func (q *Queries) CreateProfile(ctx context.Context, arg CreateProfileParams) (Profile, error) { func (q *Queries) CreateProfile(ctx context.Context, arg CreateProfileParams) (Profile, error) {
@@ -381,8 +381,8 @@ type GetProfileByUsernameRestrictedRow struct {
Birthday pgtype.Timestamp Birthday pgtype.Timestamp
Bio *string Bio *string
AvatarUrl *string AvatarUrl *string
Color *string Color string
ColorGrad *string ColorGrad string
HideProfileDetails *bool HideProfileDetails *bool
} }
@@ -454,8 +454,8 @@ type GetProfilesRestrictedRow struct {
Username string Username string
Name string Name string
AvatarUrl *string AvatarUrl *string
Color *string Color string
ColorGrad *string ColorGrad string
HideProfileDetails *bool HideProfileDetails *bool
} }
@@ -1000,11 +1000,11 @@ WHERE username = $1
type UpdateProfileByUsernameParams struct { type UpdateProfileByUsernameParams struct {
Username string Username string
Name string Name string
Bio *string Bio string
Birthday pgtype.Timestamp Birthday pgtype.Timestamp
AvatarUrl *string AvatarUrl string
Color *string Color string
ColorGrad *string ColorGrad string
} }
func (q *Queries) UpdateProfileByUsername(ctx context.Context, arg UpdateProfileByUsernameParams) error { func (q *Queries) UpdateProfileByUsername(ctx context.Context, arg UpdateProfileByUsernameParams) error {

View File

@@ -76,11 +76,11 @@ CREATE TABLE IF NOT EXISTS "profiles" (
id BIGSERIAL PRIMARY KEY, id BIGSERIAL PRIMARY KEY,
user_id BIGINT UNIQUE NOT NULL REFERENCES users(id) ON DELETE CASCADE, user_id BIGINT UNIQUE NOT NULL REFERENCES users(id) ON DELETE CASCADE,
name VARCHAR(75) NOT NULL, name VARCHAR(75) NOT NULL,
bio VARCHAR(512), bio VARCHAR(512) NOT NULL DEFAULT '',
avatar_url VARCHAR(255), avatar_url VARCHAR(255) NOT NULL DEFAULT '',
birthday TIMESTAMP, birthday TIMESTAMP,
color VARCHAR(7), color VARCHAR(7) NOT NULL DEFAULT '#254333',
color_grad VARCHAR(7) color_grad VARCHAR(7) NOT NULL DEFAULT '#691E4D'
); );
CREATE TABLE IF NOT EXISTS "profile_settings" ( CREATE TABLE IF NOT EXISTS "profile_settings" (