All files / packages/constants/src endpoints.ts

100% Statements 22/22
100% Branches 1/1
100% Functions 15/15
100% Lines 21/21

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 441x 1x 1x 1x 1x   32x         1x 1x 1x 1x 2x   1x       1x           1x   1x   1x   1x       1x 1x 1x 1x      
const TICKETS_ENDPOINT = "/api/tickets";
const MEAL_RESERVATIONS_ENDPOINT = "/api/meal-reservations";
const EMPLOYEES_ENDPOINT = "/api/v1/employees";
const HOLIDAYS_ENDPOINT = "/api/configs/dates";
const NOTIFICATIONS_ENDPOINT = "/api/notifications";
 
export const API_ENDPOINTS = {
  LIST_REQUESTS: TICKETS_ENDPOINT,
  PROFILE_MY_REQUEST: "/api/tickets/profile/my-request",
  PROFILE_INCOMING_REQUEST: "/api/tickets/profile/incoming-request",
  MY_REQUESTS: "/api/tickets/me",
  TICKET_DETAIL: (id: string) => `${TICKETS_ENDPOINT}/${id}`,
  TICKET_OUTCOMES: (id: string) => `${TICKETS_ENDPOINT}/${id}/outcomes`,
  TICKETS_QUERY: (query: string) => `${TICKETS_ENDPOINT}${query}`,
  MY_REQUESTS_QUERY: (query: string) => `${TICKETS_ENDPOINT}/me${query}`,
  TICKET_USER: (userId: string, query = "") => `${TICKETS_ENDPOINT}/${userId}${query}`,
  TICKET_ON_BEHALF: (userId?: string) =>
    `${TICKETS_ENDPOINT}/on-be-half/${userId}?showHistories=false`,
  ME: "/api/users/me",
  EXTRA_USERS: "/api/extra-users",
  MEAL_RESERVATIONS: MEAL_RESERVATIONS_ENDPOINT,
  MEAL_RESERVATION: (id: string) => `${MEAL_RESERVATIONS_ENDPOINT}/${id}`,
  ROOMS: "/api/rooms",
  MEETING_ROOMS: "/api/meeting-rooms",
  MEETING_ROOMS_BOOKED: "/api/meeting-rooms/booked",
  MAINTENANCE_SCOPES: "/api/maintain-scopes",
  EMPLOYEES: EMPLOYEES_ENDPOINT,
  EMPLOYEES_SIMPLE: () => `${EMPLOYEES_ENDPOINT}?limit=300&simple=true`,
  EMPLOYEE_RELATIONSHIPS: (email: string) =>
    `${EMPLOYEES_ENDPOINT}/${encodeURIComponent(email)}/relationships`,
  HOLIDAYS: HOLIDAYS_ENDPOINT,
  HOLIDAYS_BY_YEAR: (year: number) => `${HOLIDAYS_ENDPOINT}/${year}`,
  NOTIFICATIONS: NOTIFICATIONS_ENDPOINT,
  NOTIFICATION_USER: (userId: string) => `${NOTIFICATIONS_ENDPOINT}/${userId}`,
  OTP_GENERATE: "/api/otp/generate",
  CHATBOT: {
    THREADS: "/api/v1/chat/threads",
    STREAM: (threadId: string) => `/api/v1/chat/threads/${threadId}/messages/stream`,
    ACTIONS_CONFIRM: (threadId: string) => `/api/v1/chat/threads/${threadId}/actions/confirm`,
    ACTIONS_CANCEL: (threadId: string) => `/api/v1/chat/threads/${threadId}/actions/cancel`,
    RESET: (threadId: string) => `/api/v1/chat/threads/${threadId}/reset`,
  },
} as const;