Skip to content

Commit

Permalink
WIP: [ADD] event_rest_api
Browse files Browse the repository at this point in the history
  • Loading branch information
qgroulard committed Dec 9, 2021
1 parent 095d604 commit 8358d1a
Show file tree
Hide file tree
Showing 29 changed files with 996 additions and 0 deletions.
78 changes: 78 additions & 0 deletions event_rest_api/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
==============
Event Rest Api
==============

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fevent-lightgray.png?logo=github
:target: https://github.com/OCA/event/tree/14.0/event_rest_api
:alt: OCA/event
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/event-14-0/event-14-0-event_rest_api
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/199/14.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

TODO

**Table of contents**

.. contents::
:local:

Usage
=====

TODO

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/event/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/event/issues/new?body=module:%20event_rest_api%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* ACSONE SA/NV

Contributors
~~~~~~~~~~~~

* Quentin Groulard <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/event <https://github.com/OCA/event/tree/14.0/event_rest_api>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions event_rest_api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import pydantic_models
from . import services
18 changes: 18 additions & 0 deletions event_rest_api/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2021 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Event Rest Api",
"summary": """Add a REST API to manage events""",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/event",
"depends": ["base_rest", "base_rest_pydantic", "event"],
"data": [],
"external_dependencies": {
"python": [
"pydantic",
]
},
}
9 changes: 9 additions & 0 deletions event_rest_api/pydantic_models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from . import event_info
from . import event_registration_info
from . import event_registration_request
from . import event_search_filter
from . import event_stage_info
from . import event_stage_search_filter
from . import event_ticket_info
from . import event_type_info
from . import event_type_search_filter
28 changes: 28 additions & 0 deletions event_rest_api/pydantic_models/event_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2021 ACSONE SA/NV
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from datetime import datetime
from typing import List

import pydantic

from odoo.addons.pydantic import models, utils

from .event_stage_info import EventStageInfo
from .event_ticket_info import EventTicketInfo
from .event_type_info import EventTypeInfo


class EventInfo(models.BaseModel):
id: int
name: str
date_begin: datetime
date_end: datetime
event_tickets: List[EventTicketInfo] = pydantic.Field(..., alias="event_ticket_ids")
event_type: EventTypeInfo = pydantic.Field(..., alias="event_type_id")
stage: EventStageInfo = pydantic.Field(..., alias="stage_id")
write_date: datetime

class Config:
orm_mode = True
getter_dict = utils.GenericOdooGetter
26 changes: 26 additions & 0 deletions event_rest_api/pydantic_models/event_registration_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2021 ACSONE SA/NV
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from datetime import datetime

import pydantic

from odoo.addons.pydantic import models, utils

from .event_info import EventInfo
from .event_ticket_info import EventTicketInfo


class EventRegistrationInfo(models.BaseModel):
id: int
partner_id: int = None
firstname: str = None
lastname: str = None
email: str = None
event: EventInfo = pydantic.Field(..., alias="event_id")
event_ticket: EventTicketInfo = pydantic.Field(..., alias="event_ticket_id")
write_date: datetime

class Config:
orm_mode = True
getter_dict = utils.GenericOdooGetter
20 changes: 20 additions & 0 deletions event_rest_api/pydantic_models/event_registration_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2021 ACSONE SA/NV
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from typing import List

from odoo.addons.pydantic import models


class EventRegistrationRequest(models.BaseModel):

firstname: str
lastname: str
email: str
phone: str = None
event_ticket_id: int = None


class EventRegistrationRequestList(models.BaseModel):

event_registration_requests: List[EventRegistrationRequest] = []
17 changes: 17 additions & 0 deletions event_rest_api/pydantic_models/event_search_filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2021 ACSONE SA/NV
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from datetime import datetime
from typing import List

from odoo.addons.pydantic import models


class EventSearchFilter(models.BaseModel):

id: int = None
name: str = None
start_after: datetime = None
end_before: datetime = None
event_type_ids: List[int] = None
stage_ids: List[int] = None
18 changes: 18 additions & 0 deletions event_rest_api/pydantic_models/event_stage_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2021 ACSONE SA/NV
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from datetime import datetime

from odoo.addons.pydantic import models, utils


class EventStageInfo(models.BaseModel):
id: int
name: str
sequence: int = None
pipe_end: bool = None
write_date: datetime

class Config:
orm_mode = True
getter_dict = utils.GenericOdooGetter
11 changes: 11 additions & 0 deletions event_rest_api/pydantic_models/event_stage_search_filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2021 ACSONE SA/NV
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo.addons.pydantic import models


class EventStageSearchFilter(models.BaseModel):

id: int = None
name: str = None
pipe_end: bool = None
21 changes: 21 additions & 0 deletions event_rest_api/pydantic_models/event_ticket_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2021 ACSONE SA/NV
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from datetime import date, datetime

from odoo.addons.pydantic import models, utils


class EventTicketInfo(models.BaseModel):
id: int
event_id: int
name: str
description: str = None
start_sale_date: date = None
end_sale_date: date = None
seats_available: int = None
write_date: datetime

class Config:
orm_mode = True
getter_dict = utils.GenericOdooGetter
16 changes: 16 additions & 0 deletions event_rest_api/pydantic_models/event_type_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2021 ACSONE SA/NV
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from datetime import datetime

from odoo.addons.pydantic import models, utils


class EventTypeInfo(models.BaseModel):
id: int
name: str
write_date: datetime

class Config:
orm_mode = True
getter_dict = utils.GenericOdooGetter
10 changes: 10 additions & 0 deletions event_rest_api/pydantic_models/event_type_search_filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2021 ACSONE SA/NV
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo.addons.pydantic import models


class EventTypeSearchFilter(models.BaseModel):

id: int = None
name: str = None
1 change: 1 addition & 0 deletions event_rest_api/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Quentin Groulard <[email protected]>
1 change: 1 addition & 0 deletions event_rest_api/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO
1 change: 1 addition & 0 deletions event_rest_api/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO
4 changes: 4 additions & 0 deletions event_rest_api/services/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import service
from . import event
from . import event_stage
from . import event_type
Loading

0 comments on commit 8358d1a

Please sign in to comment.