Skip to content

[FEATURE] Creating a new DB object (Template) #95

@davicara

Description

@davicara

Issue Type

  • Bug report
  • Feature request
  • Documentation update
  • Other (please specify)

Description

This is a template on the requirements to create new Database Principles / Tables / Objects

Expected behaviour

[What you expected to happen]

Actual behaviour

[What actually happened]

Screenshots

[If applicable, add screenshots to help explain your problem]

Additional context

How to create:

You must create a new DBObject, this means making a new class inside the database_objects.py module, this will automatically be grabbed by the database and will create a new table.

Image

I would also suggest creating a Pydantic object as FastAPI works better with those, this means creating a class in pydantic_objects.py

Image

Lastly, I do suggest making a new handler for this new object like I did with task_handler.py, this is because the database.py will not automatically convert the Database object to the Pydantic object.

Requirements:

  • ID: There must be a PRIMARYKEY, preferably an ID, remeber that you can AUTOINCREMENT with SQL so it can be left in the background. get_object_by_id() will only work with an id tag not every primary key.
  • Name: A name is not required however if you are wanting to use the inbuilt function get_object_by_name then it will require a name field as well as it being UNIQUE

Possible Solution

[Not obligatory, but suggest a fix/reason for the bug, or ideas how to implement the feature]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions