mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[REF] pms-api-rest: refactor services
This commit is contained in:
committed by
Darío Lodeiros
parent
1c7b8efdc5
commit
2a0d960184
@@ -3,13 +3,6 @@ from odoo.addons.base_rest.controllers import main
|
||||
|
||||
class BaseRestPrivateApiController(main.RestController):
|
||||
_root_path = "/api/"
|
||||
_collection_name = "pms.private.services"
|
||||
_default_auth = "jwt_api_pms"
|
||||
_default_cors = "*"
|
||||
|
||||
|
||||
class BaseRestPublicApiController(main.RestController):
|
||||
_root_path = "/auth/"
|
||||
_collection_name = "pms.public.services"
|
||||
_collection_name = "pms.services"
|
||||
_default_auth = "public"
|
||||
_default_cors = "*"
|
||||
|
||||
@@ -9,7 +9,7 @@ class PmsCalendarService(Component):
|
||||
_inherit = "base.rest.service"
|
||||
_name = "pms.private.services"
|
||||
_usage = "calendar"
|
||||
_collection = "pms.private.services"
|
||||
_collection = "pms.services"
|
||||
|
||||
@restapi.method(
|
||||
[
|
||||
@@ -22,7 +22,8 @@ class PmsCalendarService(Component):
|
||||
],
|
||||
input_param=Datamodel("pms.calendar.search.param"),
|
||||
output_param=Datamodel("pms.calendar.info", is_list=True),
|
||||
auth="public",
|
||||
auth="jwt_api_pms",
|
||||
|
||||
)
|
||||
def get_calendar(self, calendar_search_param):
|
||||
domain = list()
|
||||
@@ -62,6 +63,7 @@ class PmsCalendarService(Component):
|
||||
)
|
||||
],
|
||||
input_param=Datamodel("pms.calendar.swap.info", is_list=False),
|
||||
auth="jwt_api_pms",
|
||||
)
|
||||
def swap_reservation_slices(self, swap_info):
|
||||
room_id_a = swap_info.roomIdA
|
||||
|
||||
@@ -9,7 +9,7 @@ class PmsFolioService(Component):
|
||||
_inherit = "base.rest.service"
|
||||
_name = "pms.folio.service"
|
||||
_usage = "folios"
|
||||
_collection = "pms.private.services"
|
||||
_collection = "pms.services"
|
||||
|
||||
@restapi.method(
|
||||
[
|
||||
|
||||
@@ -14,7 +14,7 @@ class PmsPartnerService(Component):
|
||||
_inherit = "base.rest.service"
|
||||
_name = "pms.auth.service"
|
||||
_usage = "login"
|
||||
_collection = "pms.public.services"
|
||||
_collection = "pms.services"
|
||||
|
||||
@restapi.method(
|
||||
[
|
||||
@@ -27,6 +27,7 @@ class PmsPartnerService(Component):
|
||||
],
|
||||
input_param=Datamodel("pms.api.rest.user.input", is_list=False),
|
||||
output_param=Datamodel("pms.api.rest.user.output", is_list=False),
|
||||
auth="public",
|
||||
)
|
||||
def login(self, user):
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ class PmsPartnerService(Component):
|
||||
_inherit = "base.rest.service"
|
||||
_name = "pms.partner.service"
|
||||
_usage = "partners"
|
||||
_collection = "pms.private.services"
|
||||
_collection = "pms.services"
|
||||
|
||||
@restapi.method(
|
||||
[
|
||||
@@ -19,6 +19,7 @@ class PmsPartnerService(Component):
|
||||
)
|
||||
],
|
||||
output_param=Datamodel("pms.partner.info", is_list=True),
|
||||
auth="jwt_api_pms",
|
||||
)
|
||||
def get_partners(self):
|
||||
domain = []
|
||||
|
||||
@@ -7,7 +7,7 @@ class PmsPropertyComponent(Component):
|
||||
_inherit = "base.rest.service"
|
||||
_name = "pms.property.service"
|
||||
_usage = "properties"
|
||||
_collection = "pms.private.services"
|
||||
_collection = "pms.services"
|
||||
|
||||
@restapi.method(
|
||||
[
|
||||
@@ -20,6 +20,8 @@ class PmsPropertyComponent(Component):
|
||||
],
|
||||
input_param=Datamodel("pms.property.search.param"),
|
||||
output_param=Datamodel("pms.property.info", is_list=True),
|
||||
auth="jwt_api_pms",
|
||||
|
||||
)
|
||||
def get_properties(self, property_search_param):
|
||||
domain = []
|
||||
@@ -55,6 +57,8 @@ class PmsPropertyComponent(Component):
|
||||
)
|
||||
],
|
||||
output_param=Datamodel("pms.property.info"),
|
||||
auth="jwt_api_pms",
|
||||
|
||||
)
|
||||
def get_property(self, property_id):
|
||||
pms_property = (
|
||||
@@ -83,6 +87,8 @@ class PmsPropertyComponent(Component):
|
||||
)
|
||||
],
|
||||
output_param=Datamodel("pms.account.journal.info", is_list=True),
|
||||
auth="jwt_api_pms",
|
||||
|
||||
)
|
||||
def get_method_payments_property(self, property_id):
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class PmsRoomService(Component):
|
||||
_inherit = "base.rest.service"
|
||||
_name = "pms.reservation.service"
|
||||
_usage = "reservations"
|
||||
_collection = "pms.private.services"
|
||||
_collection = "pms.services"
|
||||
|
||||
@restapi.method(
|
||||
[
|
||||
@@ -21,6 +21,8 @@ class PmsRoomService(Component):
|
||||
)
|
||||
],
|
||||
output_param=Datamodel("pms.reservation.info", is_list=True),
|
||||
auth="jwt_api_pms",
|
||||
|
||||
)
|
||||
def get_reservations(self):
|
||||
domain = []
|
||||
@@ -54,6 +56,8 @@ class PmsRoomService(Component):
|
||||
)
|
||||
],
|
||||
input_param=Datamodel("pms.calendar.changes", is_list=False),
|
||||
auth="jwt_api_pms",
|
||||
|
||||
)
|
||||
def move_reservation_line(self, reservation_id, reservation_lines_changes):
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ class PmsRoomService(Component):
|
||||
_inherit = "base.rest.service"
|
||||
_name = "pms.room.service"
|
||||
_usage = "rooms"
|
||||
_collection = "pms.private.services"
|
||||
_collection = "pms.services"
|
||||
|
||||
@restapi.method(
|
||||
[
|
||||
@@ -20,6 +20,8 @@ class PmsRoomService(Component):
|
||||
],
|
||||
input_param=Datamodel("pms.room.search.param"),
|
||||
output_param=Datamodel("pms.room.info", is_list=True),
|
||||
auth="jwt_api_pms",
|
||||
|
||||
)
|
||||
def get_rooms(self, room_search_param):
|
||||
domain = []
|
||||
|
||||
@@ -7,7 +7,7 @@ class PmsRoomTypeService(Component):
|
||||
_inherit = "base.rest.service"
|
||||
_name = "pms.room.type.service"
|
||||
_usage = "room-types"
|
||||
_collection = "pms.private.services"
|
||||
_collection = "pms.services"
|
||||
|
||||
@restapi.method(
|
||||
[
|
||||
@@ -20,6 +20,8 @@ class PmsRoomTypeService(Component):
|
||||
],
|
||||
input_param=Datamodel("pms.room.search.param"),
|
||||
output_param=Datamodel("pms.room.info", is_list=True),
|
||||
auth="jwt_api_pms",
|
||||
|
||||
)
|
||||
def get_room_types(self, room_type_search_param):
|
||||
domain = []
|
||||
|
||||
Reference in New Issue
Block a user