feat: implement notification system

This commit is contained in:
Face 2025-06-11 18:37:03 +03:00
parent de3f8a4929
commit e61c41e414
19 changed files with 883 additions and 3196 deletions

View file

@ -1,5 +1,5 @@
{
"id": "077132a0-ccad-4d56-855b-150b8fe31d94",
"id": "41f7bba3-1d5d-41ba-83bb-ca129ace81f0",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
@ -292,7 +292,7 @@
},
"change_24h": {
"name": "change_24h",
"type": "numeric(10, 4)",
"type": "numeric(30, 4)",
"primaryKey": false,
"notNull": false,
"default": "'0.0000'"
@ -544,6 +544,136 @@
},
"uniqueConstraints": {}
},
"public.notification": {
"name": "notification",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "notification_type",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"message": {
"name": "message",
"type": "text",
"primaryKey": false,
"notNull": true
},
"is_read": {
"name": "is_read",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"notification_user_id_idx": {
"name": "notification_user_id_idx",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"notification_type_idx": {
"name": "notification_type_idx",
"columns": [
{
"expression": "type",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"notification_is_read_idx": {
"name": "notification_is_read_idx",
"columns": [
{
"expression": "is_read",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"notification_created_at_idx": {
"name": "notification_created_at_idx",
"columns": [
{
"expression": "created_at",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"notification_user_id_user_id_fk": {
"name": "notification_user_id_user_id_fk",
"tableFrom": "notification",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"public.prediction_bet": {
"name": "prediction_bet",
"schema": "",
@ -1194,6 +1324,18 @@
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"recipient_user_id": {
"name": "recipient_user_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"sender_user_id": {
"name": "sender_user_id",
"type": "integer",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@ -1223,6 +1365,32 @@
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"transaction_recipient_user_id_user_id_fk": {
"name": "transaction_recipient_user_id_user_id_fk",
"tableFrom": "transaction",
"tableTo": "user",
"columnsFrom": [
"recipient_user_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"transaction_sender_user_id_user_id_fk": {
"name": "transaction_sender_user_id_user_id_fk",
"tableFrom": "transaction",
"tableTo": "user",
"columnsFrom": [
"sender_user_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
@ -1492,6 +1660,16 @@
}
},
"enums": {
"public.notification_type": {
"name": "notification_type",
"schema": "public",
"values": [
"HOPIUM",
"SYSTEM",
"TRANSFER",
"RUG_PULL"
]
},
"public.prediction_market_status": {
"name": "prediction_market_status",
"schema": "public",
@ -1506,7 +1684,9 @@
"schema": "public",
"values": [
"BUY",
"SELL"
"SELL",
"TRANSFER_IN",
"TRANSFER_OUT"
]
}
},