Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions migrations/20240813130838_rename_present_to_isPresent.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE Attendance RENAME COLUMN ispresent TO is_prresent;
2 changes: 1 addition & 1 deletion migrations/20240813132052_rename_present_to_is_present.sql
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ALTER TABLE Attendance RENAME COLUMN ispresent TO is_present;

1 change: 1 addition & 0 deletions src/db/member.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ pub struct Member {
pub email: String,
pub sex: String,
pub year: i32,
pub macaddress: String,
}
6 changes: 4 additions & 2 deletions src/graphql/mutations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,21 @@ impl MutationRoot {
hostel: String,
email: String,
sex: String,
year: i32
year: i32,
macaddress: String,
) -> Result<Member, sqlx::Error> {
let pool = ctx.data::<Arc<PgPool>>().expect("Pool not found in context");

let member = sqlx::query_as::<_, Member>(
"INSERT INTO Member (rollno, name, hostel, email, sex, year) VALUES ($1, $2, $3, $4, $5, $6) RETURNING *"
"INSERT INTO Member (rollno, name, hostel, email, sex, year, macaddress) VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING *"
)
.bind(rollno)
.bind(name)
.bind(hostel)
.bind(email)
.bind(sex)
.bind(year)
.bind(macaddress)
.fetch_one(pool.as_ref())
.await?;

Expand Down