Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions backend/apps/owasp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ owasp-create-project-metadata-file:
@echo "Generating metadata"
@CMD="python manage.py owasp_create_project_metadata_file $(entity_key)" $(MAKE) exec-backend-command

SNAPSHOT_FREQUENCY ?= weekly

owasp-create-snapshot:
@echo "Creating OWASP community snapshot"
@CMD="python manage.py owasp_create_snapshot --frequency $(SNAPSHOT_FREQUENCY)" $(MAKE) exec-backend-command

owasp-enrich-chapters:
@echo "Enriching OWASP chapters"
@CMD="python manage.py owasp_enrich_chapters" $(MAKE) exec-backend-command
Expand Down Expand Up @@ -50,12 +56,6 @@ owasp-generate-community-snapshot-video:
nest-snapshot-video \
python manage.py owasp_generate_community_snapshot_video $(snapshot_key) /home/owasp/generated_videos

SNAPSHOT_FREQUENCY ?= weekly

owasp-create-snapshot:
@echo "Creating OWASP community snapshot"
@CMD="python manage.py owasp_create_snapshot --frequency $(SNAPSHOT_FREQUENCY)" $(MAKE) exec-backend-command

owasp-process-snapshots:
@echo "Processing OWASP snapshots"
@CMD="python manage.py owasp_process_snapshots" $(MAKE) exec-backend-command
Expand Down
37 changes: 22 additions & 15 deletions backend/apps/owasp/admin/snapshot_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@

from django.contrib import admin

from apps.owasp.models.project_subscription_preference import ProjectSubscriptionPreference
from apps.owasp.models.snapshot_subscription import SnapshotSubscription


class ProjectSubscriptionPreferenceInline(admin.StackedInline):
"""Inline admin for per-project subscription preferences."""

model = ProjectSubscriptionPreference
extra = 0
can_delete = True
autocomplete_fields = ("project",)


class SnapshotSubscriptionAdmin(admin.ModelAdmin):
"""Admin for SnapshotSubscription model."""

Expand All @@ -13,36 +23,33 @@ class SnapshotSubscriptionAdmin(admin.ModelAdmin):
search_fields = ("user__email", "user__username")
raw_id_fields = ("user",)
readonly_fields = ("unsubscribe_token", "created_at", "updated_at")
autocomplete_fields = ("subscribed_projects", "subscribed_chapters")
autocomplete_fields = ("chapters",)
inlines = [ProjectSubscriptionPreferenceInline]

fieldsets = (
(None, {"fields": ("user", "frequency", "is_active")}),
(
"Content Preferences",
"System",
{
"fields": ("unsubscribe_token", "created_at", "updated_at"),
"classes": ("collapse",),
},
),
(
"General Subscriptions",
{
"fields": (
"include_chapters",
"include_events",
"include_issues",
"include_posts",
"include_projects",
"include_pull_requests",
"include_releases",
"include_users",
),
},
),
(
"Subscription Filters",
{
"fields": ("subscribed_projects", "subscribed_chapters"),
},
),
(
"System",
"Chapter Subscriptions",
{
"fields": ("unsubscribe_token", "created_at", "updated_at"),
"classes": ("collapse",),
"fields": ("chapters",),
},
),
)
Expand Down
10 changes: 10 additions & 0 deletions backend/apps/owasp/api/internal/mutations/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""OWASP app mutations."""

import strawberry

from .snapshot_subscription import SnapshotSubscriptionMutations


@strawberry.type
class OwaspMutations(SnapshotSubscriptionMutations):
"""OWASP mutations."""
Loading
Loading