@ -1,41 +0,0 @@
|
||||
from core.serializers.model_notes import (
|
||||
ModelNoteBaseSerializer,
|
||||
ModelNoteModelSerializer,
|
||||
ModelNoteViewSerializer
|
||||
)
|
||||
|
||||
from access.models.entity_notes import EntityNotes
|
||||
|
||||
|
||||
|
||||
class EntityNoteBaseSerializer(ModelNoteBaseSerializer):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class EntityNoteModelSerializer(
|
||||
ModelNoteModelSerializer
|
||||
):
|
||||
|
||||
|
||||
class Meta:
|
||||
|
||||
model = EntityNotes
|
||||
|
||||
fields = ModelNoteModelSerializer.Meta.fields + [
|
||||
'model',
|
||||
]
|
||||
|
||||
read_only_fields = ModelNoteModelSerializer.Meta.read_only_fields + [
|
||||
'model',
|
||||
'content_type',
|
||||
]
|
||||
|
||||
|
||||
|
||||
class EntityNoteViewSerializer(
|
||||
ModelNoteViewSerializer,
|
||||
EntityNoteModelSerializer,
|
||||
):
|
||||
|
||||
pass
|
@ -61,13 +61,13 @@ class TenantModelSerializer(
|
||||
'model_pk': item.pk
|
||||
}
|
||||
),
|
||||
'notes': reverse(
|
||||
"v2:_api_v2_organization_note-list",
|
||||
request=self._context['view'].request,
|
||||
kwargs={
|
||||
'model_id': item.pk
|
||||
}
|
||||
),
|
||||
# 'notes': reverse(
|
||||
# "v2:_api_v2_organization_note-list",
|
||||
# request=self._context['view'].request,
|
||||
# kwargs={
|
||||
# 'model_id': item.pk
|
||||
# }
|
||||
# ),
|
||||
'teams': reverse("v2:_api_v2_organization_team-list", request=self._context['view'].request, kwargs={'organization_id': item.pk}),
|
||||
}
|
||||
|
||||
|
@ -1,41 +0,0 @@
|
||||
from access.models.organization_notes import OrganizationNotes
|
||||
|
||||
from core.serializers.model_notes import (
|
||||
ModelNoteBaseSerializer,
|
||||
ModelNoteModelSerializer,
|
||||
ModelNoteViewSerializer
|
||||
)
|
||||
|
||||
|
||||
|
||||
class OrganizationNoteBaseSerializer(ModelNoteBaseSerializer):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class OrganizationNoteModelSerializer(
|
||||
ModelNoteModelSerializer
|
||||
):
|
||||
|
||||
|
||||
class Meta:
|
||||
|
||||
model = OrganizationNotes
|
||||
|
||||
fields = ModelNoteModelSerializer.Meta.fields + [
|
||||
'model',
|
||||
]
|
||||
|
||||
read_only_fields = ModelNoteModelSerializer.Meta.read_only_fields + [
|
||||
'model',
|
||||
'content_type',
|
||||
]
|
||||
|
||||
|
||||
|
||||
class OrganizationNoteViewSerializer(
|
||||
ModelNoteViewSerializer,
|
||||
OrganizationNoteModelSerializer,
|
||||
):
|
||||
|
||||
pass
|
@ -1,41 +0,0 @@
|
||||
from access.models.role_notes import RoleNotes
|
||||
|
||||
from core.serializers.model_notes import (
|
||||
ModelNoteBaseSerializer,
|
||||
ModelNoteModelSerializer,
|
||||
ModelNoteViewSerializer
|
||||
)
|
||||
|
||||
|
||||
|
||||
class RoleNoteBaseSerializer(ModelNoteBaseSerializer):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class RoleNoteModelSerializer(
|
||||
ModelNoteModelSerializer
|
||||
):
|
||||
|
||||
|
||||
class Meta:
|
||||
|
||||
model = RoleNotes
|
||||
|
||||
fields = ModelNoteModelSerializer.Meta.fields + [
|
||||
'model',
|
||||
]
|
||||
|
||||
read_only_fields = ModelNoteModelSerializer.Meta.read_only_fields + [
|
||||
'model',
|
||||
'content_type',
|
||||
]
|
||||
|
||||
|
||||
|
||||
class RoleNoteViewSerializer(
|
||||
ModelNoteViewSerializer,
|
||||
RoleNoteModelSerializer,
|
||||
):
|
||||
|
||||
pass
|
@ -1,41 +0,0 @@
|
||||
from access.models.team_notes import TeamNotes
|
||||
|
||||
from core.serializers.model_notes import (
|
||||
ModelNoteBaseSerializer,
|
||||
ModelNoteModelSerializer,
|
||||
ModelNoteViewSerializer
|
||||
)
|
||||
|
||||
|
||||
|
||||
class TeamNoteBaseSerializer(ModelNoteBaseSerializer):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TeamNoteModelSerializer(
|
||||
ModelNoteModelSerializer
|
||||
):
|
||||
|
||||
|
||||
class Meta:
|
||||
|
||||
model = TeamNotes
|
||||
|
||||
fields = ModelNoteModelSerializer.Meta.fields + [
|
||||
'model',
|
||||
]
|
||||
|
||||
read_only_fields = ModelNoteModelSerializer.Meta.read_only_fields + [
|
||||
'model',
|
||||
'content_type',
|
||||
]
|
||||
|
||||
|
||||
|
||||
class TeamNoteViewSerializer(
|
||||
ModelNoteViewSerializer,
|
||||
TeamNoteModelSerializer,
|
||||
):
|
||||
|
||||
pass
|
@ -4,14 +4,10 @@ from centurion_feature_flag.urls.routers import DefaultRouter
|
||||
|
||||
from access.viewsets import (
|
||||
entity,
|
||||
entity_notes,
|
||||
index as access_v2,
|
||||
organization as organization_v2,
|
||||
organization_notes,
|
||||
role,
|
||||
role_notes,
|
||||
team as team_v2,
|
||||
team_notes,
|
||||
team_user as team_user_v2
|
||||
)
|
||||
|
||||
@ -52,31 +48,31 @@ router.register(
|
||||
feature_flag = '2025-00002', basename = '_api_v2_entity'
|
||||
)
|
||||
|
||||
router.register(
|
||||
prefix = 'access/entity/(?P<model_id>[0-9]+)/notes', viewset = entity_notes.ViewSet,
|
||||
feature_flag = '2025-00002', basename = '_api_v2_entity_note'
|
||||
)
|
||||
# router.register(
|
||||
# prefix = 'access/entity/(?P<model_id>[0-9]+)/notes', viewset = entity_notes.ViewSet,
|
||||
# feature_flag = '2025-00002', basename = '_api_v2_entity_note'
|
||||
# )
|
||||
|
||||
router.register(
|
||||
prefix = 'tenant', viewset = organization_v2.ViewSet,
|
||||
basename = '_api_v2_organization'
|
||||
)
|
||||
|
||||
router.register(
|
||||
prefix = 'tenant/(?P<model_id>[0-9]+)/notes', viewset = organization_notes.ViewSet,
|
||||
basename = '_api_v2_organization_note'
|
||||
)
|
||||
# router.register(
|
||||
# prefix = 'tenant/(?P<model_id>[0-9]+)/notes', viewset = organization_notes.ViewSet,
|
||||
# basename = '_api_v2_organization_note'
|
||||
# )
|
||||
|
||||
router.register(
|
||||
prefix = 'tenant/(?P<organization_id>[0-9]+)/team', viewset = team_v2.ViewSet,
|
||||
basename = '_api_v2_organization_team'
|
||||
)
|
||||
|
||||
router.register(
|
||||
prefix = 'tenant/(?P<organization_id>[0-9]+)/team/(?P<model_id>[0-9]+)/notes',
|
||||
viewset = team_notes.ViewSet,
|
||||
basename = '_api_v2_team_note'
|
||||
)
|
||||
# router.register(
|
||||
# prefix = 'tenant/(?P<organization_id>[0-9]+)/team/(?P<model_id>[0-9]+)/notes',
|
||||
# viewset = team_notes.ViewSet,
|
||||
# basename = '_api_v2_team_note'
|
||||
# )
|
||||
|
||||
router.register(
|
||||
prefix = 'access/tenant/(?P<organization_id>[0-9]+)/team/(?P<team_id>[0-9]+)/user',
|
||||
@ -89,9 +85,9 @@ router.register(
|
||||
feature_flag = '2025-00003', basename = '_api_v2_role'
|
||||
)
|
||||
|
||||
router.register(
|
||||
prefix = 'role/(?P<model_id>[0-9]+)/notes', viewset = role_notes.ViewSet,
|
||||
feature_flag = '2025-00003', basename = '_api_v2_role_note'
|
||||
)
|
||||
# router.register(
|
||||
# prefix = 'role/(?P<model_id>[0-9]+)/notes', viewset = role_notes.ViewSet,
|
||||
# feature_flag = '2025-00003', basename = '_api_v2_role_note'
|
||||
# )
|
||||
|
||||
urlpatterns = router.urls
|
||||
|
@ -1,60 +0,0 @@
|
||||
from drf_spectacular.utils import extend_schema, extend_schema_view, OpenApiResponse
|
||||
|
||||
from access.serializers.entity_notes import (
|
||||
EntityNotes,
|
||||
EntityNoteModelSerializer,
|
||||
EntityNoteViewSerializer
|
||||
)
|
||||
|
||||
from core.viewsets.model_notes import ModelNoteViewSet
|
||||
|
||||
|
||||
|
||||
@extend_schema_view(
|
||||
create=extend_schema(
|
||||
summary = 'Add a note to an Entity',
|
||||
description = '',
|
||||
responses = {
|
||||
201: OpenApiResponse(description='created', response=EntityNoteViewSerializer),
|
||||
400: OpenApiResponse(description='Validation failed.'),
|
||||
403: OpenApiResponse(description='User is missing create permissions'),
|
||||
}
|
||||
),
|
||||
destroy = extend_schema(
|
||||
summary = 'Delete a Entity note',
|
||||
description = ''
|
||||
),
|
||||
list = extend_schema(
|
||||
summary = 'Fetch all Entity notes',
|
||||
description='',
|
||||
),
|
||||
retrieve = extend_schema(
|
||||
summary = 'Fetch a single Entity note',
|
||||
description='',
|
||||
),
|
||||
update = extend_schema(exclude = True),
|
||||
partial_update = extend_schema(
|
||||
summary = 'Update a Entity note',
|
||||
description = ''
|
||||
),
|
||||
)
|
||||
class ViewSet(ModelNoteViewSet):
|
||||
|
||||
model = EntityNotes
|
||||
|
||||
|
||||
def get_serializer_class(self):
|
||||
|
||||
if (
|
||||
self.action == 'list'
|
||||
or self.action == 'retrieve'
|
||||
):
|
||||
|
||||
self.serializer_class = EntityNoteViewSerializer
|
||||
|
||||
|
||||
else:
|
||||
|
||||
self.serializer_class = EntityNoteModelSerializer
|
||||
|
||||
return self.serializer_class
|
@ -1,60 +0,0 @@
|
||||
from drf_spectacular.utils import extend_schema, extend_schema_view, OpenApiResponse
|
||||
|
||||
from access.serializers.organization_notes import (
|
||||
OrganizationNotes,
|
||||
OrganizationNoteModelSerializer,
|
||||
OrganizationNoteViewSerializer,
|
||||
)
|
||||
|
||||
from core.viewsets.model_notes import ModelNoteViewSet
|
||||
|
||||
|
||||
|
||||
@extend_schema_view(
|
||||
create=extend_schema(
|
||||
summary = 'Add a note to an organization',
|
||||
description = '',
|
||||
responses = {
|
||||
201: OpenApiResponse(description='created', response=OrganizationNoteViewSerializer),
|
||||
400: OpenApiResponse(description='Validation failed.'),
|
||||
403: OpenApiResponse(description='User is missing create permissions'),
|
||||
}
|
||||
),
|
||||
destroy = extend_schema(
|
||||
summary = 'Delete an organization note',
|
||||
description = ''
|
||||
),
|
||||
list = extend_schema(
|
||||
summary = 'Fetch all organization notes',
|
||||
description='',
|
||||
),
|
||||
retrieve = extend_schema(
|
||||
summary = 'Fetch a single organization note',
|
||||
description='',
|
||||
),
|
||||
update = extend_schema(exclude = True),
|
||||
partial_update = extend_schema(
|
||||
summary = 'Update an organization note',
|
||||
description = ''
|
||||
),
|
||||
)
|
||||
class ViewSet(ModelNoteViewSet):
|
||||
|
||||
model = OrganizationNotes
|
||||
|
||||
|
||||
def get_serializer_class(self):
|
||||
|
||||
if (
|
||||
self.action == 'list'
|
||||
or self.action == 'retrieve'
|
||||
):
|
||||
|
||||
self.serializer_class = OrganizationNoteViewSerializer
|
||||
|
||||
|
||||
else:
|
||||
|
||||
self.serializer_class = OrganizationNoteModelSerializer
|
||||
|
||||
return self.serializer_class
|
@ -1,60 +0,0 @@
|
||||
from drf_spectacular.utils import extend_schema, extend_schema_view, OpenApiResponse
|
||||
|
||||
from access.serializers.role_notes import (
|
||||
RoleNotes,
|
||||
RoleNoteModelSerializer,
|
||||
RoleNoteViewSerializer
|
||||
)
|
||||
|
||||
from core.viewsets.model_notes import ModelNoteViewSet
|
||||
|
||||
|
||||
|
||||
@extend_schema_view(
|
||||
create=extend_schema(
|
||||
summary = 'Add a note to a Team',
|
||||
description = '',
|
||||
responses = {
|
||||
201: OpenApiResponse(description='created', response=RoleNoteViewSerializer),
|
||||
400: OpenApiResponse(description='Validation failed.'),
|
||||
403: OpenApiResponse(description='User is missing create permissions'),
|
||||
}
|
||||
),
|
||||
destroy = extend_schema(
|
||||
summary = 'Delete a team note',
|
||||
description = ''
|
||||
),
|
||||
list = extend_schema(
|
||||
summary = 'Fetch all team notes',
|
||||
description='',
|
||||
),
|
||||
retrieve = extend_schema(
|
||||
summary = 'Fetch a single team note',
|
||||
description='',
|
||||
),
|
||||
update = extend_schema(exclude = True),
|
||||
partial_update = extend_schema(
|
||||
summary = 'Update a team note',
|
||||
description = ''
|
||||
),
|
||||
)
|
||||
class ViewSet(ModelNoteViewSet):
|
||||
|
||||
model = RoleNotes
|
||||
|
||||
|
||||
def get_serializer_class(self):
|
||||
|
||||
if (
|
||||
self.action == 'list'
|
||||
or self.action == 'retrieve'
|
||||
):
|
||||
|
||||
self.serializer_class = RoleNoteViewSerializer
|
||||
|
||||
|
||||
else:
|
||||
|
||||
self.serializer_class = RoleNoteModelSerializer
|
||||
|
||||
return self.serializer_class
|
@ -1,60 +0,0 @@
|
||||
from drf_spectacular.utils import extend_schema, extend_schema_view, OpenApiResponse
|
||||
|
||||
from access.serializers.team_notes import (
|
||||
TeamNotes,
|
||||
TeamNoteModelSerializer,
|
||||
TeamNoteViewSerializer,
|
||||
)
|
||||
|
||||
from core.viewsets.model_notes import ModelNoteViewSet
|
||||
|
||||
|
||||
|
||||
@extend_schema_view(
|
||||
create=extend_schema(
|
||||
summary = 'Add a note to a Team',
|
||||
description = '',
|
||||
responses = {
|
||||
201: OpenApiResponse(description='created', response=TeamNoteViewSerializer),
|
||||
400: OpenApiResponse(description='Validation failed.'),
|
||||
403: OpenApiResponse(description='User is missing create permissions'),
|
||||
}
|
||||
),
|
||||
destroy = extend_schema(
|
||||
summary = 'Delete a team note',
|
||||
description = ''
|
||||
),
|
||||
list = extend_schema(
|
||||
summary = 'Fetch all team notes',
|
||||
description='',
|
||||
),
|
||||
retrieve = extend_schema(
|
||||
summary = 'Fetch a single team note',
|
||||
description='',
|
||||
),
|
||||
update = extend_schema(exclude = True),
|
||||
partial_update = extend_schema(
|
||||
summary = 'Update a team note',
|
||||
description = ''
|
||||
),
|
||||
)
|
||||
class ViewSet(ModelNoteViewSet):
|
||||
|
||||
model = TeamNotes
|
||||
|
||||
|
||||
def get_serializer_class(self):
|
||||
|
||||
if (
|
||||
self.action == 'list'
|
||||
or self.action == 'retrieve'
|
||||
):
|
||||
|
||||
self.serializer_class = TeamNoteViewSerializer
|
||||
|
||||
|
||||
else:
|
||||
|
||||
self.serializer_class = TeamNoteModelSerializer
|
||||
|
||||
return self.serializer_class
|
Reference in New Issue
Block a user