@betterinternship/schema 1.5.0 → 1.6.0
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/README.md +33 -33
- package/dist/db.internal.types.d.ts +41 -0
- package/dist/db.iom.types.d.ts +13 -3
- package/dist/db.js +46 -31
- package/dist/db.js.map +1 -1
- package/dist/db.types.d.ts +54 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/repository/base.d.ts +57 -0
- package/dist/repository/base.js +388 -0
- package/dist/repository/base.js.map +1 -0
- package/dist/repository/errors.d.ts +1 -0
- package/dist/repository/errors.js +16 -0
- package/dist/repository/errors.js.map +1 -0
- package/dist/repository/factories.d.ts +14 -0
- package/dist/repository/factories.js +45 -0
- package/dist/repository/factories.js.map +1 -0
- package/dist/repository/index.d.ts +3 -0
- package/dist/repository/index.js +20 -0
- package/dist/repository/index.js.map +1 -0
- package/dist/repository/json-columns.d.ts +5 -0
- package/dist/repository/json-columns.js +44 -0
- package/dist/repository/json-columns.js.map +1 -0
- package/dist/repository/paginator.d.ts +4 -0
- package/dist/repository/paginator.js +3 -0
- package/dist/repository/paginator.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +38 -38
package/README.md
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
# @betterinternship/schema
|
|
2
|
-
|
|
3
|
-
Consolidated database schema package for BetterInternship. Replaces the previous `@betterinternship/schema.base` and `@betterinternship/schema.moa` packages.
|
|
4
|
-
|
|
5
|
-
## Exports
|
|
6
|
-
|
|
7
|
-
- `db` — Kysely client over the `career.*` schema
|
|
8
|
-
- `internshipDb` — Kysely client over the `forms.*` schema
|
|
9
|
-
- `documentDb` — Kysely client over the `documents.*` schema
|
|
10
|
-
- `internalDb` — Kysely client over the `internal.*` schema
|
|
11
|
-
- `handleDBError` — shared Postgres error translator
|
|
12
|
-
- Types: `DB` (career), `InternshipDB`, `DocumentDB`, all `Career*` table interfaces, `Json`, `Generated`, `Timestamp`, etc.
|
|
13
|
-
- Namespaces: `Internship`, `Document`, `Internal` (full re-exports of their respective generated type files)
|
|
14
|
-
|
|
15
|
-
## Environment
|
|
16
|
-
|
|
17
|
-
Requires a single `DATABASE_URL` pointing at the unified Postgres database.
|
|
18
|
-
|
|
19
|
-
## Codegen
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
npm run generate # career.* -> lib/db.types.ts
|
|
23
|
-
npm run generate:internship # forms.* -> lib/db.internship.types.ts
|
|
24
|
-
npm run generate:documents # documents.* -> lib/db.doc.types.ts
|
|
25
|
-
npm run generate:internal # internal.* -> lib/db.internal.types.ts
|
|
26
|
-
npm run generate:iom # iom.* -> lib/db.iom.types.ts
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Each script reads `DATABASE_URL` from `dev.env`. Create `dev.env` with your dev database URL:
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
DATABASE_URL="postgres://..."
|
|
33
|
-
```
|
|
1
|
+
# @betterinternship/schema
|
|
2
|
+
|
|
3
|
+
Consolidated database schema package for BetterInternship. Replaces the previous `@betterinternship/schema.base` and `@betterinternship/schema.moa` packages.
|
|
4
|
+
|
|
5
|
+
## Exports
|
|
6
|
+
|
|
7
|
+
- `db` — Kysely client over the `career.*` schema
|
|
8
|
+
- `internshipDb` — Kysely client over the `forms.*` schema
|
|
9
|
+
- `documentDb` — Kysely client over the `documents.*` schema
|
|
10
|
+
- `internalDb` — Kysely client over the `internal.*` schema
|
|
11
|
+
- `handleDBError` — shared Postgres error translator
|
|
12
|
+
- Types: `DB` (career), `InternshipDB`, `DocumentDB`, all `Career*` table interfaces, `Json`, `Generated`, `Timestamp`, etc.
|
|
13
|
+
- Namespaces: `Internship`, `Document`, `Internal` (full re-exports of their respective generated type files)
|
|
14
|
+
|
|
15
|
+
## Environment
|
|
16
|
+
|
|
17
|
+
Requires a single `DATABASE_URL` pointing at the unified Postgres database.
|
|
18
|
+
|
|
19
|
+
## Codegen
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
npm run generate # career.* -> lib/db.types.ts
|
|
23
|
+
npm run generate:internship # forms.* -> lib/db.internship.types.ts
|
|
24
|
+
npm run generate:documents # documents.* -> lib/db.doc.types.ts
|
|
25
|
+
npm run generate:internal # internal.* -> lib/db.internal.types.ts
|
|
26
|
+
npm run generate:iom # iom.* -> lib/db.iom.types.ts
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Each script reads `DATABASE_URL` from `dev.env`. Create `dev.env` with your dev database URL:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
DATABASE_URL="postgres://..."
|
|
33
|
+
```
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { ColumnType } from "kysely";
|
|
2
2
|
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S, I | undefined, U> : ColumnType<T, T | undefined, T>;
|
|
3
|
+
export type InternalLinkDomain = "employer" | "student";
|
|
4
|
+
export type InternalProcessStatus = "canceled" | "failed" | "handled" | "pending";
|
|
5
|
+
export type InternalTaskStatus = "failed" | "handled" | "pending" | "retrying";
|
|
6
|
+
export type Json = JsonValue;
|
|
7
|
+
export type JsonArray = JsonValue[];
|
|
8
|
+
export type JsonObject = {
|
|
9
|
+
[x: string]: JsonValue | undefined;
|
|
10
|
+
};
|
|
11
|
+
export type JsonPrimitive = boolean | number | string | null;
|
|
12
|
+
export type JsonValue = JsonArray | JsonObject | JsonPrimitive;
|
|
3
13
|
export type Timestamp = ColumnType<Date, Date | string, Date | string>;
|
|
4
14
|
export interface InternalEmailDeliveryEvents {
|
|
5
15
|
attempts: number | null;
|
|
@@ -15,6 +25,37 @@ export interface InternalEmailDeliveryEvents {
|
|
|
15
25
|
recipient_email: string;
|
|
16
26
|
resolved_at: Timestamp | null;
|
|
17
27
|
}
|
|
28
|
+
export interface InternalProcesses {
|
|
29
|
+
base_inputs: Generated<Json | null>;
|
|
30
|
+
error: Json | null;
|
|
31
|
+
id: Generated<string>;
|
|
32
|
+
name: string;
|
|
33
|
+
result: Json | null;
|
|
34
|
+
status: Generated<InternalProcessStatus>;
|
|
35
|
+
timestamp: Generated<Timestamp>;
|
|
36
|
+
}
|
|
37
|
+
export interface InternalSlugs {
|
|
38
|
+
created_at: Generated<Timestamp>;
|
|
39
|
+
domain: InternalLinkDomain;
|
|
40
|
+
slug: string;
|
|
41
|
+
url: string;
|
|
42
|
+
}
|
|
43
|
+
export interface InternalTasks {
|
|
44
|
+
error: string | null;
|
|
45
|
+
handler_id: string;
|
|
46
|
+
id: Generated<string>;
|
|
47
|
+
inputs: Json | null;
|
|
48
|
+
internal_id: string;
|
|
49
|
+
parent_ids: string[] | null;
|
|
50
|
+
process_id: string;
|
|
51
|
+
process_name: string;
|
|
52
|
+
result: Json | null;
|
|
53
|
+
status: Generated<InternalTaskStatus>;
|
|
54
|
+
timestamp: Generated<Timestamp>;
|
|
55
|
+
}
|
|
18
56
|
export interface DB {
|
|
19
57
|
"internal.email_delivery_events": InternalEmailDeliveryEvents;
|
|
58
|
+
"internal.processes": InternalProcesses;
|
|
59
|
+
"internal.slugs": InternalSlugs;
|
|
60
|
+
"internal.tasks": InternalTasks;
|
|
20
61
|
}
|
package/dist/db.iom.types.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { ColumnType } from "kysely";
|
|
2
2
|
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S, I | undefined, U> : ColumnType<T, T | undefined, T>;
|
|
3
|
-
export type IomAuditEventType = "company_blacklisted" | "company_invite_accepted" | "company_invite_registered" | "company_invite_sent" | "company_review_approved" | "company_review_rejected" | "company_review_requested" | "company_unblacklisted" | "legacy_document_uploaded" | "legacy_moa_bulk_uploaded" | "legacy_moa_created" | "moa_issued" | "moa_revoked";
|
|
3
|
+
export type IomAuditEventType = "career_nudge_sent" | "company_blacklisted" | "company_invite_accepted" | "company_invite_cancelled" | "company_invite_registered" | "company_invite_sent" | "company_review_approved" | "company_review_rejected" | "company_review_requested" | "company_unblacklisted" | "legacy_document_uploaded" | "legacy_moa_bulk_uploaded" | "legacy_moa_created" | "moa_issued" | "moa_renewal_requested" | "moa_revoked" | "university_account_deactivated" | "university_account_invited" | "university_account_reactivated" | "university_account_role_changed" | "university_profile_updated";
|
|
4
4
|
export type IomAuthPurpose = "invite" | "password_reset";
|
|
5
5
|
export type IomAuthSubjectType = "company" | "company_invite" | "university_account";
|
|
6
|
-
export type
|
|
6
|
+
export type IomCompanyInviteKind = "listing" | "moa";
|
|
7
|
+
export type IomCompanyInviteStatus = "accepted" | "cancelled" | "expired" | "pending" | "used_waiting";
|
|
7
8
|
export type IomCompanyReviewStatus = "approved" | "rejected" | "superseded";
|
|
8
9
|
export type IomCompanyType = "corporation" | "government_agency" | "partnership" | "sole_proprietorship";
|
|
9
10
|
export type IomMoaStatus = "active" | "rejected";
|
|
10
11
|
export type IomQueuedMoaRequestStatus = "failed" | "fulfilled" | "pending";
|
|
11
|
-
export type IomUniversityRole = "staff" | "superadmin";
|
|
12
|
+
export type IomUniversityRole = "admin" | "staff" | "superadmin";
|
|
12
13
|
export type Json = JsonValue;
|
|
13
14
|
export type JsonArray = JsonValue[];
|
|
14
15
|
export type JsonObject = {
|
|
@@ -83,6 +84,8 @@ export interface IomCompanyInvites {
|
|
|
83
84
|
expires_at: Timestamp;
|
|
84
85
|
id: Generated<string>;
|
|
85
86
|
invited_email: string;
|
|
87
|
+
kind: Generated<IomCompanyInviteKind>;
|
|
88
|
+
legacy_company_id: string | null;
|
|
86
89
|
personal_message: string | null;
|
|
87
90
|
status: Generated<IomCompanyInviteStatus>;
|
|
88
91
|
template_id: string | null;
|
|
@@ -117,6 +120,7 @@ export interface IomLegacyCompanies {
|
|
|
117
120
|
created_at: Generated<Timestamp>;
|
|
118
121
|
id: Generated<string>;
|
|
119
122
|
moas: Generated<Json>;
|
|
123
|
+
registered_company_id: string | null;
|
|
120
124
|
university_id: string;
|
|
121
125
|
updated_at: Generated<Timestamp>;
|
|
122
126
|
valid_until: Timestamp | null;
|
|
@@ -129,9 +133,11 @@ export interface IomMoas {
|
|
|
129
133
|
generated_pdf_url: string;
|
|
130
134
|
id: Generated<string>;
|
|
131
135
|
is_expired: boolean | null;
|
|
136
|
+
signatories: Json | null;
|
|
132
137
|
status: IomMoaStatus;
|
|
133
138
|
template_id: string;
|
|
134
139
|
university_id: string;
|
|
140
|
+
verification_code: string | null;
|
|
135
141
|
}
|
|
136
142
|
export interface IomMoaTemplates {
|
|
137
143
|
created_at: Generated<Timestamp>;
|
|
@@ -164,11 +170,14 @@ export interface IomQueuedMoaRequests {
|
|
|
164
170
|
rep_signature_data: string;
|
|
165
171
|
rep_signature_type: string;
|
|
166
172
|
rep_title: string;
|
|
173
|
+
signatories: Generated<Json>;
|
|
167
174
|
status: Generated<IomQueuedMoaRequestStatus>;
|
|
168
175
|
template_id: string;
|
|
169
176
|
university_id: string;
|
|
170
177
|
}
|
|
171
178
|
export interface IomUniversities {
|
|
179
|
+
account_holder_name: string | null;
|
|
180
|
+
account_holder_title: string | null;
|
|
172
181
|
address: string | null;
|
|
173
182
|
created_at: Generated<Timestamp>;
|
|
174
183
|
id: Generated<string>;
|
|
@@ -178,6 +187,7 @@ export interface IomUniversities {
|
|
|
178
187
|
rep_name: string | null;
|
|
179
188
|
rep_signature_url: string | null;
|
|
180
189
|
rep_title: string | null;
|
|
190
|
+
signatories: Generated<Json>;
|
|
181
191
|
updated_at: Generated<Timestamp>;
|
|
182
192
|
}
|
|
183
193
|
export interface IomUniversityAccounts {
|
package/dist/db.js
CHANGED
|
@@ -4,38 +4,53 @@ exports.handleDBError = exports.iomDb = exports.internalDb = exports.documentDb
|
|
|
4
4
|
const kysely_1 = require("kysely");
|
|
5
5
|
const pg_1 = require("pg");
|
|
6
6
|
const env_1 = require("./env");
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
let pool;
|
|
8
|
+
const getPool = () => {
|
|
9
|
+
if (pool)
|
|
10
|
+
return pool;
|
|
11
|
+
const DATABASE_URL = env_1.ENV.DATABASE_URL;
|
|
12
|
+
const DATABASE_CA_CERT = env_1.ENV.DATABASE_CA_CERT;
|
|
13
|
+
if (!DATABASE_URL)
|
|
14
|
+
throw new Error("[ERROR:ENV] Missing DATABASE_URL.");
|
|
15
|
+
const isNoVerify = DATABASE_URL.includes("sslmode=no-verify");
|
|
16
|
+
if (!DATABASE_CA_CERT && !isNoVerify)
|
|
17
|
+
throw new Error("[ERROR:ENV] Missing DATABASE_CA_CERT.");
|
|
18
|
+
pool = new pg_1.Pool({
|
|
19
|
+
connectionString: DATABASE_URL,
|
|
20
|
+
ssl: isNoVerify
|
|
21
|
+
? { rejectUnauthorized: false }
|
|
22
|
+
: {
|
|
23
|
+
rejectUnauthorized: true,
|
|
24
|
+
ca: DATABASE_CA_CERT?.replace(/\\n/g, "\n"),
|
|
25
|
+
checkServerIdentity: () => undefined,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
return pool;
|
|
29
|
+
};
|
|
30
|
+
const lazyKysely = () => {
|
|
31
|
+
let instance;
|
|
32
|
+
const build = () => (instance ??= new kysely_1.Kysely({
|
|
33
|
+
dialect: new kysely_1.PostgresDialect({ pool: getPool() }),
|
|
34
|
+
}));
|
|
35
|
+
return new Proxy({}, {
|
|
36
|
+
get(_target, prop) {
|
|
37
|
+
const inst = build();
|
|
38
|
+
const value = Reflect.get(inst, prop, inst);
|
|
39
|
+
return typeof value === "function" ? value.bind(inst) : value;
|
|
40
|
+
},
|
|
41
|
+
has(_target, prop) {
|
|
42
|
+
return Reflect.has(build(), prop);
|
|
22
43
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
exports.documentDb =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
exports.internalDb = new kysely_1.Kysely({
|
|
34
|
-
dialect: new kysely_1.PostgresDialect({ pool }),
|
|
35
|
-
});
|
|
36
|
-
exports.iomDb = new kysely_1.Kysely({
|
|
37
|
-
dialect: new kysely_1.PostgresDialect({ pool }),
|
|
38
|
-
});
|
|
44
|
+
getPrototypeOf() {
|
|
45
|
+
return Object.getPrototypeOf(build());
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
exports.db = lazyKysely();
|
|
50
|
+
exports.internshipDb = lazyKysely();
|
|
51
|
+
exports.documentDb = lazyKysely();
|
|
52
|
+
exports.internalDb = lazyKysely();
|
|
53
|
+
exports.iomDb = lazyKysely();
|
|
39
54
|
const handleDBError = (error, description = "") => {
|
|
40
55
|
switch (error.code) {
|
|
41
56
|
case "PGRST116":
|
package/dist/db.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.js","sourceRoot":"","sources":["../lib/db.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"db.js","sourceRoot":"","sources":["../lib/db.ts"],"names":[],"mappings":"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"}
|
package/dist/db.types.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { ColumnType } from "kysely";
|
|
2
|
+
export type CareerApplicationSource = "discord" | "mass" | "normal";
|
|
2
3
|
export type CareerApplicationVisibility = "archived" | "deleted" | "visible";
|
|
4
|
+
export type CareerJobActivationEvent = "activated" | "deactivated";
|
|
5
|
+
export type CareerJobActivationSource = "employer" | "god";
|
|
3
6
|
export type CareerJobPauseReason = "dormant" | "neglected" | "unresponsive";
|
|
7
|
+
export type CareerJobWaitlistRemovalReason = "left" | "listing_deleted" | "notified";
|
|
4
8
|
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S, I | undefined, U> : ColumnType<T, T | undefined, T>;
|
|
5
9
|
export type Int8 = ColumnType<string, bigint | number | string, bigint | number | string>;
|
|
6
10
|
export type Json = JsonValue;
|
|
@@ -15,11 +19,13 @@ export type Timestamp = ColumnType<Date, Date | string, Date | string>;
|
|
|
15
19
|
export interface CareerApplications {
|
|
16
20
|
applied_at: Generated<Timestamp>;
|
|
17
21
|
cover_letter: string | null;
|
|
22
|
+
first_viewed: Timestamp | null;
|
|
18
23
|
id: Generated<string>;
|
|
19
24
|
job_id: string | null;
|
|
20
25
|
notes: string | null;
|
|
21
26
|
resume_id: string | null;
|
|
22
27
|
review: string | null;
|
|
28
|
+
source: CareerApplicationSource | null;
|
|
23
29
|
status: Generated<number>;
|
|
24
30
|
updated_at: Generated<Timestamp | null>;
|
|
25
31
|
user_id: string | null;
|
|
@@ -36,6 +42,15 @@ export interface CareerConversations {
|
|
|
36
42
|
id: Generated<string>;
|
|
37
43
|
user_id: string;
|
|
38
44
|
}
|
|
45
|
+
export interface CareerEmployerIomLinkRequests {
|
|
46
|
+
consumed_at: Timestamp | null;
|
|
47
|
+
created_at: Generated<Timestamp>;
|
|
48
|
+
employer_id: string;
|
|
49
|
+
expires_at: Timestamp;
|
|
50
|
+
id: Generated<string>;
|
|
51
|
+
iom_tin: string;
|
|
52
|
+
token_hash: string;
|
|
53
|
+
}
|
|
39
54
|
export interface CareerEmployers {
|
|
40
55
|
accepted_universities: Generated<string[]>;
|
|
41
56
|
accepts_non_university: Generated<boolean>;
|
|
@@ -44,13 +59,16 @@ export interface CareerEmployers {
|
|
|
44
59
|
email: string | null;
|
|
45
60
|
id: Generated<string>;
|
|
46
61
|
industry: string | null;
|
|
62
|
+
is_deactivated: Generated<boolean>;
|
|
47
63
|
is_verified: Generated<boolean>;
|
|
48
64
|
job_count: Generated<number>;
|
|
49
65
|
legal_entity_name: string;
|
|
50
66
|
location: string | null;
|
|
51
67
|
logo: string | null;
|
|
52
68
|
name: string;
|
|
69
|
+
owner_user_id: string | null;
|
|
53
70
|
phone_number: string | null;
|
|
71
|
+
tin: string | null;
|
|
54
72
|
updated_at: Generated<Timestamp>;
|
|
55
73
|
website: string | null;
|
|
56
74
|
}
|
|
@@ -58,6 +76,7 @@ export interface CareerEmployerUserKeyrings {
|
|
|
58
76
|
consumed_at: Timestamp | null;
|
|
59
77
|
created_at: Generated<Timestamp>;
|
|
60
78
|
employer_user_id: string;
|
|
79
|
+
expires_at: Timestamp | null;
|
|
61
80
|
hash: string;
|
|
62
81
|
id: Generated<string>;
|
|
63
82
|
}
|
|
@@ -73,9 +92,18 @@ export interface CareerEmployerUsers {
|
|
|
73
92
|
middle_name: string | null;
|
|
74
93
|
password: string;
|
|
75
94
|
profile_picture: string | null;
|
|
95
|
+
receives_applicant_digest: Generated<boolean>;
|
|
76
96
|
role: Generated<string>;
|
|
77
97
|
updated_at: Generated<Timestamp>;
|
|
78
98
|
}
|
|
99
|
+
export interface CareerGodKeyrings {
|
|
100
|
+
created_at: Generated<Timestamp>;
|
|
101
|
+
employer_user_id: string;
|
|
102
|
+
hash: string;
|
|
103
|
+
id: Generated<string>;
|
|
104
|
+
last_used_at: Timestamp | null;
|
|
105
|
+
ref_employer_id: string | null;
|
|
106
|
+
}
|
|
79
107
|
export interface CareerGods {
|
|
80
108
|
employer_user_id: string;
|
|
81
109
|
id: Generated<string>;
|
|
@@ -87,6 +115,16 @@ export interface CareerInternshipFormMappings {
|
|
|
87
115
|
id: Generated<string>;
|
|
88
116
|
university_id: string | null;
|
|
89
117
|
}
|
|
118
|
+
export interface CareerJobActivationEvents {
|
|
119
|
+
actor_employer_user_id: string | null;
|
|
120
|
+
employer_id: string;
|
|
121
|
+
event: CareerJobActivationEvent;
|
|
122
|
+
id: Generated<string>;
|
|
123
|
+
job_id: string;
|
|
124
|
+
occurred_at: Generated<Timestamp>;
|
|
125
|
+
qualified: Generated<boolean>;
|
|
126
|
+
source: CareerJobActivationSource;
|
|
127
|
+
}
|
|
90
128
|
export interface CareerJobPauses {
|
|
91
129
|
employer_id: string;
|
|
92
130
|
id: Generated<string>;
|
|
@@ -108,6 +146,7 @@ export interface CareerJobs {
|
|
|
108
146
|
is_deleted: Generated<boolean>;
|
|
109
147
|
is_unlisted: Generated<boolean>;
|
|
110
148
|
is_year_round: boolean | null;
|
|
149
|
+
last_activated_at: Generated<Timestamp>;
|
|
111
150
|
location: string | null;
|
|
112
151
|
requirements: string | null;
|
|
113
152
|
salary: Numeric | null;
|
|
@@ -123,6 +162,15 @@ export interface CareerJobsChallenge {
|
|
|
123
162
|
jobs_id: string;
|
|
124
163
|
title: string;
|
|
125
164
|
}
|
|
165
|
+
export interface CareerJobWaitlists {
|
|
166
|
+
created_at: Generated<Timestamp>;
|
|
167
|
+
id: Generated<string>;
|
|
168
|
+
job_id: string;
|
|
169
|
+
notified_at: Timestamp | null;
|
|
170
|
+
removal_reason: CareerJobWaitlistRemovalReason | null;
|
|
171
|
+
removed_at: Timestamp | null;
|
|
172
|
+
user_id: string;
|
|
173
|
+
}
|
|
126
174
|
export interface CareerMoa {
|
|
127
175
|
employer_id: string;
|
|
128
176
|
expires_at: Generated<Timestamp>;
|
|
@@ -204,6 +252,7 @@ export interface CareerRefLevels {
|
|
|
204
252
|
}
|
|
205
253
|
export interface CareerRefUniversities {
|
|
206
254
|
id: Generated<string>;
|
|
255
|
+
iom_university_id: string | null;
|
|
207
256
|
name: string;
|
|
208
257
|
}
|
|
209
258
|
export interface CareerResumes {
|
|
@@ -224,6 +273,7 @@ export interface CareerSessions {
|
|
|
224
273
|
employer_id: string | null;
|
|
225
274
|
id: Generated<string>;
|
|
226
275
|
owner_id: string;
|
|
276
|
+
subaccount_id: string | null;
|
|
227
277
|
timestamp: Generated<Timestamp>;
|
|
228
278
|
user_id: string | null;
|
|
229
279
|
}
|
|
@@ -269,12 +319,16 @@ export interface DB {
|
|
|
269
319
|
"career.applications": CareerApplications;
|
|
270
320
|
"career.applications_challenge_submission": CareerApplicationsChallengeSubmission;
|
|
271
321
|
"career.conversations": CareerConversations;
|
|
322
|
+
"career.employer_iom_link_requests": CareerEmployerIomLinkRequests;
|
|
272
323
|
"career.employer_user_keyrings": CareerEmployerUserKeyrings;
|
|
273
324
|
"career.employer_users": CareerEmployerUsers;
|
|
274
325
|
"career.employers": CareerEmployers;
|
|
326
|
+
"career.god_keyrings": CareerGodKeyrings;
|
|
275
327
|
"career.gods": CareerGods;
|
|
276
328
|
"career.internship_form_mappings": CareerInternshipFormMappings;
|
|
329
|
+
"career.job_activation_events": CareerJobActivationEvents;
|
|
277
330
|
"career.job_pauses": CareerJobPauses;
|
|
331
|
+
"career.job_waitlists": CareerJobWaitlists;
|
|
278
332
|
"career.jobs": CareerJobs;
|
|
279
333
|
"career.jobs_challenge": CareerJobsChallenge;
|
|
280
334
|
"career.moa": CareerMoa;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.IOM = exports.Internal = exports.Document = exports.Internship = void 0;
|
|
18
18
|
__exportStar(require("./db"), exports);
|
|
19
19
|
__exportStar(require("./db.types"), exports);
|
|
20
|
+
__exportStar(require("./repository"), exports);
|
|
20
21
|
exports.Internship = require("./db.internship.types");
|
|
21
22
|
exports.Document = require("./db.doc.types");
|
|
22
23
|
exports.Internal = require("./db.internal.types");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uCAAqB;AACrB,6CAA2B;AAC3B,sDAAoD;AACpD,6CAA2C;AAC3C,kDAAgD;AAChD,wCAAsC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uCAAqB;AACrB,6CAA2B;AAC3B,+CAA6B;AAC7B,sDAAoD;AACpD,6CAA2C;AAC3C,kDAAgD;AAChD,wCAAsC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Kysely, Selectable, Insertable, Updateable } from "kysely";
|
|
2
|
+
import { PaginationOptions } from "./paginator";
|
|
3
|
+
export declare class Repository<DB, T extends keyof DB & string, Entity = Selectable<DB[T]>, Insert = Insertable<DB[T]>, Update = Updateable<DB[T]>> {
|
|
4
|
+
protected db: Kysely<DB>;
|
|
5
|
+
protected table: T;
|
|
6
|
+
protected schema: string;
|
|
7
|
+
constructor(db: Kysely<DB>, table: T, schema: string);
|
|
8
|
+
private applySelect;
|
|
9
|
+
private applyCondition;
|
|
10
|
+
private applyFilters;
|
|
11
|
+
findOne(id: string, fields?: string): Promise<Entity>;
|
|
12
|
+
findOneOrNull(id: string, fields?: string): Promise<Entity | null>;
|
|
13
|
+
checkOneBy(filter: Partial<{
|
|
14
|
+
[column in keyof DB[T]]: unknown;
|
|
15
|
+
}>, fields?: string): Promise<boolean>;
|
|
16
|
+
countBy(filter?: Partial<{
|
|
17
|
+
[column in keyof DB[T]]: unknown;
|
|
18
|
+
}>): Promise<number>;
|
|
19
|
+
findOneBy(filter: Partial<{
|
|
20
|
+
[column in keyof DB[T]]: unknown;
|
|
21
|
+
}>, fields?: string): Promise<Entity>;
|
|
22
|
+
findOneByOrNull(filter: Partial<{
|
|
23
|
+
[column in keyof DB[T]]: unknown;
|
|
24
|
+
}>, fields?: string): Promise<Entity | null>;
|
|
25
|
+
findLastOrderedBy(filter: Partial<{
|
|
26
|
+
[column in keyof DB[T]]: unknown;
|
|
27
|
+
}>, sortField: keyof DB[T] & string, sortAscending?: boolean, fields?: string): Promise<Entity>;
|
|
28
|
+
findAllBy(filter: Partial<{
|
|
29
|
+
[column in keyof DB[T]]: unknown;
|
|
30
|
+
}>, fields?: string, options?: PaginationOptions): Promise<Entity[]>;
|
|
31
|
+
findAllByOrdered(filter: Partial<{
|
|
32
|
+
[column in keyof DB[T]]: unknown;
|
|
33
|
+
}>, sortField: keyof DB[T] & string, sortAscending?: boolean, options?: PaginationOptions, fields?: string): Promise<Entity[]>;
|
|
34
|
+
findAllIn(filterColumn: keyof DB[T] & string, filterValues: string[], fields?: string): Promise<Entity[]>;
|
|
35
|
+
findAll(fields?: string, options?: PaginationOptions): Promise<Entity[]>;
|
|
36
|
+
findPaginated(filter: Partial<{
|
|
37
|
+
[column in keyof DB[T]]: unknown;
|
|
38
|
+
}>, fields?: string, options?: {
|
|
39
|
+
page?: number;
|
|
40
|
+
limit?: number;
|
|
41
|
+
orderBy?: keyof DB[T] & string;
|
|
42
|
+
orderDir?: "asc" | "desc";
|
|
43
|
+
}): Promise<{
|
|
44
|
+
data: Entity[];
|
|
45
|
+
total: number;
|
|
46
|
+
}>;
|
|
47
|
+
countAll(): Promise<number>;
|
|
48
|
+
insertOne(insert: Partial<Insert>, fields?: string): Promise<Entity>;
|
|
49
|
+
updateOne(id: string, updated: Partial<Update>, fields?: string): Promise<Entity>;
|
|
50
|
+
updateAllBy(filters: Partial<{
|
|
51
|
+
[column in keyof DB[T]]: unknown;
|
|
52
|
+
}>, updated: Partial<Update>, fields?: string): Promise<Entity[]>;
|
|
53
|
+
deleteOne(id: string, fields?: string): Promise<Entity>;
|
|
54
|
+
deleteAllBy(filters: Partial<{
|
|
55
|
+
[column in keyof DB[T]]: unknown;
|
|
56
|
+
}>, fields?: string): Promise<Entity[]>;
|
|
57
|
+
}
|