feat(logs): add workspace activity log api
This commit is contained in:
@@ -1 +1,68 @@
|
||||
AUDITLOG_INCLUDE_ALL_MODELS = True
|
||||
COMMON_EXCLUDED_FIELDS = [
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"deleted_at",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
]
|
||||
|
||||
AUDITLOG_INCLUDE_ALL_MODELS = False
|
||||
AUDITLOG_STORE_JSON_CHANGES = True
|
||||
AUDITLOG_USE_TEXT_CHANGES_IF_JSON_IS_NOT_PRESENT = True
|
||||
AUDITLOG_INCLUDE_TRACKING_MODELS = [
|
||||
{
|
||||
"model": "workspaces.Workspace",
|
||||
"exclude_fields": COMMON_EXCLUDED_FIELDS,
|
||||
"serialize_data": True,
|
||||
"serialize_auditlog_fields_only": True,
|
||||
},
|
||||
{
|
||||
"model": "workspaces.WorkspaceMembership",
|
||||
"exclude_fields": COMMON_EXCLUDED_FIELDS,
|
||||
"serialize_data": True,
|
||||
"serialize_auditlog_fields_only": True,
|
||||
},
|
||||
{
|
||||
"model": "workspaces.WorkspaceUserRate",
|
||||
"exclude_fields": COMMON_EXCLUDED_FIELDS,
|
||||
"serialize_data": True,
|
||||
"serialize_auditlog_fields_only": True,
|
||||
},
|
||||
{
|
||||
"model": "clients.Client",
|
||||
"exclude_fields": COMMON_EXCLUDED_FIELDS,
|
||||
"serialize_data": True,
|
||||
"serialize_auditlog_fields_only": True,
|
||||
},
|
||||
{
|
||||
"model": "projects.Project",
|
||||
"exclude_fields": COMMON_EXCLUDED_FIELDS,
|
||||
"serialize_data": True,
|
||||
"serialize_auditlog_fields_only": True,
|
||||
},
|
||||
{
|
||||
"model": "projects.ProjectMembership",
|
||||
"exclude_fields": COMMON_EXCLUDED_FIELDS,
|
||||
"serialize_data": True,
|
||||
"serialize_auditlog_fields_only": True,
|
||||
},
|
||||
{
|
||||
"model": "tags.Tag",
|
||||
"exclude_fields": COMMON_EXCLUDED_FIELDS,
|
||||
"serialize_data": True,
|
||||
"serialize_auditlog_fields_only": True,
|
||||
},
|
||||
{
|
||||
"model": "time_entries.TimeEntry",
|
||||
"exclude_fields": COMMON_EXCLUDED_FIELDS,
|
||||
"m2m_fields": {"tags"},
|
||||
"serialize_data": True,
|
||||
"serialize_auditlog_fields_only": True,
|
||||
},
|
||||
{
|
||||
"model": "reports.ReportExportJob",
|
||||
"exclude_fields": COMMON_EXCLUDED_FIELDS,
|
||||
"serialize_data": True,
|
||||
"serialize_auditlog_fields_only": True,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -47,6 +47,7 @@ LOCAL_APPS = [
|
||||
"apps.time_entries",
|
||||
"apps.notifications",
|
||||
"apps.reports",
|
||||
"apps.logs",
|
||||
]
|
||||
|
||||
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
|
||||
@@ -60,6 +61,7 @@ MIDDLEWARE = [
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
"apps.logs.middlewares.JWTRequestActorMiddleware",
|
||||
"core.middlewares.current_user.CurrentUserMiddleware",
|
||||
"core.middlewares.exception_logging.ExceptionLoggingMiddleware",
|
||||
"config.services.logging.RequestLoggingMiddleware",
|
||||
@@ -246,3 +248,5 @@ STORAGES = {
|
||||
|
||||
SMS_APIKEY = os.getenv("SMS_APIKEY", "")
|
||||
BASE_URL = os.getenv("BASE_URL", "")
|
||||
|
||||
from config.services.auditlog import * # noqa: E402,F401,F403
|
||||
|
||||
@@ -23,6 +23,7 @@ urlpatterns = [
|
||||
path('api/', include('apps.time_entries.api.urls'), name="time_entries"),
|
||||
path("api/notifications/", include("apps.notifications.api.urls"), name="notifications"),
|
||||
path("api/reports/", include("apps.reports.api.urls"), name="reports"),
|
||||
path("api/logs/", include("apps.logs.api.urls"), name="logs"),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
|
||||
Reference in New Issue
Block a user