feat: Chat request implementation #14

Manually merged
awiteb merged 55 commits from awiteb/chat-request-and-response into master 2024-07-18 14:21:39 +02:00 AGit

55 commits

Author SHA1 Message Date
6f0b88afb1
chore: More logging
All checks were successful
DCO checker / DCO checker (pull_request) Successful in 4s
Rust CI / Rust CI (pull_request) Successful in 4m28s
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-18 12:28:45 +03:00
39e7861917
change: Rename OutChatRequestsExt::have_chat_request_to function to get_chat_request_to
All checks were successful
DCO checker / DCO checker (pull_request) Successful in 3s
Rust CI / Rust CI (pull_request) Successful in 4m11s
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-18 11:22:56 +03:00
21880c5f82
refactor: Use get_user_status util in more places
All checks were successful
DCO checker / DCO checker (pull_request) Successful in 9s
Rust CI / Rust CI (pull_request) Successful in 4m52s
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-18 11:17:43 +03:00
4e50cb34c0
fix: Create the index after the table
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-18 11:17:43 +03:00
530f3bc90b
fix: Create the foreign keys columns
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-18 11:17:43 +03:00
ccc0c2954b
refactor: Use pagination directly as an argument
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-18 11:17:37 +03:00
d0d048c135
feat: Impl EndpointArgRegister for Pagination
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-18 10:57:52 +03:00
868ec66b68
feat: Create unique index for UserId and Target
All checks were successful
DCO checker / DCO checker (pull_request) Successful in 4s
Rust CI / Rust CI (pull_request) Successful in 4m32s
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-17 23:28:17 +03:00
9c1ba97791
feat: Create unique index for SenderId and Recipient
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-17 23:28:08 +03:00
9039ee66f0
feat: Create unique index for RecipientId and Sender
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-17 23:27:59 +03:00
02a0ac09cc
chore: Private use of sea_orm_migration prelude
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-17 22:27:30 +03:00
6268b5fe48
refactor: Reorder code blocks for better readability
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-17 21:57:47 +03:00
92492288c0
fix: Bug when requester already has recipient in whitelist
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-17 21:45:15 +03:00
8f791acd5d
remove: Remove ServerEvent::Message event
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-17 21:17:54 +03:00
09f90b060f
chore: Returns Option of ServerEvent in chat request handlers
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-17 21:16:36 +03:00
c517fea6fd
chore: Add new websocket errors
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-17 21:15:05 +03:00
c13d0fc59b
fix: Sort ServerEventType::ChatRequestResponse event alphabetically
All checks were successful
DCO checker / DCO checker (pull_request) Successful in 7s
Rust CI / Rust CI (pull_request) Successful in 4m43s
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-17 19:38:13 +03:00
48acab2519
chore: Use HashMap::get instead of Iter::find
Some checks failed
DCO checker / DCO checker (pull_request) Successful in 3s
Rust CI / Rust CI (pull_request) Has been cancelled
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-17 19:35:37 +03:00
05167042be
chore: Fix typos
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-17 19:25:49 +03:00
7ef02d05d0
feat: Use TableCreateStatement::foreign_key for foreign keys
All checks were successful
DCO checker / DCO checker (pull_request) Successful in 16s
Rust CI / Rust CI (pull_request) Successful in 5m3s
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-17 19:15:05 +03:00
3d086e511c
feat: Replace whitelist & blacklist tables with users_status table
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-17 18:38:23 +03:00
a894089b19
chore: Make the Users enum public
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-17 18:33:34 +03:00
727b985847
chore: Fix typo in the AlreadyOnTheBlacklist error name
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-17 18:30:55 +03:00
1857365aac
fix: Remove user from whitelist table before add it to blacklist one
All checks were successful
DCO checker / DCO checker (pull_request) Successful in 2s
Rust CI / Rust CI (pull_request) Successful in 4m22s
Same thing with blacklist table

Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:25 +03:00
747e27c4af
feat: Endpoint to returns user blacklisted users
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:25 +03:00
411f7e37f0
feat: Endpoint to returns user whitelisted users
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:25 +03:00
d065d7ea95
feat: Module for parameters
This module comes with `Pagination` parameter

Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:25 +03:00
43778a62fe
feat: New API errors, Querys and NotRegisteredUser
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:24 +03:00
d7a63ea092
feat: Whitelist extension to return user whitelisted users
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:24 +03:00
b02e2d8b4d
feat: Create WhiteListedUser schema
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:24 +03:00
89b3c09181
chore: Add EntityOrSelect to entities prelude
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:24 +03:00
558ceac74f
chore: Fix typos
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:24 +03:00
24e038f482
feat: ChatRequestResponse event
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:23 +03:00
2bfff6c05d
refactor: Refactor server errors
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:23 +03:00
abbdec49e7
change: Rename DuplicatedUser error to AlreadyRegistered
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:23 +03:00
927a345802
feat: Handle ChatRequest event
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:23 +03:00
8cc6aef67b
feat: ChatRequest event handler
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:23 +03:00
9dca968b30
feat: Message and ChatRequest events
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:22 +03:00
ff37501b74
feat: New event called ChatRequest
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:22 +03:00
8333a6ba9a
chore: New errors
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:22 +03:00
90cd947e71
feat: New tables utils
The tables is:
- `blacklist`
- `incoming_chat_requests`
- `whitelist`
- `outgoing_chat_requests`

Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:22 +03:00
4de83b02cd
chore: Functions to send an event to user & check if it is online
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:22 +03:00
b72fb8e7f6
feat: Macro to try the websocket error
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:21 +03:00
226df1961b
chore: Use sea_orm::ModelTrait in entities prelude
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:21 +03:00
65d6b147d9
chore: Returns database connection as Arc
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:21 +03:00
b4b3b537fd
feat: Websocket error macro
`ws_errors` macro to make adding new errors easy

Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:21 +03:00
033a21f733
chore: Function to return user by its public key
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:21 +03:00
33b44cb256
chore: Impl AsRef for ServerEvent
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:20 +03:00
2bac5be8c8
chore: Use entities prelude
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:20 +03:00
b712f96f59
change: Change the user id from integer to bigint
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:20 +03:00
b899dd6ac5
feat: Whitelist table
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:20 +03:00
9215d836de
feat: Blacklist table
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:20 +03:00
844adbf699
feat: Incoming chat request table
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:19 +03:00
71ae2f9145
feat: Outgoing chat request table
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:19 +03:00
e0a9997d79
chore: Add chrono to oxidetalis_entitys dependencies
Signed-off-by: Awiteb <a@4rs.nl>
2024-07-16 17:27:19 +03:00