Skip to content

Commit 29fe88e

Browse files
committed
renames update_attendance_present to mark_attendance, fixes documentation issues
1 parent 4da81ec commit 29fe88e

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE Member ADD COLUMN macaddress TEXT;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE Attendance RENAME COLUMN present TO ispresent;

src/db/attendance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ pub struct Attendance {
99
pub date: NaiveDate,
1010
pub timein: NaiveTime,
1111
pub timeout: NaiveTime,
12-
pub present: bool,
12+
pub ispresent: bool,
1313
}

src/graphql/mutations.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl MutationRoot {
4040
}
4141

4242

43-
//Mutation for adding Attendance to the Attendance table
43+
//Mutation for adding attendance to the Attendance table
4444
async fn add_attendance(
4545
&self,
4646
ctx: &Context<'_>,
@@ -64,19 +64,19 @@ impl MutationRoot {
6464
Ok(attendance)
6565
}
6666

67-
async fn update_attendance_present(
67+
async fn mark_attendance(
6868
&self,
6969
ctx: &Context<'_>,
7070
id: i32,
7171
date: NaiveDate,
72-
present: bool,
72+
ispresent: bool,
7373
) -> Result<Attendance,sqlx::Error> {
7474
let pool = ctx.data::<Arc<PgPool>>().expect("Pool not found in context");
7575

7676
let attendance = sqlx::query_as::<_, Attendance>(
77-
"UPDATE Attendance SET present = $1 WHERE id = $2 AND date = $3 RETURNING *"
77+
"UPDATE Attendance SET ispresent = $1 WHERE id = $2 AND date = $3 RETURNING *"
7878
)
79-
.bind(present)
79+
.bind(ispresent)
8080
.bind(id)
8181
.bind(date)
8282
.fetch_one(pool.as_ref())

src/graphql/query.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub struct QueryRoot;
1111
#[Object]
1212
impl QueryRoot {
1313

14-
//Query for retrieving the Members
14+
//Query for retrieving the members
1515
async fn get_member(&self, ctx: &Context<'_>) -> Result<Vec<Member>, sqlx::Error> {
1616
let pool = ctx.data::<Arc<PgPool>>().expect("Pool not found in context");
1717
let users = sqlx::query_as::<_, Member>("SELECT * FROM Member")
@@ -20,7 +20,7 @@ impl QueryRoot {
2020
Ok(users)
2121
}
2222

23-
//Query for retrieving the Attendance based on date
23+
//Query for retrieving the attendance based on date
2424
async fn get_attendance(
2525
&self,
2626
ctx: &Context<'_>,

0 commit comments

Comments
 (0)