-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathurls.py
More file actions
62 lines (56 loc) · 1.91 KB
/
urls.py
File metadata and controls
62 lines (56 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from django.urls import path
from rest_framework import routers
from market.views import (
CreateImages,
DeleteImage,
Listings,
Offers,
OffersMade,
OffersReceived,
SavedListings,
Tags,
UserSavedListings,
get_current_user,
get_phone_status,
send_verification_code,
verify_phone_code,
)
app_name = "market"
router = routers.DefaultRouter()
router.register(r"listings", Listings, basename="listings")
additional_urls = [
# Current user
path("user/me/", get_current_user, name="current-user"),
# List of all amenities
path("tags/", Tags.as_view(), name="tags"),
# All saved listings for user
path("saved/", UserSavedListings.as_view(), name="user-saved-listings"),
# All offers made by user
path("offers/made/", OffersMade.as_view(), name="offers-made"),
# All offers for an listing owned by user
path("offers/received/", OffersReceived.as_view(), name="offers-received"),
# Saved listings
# post: save a listing for the user
# delete: unsave a listing for the user
path(
"listings/<listing_id>/saved/",
SavedListings.as_view({"post": "create", "delete": "destroy"}),
),
# Offers
# get: list all offers for an listing
# post: create an offer for an listing
# delete: delete an offer for an listing
path(
"listings/<listing_id>/offers/",
Offers.as_view({"get": "list", "post": "create", "delete": "destroy"}),
),
# Image Creation
path("listings/<listing_id>/images/", CreateImages.as_view()),
# Image Deletion
path("listings/images/<image_id>/", DeleteImage.as_view()),
# Phone verification
path("phone/status/", get_phone_status, name="phone-status"),
path("phone/send-code/", send_verification_code, name="send-verification-code"),
path("phone/verify-code/", verify_phone_code, name="verify-phone-code"),
]
urlpatterns = router.urls + additional_urls