Compare commits
2 Commits
8f04566b5a
...
6f7d8bf244
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f7d8bf244 | |||
| 6588190e8b |
@@ -43,11 +43,11 @@ type Profile struct {
|
||||
ID int64
|
||||
UserID int64
|
||||
Name string
|
||||
Bio *string
|
||||
AvatarUrl *string
|
||||
Bio string
|
||||
AvatarUrl string
|
||||
Birthday pgtype.Timestamp
|
||||
Color *string
|
||||
ColorGrad *string
|
||||
Color string
|
||||
ColorGrad string
|
||||
}
|
||||
|
||||
type ProfileSetting struct {
|
||||
|
||||
@@ -146,11 +146,11 @@ VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING id, user_id, name, bio, avatar_url
|
||||
type CreateProfileParams struct {
|
||||
UserID int64
|
||||
Name string
|
||||
Bio *string
|
||||
Bio string
|
||||
Birthday pgtype.Timestamp
|
||||
AvatarUrl *string
|
||||
Color *string
|
||||
ColorGrad *string
|
||||
AvatarUrl string
|
||||
Color string
|
||||
ColorGrad string
|
||||
}
|
||||
|
||||
func (q *Queries) CreateProfile(ctx context.Context, arg CreateProfileParams) (Profile, error) {
|
||||
@@ -381,8 +381,8 @@ type GetProfileByUsernameRestrictedRow struct {
|
||||
Birthday pgtype.Timestamp
|
||||
Bio *string
|
||||
AvatarUrl *string
|
||||
Color *string
|
||||
ColorGrad *string
|
||||
Color string
|
||||
ColorGrad string
|
||||
HideProfileDetails *bool
|
||||
}
|
||||
|
||||
@@ -454,8 +454,8 @@ type GetProfilesRestrictedRow struct {
|
||||
Username string
|
||||
Name string
|
||||
AvatarUrl *string
|
||||
Color *string
|
||||
ColorGrad *string
|
||||
Color string
|
||||
ColorGrad string
|
||||
HideProfileDetails *bool
|
||||
}
|
||||
|
||||
@@ -1000,11 +1000,11 @@ WHERE username = $1
|
||||
type UpdateProfileByUsernameParams struct {
|
||||
Username string
|
||||
Name string
|
||||
Bio *string
|
||||
Bio string
|
||||
Birthday pgtype.Timestamp
|
||||
AvatarUrl *string
|
||||
Color *string
|
||||
ColorGrad *string
|
||||
AvatarUrl string
|
||||
Color string
|
||||
ColorGrad string
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateProfileByUsername(ctx context.Context, arg UpdateProfileByUsernameParams) error {
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Copyright (c) 2025 Nikolai Papin
|
||||
//
|
||||
// This file is part of Easywish
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
|
||||
// the GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"context"
|
||||
"easywish/config"
|
||||
|
||||
"github.com/jackc/pgx/v5"
|
||||
)
|
||||
|
||||
func GetDbConn() (*pgx.Conn, context.Context, error) {
|
||||
ctx := context.Background()
|
||||
conn, err := pgx.Connect(ctx, config.GetConfig().DatabaseUrl)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return conn, ctx, nil
|
||||
}
|
||||
@@ -76,11 +76,11 @@ CREATE TABLE IF NOT EXISTS "profiles" (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
user_id BIGINT UNIQUE NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
name VARCHAR(75) NOT NULL,
|
||||
bio VARCHAR(512),
|
||||
avatar_url VARCHAR(255),
|
||||
bio VARCHAR(512) NOT NULL DEFAULT '',
|
||||
avatar_url VARCHAR(255) NOT NULL DEFAULT '',
|
||||
birthday TIMESTAMP,
|
||||
color VARCHAR(7),
|
||||
color_grad VARCHAR(7)
|
||||
color VARCHAR(7) NOT NULL DEFAULT '#254333',
|
||||
color_grad VARCHAR(7) NOT NULL DEFAULT '#691E4D'
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "profile_settings" (
|
||||
|
||||
Reference in New Issue
Block a user