remove: shortcut module (#1315)

This commit is contained in:
pablohashescobar 2023-06-20 10:26:44 +05:30 committed by GitHub
parent f797bb20f9
commit d1d8722525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 0 additions and 100 deletions

View File

@ -23,7 +23,6 @@ from .project import (
ProjectLiteSerializer, ProjectLiteSerializer,
) )
from .state import StateSerializer, StateLiteSerializer from .state import StateSerializer, StateLiteSerializer
from .shortcut import ShortCutSerializer
from .view import IssueViewSerializer, IssueViewFavoriteSerializer from .view import IssueViewSerializer, IssueViewFavoriteSerializer
from .cycle import CycleSerializer, CycleIssueSerializer, CycleFavoriteSerializer from .cycle import CycleSerializer, CycleIssueSerializer, CycleFavoriteSerializer
from .asset import FileAssetSerializer from .asset import FileAssetSerializer

View File

@ -1,14 +0,0 @@
# Module imports
from .base import BaseSerializer
from plane.db.models import Shortcut
class ShortCutSerializer(BaseSerializer):
class Meta:
model = Shortcut
fields = "__all__"
read_only_fields = [
"workspace",
"project",
]

View File

@ -84,9 +84,6 @@ from plane.api.views import (
ProjectEstimatePointEndpoint, ProjectEstimatePointEndpoint,
BulkEstimatePointEndpoint, BulkEstimatePointEndpoint,
## End Estimates ## End Estimates
# Shortcuts
ShortCutViewSet,
## End Shortcuts
# Views # Views
IssueViewViewSet, IssueViewViewSet,
ViewIssuesEndpoint, ViewIssuesEndpoint,
@ -539,30 +536,6 @@ urlpatterns = [
name="bulk-create-estimate-points", name="bulk-create-estimate-points",
), ),
# End Estimates ## # End Estimates ##
# Shortcuts
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/shortcuts/",
ShortCutViewSet.as_view(
{
"get": "list",
"post": "create",
}
),
name="project-shortcut",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/shortcuts/<uuid:pk>/",
ShortCutViewSet.as_view(
{
"get": "retrieve",
"put": "update",
"patch": "partial_update",
"delete": "destroy",
}
),
name="project-shortcut",
),
## End Shortcuts
# Views # Views
path( path(
"workspaces/<str:slug>/projects/<uuid:project_id>/views/", "workspaces/<str:slug>/projects/<uuid:project_id>/views/",

View File

@ -43,7 +43,6 @@ from .workspace import (
WorkspaceThemeViewSet, WorkspaceThemeViewSet,
) )
from .state import StateViewSet from .state import StateViewSet
from .shortcut import ShortCutViewSet
from .view import IssueViewViewSet, ViewIssuesEndpoint, IssueViewFavoriteViewSet from .view import IssueViewViewSet, ViewIssuesEndpoint, IssueViewFavoriteViewSet
from .cycle import ( from .cycle import (
CycleViewSet, CycleViewSet,

View File

@ -1,29 +0,0 @@
# Module imports
from . import BaseViewSet
from plane.api.serializers import ShortCutSerializer
from plane.api.permissions import ProjectEntityPermission
from plane.db.models import Shortcut
class ShortCutViewSet(BaseViewSet):
serializer_class = ShortCutSerializer
model = Shortcut
permission_classes = [
ProjectEntityPermission,
]
def perform_create(self, serializer):
serializer.save(project_id=self.kwargs.get("project_id"))
def get_queryset(self):
return self.filter_queryset(
super()
.get_queryset()
.filter(workspace__slug=self.kwargs.get("slug"))
.filter(project_id=self.kwargs.get("project_id"))
.filter(project__project_projectmember__member=self.request.user)
.select_related("project")
.select_related("workspace")
.distinct()
)

View File

@ -43,8 +43,6 @@ from .state import State
from .cycle import Cycle, CycleIssue, CycleFavorite from .cycle import Cycle, CycleIssue, CycleFavorite
from .shortcut import Shortcut
from .view import IssueView, IssueViewFavorite from .view import IssueView, IssueViewFavorite
from .module import Module, ModuleMember, ModuleIssue, ModuleLink, ModuleFavorite from .module import Module, ModuleMember, ModuleIssue, ModuleLink, ModuleFavorite

View File

@ -1,26 +0,0 @@
# Django imports
from django.db import models
# Module imports
from . import ProjectBaseModel
class Shortcut(ProjectBaseModel):
TYPE_CHOICES = (("repo", "Repo"), ("direct", "Direct"))
name = models.CharField(max_length=255, verbose_name="Cycle Name")
description = models.TextField(verbose_name="Cycle Description", blank=True)
type = models.CharField(
max_length=255, verbose_name="Shortcut Type", choices=TYPE_CHOICES
)
url = models.URLField(verbose_name="URL", blank=True, null=True)
class Meta:
verbose_name = "Shortcut"
verbose_name_plural = "Shortcuts"
db_table = "shortcuts"
ordering = ("-created_at",)
def __str__(self):
"""Return name of the shortcut"""
return f"{self.name} <{self.project.name}>"