All files / utils categoricalCourseEmailsUtils.js

100% Statements 3/3
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3

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              46x           5x               5x          
/**
 * Query key prefix for every cached result of GET /api/courses/emails for a
 * course (whatever the type and format). Mutations that change who is on the
 * staff list or roster invalidate this prefix so that any Emails card showing
 * those addresses refetches them.
 */
export function categoricalCourseEmailsQueryKey(courseId) {
  return `/api/courses/emails?courseId=${courseId}`;
}
 
// The formats GET /api/courses/emails can return the addresses in: `value` is
// the EmailFormats value the endpoint accepts, `label` is what the user sees.
// The first one is the default.
export const EMAIL_FORMATS = [
  { value: "ONE_PER_LINE", label: "One per line" },
  { value: "COMMA_SEPARATED", label: "Comma separated" },
];
 
// The types GET /api/courses/emails can return the addresses in: `value` is
// the EmailTypes value the endpoint accepts, `label` is what the user sees.
// The first one is the default.
export const EMAIL_TYPES = [
  { value: "STUDENTS", label: "Students" },
  { value: "STAFF", label: "Staff" },
  { value: "ALL", label: "All" },
];