Module iqps_backend::db::queries
source · Expand description
SQL queries for the database.
Some of these are functions that return a query that is dynamically generated based on requirements.
Enums§
- An enum representing the exam filter for the search query
Constants§
- List of fields in the
crate::db::models::DBAdminDashboardQP
to be used with SELECT clauses - Insert a newly uploaded file in the db (and return the id) Parameters in the following order:
course_code
,course_name
,year
,exam
,semester
,filelink
,from_library
- List of fields in the
crate::db::models::DBSearchQP
to be used with SELECT clauses - Soft deletes a paper (sets
approve_status
to false andis_deleted
to true) of an uploaded paper. - Updates the filelink ($2) of a paper with the given id ($1). Used to update the filelink after a paper is uploaded.
Functions§
- Gets all unapproved papers (
crate::db::models::DBAdminDashboardQP
) from the database - Returns a query that updates a paper’s details by id ($1) (course_code, course_name, year, semester, exam, approve_status, filelink).
approved_by
optionally included if the edit is also used for approval. - Get a paper (
crate::db::models::DBAdminDashboardQP
) with the given id (first parameter$1
) - Returns the query for searching question papers. It is mostly voodoo, @Rajiv please update the documentation.
- Query to get similar papers. Matches
course_code
($1) always. Other parameters are optional and can be enabled or disabled using the arguments to this function.