@things-factory/organization 10.1.229 → 10.1.230

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/organization",
3
- "version": "10.1.229",
3
+ "version": "10.1.230",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -43,5 +43,5 @@
43
43
  "@things-factory/shell": "^10.1.228",
44
44
  "exceljs": "4.2.0"
45
45
  },
46
- "gitHead": "df6361882dc166ef3f8bd54492113253c802f879"
46
+ "gitHead": "27f533e9f72834aac95fd6e7287e5ae1862164da"
47
47
  }
@@ -123,6 +123,20 @@ describe("an employee's own profile", () => {
123
123
  expect(await dataSource.getRepository(organization.EmployeeProfile).count()).toBe(1)
124
124
  })
125
125
 
126
+ it('★ read back newest first, as written by its end - the stored rows keep the order written', async () => {
127
+ const lee = await person('lee')
128
+ const saved = await ask(lee, SAVE, {
129
+ profile: {
130
+ projects: [{ name: 'old', startedOn: '2015-01', endedOn: '2016-01' }, { name: 'now', startedOn: '2024-01' }, { name: 'mid', startedOn: '2019-01', endedOn: '2021-06' }]
131
+ }
132
+ })
133
+ expect(saved.errors).toBeUndefined()
134
+ expect(saved.data.saveMyEmployeeProfile.projects.map((row: any) => row.name)).toEqual(['now', 'mid', 'old'])
135
+ expect((await ask(lee, MINE)).data.myEmployeeProfile.projects.map((row: any) => row.name)).toEqual(['now', 'mid', 'old'])
136
+ const [stored] = await dataSource.query(`SELECT projects FROM employee_profiles WHERE deleted_at IS NULL ORDER BY updated_at DESC LIMIT 1`)
137
+ expect(JSON.parse(stored.projects).map((row: any) => row.name)).toEqual(['old', 'now', 'mid'])
138
+ })
139
+
126
140
  it('★ adding from a résumé takes nothing away, and reaches only one\'s own', async () => {
127
141
  const kim = await person('kim')
128
142
  const park = await person('park')
@@ -10,7 +10,6 @@ import {
10
10
  taglineOf,
11
11
  dotted,
12
12
  layoutHtml,
13
- newestFirst,
14
13
  periodOf,
15
14
  profileFileName,
16
15
  profileFooterHtml,
@@ -24,6 +23,7 @@ import {
24
23
  sheetNamesOf,
25
24
  type ProfileSheetWords
26
25
  } from '../server/service/employee-profile/employee-profile-document'
26
+ import { inShowingOrder, newestFirst } from '../server/service/employee-profile/employee-profile-rules'
27
27
 
28
28
  /** The profiles a quotation attaches - one layout, painted as Excel and as HTML for PDF (ADR-0169 decision 5). */
29
29
  const COUNTS: Record<string, (...args: number[]) => string> = {
@@ -124,6 +124,15 @@ describe('one layout of a staffing profile', () => {
124
124
  expect(newestFirst([{ name: 'old', acquiredOn: '2015-05-01' }, { name: 'new', acquiredOn: '2023-01-10' }]).map(row => row.name)).toEqual(['new', 'old'])
125
125
  })
126
126
 
127
+ it('★ a profile is shown in that order wherever it is read - put in it as it is loaded, the stored order untouched', () => {
128
+ const profile = inShowingOrder({ careers: [{ company: 'old', startedOn: '2001-01', endedOn: '2005-01' }, { company: 'now', startedOn: '2010-01' }], projects: null as any, skills: ['b', 'a'] } as any)
129
+ expect(profile.careers.map((row: any) => row.company)).toEqual(['now', 'old'])
130
+ expect(profile.projects).toBeNull()
131
+ expect(profile.skills).toEqual(['b', 'a'])
132
+ const entity = require('fs').readFileSync(require('path').join(__dirname, '../server/service/employee-profile/employee-profile.ts'), 'utf8')
133
+ expect(entity).toMatch(/^ @AfterLoad\(\)\n showNewestFirst\(\) \{\n inShowingOrder\(this\)/m)
134
+ })
135
+
127
136
  it('★ every dated table of the page reads newest first', () => {
128
137
  const person = {
129
138
  ...KIM,