@adaptware/eagles-db 0.4.14 → 0.4.17

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.
@@ -19,36 +19,33 @@ model JobDescription {
19
19
  summary Json?
20
20
  ai_insight Json?
21
21
  job_fit_comparison Json?
22
- target_closing_date DateTime?
23
- closing_date DateTime?
24
-
25
- job_number Int?
26
- job_code String? @unique
27
22
  // Audit fields
28
- created_at DateTime @default(now())
29
- updated_at DateTime @updatedAt
30
- created_by String
31
- updated_by String
32
- is_active Boolean @default(true)
33
- openings Int @default(1)
34
- job_profile_id String?
35
- job_profile JobProfile? @relation(fields: [job_profile_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
36
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
37
- applications Application[]
38
- interviews Interview[]
39
- assignments Assignment[]
40
- fit_check FitCheck[] // one-to-many link
41
- job_description_data JobDescriptionData[] // one-to-many link
42
- evaluationPlan EvaluationPlan[] // relation to evaluation methods
43
- ongoing_evaluations OngoingEvaluation[] // optional one-to-many
44
- assignment_library AssignmentLibrary[]
45
- approvals Approval[] // one-to-many relation
46
- resumes Resume[] // one-to-many link
47
- budget Budget?
48
- hiring_manager User? @relation("HiringManager", fields: [hiring_manager_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
49
- recruiters User[]
50
- transcripts Transcript[]
51
- integration_job_syncs IntegrationJobSync[]
23
+ created_at DateTime @default(now())
24
+ updated_at DateTime @updatedAt
25
+ created_by String
26
+ updated_by String
27
+ is_active Boolean @default(true)
28
+ openings Int @default(1)
29
+ job_profile_id String?
30
+ job_profile JobProfile? @relation(fields: [job_profile_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
31
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
32
+ applications Application[]
33
+ interviews Interview[]
34
+ assignments Assignment[]
35
+ fit_check FitCheck[] // one-to-many link
36
+ job_description_data JobDescriptionData[] // one-to-many link
37
+ evaluationPlan EvaluationPlan[] // relation to evaluation methods
38
+ ongoing_evaluations OngoingEvaluation[] // optional one-to-many
39
+ assignment_library AssignmentLibrary[]
40
+ approvals Approval[] // one-to-many relation
41
+ resumes Resume[] // one-to-many link
42
+ budget Budget?
43
+ hiring_manager User? @relation("HiringManager", fields: [hiring_manager_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
44
+ recruiters User[]
45
+ transcripts Transcript[]
46
+ integration_job_syncs IntegrationJobSync[]
47
+ conversations Conversation[]
48
+ communication_messages CommunicationMessage[]
52
49
 
53
50
  @@index([organisation_id])
54
51
  @@index([hiring_manager_id])
@@ -0,0 +1,131 @@
1
+ -- CreateEnum
2
+ CREATE TYPE "CommChannel" AS ENUM ('WHATSAPP', 'EMAIL', 'SMS', 'CALL');
3
+
4
+ -- CreateEnum
5
+ CREATE TYPE "CommProvider" AS ENUM ('META_WHATSAPP', 'TWILIO', 'GUPSHUP', 'MTALKZ', 'THREE_SIXTY_DIALOG', 'GMAIL', 'OUTLOOK', 'GENERIC_SMTP', 'GENERIC');
6
+
7
+ -- CreateEnum
8
+ CREATE TYPE "CommDirection" AS ENUM ('INBOUND', 'OUTBOUND');
9
+
10
+ -- CreateEnum
11
+ CREATE TYPE "CommMessageStatus" AS ENUM ('QUEUED', 'SENT', 'DELIVERED', 'READ', 'FAILED', 'RECEIVED');
12
+
13
+ -- CreateTable
14
+ CREATE TABLE "ChannelProviderConfig" (
15
+ "id" TEXT NOT NULL,
16
+ "organisation_id" TEXT NOT NULL,
17
+ "channel" "CommChannel" NOT NULL,
18
+ "provider" "CommProvider" NOT NULL,
19
+ "credentials" TEXT,
20
+ "metadata" JSONB NOT NULL DEFAULT '{}',
21
+ "is_active" BOOLEAN NOT NULL DEFAULT true,
22
+ "is_default" BOOLEAN NOT NULL DEFAULT true,
23
+ "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
24
+ "updated_at" TIMESTAMP(3) NOT NULL,
25
+ "created_by" TEXT NOT NULL,
26
+ "updated_by" TEXT NOT NULL,
27
+
28
+ CONSTRAINT "ChannelProviderConfig_pkey" PRIMARY KEY ("id")
29
+ );
30
+
31
+ -- CreateTable
32
+ CREATE TABLE "Conversation" (
33
+ "id" TEXT NOT NULL,
34
+ "organisation_id" TEXT NOT NULL,
35
+ "channel" "CommChannel" NOT NULL,
36
+ "provider" "CommProvider" NOT NULL,
37
+ "channel_provider_id" TEXT,
38
+ "external_id" TEXT NOT NULL,
39
+ "contact_user_id" TEXT,
40
+ "provider_thread_id" TEXT,
41
+ "subject" TEXT,
42
+ "status" TEXT NOT NULL DEFAULT 'open',
43
+ "unread_count" INTEGER NOT NULL DEFAULT 0,
44
+ "last_message_at" TIMESTAMP(3),
45
+ "metadata" JSONB NOT NULL DEFAULT '{}',
46
+ "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
47
+ "updated_at" TIMESTAMP(3) NOT NULL,
48
+ "created_by" TEXT NOT NULL,
49
+ "updated_by" TEXT NOT NULL,
50
+
51
+ CONSTRAINT "Conversation_pkey" PRIMARY KEY ("id")
52
+ );
53
+
54
+ -- CreateTable
55
+ CREATE TABLE "CommunicationMessage" (
56
+ "id" TEXT NOT NULL,
57
+ "conversation_id" TEXT NOT NULL,
58
+ "organisation_id" TEXT NOT NULL,
59
+ "channel" "CommChannel" NOT NULL,
60
+ "provider" "CommProvider" NOT NULL,
61
+ "channel_provider_id" TEXT,
62
+ "direction" "CommDirection" NOT NULL,
63
+ "status" "CommMessageStatus" NOT NULL,
64
+ "body" TEXT,
65
+ "from_identifier" TEXT NOT NULL,
66
+ "to_identifier" TEXT NOT NULL,
67
+ "sender_user_id" TEXT,
68
+ "provider_message_id" TEXT,
69
+ "template_name" TEXT,
70
+ "attachments" JSONB NOT NULL DEFAULT '[]',
71
+ "metadata" JSONB NOT NULL DEFAULT '{}',
72
+ "error" TEXT,
73
+ "sent_at" TIMESTAMP(3),
74
+ "delivered_at" TIMESTAMP(3),
75
+ "read_at" TIMESTAMP(3),
76
+ "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
77
+ "updated_at" TIMESTAMP(3) NOT NULL,
78
+
79
+ CONSTRAINT "CommunicationMessage_pkey" PRIMARY KEY ("id")
80
+ );
81
+
82
+ -- CreateIndex
83
+ CREATE UNIQUE INDEX "ChannelProviderConfig_organisation_id_channel_provider_key" ON "ChannelProviderConfig"("organisation_id", "channel", "provider");
84
+
85
+ -- CreateIndex
86
+ CREATE INDEX "ChannelProviderConfig_organisation_id_channel_idx" ON "ChannelProviderConfig"("organisation_id", "channel");
87
+
88
+ -- CreateIndex
89
+ CREATE INDEX "ChannelProviderConfig_organisation_id_channel_is_active_idx" ON "ChannelProviderConfig"("organisation_id", "channel", "is_active");
90
+
91
+ -- CreateIndex
92
+ CREATE UNIQUE INDEX "Conversation_organisation_id_channel_provider_external_id_key" ON "Conversation"("organisation_id", "channel", "provider", "external_id");
93
+
94
+ -- CreateIndex
95
+ CREATE INDEX "Conversation_organisation_id_channel_idx" ON "Conversation"("organisation_id", "channel");
96
+
97
+ -- CreateIndex
98
+ CREATE INDEX "Conversation_organisation_id_last_message_at_idx" ON "Conversation"("organisation_id", "last_message_at");
99
+
100
+ -- CreateIndex
101
+ CREATE INDEX "Conversation_external_id_idx" ON "Conversation"("external_id");
102
+
103
+ -- CreateIndex
104
+ CREATE UNIQUE INDEX "CommunicationMessage_provider_provider_message_id_key" ON "CommunicationMessage"("provider", "provider_message_id");
105
+
106
+ -- CreateIndex
107
+ CREATE INDEX "CommunicationMessage_conversation_id_created_at_idx" ON "CommunicationMessage"("conversation_id", "created_at");
108
+
109
+ -- CreateIndex
110
+ CREATE INDEX "CommunicationMessage_organisation_id_channel_created_at_idx" ON "CommunicationMessage"("organisation_id", "channel", "created_at");
111
+
112
+ -- CreateIndex
113
+ CREATE INDEX "CommunicationMessage_organisation_id_status_idx" ON "CommunicationMessage"("organisation_id", "status");
114
+
115
+ -- AddForeignKey
116
+ ALTER TABLE "ChannelProviderConfig" ADD CONSTRAINT "ChannelProviderConfig_organisation_id_fkey" FOREIGN KEY ("organisation_id") REFERENCES "Organisation"("id") ON DELETE CASCADE ON UPDATE CASCADE;
117
+
118
+ -- AddForeignKey
119
+ ALTER TABLE "Conversation" ADD CONSTRAINT "Conversation_organisation_id_fkey" FOREIGN KEY ("organisation_id") REFERENCES "Organisation"("id") ON DELETE CASCADE ON UPDATE CASCADE;
120
+
121
+ -- AddForeignKey
122
+ ALTER TABLE "Conversation" ADD CONSTRAINT "Conversation_channel_provider_id_fkey" FOREIGN KEY ("channel_provider_id") REFERENCES "ChannelProviderConfig"("id") ON DELETE SET NULL ON UPDATE CASCADE;
123
+
124
+ -- AddForeignKey
125
+ ALTER TABLE "CommunicationMessage" ADD CONSTRAINT "CommunicationMessage_conversation_id_fkey" FOREIGN KEY ("conversation_id") REFERENCES "Conversation"("id") ON DELETE CASCADE ON UPDATE CASCADE;
126
+
127
+ -- AddForeignKey
128
+ ALTER TABLE "CommunicationMessage" ADD CONSTRAINT "CommunicationMessage_organisation_id_fkey" FOREIGN KEY ("organisation_id") REFERENCES "Organisation"("id") ON DELETE CASCADE ON UPDATE CASCADE;
129
+
130
+ -- AddForeignKey
131
+ ALTER TABLE "CommunicationMessage" ADD CONSTRAINT "CommunicationMessage_channel_provider_id_fkey" FOREIGN KEY ("channel_provider_id") REFERENCES "ChannelProviderConfig"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -0,0 +1,45 @@
1
+ -- AlterTable: Conversation
2
+ ALTER TABLE "Conversation"
3
+ ADD COLUMN "application_id" TEXT,
4
+ ADD COLUMN "job_description_id" TEXT;
5
+
6
+ -- AlterTable: CommunicationMessage
7
+ ALTER TABLE "CommunicationMessage"
8
+ ADD COLUMN "application_id" TEXT,
9
+ ADD COLUMN "job_description_id" TEXT;
10
+
11
+ -- CreateIndex
12
+ CREATE INDEX "Conversation_organisation_id_application_id_idx" ON "Conversation"("organisation_id", "application_id");
13
+
14
+ -- CreateIndex
15
+ CREATE INDEX "Conversation_organisation_id_job_description_id_idx" ON "Conversation"("organisation_id", "job_description_id");
16
+
17
+ -- CreateIndex
18
+ CREATE INDEX "CommunicationMessage_organisation_id_application_id_idx" ON "CommunicationMessage"("organisation_id", "application_id");
19
+
20
+ -- CreateIndex
21
+ CREATE INDEX "CommunicationMessage_organisation_id_job_description_id_idx" ON "CommunicationMessage"("organisation_id", "job_description_id");
22
+
23
+ -- AddForeignKey
24
+ ALTER TABLE "Conversation"
25
+ ADD CONSTRAINT "Conversation_application_id_fkey"
26
+ FOREIGN KEY ("application_id") REFERENCES "Application"("id")
27
+ ON DELETE SET NULL ON UPDATE CASCADE;
28
+
29
+ -- AddForeignKey
30
+ ALTER TABLE "Conversation"
31
+ ADD CONSTRAINT "Conversation_job_description_id_fkey"
32
+ FOREIGN KEY ("job_description_id") REFERENCES "JobDescription"("id")
33
+ ON DELETE SET NULL ON UPDATE CASCADE;
34
+
35
+ -- AddForeignKey
36
+ ALTER TABLE "CommunicationMessage"
37
+ ADD CONSTRAINT "CommunicationMessage_application_id_fkey"
38
+ FOREIGN KEY ("application_id") REFERENCES "Application"("id")
39
+ ON DELETE SET NULL ON UPDATE CASCADE;
40
+
41
+ -- AddForeignKey
42
+ ALTER TABLE "CommunicationMessage"
43
+ ADD CONSTRAINT "CommunicationMessage_job_description_id_fkey"
44
+ FOREIGN KEY ("job_description_id") REFERENCES "JobDescription"("id")
45
+ ON DELETE SET NULL ON UPDATE CASCADE;
@@ -1,19 +1,19 @@
1
1
  model Notes {
2
- id String @id @default(uuid())
3
- application_id String
4
- user_id String
5
- note String
6
- pinned Boolean @default(false)
7
- created_at DateTime @default(now())
8
- updated_at DateTime @updatedAt
9
- created_by String
10
- updated_by String
11
- is_active Boolean @default(true)
2
+ id String @id @default(uuid())
3
+ application_id String
4
+ user_id String
5
+ note String
6
+ pinned Boolean @default(false)
7
+ created_at DateTime @default(now())
8
+ updated_at DateTime @updatedAt
9
+ created_by String
10
+ updated_by String
11
+ is_active Boolean @default(true)
12
12
 
13
- // Relations
14
- application Application @relation(fields: [application_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
15
- user User @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
13
+ // Relations
14
+ application Application @relation(fields: [application_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
15
+ user User @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
16
16
 
17
- @@index([application_id, created_at])
18
- @@index([user_id, created_at])
17
+ @@index([application_id, created_at])
18
+ @@index([user_id, created_at])
19
19
  }
@@ -26,8 +26,6 @@ model Organisation {
26
26
  is_active Boolean @default(true)
27
27
  alias String? @unique
28
28
  logo String?
29
- org_code String? @unique
30
- job_sequence Int @default(1)
31
29
  applications Application[]
32
30
  user_roles UserRole[]
33
31
  job_descriptions JobDescription[]
@@ -47,7 +45,10 @@ model Organisation {
47
45
  assessments Assessment[]
48
46
  timezone String @default("Asia/Kolkata")
49
47
  organisation_configs OrganisationConfig[]
50
- activity_events ActivityEvent[]
48
+
49
+ channel_provider_configs ChannelProviderConfig[]
50
+ conversations Conversation[]
51
+ communication_messages CommunicationMessage[]
51
52
 
52
53
  @@index([name])
53
54
  }
@@ -1,12 +1,12 @@
1
1
  model OrganisationConfig {
2
- id String @id @default(uuid())
3
- organisation_id String
4
- config_key String
5
- value Json
6
- created_at DateTime @default(now())
7
- updated_at DateTime @updatedAt
8
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
2
+ id String @id @default(uuid())
3
+ organisation_id String
4
+ config_key String
5
+ value Json
6
+ created_at DateTime @default(now())
7
+ updated_at DateTime @updatedAt
8
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
9
9
 
10
- @@unique([organisation_id, config_key])
11
- @@map("organisationConfig")
10
+ @@unique([organisation_id, config_key])
11
+ @@map("organisationConfig")
12
12
  }
@@ -1,10 +1,10 @@
1
1
  model RefreshToken {
2
- id String @id @default(uuid())
3
- user_id String
4
- token String @unique
5
- is_active Boolean @default(true)
6
- expires_at DateTime
7
- created_at DateTime @default(now())
8
- updated_at DateTime @updatedAt
9
- user User @relation("TokenRefresh", fields: [user_id], references: [id], onDelete: Cascade)
2
+ id String @id @default(uuid())
3
+ user_id String
4
+ token String @unique
5
+ is_active Boolean @default(true)
6
+ expires_at DateTime
7
+ created_at DateTime @default(now())
8
+ updated_at DateTime @updatedAt
9
+ user User @relation("TokenRefresh", fields: [user_id], references: [id], onDelete: Cascade)
10
10
  }
@@ -67,7 +67,6 @@ model User {
67
67
  refresh_token_auth RefreshToken[] @relation("TokenRefresh")
68
68
  zoom_meeting_participants ZoomMeetingParticipant[]
69
69
  notes Notes[]
70
- recruiter_applications Application[] @relation("ApplicationRecruiter")
71
70
 
72
71
  name String?
73
72
  phone String?
@@ -1,115 +0,0 @@
1
- enum ActivityEventType {
2
- APPLICATION_CREATED
3
- APPLICATION_STARTED
4
- APPLICATION_REJECTED
5
- APPLICATION_SHORTLISTED
6
-
7
- ROUND_ASSIGNED
8
- ROUND_COMPLETED
9
- ROUND_PASSED
10
- ROUND_FAILED
11
-
12
- INTERVIEW_CREATED
13
- INTERVIEW_SCHEDULED
14
- INTERVIEW_RESCHEDULED
15
- INTERVIEW_CANCELLED
16
- INTERVIEW_STARTED
17
- INTERVIEW_COMPLETED
18
- INTERVIEW_NO_SHOW
19
- INTERVIEW_EVALUATION_PENDING
20
- INTERVIEW_EVALUATED
21
-
22
- FEEDBACK_SUBMITTED
23
-
24
- ASSIGNMENT_CREATED
25
- ASSIGNMENT_STARTED
26
- ASSIGNMENT_COMPLETED
27
- ASSIGNMENT_CANCELLED
28
- ASSIGNMENT_EVALUATED
29
-
30
- ASSESSMENT_CREATED
31
- ASSESSMENT_STARTED
32
- ASSESSMENT_COMPLETED
33
- ASSESSMENT_CANCELLED
34
- ASSESSMENT_EVALUATED
35
-
36
- JOB_CREATED
37
- JOB_PUBLISHED
38
- JOB_CLOSED
39
- JOB_DEACTIVATED
40
-
41
- EVALUATION_PLAN_CREATED
42
- EVALUATION_PLAN_PUBLISHED
43
- EVALUATION_PLAN_DELETED
44
- EVALUATION_PLAN_UPDATED
45
- STATUS_CHANGED
46
-
47
- CUSTOM
48
- }
49
-
50
- enum ActivityEntityType {
51
- APPLICATION
52
-
53
- CANDIDATE
54
-
55
- JOB
56
-
57
- ONGOING_EVALUATION
58
-
59
- EVALUATION_PLAN
60
-
61
- INTERVIEW
62
-
63
- ASSIGNMENT
64
-
65
- ASSESSMENT
66
-
67
- ORGANISATION
68
-
69
- USER
70
- }
71
-
72
- enum ActivityEntityActorType {
73
- USER
74
-
75
- SYSTEM
76
-
77
- AI_AGENT
78
-
79
- WEBHOOK
80
- }
81
-
82
- model ActivityEvent {
83
- id String @id @default(uuid())
84
-
85
- organisation_id String?
86
-
87
- event_type ActivityEventType
88
-
89
- entity_type ActivityEntityType
90
- entity_id String
91
-
92
- actor_id String?
93
- actor_type ActivityEntityActorType
94
-
95
- related_entities Json?
96
-
97
- snapshot Json?
98
-
99
- payload Json?
100
-
101
- schema_version Int @default(1)
102
-
103
- occurred_at DateTime
104
-
105
- created_at DateTime @default(now())
106
-
107
- organisation Organisation? @relation(fields: [organisation_id], references: [id])
108
-
109
- @@index([organisation_id, occurred_at])
110
- @@index([organisation_id, event_type])
111
- @@index([entity_type, entity_id])
112
- @@index([actor_id])
113
- @@index([occurred_at])
114
- @@map("activity_events")
115
- }