Compare commits

...

3 commits

2 changed files with 32 additions and 26 deletions

View file

@ -196,7 +196,7 @@ paths:
# error: # error:
# type: string # type: string
# /users: /users:
# get: # get:
# summary: Search user # summary: Search user
# parameters: # parameters:
@ -218,28 +218,28 @@ paths:
# items: # items:
# $ref: '#/components/schemas/User' # $ref: '#/components/schemas/User'
# post: post:
# summary: Add new user summary: Add new user
# requestBody: requestBody:
# required: true required: true
# content: content:
# application/json: application/json:
# schema: schema:
# $ref: '#/components/schemas/User' $ref: '#/components/schemas/User'
# responses: responses:
# '200': '200':
# description: Add result description: Add result
# content: content:
# application/json: application/json:
# schema: schema:
# type: object type: object
# properties: properties:
# success: success:
# type: boolean type: boolean
# error: error:
# type: string type: string
# user_json: user_json:
# $ref: '#/components/schemas/User' $ref: '#/components/schemas/User'
# /users/{user_id}/titles: # /users/{user_id}/titles:
# get: # get:
@ -580,7 +580,7 @@ components:
required: required:
- user_id - user_id
- nickname - nickname
- creation_date # - creation_date
UserTitle: UserTitle:
type: object type: object
additionalProperties: true additionalProperties: true

View file

@ -27,8 +27,8 @@ CREATE TABLE users (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY, id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
avatar_id bigint REFERENCES images (id), avatar_id bigint REFERENCES images (id),
passhash text NOT NULL, passhash text NOT NULL,
mail text CHECK (mail ~ '[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+'), mail text CHECK (mail ~ '^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+$'),
nickname text NOT NULL CHECK (nickname ~ '^[a-zA-Z0-9_-]+$'), nickname text UNIQUE NOT NULL CHECK (nickname ~ '^[a-zA-Z0-9_-]{3,}$'),
disp_name text, disp_name text,
user_desc text, user_desc text,
creation_date timestamptz NOT NULL, creation_date timestamptz NOT NULL,
@ -85,6 +85,12 @@ CREATE TABLE signals (
pending boolean NOT NULL pending boolean NOT NULL
); );
CREATE TABLE external_ids (
user_id NOT NULL REFERENCES users (id),
service_id text NOT NULL,
external_ids text NOT NULL
);
-- Functions -- Functions
CREATE OR REPLACE FUNCTION update_title_rating() CREATE OR REPLACE FUNCTION update_title_rating()
RETURNS TRIGGER AS $$ RETURNS TRIGGER AS $$