@hirelink/database-prisma 1.1.2 → 1.1.6
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/.github/workflows/PR_Review_Notifier.yaml +97 -0
- package/package.json +1 -1
- package/prisma/migrations/20250408100708_add_caniddate_type/migration.sql +5 -0
- package/prisma/migrations/20250410044714_sync_database_schema/migration.sql +19 -0
- package/prisma/schema.prisma +143 -136
- package/team_leads.json +3 -0
@@ -0,0 +1,97 @@
|
|
1
|
+
name: Notify Slack on Pull Request
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
types: [opened, reopened, ready_for_review, synchronize]
|
6
|
+
# pull_request_target:
|
7
|
+
# types: [opened, reopened, ready_for_review, synchronize]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
notify-slack:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- name: Checkout code
|
15
|
+
uses: actions/checkout@v4
|
16
|
+
|
17
|
+
- name: Checkout main branch's team_leads.json
|
18
|
+
run: |
|
19
|
+
git fetch origin main
|
20
|
+
git checkout origin/main -- team_leads.json
|
21
|
+
|
22
|
+
- name: Extract PR Info
|
23
|
+
id: pr
|
24
|
+
run: |
|
25
|
+
echo "url=${{ github.event.pull_request.html_url }}" >> $GITHUB_OUTPUT
|
26
|
+
echo "author=${{ github.event.pull_request.user.login }}" >> $GITHUB_OUTPUT
|
27
|
+
echo "title=${{ github.event.pull_request.title }}" >> $GITHUB_OUTPUT
|
28
|
+
echo "head=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT
|
29
|
+
echo "base=${{ github.event.pull_request.base.ref }}" >> $GITHUB_OUTPUT
|
30
|
+
echo "ref=${{ github.ref }}" >> $GITHUB_OUTPUT
|
31
|
+
echo "event=${{ github.event_name }}" >> $GITHUB_OUTPUT
|
32
|
+
echo "commit=${{ github.sha }}" >> $GITHUB_OUTPUT
|
33
|
+
echo "short_commit=$(echo '${{ github.sha }}' | cut -c1-7)" >> $GITHUB_OUTPUT
|
34
|
+
echo "workflow_url=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_OUTPUT
|
35
|
+
|
36
|
+
- name: Lookup Slack User IDs from team_leads.json
|
37
|
+
id: lead
|
38
|
+
env:
|
39
|
+
SLACK_BOT_PR_REVIEW_TOKEN: ${{ secrets.SLACK_BOT_PR_REVIEW_TOKEN }}
|
40
|
+
run: |
|
41
|
+
TEAM_LEAD_KEYS=("Team Lead 1" "Team Lead 2")
|
42
|
+
MENTIONS=""
|
43
|
+
if [ ! -f team_leads.json ]; then
|
44
|
+
echo "team_leads.json not found!"
|
45
|
+
exit 1
|
46
|
+
fi
|
47
|
+
for key in "${TEAM_LEAD_KEYS[@]}"; do
|
48
|
+
EMAIL=$(jq -r --arg k "$key" '.[$k]' team_leads.json)
|
49
|
+
if [ "$EMAIL" == "null" ] || [ -z "$EMAIL" ]; then
|
50
|
+
continue
|
51
|
+
fi
|
52
|
+
RESPONSE=$(curl -s -H "Authorization: Bearer $SLACK_BOT_PR_REVIEW_TOKEN" \
|
53
|
+
"https://slack.com/api/users.lookupByEmail?email=$EMAIL")
|
54
|
+
SLACK_ID=$(echo "$RESPONSE" | jq -r '.user.id // empty')
|
55
|
+
if [ -n "$SLACK_ID" ]; then
|
56
|
+
MENTIONS="$MENTIONS <@$SLACK_ID>"
|
57
|
+
fi
|
58
|
+
done
|
59
|
+
echo "lead_mentions=$MENTIONS" >> $GITHUB_OUTPUT
|
60
|
+
|
61
|
+
- name: Send Slack Notification via curl
|
62
|
+
env:
|
63
|
+
SLACK_BOT_PR_REVIEW_TOKEN: ${{ secrets.SLACK_BOT_PR_REVIEW_TOKEN }}
|
64
|
+
run: |
|
65
|
+
curl -X POST https://slack.com/api/chat.postMessage \
|
66
|
+
-H "Authorization: Bearer $SLACK_BOT_PR_REVIEW_TOKEN" \
|
67
|
+
-H "Content-type: application/json" \
|
68
|
+
--data '{
|
69
|
+
"channel": "github-pr-review-notification",
|
70
|
+
"text": "🚨 New Pull Request Notification",
|
71
|
+
"blocks": [
|
72
|
+
{
|
73
|
+
"type": "section",
|
74
|
+
"fields": [
|
75
|
+
{
|
76
|
+
"type": "mrkdwn",
|
77
|
+
"text": "*Event:*\n`${{ steps.pr.outputs.event }}`"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"type": "mrkdwn",
|
81
|
+
"text": "*Ref:*\n`${{ steps.pr.outputs.ref }}`"
|
82
|
+
},
|
83
|
+
{
|
84
|
+
"type": "mrkdwn",
|
85
|
+
"text": "*Commit:*\n<https://github.com/${{ github.repository }}/commit/${{ steps.pr.outputs.commit }}|`${{ steps.pr.outputs.short_commit }}`>"
|
86
|
+
}
|
87
|
+
]
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"type": "section",
|
91
|
+
"text": {
|
92
|
+
"type": "mrkdwn",
|
93
|
+
"text": ":rotating_light: *New PR* opened by `${{ steps.pr.outputs.author }}`:\n<${{ steps.pr.outputs.url }}|${{ steps.pr.outputs.title }}>\n\n:twisted_rightwards_arrows: *Branch:* `${{ steps.pr.outputs.head }}` → `${{ steps.pr.outputs.base }}`\n:bust_in_silhouette: *Team Lead(s):* \n${{ steps.lead.outputs.lead_mentions }}"
|
94
|
+
}
|
95
|
+
}
|
96
|
+
]
|
97
|
+
}'
|
package/package.json
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
-- AlterTable
|
2
|
+
ALTER TABLE "User" ALTER COLUMN "work_experience" SET DEFAULT 'experience';
|
3
|
+
|
4
|
+
-- CreateTable
|
5
|
+
CREATE TABLE "ExperienceHistory" (
|
6
|
+
"id" TEXT NOT NULL,
|
7
|
+
"status" "Work_experience" NOT NULL,
|
8
|
+
"employer" TEXT NOT NULL,
|
9
|
+
"start_date" TIMESTAMP(3) NOT NULL,
|
10
|
+
"end_date" TIMESTAMP(3) NOT NULL,
|
11
|
+
"userId" TEXT NOT NULL,
|
12
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
13
|
+
"updated_at" TIMESTAMP(3) NOT NULL,
|
14
|
+
|
15
|
+
CONSTRAINT "ExperienceHistory_pkey" PRIMARY KEY ("id")
|
16
|
+
);
|
17
|
+
|
18
|
+
-- AddForeignKey
|
19
|
+
ALTER TABLE "ExperienceHistory" ADD CONSTRAINT "ExperienceHistory_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
package/prisma/schema.prisma
CHANGED
@@ -8,145 +8,128 @@ datasource db {
|
|
8
8
|
}
|
9
9
|
|
10
10
|
model User {
|
11
|
-
id
|
12
|
-
email
|
13
|
-
first_name
|
14
|
-
last_name
|
15
|
-
role
|
16
|
-
status
|
17
|
-
created_at
|
18
|
-
updated_at
|
19
|
-
work_experience
|
20
|
-
|
11
|
+
id String @id
|
12
|
+
email String @unique
|
13
|
+
first_name String?
|
14
|
+
last_name String?
|
15
|
+
role Role
|
16
|
+
status UserStatus @default(active)
|
17
|
+
created_at DateTime? @default(now())
|
18
|
+
updated_at DateTime? @updatedAt
|
19
|
+
work_experience Work_experience? @default(experience)
|
20
|
+
candidate_documents CandidateDocument[]
|
21
|
+
hirelink_ids HirelinkId[]
|
21
22
|
hr_users HrUser[]
|
23
|
+
logs Log[]
|
24
|
+
notifications Notification[]
|
22
25
|
onboarding_details OnboardingDetail[]
|
23
|
-
candidate_documents CandidateDocument[]
|
24
|
-
sessions Session[]
|
25
26
|
otp_requests OtpRequest[]
|
26
|
-
verification_requests VerificationRequest[]
|
27
27
|
password_reset_requests PasswordResetRequest[]
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
}
|
32
|
-
|
33
|
-
enum Role {
|
34
|
-
admin
|
35
|
-
hr
|
36
|
-
candidate
|
28
|
+
sessions Session[]
|
29
|
+
verification_requests VerificationRequest[]
|
30
|
+
Experience_history ExperienceHistory[]
|
37
31
|
}
|
38
32
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
33
|
+
model ExperienceHistory {
|
34
|
+
id String @id @default(cuid())
|
35
|
+
status Work_experience
|
36
|
+
employer String
|
37
|
+
start_date DateTime
|
38
|
+
end_date DateTime
|
39
|
+
user User @relation(fields: [userId], references: [id])
|
40
|
+
userId String
|
41
|
+
created_at DateTime @default(now())
|
42
|
+
updated_at DateTime @updatedAt
|
48
43
|
}
|
49
44
|
|
50
45
|
model Organization {
|
51
|
-
org_id
|
52
|
-
legal_name
|
53
|
-
display_name
|
54
|
-
gst_number
|
55
|
-
address_line_1
|
56
|
-
address_line_2
|
57
|
-
address_line_3
|
58
|
-
city
|
59
|
-
pincode
|
60
|
-
state
|
61
|
-
terms_accepted
|
62
|
-
created_at
|
63
|
-
updated_at
|
64
|
-
|
46
|
+
org_id String @id @default(uuid())
|
47
|
+
legal_name String
|
48
|
+
display_name String?
|
49
|
+
gst_number String? @unique
|
50
|
+
address_line_1 String?
|
51
|
+
address_line_2 String?
|
52
|
+
address_line_3 String?
|
53
|
+
city String?
|
54
|
+
pincode String?
|
55
|
+
state String?
|
56
|
+
terms_accepted Boolean @default(false)
|
57
|
+
created_at DateTime? @default(now())
|
58
|
+
updated_at DateTime? @updatedAt
|
59
|
+
documents Document[]
|
65
60
|
hr_users HrUser[]
|
66
61
|
onboarding_details OnboardingDetail[]
|
67
|
-
documents Document[]
|
68
62
|
policy_masters PolicyMaster[]
|
69
63
|
}
|
70
64
|
|
71
65
|
model HrUser {
|
72
|
-
hr_user_id
|
73
|
-
org_id
|
74
|
-
user_id
|
75
|
-
status
|
76
|
-
created_at
|
77
|
-
updated_at
|
78
|
-
|
66
|
+
hr_user_id String @id @default(uuid())
|
67
|
+
org_id String
|
68
|
+
user_id String
|
69
|
+
status HrUserStatus @default(initiated)
|
70
|
+
created_at DateTime? @default(now())
|
71
|
+
updated_at DateTime? @updatedAt
|
79
72
|
organization Organization @relation(fields: [org_id], references: [org_id])
|
80
73
|
user User @relation(fields: [user_id], references: [id])
|
81
74
|
}
|
82
75
|
|
83
|
-
enum HrUserStatus {
|
84
|
-
active
|
85
|
-
initiated
|
86
|
-
disabled
|
87
|
-
}
|
88
|
-
|
89
76
|
model OnboardingDetail {
|
90
|
-
onboarding_id String
|
77
|
+
onboarding_id String @id @default(uuid())
|
91
78
|
org_id String
|
92
79
|
admin_user_id String
|
93
80
|
hr_emails String?
|
94
81
|
default_list String?
|
95
82
|
documents Json?
|
96
|
-
created_at DateTime?
|
97
|
-
updated_at DateTime?
|
98
|
-
|
99
|
-
organization
|
100
|
-
admin_user User @relation(fields: [admin_user_id], references: [id])
|
83
|
+
created_at DateTime? @default(now())
|
84
|
+
updated_at DateTime? @updatedAt
|
85
|
+
admin_user User @relation(fields: [admin_user_id], references: [id])
|
86
|
+
organization Organization @relation(fields: [org_id], references: [org_id])
|
101
87
|
}
|
102
88
|
|
103
89
|
model Document {
|
104
|
-
doc_id
|
105
|
-
org_id
|
106
|
-
doc_name
|
107
|
-
mandatory
|
108
|
-
optional
|
109
|
-
custom
|
110
|
-
created_at
|
111
|
-
updated_at
|
112
|
-
|
90
|
+
doc_id String @id @default(uuid())
|
91
|
+
org_id String
|
92
|
+
doc_name String
|
93
|
+
mandatory Boolean @default(false)
|
94
|
+
optional Boolean @default(false)
|
95
|
+
custom Boolean @default(false)
|
96
|
+
created_at DateTime? @default(now())
|
97
|
+
updated_at DateTime? @updatedAt
|
113
98
|
organization Organization @relation(fields: [org_id], references: [org_id])
|
114
99
|
}
|
115
100
|
|
116
101
|
model PolicyMaster {
|
117
|
-
id String
|
102
|
+
id String @id
|
118
103
|
document_name String
|
119
104
|
default_option String
|
120
105
|
additional_option String
|
121
|
-
created_at DateTime?
|
122
|
-
updated_at DateTime?
|
106
|
+
created_at DateTime? @default(now())
|
107
|
+
updated_at DateTime? @updatedAt
|
123
108
|
org_id String
|
124
109
|
created_by String
|
125
|
-
active Boolean
|
126
|
-
|
127
|
-
organization Organization @relation(fields: [org_id], references: [org_id])
|
110
|
+
active Boolean @default(true)
|
111
|
+
organization Organization @relation(fields: [org_id], references: [org_id])
|
128
112
|
}
|
129
113
|
|
130
114
|
model CandidateDocument {
|
131
|
-
doc_id
|
132
|
-
doc_name
|
133
|
-
doc_type
|
134
|
-
status
|
135
|
-
uploaded_at
|
136
|
-
user_id
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
user
|
115
|
+
doc_id String @id
|
116
|
+
doc_name String
|
117
|
+
doc_type String
|
118
|
+
status String
|
119
|
+
uploaded_at String
|
120
|
+
user_id String
|
121
|
+
candidate_document_type CandidateDocumentType?
|
122
|
+
created_at DateTime? @default(now())
|
123
|
+
updated_at DateTime? @updatedAt
|
124
|
+
user User @relation(fields: [user_id], references: [id])
|
141
125
|
}
|
142
126
|
|
143
127
|
model Session {
|
144
128
|
id String @id @default(uuid())
|
145
129
|
user_id String
|
146
|
-
token String
|
130
|
+
token String
|
147
131
|
expires_at DateTime
|
148
|
-
|
149
|
-
user User @relation(fields: [user_id], references: [id])
|
132
|
+
user User @relation(fields: [user_id], references: [id])
|
150
133
|
}
|
151
134
|
|
152
135
|
model OtpRequest {
|
@@ -156,14 +139,7 @@ model OtpRequest {
|
|
156
139
|
status OtpStatus
|
157
140
|
created_at DateTime @default(now())
|
158
141
|
expires_at DateTime
|
159
|
-
|
160
|
-
user User @relation(fields: [user_id], references: [id])
|
161
|
-
}
|
162
|
-
|
163
|
-
enum OtpStatus {
|
164
|
-
Pending
|
165
|
-
Verified
|
166
|
-
Expired
|
142
|
+
user User @relation(fields: [user_id], references: [id])
|
167
143
|
}
|
168
144
|
|
169
145
|
model PasswordResetRequest {
|
@@ -173,14 +149,7 @@ model PasswordResetRequest {
|
|
173
149
|
status PasswordResetStatus
|
174
150
|
created_at DateTime @default(now())
|
175
151
|
expires_at DateTime
|
176
|
-
|
177
|
-
user User @relation(fields: [user_id], references: [id])
|
178
|
-
}
|
179
|
-
|
180
|
-
enum PasswordResetStatus {
|
181
|
-
Pending
|
182
|
-
Used
|
183
|
-
Expired
|
152
|
+
user User @relation(fields: [user_id], references: [id])
|
184
153
|
}
|
185
154
|
|
186
155
|
model VerificationRequest {
|
@@ -189,53 +158,91 @@ model VerificationRequest {
|
|
189
158
|
status VerificationStatus
|
190
159
|
requested_at DateTime
|
191
160
|
completed_at DateTime?
|
192
|
-
|
193
|
-
user User @relation(fields: [user_id], references: [id])
|
194
|
-
}
|
195
|
-
|
196
|
-
enum VerificationStatus {
|
197
|
-
Pending
|
198
|
-
InProgress
|
199
|
-
Verified
|
200
|
-
Rejected
|
161
|
+
user User @relation(fields: [user_id], references: [id])
|
201
162
|
}
|
202
163
|
|
203
164
|
model HirelinkId {
|
204
165
|
id String @id @default(uuid())
|
205
166
|
user_id String
|
206
|
-
hirelink_url String @unique
|
167
|
+
hirelink_url String @unique
|
207
168
|
reference_name String @db.VarChar(32)
|
208
169
|
status HirelinkStatus
|
209
170
|
created_at DateTime @default(now())
|
210
|
-
|
211
|
-
user User @relation(fields: [user_id], references: [id])
|
212
|
-
}
|
213
|
-
|
214
|
-
enum HirelinkStatus {
|
215
|
-
Active
|
216
|
-
Inactive
|
171
|
+
user User @relation(fields: [user_id], references: [id])
|
217
172
|
}
|
218
173
|
|
219
174
|
model Notification {
|
220
175
|
id String @id @default(uuid())
|
221
176
|
user_id String
|
222
|
-
message String
|
177
|
+
message String
|
223
178
|
status NotificationStatus
|
224
179
|
created_at DateTime @default(now())
|
225
|
-
|
226
|
-
user User @relation(fields: [user_id], references: [id])
|
227
|
-
}
|
228
|
-
|
229
|
-
enum NotificationStatus {
|
230
|
-
Unread
|
231
|
-
Read
|
180
|
+
user User @relation(fields: [user_id], references: [id])
|
232
181
|
}
|
233
182
|
|
234
183
|
model Log {
|
235
184
|
id String @id @default(uuid())
|
236
185
|
user_id String
|
237
|
-
action String
|
186
|
+
action String
|
238
187
|
timestamp DateTime @default(now())
|
188
|
+
user User @relation(fields: [user_id], references: [id])
|
189
|
+
}
|
190
|
+
|
191
|
+
enum Role {
|
192
|
+
admin
|
193
|
+
hr
|
194
|
+
candidate
|
195
|
+
}
|
196
|
+
|
197
|
+
enum Work_experience {
|
198
|
+
experience
|
199
|
+
fresher
|
200
|
+
}
|
239
201
|
|
240
|
-
|
202
|
+
enum UserStatus {
|
203
|
+
active
|
204
|
+
inactive
|
205
|
+
locked
|
206
|
+
}
|
207
|
+
|
208
|
+
enum HrUserStatus {
|
209
|
+
active
|
210
|
+
initiated
|
211
|
+
disabled
|
212
|
+
}
|
213
|
+
|
214
|
+
enum CandidateDocumentType {
|
215
|
+
identity
|
216
|
+
education
|
217
|
+
employment
|
218
|
+
payslips
|
219
|
+
}
|
220
|
+
|
221
|
+
enum OtpStatus {
|
222
|
+
Pending
|
223
|
+
Verified
|
224
|
+
Expired
|
225
|
+
}
|
226
|
+
|
227
|
+
enum PasswordResetStatus {
|
228
|
+
Pending
|
229
|
+
Used
|
230
|
+
Expired
|
231
|
+
}
|
232
|
+
|
233
|
+
enum VerificationStatus {
|
234
|
+
Pending
|
235
|
+
InProgress
|
236
|
+
Verified
|
237
|
+
Rejected
|
238
|
+
}
|
239
|
+
|
240
|
+
enum HirelinkStatus {
|
241
|
+
Active
|
242
|
+
Inactive
|
243
|
+
}
|
244
|
+
|
245
|
+
enum NotificationStatus {
|
246
|
+
Unread
|
247
|
+
Read
|
241
248
|
}
|
package/team_leads.json
ADDED