-
Notifications
You must be signed in to change notification settings - Fork 1
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
LLSC-24: Scheduling API #18
base: main
Are you sure you want to change the base?
Conversation
lint lint
…/uwblueprint/llsc into janealsh/LLSC-24-schedules-model
To Do: - add relationship for Schedule (time_blocks field)
boiler plate code
id should be integers, not uuid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great so far! Left some comments, but as we went through before, functionality wise this looks good to me.
from abc import ABC, abstractmethod | ||
from app.schemas.schedule import ScheduleCreate, ScheduleInDB, ScheduleAdd, ScheduleData, ScheduleRemove | ||
|
||
class IScheduleService(ABC): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I think about this, I don't think we need this abstract class. ScheduleService
is a standalone class.
from sqlalchemy.orm import Session | ||
|
||
from app.models import Schedule, TimeBlock | ||
# from app.schemas.schedule import UserCreate, UserInDB, UserRole |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should remove these comments!
backend/app/models/ScheduleState.py
Outdated
from .Base import Base | ||
|
||
|
||
class ScheduleState(Base): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename this to ScheduleStatus
, I think this would be more indicative of a progession since Schedule
is general.
|
||
class ScheduleState(str, Enum): | ||
PENDING_PARTICIPANT = "PENDING_PARTICIPANT_RESPONSE" | ||
PENDING_VOLUNTEER = "PENDING_VOLUNTEER_RESPONSE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: keep these in the same order as in the DB, just in case someone uses this as a reference for the ordering.
backend/app/schemas/schedule.py
Outdated
model_config = ConfigDict(from_attributes=True) | ||
|
||
# Provides both Schedule data and full TimeBlock data | ||
class ScheduleData(ScheduleInDB): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case I'd call this ScheduleGetResponse
.
backend/app/server.py
Outdated
@@ -20,7 +20,7 @@ | |||
@asynccontextmanager | |||
async def lifespan(_: FastAPI): | |||
log.info("Starting up...") | |||
models.run_migrations() | |||
# models.run_migrations() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uncomment this line for now, we should have a separate PR to handle updating the migration steps.
backend/app/schemas/time_block.py
Outdated
''' | ||
pass | ||
|
||
class TimeBlockInDB(BaseModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call this TimeBlockEntity
instead, InDB
isn't standard for DB representations.
Reminder to fix linter rules as well |
update schedule_state to schedule_status
## Notion ticket link <!-- Please replace with your ticket's URL --> [Ticket Name](https://www.notion.so/uwblueprintexecs/Task-Board-db95cd7b93f245f78ee85e3a8a6a316d) <!-- Give a quick summary of the implementation details, provide design justifications if necessary --> ## Implementation description * <!-- What should the reviewer do to verify your changes? Describe expected results and include screenshots when appropriate --> ## Steps to test 1. <!-- Draw attention to the substantial parts of your PR or anything you'd like a second opinion on --> ## What should reviewers focus on? * ## Checklist - [ ] My PR name is descriptive and in imperative tense - [ ] My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits - [ ] I have run the appropriate linter(s) - [ ] I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR
Notion ticket link
LLSC-24 Scheduling API
Implementation description
Steps to test
Make a request to http://localhost:8000/schedules (Check FastAPI docs for example input)
![image](https://private-user-images.githubusercontent.com/43621165/399389814-fc9b14b4-db5e-4141-a095-a4ad3aa7b08d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjAyOTIsIm5iZiI6MTczOTM1OTk5MiwicGF0aCI6Ii80MzYyMTE2NS8zOTkzODk4MTQtZmM5YjE0YjQtZGI1ZS00MTQxLWEwOTUtYTRhZDNhYTdiMDhkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDExMzMxMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA4M2RiMTcxNmE4MWRhMGQxOTI3ZWIzNDcxYWI1N2Y2MmY2M2FhMjczY2FhMjc0ZWNmZDUyNWQxZDU4ZWUzOTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Kws80Y3bbCTCkgOnda4g7s7iFbWdehyzDQ2RtnQMKHA)
Verify that a new Schedule was created, and that the new Time Blocks have that Schedule id as a field
![image](https://private-user-images.githubusercontent.com/43621165/399389850-7dd0e84d-7336-4358-9251-9f81d3f410d8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjAyOTIsIm5iZiI6MTczOTM1OTk5MiwicGF0aCI6Ii80MzYyMTE2NS8zOTkzODk4NTAtN2RkMGU4NGQtNzMzNi00MzU4LTkyNTEtOWY4MWQzZjQxMGQ4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDExMzMxMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVhNGYxZTcxZjVlOTdlMjYxNTQ5ZTg1MWE1ZDU1ODBjOTE2NTIwNjMwYmM3YTMyNmNkZDhjNzA1Y2U3N2VjYjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.gd28KJzn_VyA47oxLnCAGbjAj_ucO-pqTfEtNw4SphA)
![image](https://private-user-images.githubusercontent.com/43621165/399389886-633b4a80-a045-404e-bb01-0d8eac0bb898.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjAyOTIsIm5iZiI6MTczOTM1OTk5MiwicGF0aCI6Ii80MzYyMTE2NS8zOTkzODk4ODYtNjMzYjRhODAtYTA0NS00MDRlLWJiMDEtMGQ4ZWFjMGJiODk4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDExMzMxMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI2OWM5NjRjZjk0YmMxNWY3MGExYzRlYjcxMzMyYTY3Yjc3ZmVhZDQwMjdlNGYyMTBmOGMzODk2MDcwMGVkMGEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.iNogNNHuz-c6UsTWbN9scbVXCyFo1qakT8d0hvRQM1w)
Schedule 13 is created:
3 TimeBlocks were created corresponding to Schedule 13:
What should reviewers focus on?
Checklist