Skip to content

Commit

Permalink
Merge pull request #122 from Mouwf/feature/design-notification
Browse files Browse the repository at this point in the history
通知機能の設計を行った。
  • Loading branch information
eigoninaritai-naokichi authored May 21, 2024
2 parents c3c084f + e795af5 commit 8cf2abe
Show file tree
Hide file tree
Showing 7 changed files with 322 additions and 51 deletions.
331 changes: 280 additions & 51 deletions project-designs/class-diagrams/ff14-sns.drawio

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CREATE TABLE notification_types (
id SERIAL PRIMARY KEY,
type_name VARCHAR(255) NOT NULL UNIQUE
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CREATE TABLE notifications (
id BIGSERIAL PRIMARY KEY,
notification_target_user_id INTEGER NOT NULL REFERENCES users(id),
action_user_id INTEGER NOT NULL REFERENCES users(id),
action_target_user_id INTEGER NOT NULL REFERENCES users(id),
notification_type_id INTEGER NOT NULL REFERENCES notification_types(id),
action_target_post_id BIGINT NOT NULL REFERENCES posts(id),
action_target_reply_id BIGINT NULL REFERENCES replies(id),
action_reply_id BIGINT NULL REFERENCES replies(id),
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX idx_notification_target_user_id ON notifications(notification_target_user_id);
CREATE INDEX idx_action_user_id ON notifications(action_user_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CREATE TABLE user_notification_statuses (
id SERIAL PRIMARY KEY,
user_id INTEGER NOT NULL REFERENCES users(id),
is_read BOOLEAN NOT NULL DEFAULT FALSE
);

CREATE INDEX idx_user_id_on_user_notification_statuses ON user_notification_statuses(user_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 通知タイプテーブル
* ID(主キー)
* タイプ名(一意、NULL不可)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 通知テーブル
* ID(主キー)
* 通知対象ユーザーID(外部キー、NULL不可)
* アクションユーザーID(外部キー、NULL不可)
* アクション対象ユーザーID(外部キー、NULL不可)
* 通知タイプID(外部キー、NULL不可)
* アクション対象投稿ID(外部キー、NULL不可)
* アクション対象リプライID(外部キー、NULL可)
* アクションリプライID(外部キー、NULL可)
* 通知日時
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ユーザー通知ステータス
* ID(主キー)
* ユーザーID(外部キー、NULL不可)
* 既読したかどうか(BOOL、NULL不可)

0 comments on commit 8cf2abe

Please sign in to comment.