Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add template endpoint #667

Merged
merged 2 commits into from
Sep 13, 2023
Merged

Add template endpoint #667

merged 2 commits into from
Sep 13, 2023

Conversation

dmtrek14
Copy link
Collaborator

@dmtrek14 dmtrek14 commented Sep 12, 2023

First, there are some small changes to the template table to allow for storage of global templates in the database.

Second, this adds a GET endpoint to the API to retriever user templates. This will get all templates the user has created as well as all global templates.

@dmtrek14 dmtrek14 force-pushed the add-template-endpoint branch 2 times, most recently from c87e817 to c80ae4f Compare September 12, 2023 22:25
Copy link
Member

@anarute anarute left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the minor suggestion, it looks good to me!

Also another nit is that in the first commit it is written that some columns were deprecated, but I don't see that in the code.

customer_id = Column("customerid", Integer, ForeignKey("customer.id"), nullable=True)
user_id = Column("usrid", Integer, ForeignKey("usr.id"), nullable=True)
project_id = Column("projectid", Integer, ForeignKey("project.id"), nullable=True)
is_global = Column(Boolean, nullable=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding default=False, just to make sure no task is global by mistake.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had started by removing the telework and onsite columns, but that was going to break some things

- Add isGlobal column so that we can store global templates in db
- Made usrid nullable since global templates won't belong to single user
- Update model for table
- Add service to fetch all user templates plus global templates
- Add schema
Copy link
Member

@anarute anarute left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now, thank you!

@dmtrek14 dmtrek14 merged commit 8ff647b into main Sep 13, 2023
1 check passed
@dmtrek14 dmtrek14 deleted the add-template-endpoint branch September 13, 2023 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants