Introduce notifications app and integrate emails
Add a new notifications app (models, serializers, views, admin, tasks, consumers, routing, urls, tests) with Notification.notify for in-app websocket pushes and optional email delivery. Centralize email sending in notifications.tasks.send_email_with_context and re-export it from account.tasks for compatibility. Update account and commerce and advertisement tasks to use Notification.notify/_notify_order and the new email helper; adjust order/notification tasks to consolidate logic. Wire notifications into ASGI routing, settings and URL conf. Misc: handle OSError when importing weasyprint, add tmp/ to .gitignore, add local .claude PowerShell checks, add social.blog skeleton, and remove legacy ews-component test files.
This commit is contained in:
1
backend/social/blog/IDEA.md
Normal file
1
backend/social/blog/IDEA.md
Normal file
@@ -0,0 +1 @@
|
||||
# editorjs.io - základ
|
||||
0
backend/social/blog/__init__.py
Normal file
0
backend/social/blog/__init__.py
Normal file
3
backend/social/blog/admin.py
Normal file
3
backend/social/blog/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
5
backend/social/blog/apps.py
Normal file
5
backend/social/blog/apps.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class BlogConfig(AppConfig):
|
||||
name = 'blog'
|
||||
0
backend/social/blog/migrations/__init__.py
Normal file
0
backend/social/blog/migrations/__init__.py
Normal file
16
backend/social/blog/models.py
Normal file
16
backend/social/blog/models.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
|
||||
|
||||
class Blog(models.Model):
|
||||
title = models.CharField(max_length=255)
|
||||
content = models.JsonField()
|
||||
|
||||
authors = models.ManyToManyField('Author', related_name='blogs')
|
||||
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
0
backend/social/blog/serializers.py
Normal file
0
backend/social/blog/serializers.py
Normal file
3
backend/social/blog/tests.py
Normal file
3
backend/social/blog/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
3
backend/social/blog/views.py
Normal file
3
backend/social/blog/views.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
6
backend/social/chat/IDEA.md
Normal file
6
backend/social/chat/IDEA.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Notify requests for chats
|
||||
|
||||
# Notify @mentions in chats
|
||||
|
||||
# Add requests before filling chat (maybe add chat type request and allowed and archived for advanced filtering) + actions
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
chat app diagram
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ CLIENT (browser) │
|
||||
└────────────┬────────────────────────────┬───────────────────────┘
|
||||
│ WebSocket │ HTTP REST
|
||||
│ ws/chat/<id>/ │ /api/social/
|
||||
▼ ▼
|
||||
┌────────────────────────┐ ┌────────────────────────────────────┐
|
||||
│ ChatConsumer │ │ REST Views │
|
||||
│ (consumers.py) │ │ (views.py) │
|
||||
│ │ │ │
|
||||
│ connect() │ │ ChatViewSet │
|
||||
│ ├─ auth check │ │ ├─ list / retrieve (GET) │
|
||||
│ └─ membership check ──┼───┼──► IsChatMember │
|
||||
│ │ │ ├─ create (POST) │
|
||||
│ receive() │ │ ├─ update/partial (PATCH/PUT) │
|
||||
│ ├─ new_chat_message │ │ │ └─ CanManageChat │
|
||||
│ │ (text only) │ │ ├─ destroy (DELETE) │
|
||||
│ │ └─► _create_message │ │ └─ CanManageChat │
|
||||
│ │ (DB INSERT) │ │ └─ add/remove member & moderator │
|
||||
│ │ │ │ │
|
||||
│ ├─ new_reply_message │ │ MessageViewSet │
|
||||
│ │ (text only) │ │ ├─ list / retrieve (GET) │
|
||||
│ │ └─► _create_message │ │ └─ IsAuthenticated │
|
||||
│ │ (DB INSERT) │ │ ├─ send (POST) │
|
||||
│ │ │ │ │ ├─ IsAuthenticated │
|
||||
│ └─ reaction │ │ │ ├─ DB INSERT Message │
|
||||
│ └─► _toggle_reaction │ │ ├─ DB INSERT MessageFile(s) │
|
||||
│ (DB UPDATE/ │ │ │ └─► group_send(chat.msg) ─────┼──► WebSocket push
|
||||
│ DELETE) │ │ ├─ update/partial (PATCH/PUT) │
|
||||
│ │ │ │ ├─ IsMessageSenderOnly │
|
||||
│ typing / stop_typing │ │ │ ├─ message.edit_content() │
|
||||
│ └─► group_send only │ │ │ └─► group_send(edit.msg) ─────┼──► WebSocket push
|
||||
│ (no DB write) │ │ └─ destroy (DELETE) │
|
||||
│ │ │ ├─ CanDeleteMessage │
|
||||
│ │ │ └─► group_send(delete.msg) ───┼──► WebSocket push
|
||||
└────────────┬───────────┘ └──────────────┬─────────────────────┘
|
||||
│ │
|
||||
│ both use channel_layer │
|
||||
▼ ▼
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ Channel Layer (Redis) │
|
||||
│ group: "chat_{id}" │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
│
|
||||
▼ group_send dispatches to all connected consumers
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ ChatConsumer event handlers (push to each connected client) │
|
||||
│ chat_message · reply_chat_message · edit_message │
|
||||
│ delete_message · message_reaction · typing_status · stop_typing│
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
|
||||
┌──────────────────────────────────┐ ┌──────────────────────────┐
|
||||
│ Database writes summary │ │ When to use which path │
|
||||
│ │ │ │
|
||||
│ CREATE Message ← consumer │ │ WS ← text-only msg │
|
||||
│ (text only) │ │ HTTP← msg with files │
|
||||
│ CREATE Message ← view /send │ │ HTTP← edit message │
|
||||
│ (any) │ │ HTTP← delete message │
|
||||
│ CREATE MessageFile ← view/send │ │ WS ← reaction │
|
||||
│ UPDATE Message ← view │ │ WS ← typing indicator │
|
||||
│ DELETE Message ← view (soft) │ └──────────────────────────┘
|
||||
│ CREATE MessageReaction ← cons │
|
||||
│ UPDATE MessageReaction ← cons │
|
||||
│ DELETE MessageReaction ← cons │
|
||||
│ CREATE MessageHistory ← model │
|
||||
│ (auto on edit_content) │
|
||||
└──────────────────────────────────┘
|
||||
3
backend/social/hubs/IDEA.md
Normal file
3
backend/social/hubs/IDEA.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Notify on mod ADD
|
||||
|
||||
# notify for Apeal
|
||||
11
backend/social/posts/IDEA.md
Normal file
11
backend/social/posts/IDEA.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Votes in posts as widget
|
||||
|
||||
# Location tag
|
||||
|
||||
# PFP from hub on posts outside of hub
|
||||
|
||||
# Collab/multiple authors on posts
|
||||
|
||||
# NSFW tag, spoiler tag
|
||||
|
||||
# Notify on likes 1 --> 10 --> 100 -> 500 -> 1000 etc..
|
||||
Reference in New Issue
Block a user