You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# try:returnawaitconsent.storage().save()
# except Exception as e:# raise HTTPException(status_code=500, detail=str(e))
Logic inside endpoints must refer to handling how data is served not business logic. The logic for saving objects or other business actions is inside domain, or service folder.
The rest of the method is just HTTP error handling.
Domain folder
Domain folder consists of objects that represent the domain of Tracardi. That is: profile, session, etc.
These object define data and methods for processing this data. These are pydantic objects. See https://pydantic-docs.helpmanual.io/ for more information.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Project Structure
Tracardi has the following structure.
The whole application is in
app
folder. Inside app folder you will findapi
,domain
,exceptions
,event_server
,service
,process_engine
.Api folder
Inside API folder you will find all endpoints that are exposed to fastApi. These files should be very light. No big logic inside.
For example a simple CRUD endpoint should look like this.
This is authenticated endpoint that starts with "/consent" and for every CRUD operation it has simple one line logic.
Authentication
This forces authentication requirement on an Endpoint
REST endpoints
Example of POST:
Logic inside endpoints must refer to handling how data is served not business logic. The logic for saving objects or other business actions is inside
domain
, orservice
folder.The rest of the method is just HTTP error handling.
Domain folder
Domain folder consists of objects that represent the domain of Tracardi. That is: profile, session, etc.
These object define data and methods for processing this data. These are pydantic objects. See https://pydantic-docs.helpmanual.io/ for more information.
If object has some logic it should be inside domain object.
Beta Was this translation helpful? Give feedback.
All reactions