placementt-core 1.400.1063 → 1.400.1064

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1929,6 +1929,15 @@ export type ScheduledVisit = {
1929
1929
  * a new target type never needs a lookup table. */
1930
1930
  targetCollection: "placements" | "users";
1931
1931
  targetId: string;
1932
+ /** The target's name, copied in at write time by whoever creates the check.
1933
+ *
1934
+ * Denormalised on purpose: a list of checks is a list of people, and reading the
1935
+ * target doc per row costs one read per pupil every time a staff member opens a
1936
+ * cohort's checks — a two-hundred-wide read for a name that never changes. Written
1937
+ * by every generator and by the ad-hoc dialog; absent on checks written before
1938
+ * this existed, so every reader falls back rather than showing a blank. */
1939
+ targetForename?: string;
1940
+ targetSurname?: string;
1932
1941
  date: string;
1933
1942
  checkType: "call" | "in-person" | "video" | "email" | "other";
1934
1943
  createdByUid: string;
@@ -3903,6 +3912,18 @@ export declare const CAREERS_RECORD_MODE_LABELS: Record<CareersRecordEntry["mode
3903
3912
  * @return {CareersRecordEntry["mode"]} the record's mode.
3904
3913
  */
3905
3914
  export declare function checkTypeToRecordMode(checkType: ScheduledVisit["checkType"]): CareersRecordEntry["mode"];
3915
+ /**
3916
+ * Who a check is about, off the check itself.
3917
+ *
3918
+ * The name is denormalised onto the check precisely so a list of them needs no read
3919
+ * per row — see ScheduledVisit.targetForename. Returns an empty string for a check
3920
+ * written before that field existed, which is the caller's cue to fall back to
3921
+ * whatever roster it already has rather than print a uid at a member of staff.
3922
+ *
3923
+ * @param {Pick<ScheduledVisit, "targetForename"|"targetSurname">} check the check.
3924
+ * @return {string} their name, or "" when the check does not carry one.
3925
+ */
3926
+ export declare function checkTargetName(check: Pick<ScheduledVisit, "targetForename" | "targetSurname">): string;
3906
3927
  export type SuggestedFixRepo = "placementt-web" | "placementt-backend" | "placementt-core";
3907
3928
  export type SuggestedFix = {
3908
3929
  isCodeChange: boolean;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CAREERS_RECORD_MODE_LABELS = exports.CAREERS_RECORD_TYPE_LABELS = void 0;
4
4
  exports.checkTypeToRecordMode = checkTypeToRecordMode;
5
+ exports.checkTargetName = checkTargetName;
5
6
  /** Staff-facing labels for each entry type. In core because the web form, the setup
6
7
  * wizard and the backend CSV export all name them and must not drift. */
7
8
  exports.CAREERS_RECORD_TYPE_LABELS = {
@@ -43,4 +44,18 @@ function checkTypeToRecordMode(checkType) {
43
44
  default: return "inPerson";
44
45
  }
45
46
  }
47
+ /**
48
+ * Who a check is about, off the check itself.
49
+ *
50
+ * The name is denormalised onto the check precisely so a list of them needs no read
51
+ * per row — see ScheduledVisit.targetForename. Returns an empty string for a check
52
+ * written before that field existed, which is the caller's cue to fall back to
53
+ * whatever roster it already has rather than print a uid at a member of staff.
54
+ *
55
+ * @param {Pick<ScheduledVisit, "targetForename"|"targetSurname">} check the check.
56
+ * @return {string} their name, or "" when the check does not carry one.
57
+ */
58
+ function checkTargetName(check) {
59
+ return `${check.targetForename ?? ""} ${check.targetSurname ?? ""}`.trim();
60
+ }
46
61
  //# sourceMappingURL=typeDefinitions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"typeDefinitions.js","sourceRoot":"","sources":["../src/typeDefinitions.ts"],"names":[],"mappings":";;;AA66HA,sDASC;AA1CD;yEACyE;AAC5D,QAAA,0BAA0B,GAA2C;IAC9E,gBAAgB,EAAE,2BAA2B;IAC7C,mBAAmB,EAAE,sBAAsB;IAC3C,cAAc,EAAE,iBAAiB;IACjC,kBAAkB,EAAE,qBAAqB;IACzC,UAAU,EAAE,oCAAoC;IAChD,aAAa,EAAE,yBAAyB;IACxC,aAAa,EAAE,wBAAwB;IACvC,KAAK,EAAE,OAAO;CACjB,CAAC;AAEW,QAAA,0BAA0B,GAA+C;IAClF,QAAQ,EAAE,WAAW;IACrB,KAAK,EAAE,YAAY;IACnB,KAAK,EAAE,OAAO;CACjB,CAAC;AAEF;;;;;;;;;;;;;GAa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KAAK,CAAC,aAAa,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;AAC/E,CAAC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "private": false,
3
3
  "name": "placementt-core",
4
4
  "author": "Placementt",
5
- "version": "1.400.1063",
5
+ "version": "1.400.1064",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
8
8
  "scripts": {
@@ -1918,6 +1918,15 @@ export type ScheduledVisit = {
1918
1918
  * a new target type never needs a lookup table. */
1919
1919
  targetCollection: "placements"|"users",
1920
1920
  targetId: string,
1921
+ /** The target's name, copied in at write time by whoever creates the check.
1922
+ *
1923
+ * Denormalised on purpose: a list of checks is a list of people, and reading the
1924
+ * target doc per row costs one read per pupil every time a staff member opens a
1925
+ * cohort's checks — a two-hundred-wide read for a name that never changes. Written
1926
+ * by every generator and by the ad-hoc dialog; absent on checks written before
1927
+ * this existed, so every reader falls back rather than showing a blank. */
1928
+ targetForename?: string,
1929
+ targetSurname?: string,
1921
1930
  date: string, // yyyy-mm-dd
1922
1931
  checkType: "call"|"in-person"|"video"|"email"|"other",
1923
1932
  createdByUid: string,
@@ -4022,6 +4031,21 @@ export function checkTypeToRecordMode(checkType: ScheduledVisit["checkType"]): C
4022
4031
  }
4023
4032
  }
4024
4033
 
4034
+ /**
4035
+ * Who a check is about, off the check itself.
4036
+ *
4037
+ * The name is denormalised onto the check precisely so a list of them needs no read
4038
+ * per row — see ScheduledVisit.targetForename. Returns an empty string for a check
4039
+ * written before that field existed, which is the caller's cue to fall back to
4040
+ * whatever roster it already has rather than print a uid at a member of staff.
4041
+ *
4042
+ * @param {Pick<ScheduledVisit, "targetForename"|"targetSurname">} check the check.
4043
+ * @return {string} their name, or "" when the check does not carry one.
4044
+ */
4045
+ export function checkTargetName(check: Pick<ScheduledVisit, "targetForename"|"targetSurname">): string {
4046
+ return `${check.targetForename ?? ""} ${check.targetSurname ?? ""}`.trim();
4047
+ }
4048
+
4025
4049
  export type SuggestedFixRepo = "placementt-web"|"placementt-backend"|"placementt-core";
4026
4050
 
4027
4051
  export type SuggestedFix = {