feat(src/notes): add note CRUD API

Implement models, serializers, views and URLs for managing project notes; enables structured association of notes with projects and users, improving organization and auditability.
This commit is contained in:
sankalp committed 2026-06-25 23:07:58 +05:45
1 parent 72a4c81028
commit 0851411be7
5 files changed
+86 -16

No files matched your search

+24 -3
View File
@@ -1,5 +1,26 @@
"""generated with djinit"""
from rest_framework import generics, permissions
from rest_framework import viewsets
from src.notes.models import ProjectNote
from src.notes.serializers import ProjectNoteSerializer
class ProjectNoteListCreateView(generics.ListCreateAPIView):
serializer_class = ProjectNoteSerializer
permission_classes = (permissions.IsAuthenticated,)
def get_queryset(self):
qs = ProjectNote.objects.select_related("created_by")
project_id = self.request.query_params.get("project")
if project_id:
qs = qs.filter(project_id=project_id)
return qs.order_by("-note_date", "-created_at")
def perform_create(self, serializer):
serializer.save(created_by=self.request.user)
class ProjectNoteDetailView(generics.RetrieveUpdateDestroyAPIView):
queryset = ProjectNote.objects.all()
serializer_class = ProjectNoteSerializer
permission_classes = (permissions.IsAuthenticated,)
# Create your views here.