@hirelink/database-prisma 1.1.5 → 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.
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hirelink/database-prisma",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "A Prisma-based database package for Hirelink applications.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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;
@@ -16,7 +16,7 @@ model User {
16
16
  status UserStatus @default(active)
17
17
  created_at DateTime? @default(now())
18
18
  updated_at DateTime? @updatedAt
19
- work_experience Work_experience?
19
+ work_experience Work_experience? @default(experience)
20
20
  candidate_documents CandidateDocument[]
21
21
  hirelink_ids HirelinkId[]
22
22
  hr_users HrUser[]
@@ -27,6 +27,19 @@ model User {
27
27
  password_reset_requests PasswordResetRequest[]
28
28
  sessions Session[]
29
29
  verification_requests VerificationRequest[]
30
+ Experience_history ExperienceHistory[]
31
+ }
32
+
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
30
43
  }
31
44
 
32
45
  model Organization {
@@ -0,0 +1,3 @@
1
+ {
2
+ "Team Lead 1" : "mahesh@turka.tech"
3
+ }