Skip to content

mirroring LP information in our database #3

@LinusBolls

Description

@LinusBolls

goal

this is a step towards allowing people to share their study plans with one another. currently, we fetch information like a user's past assessments directly in their browser. this means that any user who doesn't have this user's LP token won't be able to see their information, making study plan sharing impossible.

entities

user (modify)

right now, mirroring these fields is important to show information about the professor that coordinates or assesses a given module. we'll mirror the following values from the LP graphql schema:

  • firstName
  • lastName
  • name
  • email
  • avatarUrl
  • role
  • slackLink
  • bio
  • inactive
  • grants
    these are the values that might be interesting to us or are currently required. nullability should be mirrored from the graphql schema.
    we will worry about how to migrate these changes to the prod db at a later point. in the future, professors will be populated in the seeding script.

assessment (create)

we'll want to mirror all primitive values (values that are not a relation) from the LP graphql schema. this is all relevant information that will allow us to build future features more quickly. we'll also want to mirror the semester, assessor, module, and user properties.

module (modify)

we'll want to mirror all fields of the LP graphql schema, except for moduleHandbooks, learningResources, and semesterModules, which will be ignored.

endpoints

POST /auth/login (modify)

the call signature of this endpoint remains the same. we don't need the user's browser to send the user information to our backend, since we're fetching the LP user from our backend anyway. just insert the values we're fetching anyway into the modified user entity. we'll also want to fetch the user's assessments here and use them to populate the study plan.

PUT /study-plan/{id}/assessments (create)

this will get called anytime the subject of a study plan opens the study plan, to get the latest state of their studies synced to our backend.
req body: Record<SemesterId, Assessment>, with SemesterId being Semester.id, not Semester.lpId. Assessment is the input type for our new assessment entity. the assessor and user fields will be lpIds.

GET /study-plan/{id} (modify)

TODO @LinusBolls

all endpoints will be guarded using zod schemas.

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions