@fabriktor/fx 0.0.109 → 0.0.110

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.
@@ -26,21 +26,15 @@ export type ArchiveLocationOptions = {
26
26
  owner_id: string;
27
27
  location: Location;
28
28
  };
29
- export type SearchLocationsOptions = OwnerSearchOptions & {
30
- is_archived?: boolean;
31
- };
32
- export type SearchAccessibleLocationsOptions = SearchOptions & {
33
- is_archived?: boolean;
34
- };
35
- export type SearchJobProgramsOptions = OwnerSearchOptions & {
36
- location_id?: string;
37
- };
38
- export type SearchJobsOptions = OwnerSearchOptions & {
39
- location_id?: string;
40
- };
41
- export type SearchAccessibleJobsOptions = SearchOptions & {
42
- location_id?: string;
43
- };
29
+ type LocationSearchFields = Partial<Pick<Location, "is_archived">>;
30
+ type JobSearchFields = Partial<Pick<Job, "location_id" | "status">>;
31
+ export type SearchLocationsOptions = OwnerSearchOptions & LocationSearchFields;
32
+ export type SearchAccessibleLocationsOptions = SearchOptions & LocationSearchFields;
33
+ export type SearchJobProgramsOptions = OwnerSearchOptions & Partial<Pick<JobProgram, "finished">> & {
34
+ location_id?: JobProgram["job_location_id"];
35
+ };
36
+ export type SearchJobsOptions = OwnerSearchOptions & JobSearchFields;
37
+ export type SearchAccessibleJobsOptions = SearchOptions & JobSearchFields;
44
38
  export type SearchLocationsPage = SearchPage<Location>;
45
39
  export type SearchJobProgramsPage = SearchPage<JobProgram>;
46
40
  export type SearchJobsPage = SearchPage<Job>;
@@ -168,12 +168,13 @@ export class JobsFX {
168
168
  };
169
169
  }
170
170
  async searchJobPrograms(opts) {
171
- const { location_id, ...searchOpts } = opts;
171
+ const { location_id, finished, ...searchOpts } = opts;
172
172
  return await runOwnerSearch({
173
173
  ...searchOpts,
174
- query: location_id === undefined
175
- ? undefined
176
- : queryParams({ job_location_id: location_id }),
174
+ query: queryParams({
175
+ job_location_id: resolvedID(location_id),
176
+ finished,
177
+ }),
177
178
  search: (searchOpts) => this.jobs.searchManyJobPrograms(searchOpts),
178
179
  });
179
180
  }
@@ -219,20 +220,18 @@ export class JobsFX {
219
220
  return await this.findJob(id);
220
221
  }
221
222
  async searchJobs(opts) {
222
- const { location_id, ...searchOpts } = opts;
223
- const id = resolvedID(location_id);
223
+ const { location_id, status, ...searchOpts } = opts;
224
224
  return await runOwnerSearch({
225
225
  ...searchOpts,
226
- query: id === undefined ? undefined : queryParams({ location_id: id }),
226
+ query: jobSearchQuery({ location_id, status }),
227
227
  search: (opts) => this.jobs.searchManyJobs(opts),
228
228
  });
229
229
  }
230
230
  async searchAccessibleJobs(opts = {}) {
231
- const { location_id, ...searchOpts } = opts;
232
- const id = resolvedID(location_id);
231
+ const { location_id, status, ...searchOpts } = opts;
233
232
  return await runSearch({
234
233
  ...searchOpts,
235
- query: id === undefined ? undefined : queryParams({ location_id: id }),
234
+ query: jobSearchQuery({ location_id, status }),
236
235
  search: (opts) => this.jobs.searchMineJobs(opts),
237
236
  });
238
237
  }
@@ -440,6 +439,12 @@ export class JobsFX {
440
439
  return job;
441
440
  }
442
441
  }
442
+ function jobSearchQuery(fields) {
443
+ return queryParams({
444
+ location_id: resolvedID(fields.location_id),
445
+ status: fields.status,
446
+ });
447
+ }
443
448
  function jobMembershipInput(opts) {
444
449
  const id = requiredID(opts.job.id, "job", msgJobIDRequired);
445
450
  const location_id = locationID(opts.location, opts.job.location_id, "job", msgJobLocationMismatch);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriktor/fx",
3
- "version": "0.0.109",
3
+ "version": "0.0.110",
4
4
  "description": "![Fabriktor Logo](./img/fabriktor-character.gif)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,7 +17,7 @@
17
17
  "typescript": "^6.0.3"
18
18
  },
19
19
  "dependencies": {
20
- "@fabriktor/client": "0.0.84",
20
+ "@fabriktor/client": "0.0.85",
21
21
  "@fabriktor/fx": "0.0.94",
22
22
  "@fabriktor/schema": "0.0.63"
23
23
  }