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 {
|
type Member struct {
|
||||||
ID xid.ID
|
ID xid.ID
|
||||||
UserID xid.ID
|
UserID xid.ID
|
||||||
Name string
|
Name string
|
||||||
Bio *string
|
Bio *string
|
||||||
AvatarURL *string
|
AvatarURLs []string `db:"avatar_urls"`
|
||||||
Links []string
|
Links []string
|
||||||
}
|
}
|
||||||
|
|
||||||
const ErrMemberNotFound = errors.Sentinel("member not found")
|
const ErrMemberNotFound = errors.Sentinel("member not found")
|
||||||
|
|
|
@ -18,9 +18,8 @@ type User struct {
|
||||||
DisplayName *string
|
DisplayName *string
|
||||||
Bio *string
|
Bio *string
|
||||||
|
|
||||||
AvatarSource *string
|
AvatarURLs []string `db:"avatar_urls"`
|
||||||
AvatarURLs []string `db:"avatar_urls"`
|
Links []string
|
||||||
Links []string
|
|
||||||
|
|
||||||
Discord *string
|
Discord *string
|
||||||
DiscordUsername *string
|
DiscordUsername *string
|
||||||
|
|
|
@ -12,11 +12,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetMemberResponse struct {
|
type GetMemberResponse struct {
|
||||||
ID xid.ID `json:"id"`
|
ID xid.ID `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Bio *string `json:"bio"`
|
Bio *string `json:"bio"`
|
||||||
AvatarURL *string `json:"avatar_url"`
|
AvatarURLs []string `json:"avatar_urls"`
|
||||||
Links []string `json:"links"`
|
Links []string `json:"links"`
|
||||||
|
|
||||||
Names []db.Name `json:"names"`
|
Names []db.Name `json:"names"`
|
||||||
Pronouns []db.Pronoun `json:"pronouns"`
|
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 {
|
func dbMemberToMember(u db.User, m db.Member, names []db.Name, pronouns []db.Pronoun, fields []db.Field) GetMemberResponse {
|
||||||
return GetMemberResponse{
|
return GetMemberResponse{
|
||||||
ID: m.ID,
|
ID: m.ID,
|
||||||
Name: m.Name,
|
Name: m.Name,
|
||||||
Bio: m.Bio,
|
Bio: m.Bio,
|
||||||
AvatarURL: m.AvatarURL,
|
AvatarURLs: m.AvatarURLs,
|
||||||
Links: m.Links,
|
Links: m.Links,
|
||||||
|
|
||||||
Names: names,
|
Names: names,
|
||||||
Pronouns: pronouns,
|
Pronouns: pronouns,
|
||||||
|
|
|
@ -8,9 +8,8 @@ create table users (
|
||||||
display_name text,
|
display_name text,
|
||||||
bio text,
|
bio text,
|
||||||
|
|
||||||
avatar_source text,
|
avatar_urls text[],
|
||||||
avatar_urls text[],
|
links text[],
|
||||||
links text[],
|
|
||||||
|
|
||||||
discord text unique, -- for Discord oauth
|
discord text unique, -- for Discord oauth
|
||||||
discord_username text
|
discord_username text
|
||||||
|
@ -36,11 +35,11 @@ create table user_fields (
|
||||||
id bigserial primary key,
|
id bigserial primary key,
|
||||||
name text not null,
|
name text not null,
|
||||||
|
|
||||||
favourite text[] not null default array[]::text[],
|
favourite text[],
|
||||||
okay text[] not null default array[]::text[],
|
okay text[],
|
||||||
jokingly text[] not null default array[]::text[],
|
jokingly text[],
|
||||||
friends_only text[] not null default array[]::text[],
|
friends_only text[],
|
||||||
avoid text[] not null default array[]::text[]
|
avoid text[]
|
||||||
);
|
);
|
||||||
|
|
||||||
create table members (
|
create table members (
|
||||||
|
@ -49,8 +48,8 @@ create table members (
|
||||||
name text not null,
|
name text not null,
|
||||||
bio text,
|
bio text,
|
||||||
|
|
||||||
avatar_url text,
|
avatar_urls text[],
|
||||||
links text[]
|
links text[]
|
||||||
);
|
);
|
||||||
|
|
||||||
create table member_names (
|
create table member_names (
|
||||||
|
@ -73,9 +72,9 @@ create table member_fields (
|
||||||
id bigserial primary key,
|
id bigserial primary key,
|
||||||
name text not null,
|
name text not null,
|
||||||
|
|
||||||
favourite text[] not null default array[]::text[],
|
favourite text[],
|
||||||
okay text[] not null default array[]::text[],
|
okay text[],
|
||||||
jokingly text[] not null default array[]::text[],
|
jokingly text[],
|
||||||
friends_only text[] not null default array[]::text[],
|
friends_only text[],
|
||||||
avoid text[] not null default array[]::text[]
|
avoid text[]
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue