[SILO-671] feat: add sticky external apis (#8139)
* add sticky external apis * add created_at sort by to list * remove select related method from query set
This commit is contained in:
parent
a7e2e596bf
commit
cea6f7530b
9 changed files with 192 additions and 2 deletions
|
|
@ -140,6 +140,7 @@ from .examples import (
|
|||
WORKSPACE_MEMBER_EXAMPLE,
|
||||
PROJECT_MEMBER_EXAMPLE,
|
||||
CYCLE_ISSUE_EXAMPLE,
|
||||
STICKY_EXAMPLE,
|
||||
)
|
||||
|
||||
# Helper decorators
|
||||
|
|
@ -292,6 +293,7 @@ __all__ = [
|
|||
"WORKSPACE_MEMBER_EXAMPLE",
|
||||
"PROJECT_MEMBER_EXAMPLE",
|
||||
"CYCLE_ISSUE_EXAMPLE",
|
||||
"STICKY_EXAMPLE",
|
||||
# Decorators
|
||||
"workspace_docs",
|
||||
"project_docs",
|
||||
|
|
|
|||
|
|
@ -262,3 +262,18 @@ def state_docs(**kwargs):
|
|||
}
|
||||
|
||||
return extend_schema(**_merge_schema_options(defaults, kwargs))
|
||||
|
||||
def sticky_docs(**kwargs):
|
||||
"""Decorator for sticky management endpoints"""
|
||||
defaults = {
|
||||
"tags": ["Stickies"],
|
||||
"summary": "Endpoints for sticky create/update/delete and fetch sticky details",
|
||||
"parameters": [WORKSPACE_SLUG_PARAMETER],
|
||||
"responses": {
|
||||
401: UNAUTHORIZED_RESPONSE,
|
||||
403: FORBIDDEN_RESPONSE,
|
||||
404: NOT_FOUND_RESPONSE,
|
||||
},
|
||||
}
|
||||
|
||||
return extend_schema(**_merge_schema_options(defaults, kwargs))
|
||||
|
|
@ -672,6 +672,15 @@ CYCLE_ISSUE_EXAMPLE = OpenApiExample(
|
|||
},
|
||||
)
|
||||
|
||||
STICKY_EXAMPLE = OpenApiExample(
|
||||
name="Sticky",
|
||||
value={
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"name": "Sticky 1",
|
||||
"description_html": "<p>Sticky 1 description</p>",
|
||||
"created_at": "2024-01-01T10:30:00Z",
|
||||
},
|
||||
)
|
||||
|
||||
# Sample data for different entity types
|
||||
SAMPLE_ISSUE = {
|
||||
|
|
@ -781,6 +790,13 @@ SAMPLE_CYCLE_ISSUE = {
|
|||
"created_at": "2024-01-01T10:30:00Z",
|
||||
}
|
||||
|
||||
SAMPLE_STICKY = {
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"name": "Sticky 1",
|
||||
"description_html": "<p>Sticky 1 description</p>",
|
||||
"created_at": "2024-01-01T10:30:00Z",
|
||||
}
|
||||
|
||||
# Mapping of schema types to sample data
|
||||
SCHEMA_EXAMPLES = {
|
||||
"Issue": SAMPLE_ISSUE,
|
||||
|
|
@ -795,6 +811,7 @@ SCHEMA_EXAMPLES = {
|
|||
"Activity": SAMPLE_ACTIVITY,
|
||||
"Intake": SAMPLE_INTAKE,
|
||||
"CycleIssue": SAMPLE_CYCLE_ISSUE,
|
||||
"Sticky": SAMPLE_STICKY,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue