backend/app/conf/api.py

190 lines
5.8 KiB
Python
Raw Normal View History

from django.urls import path, include
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView
from blockchain.api.views import (
TransactFromAdminView,
TransactToUserView,
TransactToAdminView,
2022-10-09 06:27:35 +03:00
GetMoneyApi,
TransactionHistoryApi,
)
from events.api.views import (
ListCreateEventApi,
RetrieveUpdateDeleteEventApi,
ListPlannedEvents,
RetrieveSubmitDeleteEventAttendance,
ListAttendedWorkersApi,
SubmitWorkerAttendedEvent,
)
2022-10-09 06:27:35 +03:00
from marketplace.api.views import ListCreateProductApi, RetrieveUpdateDestroyProductApi, BuyProductApi
2022-10-08 16:02:57 +03:00
from users.api.views import (
ListCreateUserApi,
RetrieveUpdateDeleteUserApi,
2022-10-08 16:02:57 +03:00
ListCreateDepartmentApi,
RetrieveUpdateDeleteDepartmentApi,
2022-10-08 16:02:57 +03:00
ListCreateStreamApi,
RetrieveUpdateDeleteStreamApi,
2022-10-08 16:02:57 +03:00
ListCreateCommandApi,
RetrieveUpdateDeleteCommandApi,
2022-10-08 19:33:58 +03:00
CreateSeasonApi,
ListClansApiView,
2022-10-09 06:27:35 +03:00
GetSelfUserApi,
2022-10-08 16:02:57 +03:00
)
urlpatterns = [
path(
"auth/",
include(
[
path("token/", TokenObtainPairView.as_view(), name="token_obtain_pair"),
path("refresh/", TokenRefreshView.as_view(), name="token_refresh"),
]
),
),
path(
"blockchain/",
include(
[
path(
"salary/",
TransactFromAdminView.as_view(),
name="admin_to_user_transaction_api",
),
path(
"payment/",
TransactToAdminView.as_view(),
name="user_to_admin_transaction_api",
),
path(
"transact/",
TransactToUserView.as_view(),
name="user_to_user_transaction_api",
),
path(
"amount/",
GetMoneyApi.as_view(),
name="get_user_money_api",
),
path(
"history/",
TransactionHistoryApi.as_view(),
name="list_transactions_api",
),
]
),
),
2022-10-08 19:31:01 +03:00
path(
"events/",
include(
[
path("", ListCreateEventApi.as_view(), name="list_create_event"),
path(
"<str:slug>",
RetrieveUpdateDeleteEventApi.as_view(),
2022-10-08 19:31:01 +03:00
name="get_update_delete_event",
),
path(
"attendance/",
ListPlannedEvents.as_view(),
name="list_event_attendance",
),
path(
"attendance/<str:slug>/list/",
ListAttendedWorkersApi.as_view(),
name="list_event_attendance",
),
path(
"attendance/<str:slug>/submit/",
SubmitWorkerAttendedEvent.as_view(),
name="submit_event_attendance",
),
path(
"attendance/<str:slug>",
RetrieveSubmitDeleteEventAttendance.as_view(),
name="get_submit_delete_event_attendance",
),
2022-10-08 19:31:01 +03:00
]
),
),
path(
"marketplace/",
include(
[
path(
"product/",
ListCreateProductApi.as_view(),
name="list_create_product",
),
path(
"product/<str:slug>",
RetrieveUpdateDestroyProductApi.as_view(),
name="get_update_destroy_product",
),
2022-10-09 06:27:35 +03:00
path(
"product/<str:slug>/buy",
BuyProductApi.as_view(),
name="bui_product",
),
]
),
),
path(
"users/",
include(
[
2022-10-08 16:02:57 +03:00
path("", ListCreateUserApi.as_view(), name="list_create_user"),
2022-10-09 06:27:35 +03:00
path("self/", GetSelfUserApi.as_view(), name="get_self_user_api"),
2022-10-08 16:02:57 +03:00
path(
"<str:username>",
RetrieveUpdateDeleteUserApi.as_view(),
2022-10-08 16:02:57 +03:00
name="get_update_delete_user",
),
path(
"department/",
ListCreateDepartmentApi.as_view(),
name="list_create_department",
),
path(
"department/",
ListCreateDepartmentApi.as_view(),
name="list_create_department",
),
path(
"department/<int:pk>",
RetrieveUpdateDeleteDepartmentApi.as_view(),
2022-10-08 16:02:57 +03:00
name="get_update_delete_department",
),
path(
"stream/",
ListCreateStreamApi.as_view(),
name="list_create_stream",
),
path(
"stream/<int:pk>",
RetrieveUpdateDeleteStreamApi.as_view(),
2022-10-08 16:02:57 +03:00
name="get_update_delete_stream",
),
path(
"command/",
ListCreateCommandApi.as_view(),
name="list_create_command",
),
path(
"command/<int:pk>",
RetrieveUpdateDeleteCommandApi.as_view(),
2022-10-08 16:02:57 +03:00
name="get_update_delete_command",
),
]
),
),
2022-10-08 17:14:19 +03:00
path(
2022-10-08 19:57:46 +03:00
"season/",
include(
[
path("", CreateSeasonApi.as_view(), name="create new season"),
path("clans/", ListClansApiView.as_view()),
]
),
2022-10-08 19:33:58 +03:00
),
]