IO-1612 Add employee vacation tracking.
This commit is contained in:
@@ -4,7 +4,21 @@ export const QUERY_ALL_ACTIVE_APPOINTMENTS = gql`
|
||||
query QUERY_ALL_ACTIVE_APPOINTMENTS(
|
||||
$start: timestamptz!
|
||||
$end: timestamptz!
|
||||
$startd: date!
|
||||
$endd: date!
|
||||
) {
|
||||
employee_vacation(
|
||||
where: { _or: [{ start: { _gte: $startd } }, { end: { _lte: $endd } }] }
|
||||
) {
|
||||
id
|
||||
start
|
||||
end
|
||||
employee {
|
||||
id
|
||||
last_name
|
||||
first_name
|
||||
}
|
||||
}
|
||||
appointments(
|
||||
where: {
|
||||
canceled: { _eq: false }
|
||||
@@ -109,7 +123,24 @@ export const INSERT_APPOINTMENT = gql`
|
||||
`;
|
||||
|
||||
export const QUERY_APPOINTMENT_BY_DATE = gql`
|
||||
query QUERY_APPOINTMENT_BY_DATE($start: timestamptz, $end: timestamptz) {
|
||||
query QUERY_APPOINTMENT_BY_DATE(
|
||||
$start: timestamptz
|
||||
$end: timestamptz
|
||||
$startd: date!
|
||||
$endd: date!
|
||||
) {
|
||||
employee_vacation(
|
||||
where: { _or: [{ start: { _gte: $startd } }, { end: { _lte: $endd } }] }
|
||||
) {
|
||||
id
|
||||
start
|
||||
end
|
||||
employee {
|
||||
id
|
||||
last_name
|
||||
first_name
|
||||
}
|
||||
}
|
||||
appointments(
|
||||
where: { start: { _lte: $end, _gte: $start }, canceled: { _eq: false } }
|
||||
) {
|
||||
|
||||
@@ -3,6 +3,17 @@ import { gql } from "@apollo/client";
|
||||
export const QUERY_EMPLOYEES = gql`
|
||||
query QUERY_EMPLOYEES {
|
||||
employees(order_by: { employee_number: asc }) {
|
||||
last_name
|
||||
id
|
||||
first_name
|
||||
flat_rate
|
||||
employee_number
|
||||
}
|
||||
}
|
||||
`;
|
||||
export const QUERY_EMPLOYEE_BY_ID = gql`
|
||||
query QUERY_EMPLOYEE_BY_ID($id: uuid!) {
|
||||
employees_by_pk(id: $id) {
|
||||
last_name
|
||||
id
|
||||
first_name
|
||||
@@ -14,6 +25,11 @@ export const QUERY_EMPLOYEES = gql`
|
||||
rates
|
||||
pin
|
||||
user_email
|
||||
employee_vacations(order_by: { start: desc }) {
|
||||
id
|
||||
start
|
||||
end
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -55,7 +71,17 @@ export const INSERT_EMPLOYEES = gql`
|
||||
mutation INSERT_EMPLOYEES($employees: [employees_insert_input!]!) {
|
||||
insert_employees(objects: $employees) {
|
||||
returning {
|
||||
last_name
|
||||
id
|
||||
first_name
|
||||
employee_number
|
||||
active
|
||||
termination_date
|
||||
hire_date
|
||||
flat_rate
|
||||
rates
|
||||
pin
|
||||
user_email
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,3 +124,21 @@ export const QUERY_USERS_BY_EMAIL = gql`
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const INSERT_VACATION = gql`
|
||||
mutation INSERT_VACATION($vacation: employee_vacation_insert_input!) {
|
||||
insert_employee_vacation_one(object: $vacation) {
|
||||
id
|
||||
start
|
||||
end
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DELETE_VACATION = gql`
|
||||
mutation DELETE_VACATION($id: uuid!) {
|
||||
delete_employee_vacation_by_pk(id: $id) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user