mirror of
https://codeberg.org/pronounscc/pronouns.cc.git
synced 2024-11-20 10:09:52 +01:00
feat(backend): remove avatar_source field, change avatar_urls on member
This commit is contained in:
parent
5679dbb657
commit
85a061ebc5
4 changed files with 32 additions and 34 deletions
|
@ -10,12 +10,12 @@ import (
|
|||
)
|
||||
|
||||
type Member struct {
|
||||
ID xid.ID
|
||||
UserID xid.ID
|
||||
Name string
|
||||
Bio *string
|
||||
AvatarURL *string
|
||||
Links []string
|
||||
ID xid.ID
|
||||
UserID xid.ID
|
||||
Name string
|
||||
Bio *string
|
||||
AvatarURLs []string `db:"avatar_urls"`
|
||||
Links []string
|
||||
}
|
||||
|
||||
const ErrMemberNotFound = errors.Sentinel("member not found")
|
||||
|
|
|
@ -18,9 +18,8 @@ type User struct {
|
|||
DisplayName *string
|
||||
Bio *string
|
||||
|
||||
AvatarSource *string
|
||||
AvatarURLs []string `db:"avatar_urls"`
|
||||
Links []string
|
||||
AvatarURLs []string `db:"avatar_urls"`
|
||||
Links []string
|
||||
|
||||
Discord *string
|
||||
DiscordUsername *string
|
||||
|
|
|
@ -12,11 +12,11 @@ import (
|
|||
)
|
||||
|
||||
type GetMemberResponse struct {
|
||||
ID xid.ID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Bio *string `json:"bio"`
|
||||
AvatarURL *string `json:"avatar_url"`
|
||||
Links []string `json:"links"`
|
||||
ID xid.ID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Bio *string `json:"bio"`
|
||||
AvatarURLs []string `json:"avatar_urls"`
|
||||
Links []string `json:"links"`
|
||||
|
||||
Names []db.Name `json:"names"`
|
||||
Pronouns []db.Pronoun `json:"pronouns"`
|
||||
|
@ -27,11 +27,11 @@ type GetMemberResponse struct {
|
|||
|
||||
func dbMemberToMember(u db.User, m db.Member, names []db.Name, pronouns []db.Pronoun, fields []db.Field) GetMemberResponse {
|
||||
return GetMemberResponse{
|
||||
ID: m.ID,
|
||||
Name: m.Name,
|
||||
Bio: m.Bio,
|
||||
AvatarURL: m.AvatarURL,
|
||||
Links: m.Links,
|
||||
ID: m.ID,
|
||||
Name: m.Name,
|
||||
Bio: m.Bio,
|
||||
AvatarURLs: m.AvatarURLs,
|
||||
Links: m.Links,
|
||||
|
||||
Names: names,
|
||||
Pronouns: pronouns,
|
||||
|
|
|
@ -8,9 +8,8 @@ create table users (
|
|||
display_name text,
|
||||
bio text,
|
||||
|
||||
avatar_source text,
|
||||
avatar_urls text[],
|
||||
links text[],
|
||||
avatar_urls text[],
|
||||
links text[],
|
||||
|
||||
discord text unique, -- for Discord oauth
|
||||
discord_username text
|
||||
|
@ -36,11 +35,11 @@ create table user_fields (
|
|||
id bigserial primary key,
|
||||
name text not null,
|
||||
|
||||
favourite text[] not null default array[]::text[],
|
||||
okay text[] not null default array[]::text[],
|
||||
jokingly text[] not null default array[]::text[],
|
||||
friends_only text[] not null default array[]::text[],
|
||||
avoid text[] not null default array[]::text[]
|
||||
favourite text[],
|
||||
okay text[],
|
||||
jokingly text[],
|
||||
friends_only text[],
|
||||
avoid text[]
|
||||
);
|
||||
|
||||
create table members (
|
||||
|
@ -49,8 +48,8 @@ create table members (
|
|||
name text not null,
|
||||
bio text,
|
||||
|
||||
avatar_url text,
|
||||
links text[]
|
||||
avatar_urls text[],
|
||||
links text[]
|
||||
);
|
||||
|
||||
create table member_names (
|
||||
|
@ -73,9 +72,9 @@ create table member_fields (
|
|||
id bigserial primary key,
|
||||
name text not null,
|
||||
|
||||
favourite text[] not null default array[]::text[],
|
||||
okay text[] not null default array[]::text[],
|
||||
jokingly text[] not null default array[]::text[],
|
||||
friends_only text[] not null default array[]::text[],
|
||||
avoid text[] not null default array[]::text[]
|
||||
favourite text[],
|
||||
okay text[],
|
||||
jokingly text[],
|
||||
friends_only text[],
|
||||
avoid text[]
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue