added queries

This commit is contained in:
jfrye122
2023-05-04 13:47:22 -04:00
parent 71d3b43f20
commit 61a74be0b0
3 changed files with 109 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
import gql from "graphql-tag";
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
employee_number
active
termination_date
hire_date
flat_rate
rates
pin
user_email
external_id
employee_vacations(order_by: { start: desc }) {
id
start
end
}
}
}
`;
export const QUERY_ACTIVE_EMPLOYEES = gql`
query QUERY_ACTIVE_EMPLOYEES {
employees(where: { active: { _eq: true } }) {
last_name
id
first_name
employee_number
active
termination_date
hire_date
flat_rate
rates
pin
user_email
}
}
`;

View File

@@ -0,0 +1,52 @@
import gql from "graphql-tag";
export const INSERT_NEW_TIME_TICKET = gql`
mutation INSERT_NEW_TIME_TICKET(
$timeTicketInput: [timetickets_insert_input!]!
) {
insert_timetickets(objects: $timeTicketInput) {
returning {
id
clockon
clockoff
employeeid
productivehrs
actualhrs
ciecacode
date
memo
flat_rate
}
}
}
`;
export const UPDATE_TIME_TICKET = gql`
mutation UPDATE_TIME_TICKET(
$timeticketId: uuid!
$timeticket: timetickets_set_input!
) {
update_timetickets(
where: { id: { _eq: $timeticketId } }
_set: $timeticket
) {
returning {
id
clockon
clockoff
employeeid
productivehrs
actualhrs
ciecacode
created_at
updated_at
jobid
date
flat_rate
memo
}
}
}
`;

View File

@@ -6,6 +6,9 @@ const EmployeeActionTypes = {
EMPLOYEE_AUTHORIZING_SUCCESS: "EMPLOYEE_AUTHORIZING_SUCCESS",
EMPLOYEE_AUTHORIZING_FAILURE: "EMPLOYEE_AUTHORIZING_FAILURE",
EMPLOYEE_SIGN_OUT: "EMPLOYEE_SIGN_OUT",
EMPLOYEE_CREATE_TIME_TICKET_START: "EMPLOYEE_CREATE_TIME_TICKET_START",
EMPLOYEE_CREATE_TIME_TICKET_SUCCESS: "EMPLOYEE_CREATE_TIME_TICKET_SUCCESS",
EMPLOYEE_CREATE_TIME_TICKET_FAILURE: "EMPLOYEE_CREATE_TIME_TICKET_FAILURE",
EMPLOYEE_CHECK_SESSION: "EMPLOYEE_CHECK_SESSION",
EMPLOYEE_SET_CURRENT: "EMPLOYEE_SET_CURRENT"