@betterinternship/schema 1.5.0 → 1.5.1

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.
@@ -1,5 +1,6 @@
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";
3
4
  export type Timestamp = ColumnType<Date, Date | string, Date | string>;
4
5
  export interface InternalEmailDeliveryEvents {
5
6
  attempts: number | null;
@@ -15,6 +16,13 @@ export interface InternalEmailDeliveryEvents {
15
16
  recipient_email: string;
16
17
  resolved_at: Timestamp | null;
17
18
  }
19
+ export interface InternalSlugs {
20
+ created_at: Generated<Timestamp>;
21
+ domain: InternalLinkDomain;
22
+ slug: string;
23
+ url: string;
24
+ }
18
25
  export interface DB {
19
26
  "internal.email_delivery_events": InternalEmailDeliveryEvents;
27
+ "internal.slugs": InternalSlugs;
20
28
  }
@@ -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 IomCompanyInviteStatus = "accepted" | "expired" | "pending" | "used_waiting";
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
- const DATABASE_URL = env_1.ENV.DATABASE_URL;
8
- const DATABASE_CA_CERT = env_1.ENV.DATABASE_CA_CERT;
9
- if (!DATABASE_URL)
10
- throw new Error("[ERROR:ENV] Missing DATABASE_URL.");
11
- const isNoVerify = DATABASE_URL.includes('sslmode=no-verify');
12
- if (!DATABASE_CA_CERT && !isNoVerify)
13
- throw new Error("[ERROR:ENV] Missing DATABASE_CA_CERT.");
14
- const pool = new pg_1.Pool({
15
- connectionString: DATABASE_URL,
16
- ssl: isNoVerify
17
- ? { rejectUnauthorized: false }
18
- : {
19
- rejectUnauthorized: true,
20
- ca: DATABASE_CA_CERT?.replace(/\\n/g, '\n'),
21
- checkServerIdentity: () => undefined,
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
- exports.db = new kysely_1.Kysely({
25
- dialect: new kysely_1.PostgresDialect({ pool }),
26
- });
27
- exports.internshipDb = new kysely_1.Kysely({
28
- dialect: new kysely_1.PostgresDialect({ pool }),
29
- });
30
- exports.documentDb = new kysely_1.Kysely({
31
- dialect: new kysely_1.PostgresDialect({ pool }),
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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,EAAM,CAAC;AACtB,QAAA,YAAY,GAAG,UAAU,EAAgB,CAAC;AAC1C,QAAA,UAAU,GAAG,UAAU,EAAc,CAAC;AACtC,QAAA,UAAU,GAAG,UAAU,EAAc,CAAC;AACtC,QAAA,KAAK,GAAG,UAAU,EAAS,CAAC;AAElC,MAAM,aAAa,GAAG,CAAC,KAAU,EAAE,cAAsB,EAAE,EAAS,EAAE;IAC3E,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,UAAU;YACb,MAAM,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC,CAAC;QACjE,KAAK,OAAO;YACV,MAAM,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,0BAA0B,EAAE,CAAC,CAAC;QACtE,KAAK,OAAO;YACV,MAAM,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,+BAA+B,EAAE,CAAC,CAAC;QAC3E;YACE,MAAM,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC,CAAC;IACnE,CAAC;AACH,CAAC,CAAC;AAXW,QAAA,aAAa,iBAWxB"}
@@ -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
@@ -1,5 +1,6 @@
1
1
  export * from "./db";
2
2
  export * from "./db.types";
3
+ export * from "./repository";
3
4
  export * as Internship from "./db.internship.types";
4
5
  export * as Document from "./db.doc.types";
5
6
  export * as Internal from "./db.internal.types";
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,50 @@
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
+ checkOneBy(filter: Partial<{
13
+ [column in keyof DB[T]]: unknown;
14
+ }>, fields?: string): Promise<boolean>;
15
+ countBy(filter?: Partial<{
16
+ [column in keyof DB[T]]: unknown;
17
+ }>): Promise<number>;
18
+ findOneBy(filter: Partial<{
19
+ [column in keyof DB[T]]: unknown;
20
+ }>, fields?: string): Promise<Entity>;
21
+ findLastOrderedBy(filter: Partial<{
22
+ [column in keyof DB[T]]: unknown;
23
+ }>, sortField: keyof DB[T] & string, sortAscending?: boolean, fields?: string): Promise<Entity>;
24
+ findAllBy(filter: Partial<{
25
+ [column in keyof DB[T]]: unknown;
26
+ }>, fields?: string, options?: PaginationOptions): Promise<Entity[]>;
27
+ findAllByOrdered(filter: Partial<{
28
+ [column in keyof DB[T]]: unknown;
29
+ }>, sortField: keyof DB[T] & string, sortAscending?: boolean, options?: PaginationOptions, fields?: string): Promise<Entity[]>;
30
+ findAllIn(filterColumn: keyof DB[T] & string, filterValues: string[], fields?: string): Promise<Entity[]>;
31
+ findAll(fields?: string, options?: PaginationOptions): Promise<Entity[]>;
32
+ findPaginated(filter: Partial<{
33
+ [column in keyof DB[T]]: unknown;
34
+ }>, fields?: string, options?: {
35
+ page?: number;
36
+ limit?: number;
37
+ orderBy?: keyof DB[T] & string;
38
+ orderDir?: "asc" | "desc";
39
+ }): Promise<{
40
+ data: Entity[];
41
+ total: number;
42
+ }>;
43
+ countAll(): Promise<number>;
44
+ insertOne(insert: Partial<Insert>, fields?: string): Promise<Entity>;
45
+ updateOne(id: string, updated: Partial<Update>, fields?: string): Promise<Entity>;
46
+ updateAllBy(filters: Partial<{
47
+ [column in keyof DB[T]]: unknown;
48
+ }>, updated: Partial<Update>, fields?: string): Promise<Entity[]>;
49
+ deleteOne(id: string, fields?: string): Promise<Entity>;
50
+ }