회원가입시 포인트를 제공받는다. 사용자는 포인트를 사용해서 스터디를 참여할 수 있고 만약 인증 참여하지 않는다면 포인트를 돌려받지 못하고 스터디 방에서 탈퇴 당한다. 스터디는 매달 1일에 시작하고 말일에 끝난다. 말일에 살아남은 회원들은 남은 포인트의 1/N
을 다시 돌려받는다. 이렇게 매달 반복한다.
create table auth_file (
id bigint generated by default as identity,
file_name varchar(255),
created_at timestamp(6) with time zone not null,
updated_at timestamp(6) with time zone not null,
primary key (id)
)
create table category (
id bigint generated by default as identity,
depth integer not null,
parent_id bigint,
name varchar(255),
created_at timestamp(6) with time zone not null,
updated_at timestamp(6) with time zone not null,
primary key (id)
)
create table report (
id bigint generated by default as identity,
user_id bigint unique,
auth_file_id bigint ,
created_at timestamp(6) with time zone not null,
updated_at timestamp(6) with time zone not null,
primary key (id)
)
create table study_authentication (
id bigint generated by default as identity,
user_id bigint unique,
auth_file_id bigint unique,
study_room_id bigint unique,
created_at timestamp(6) with time zone not null,
updated_at timestamp(6) with time zone not null,
primary key (id)
)
create table study_room (
id bigint generated by default as identity,
category_id bigint unique,
title varchar(255),
explanation varchar(255),
state varchar(255) check (state in ('ACTIVATED','DISABLED')),
created_at timestamp(6) with time zone not null,
updated_at timestamp(6) with time zone not null,
primary key (id)
)
create table study_room_point (
id bigint generated by default as identity,
study_room_id bigint unique,
point integer not null,
created_at timestamp(6) with time zone not null,
updated_at timestamp(6) with time zone not null,
primary key (id)
)
create table study_room_point_log (
id bigint generated by default as identity,
user_id bigint unique,
point integer not null,
study_room_id bigint unique,
point_action_type varchar,
provider_type varchar,
created_at timestamp(6) with time zone not null,
updated_at timestamp(6) with time zone not null,
primary key (id)
)
create table user (
id bigint generated by default as identity,
email varchar(255),
name varchar(255),
password varchar(255),
state varchar(255) check (state in ('ACTIVATED','DISABLED','BLOCKED')),
updated_at timestamp(6) with time zone not null,
created_at timestamp(6) with time zone not null,
primary key (id)
)
create table user_point (
id bigint generated by default as identity,
user_id bigint unique,
point integer not null,
created_at timestamp(6) with time zone not null,
updated_at timestamp(6) with time zone not null,
primary key (id)
)
create table user_point_log (
id bigint generated by default as identity,
user_id bigint unique,
point integer not null,
point_action_type varchar(255),
created_at timestamp(6) with time zone not null,
updated_at timestamp(6) with time zone not null,
primary key (id)
)
create table user_study_room (
id bigint generated by default as identity,
user_id bigint unique,
state varchar(255) check (state in ('ACTIVATED','DISABLED','BLOCKED')),
study_room_id bigint unique,
created_at timestamp(6) with time zone not null,
updated_at timestamp(6) with time zone not null,
primary key (id)
)
스터디룸
CREATE INDEX idx_id_title_category ON users (id, title, category);