@vezlo/assistant-server 1.3.0 → 2.0.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 +140 -43
- package/bin/vezlo-server.js +1 -1
- package/database-schema.sql +193 -33
- package/dist/knexfile.d.ts.map +1 -1
- package/dist/knexfile.js +17 -8
- package/dist/knexfile.js.map +1 -1
- package/dist/src/config/database.d.ts.map +1 -1
- package/dist/src/config/database.js +9 -1
- package/dist/src/config/database.js.map +1 -1
- package/dist/src/config/global.d.ts.map +1 -1
- package/dist/src/config/global.js +5 -2
- package/dist/src/config/global.js.map +1 -1
- package/dist/src/config/knex.d.ts.map +1 -1
- package/dist/src/config/knex.js +22 -2
- package/dist/src/config/knex.js.map +1 -1
- package/dist/src/config/swagger.d.ts.map +1 -1
- package/dist/src/config/swagger.js +34 -73
- package/dist/src/config/swagger.js.map +1 -1
- package/dist/src/controllers/ApiKeyController.d.ts +17 -0
- package/dist/src/controllers/ApiKeyController.d.ts.map +1 -0
- package/dist/src/controllers/ApiKeyController.js +84 -0
- package/dist/src/controllers/ApiKeyController.js.map +1 -0
- package/dist/src/controllers/AuthController.d.ts +14 -0
- package/dist/src/controllers/AuthController.d.ts.map +1 -0
- package/dist/src/controllers/AuthController.js +212 -0
- package/dist/src/controllers/AuthController.js.map +1 -0
- package/dist/src/controllers/ChatController.d.ts +8 -5
- package/dist/src/controllers/ChatController.d.ts.map +1 -1
- package/dist/src/controllers/ChatController.js +139 -31
- package/dist/src/controllers/ChatController.js.map +1 -1
- package/dist/src/controllers/KnowledgeController.d.ts +5 -4
- package/dist/src/controllers/KnowledgeController.d.ts.map +1 -1
- package/dist/src/controllers/KnowledgeController.js +54 -16
- package/dist/src/controllers/KnowledgeController.js.map +1 -1
- package/dist/src/middleware/auth.d.ts +51 -0
- package/dist/src/middleware/auth.d.ts.map +1 -0
- package/dist/src/middleware/auth.js +232 -0
- package/dist/src/middleware/auth.js.map +1 -0
- package/dist/src/middleware/errorHandler.d.ts.map +1 -1
- package/dist/src/middleware/errorHandler.js +13 -19
- package/dist/src/middleware/errorHandler.js.map +1 -1
- package/dist/src/migrations/001_initial_schema.d.ts.map +1 -1
- package/dist/src/migrations/001_initial_schema.js +39 -64
- package/dist/src/migrations/001_initial_schema.js.map +1 -1
- package/dist/src/migrations/002_multitenancy_schema.d.ts +4 -0
- package/dist/src/migrations/002_multitenancy_schema.d.ts.map +1 -0
- package/dist/src/migrations/002_multitenancy_schema.js +119 -0
- package/dist/src/migrations/002_multitenancy_schema.js.map +1 -0
- package/dist/src/schemas/AuthSchemas.d.ts +89 -0
- package/dist/src/schemas/AuthSchemas.d.ts.map +1 -0
- package/dist/src/schemas/AuthSchemas.js +63 -0
- package/dist/src/schemas/AuthSchemas.js.map +1 -0
- package/dist/src/schemas/CommonSchemas.d.ts +62 -0
- package/dist/src/schemas/CommonSchemas.d.ts.map +1 -0
- package/dist/src/schemas/CommonSchemas.js +65 -0
- package/dist/src/schemas/CommonSchemas.js.map +1 -0
- package/dist/src/schemas/ConversationSchemas.d.ts +64 -27
- package/dist/src/schemas/ConversationSchemas.d.ts.map +1 -1
- package/dist/src/schemas/ConversationSchemas.js +28 -9
- package/dist/src/schemas/ConversationSchemas.js.map +1 -1
- package/dist/src/schemas/FeedbackSchemas.d.ts +43 -5
- package/dist/src/schemas/FeedbackSchemas.d.ts.map +1 -1
- package/dist/src/schemas/FeedbackSchemas.js +20 -2
- package/dist/src/schemas/FeedbackSchemas.js.map +1 -1
- package/dist/src/schemas/KnowledgeSchemas.d.ts +114 -35
- package/dist/src/schemas/KnowledgeSchemas.d.ts.map +1 -1
- package/dist/src/schemas/KnowledgeSchemas.js +58 -16
- package/dist/src/schemas/KnowledgeSchemas.js.map +1 -1
- package/dist/src/schemas/MessageSchemas.d.ts +57 -8
- package/dist/src/schemas/MessageSchemas.d.ts.map +1 -1
- package/dist/src/schemas/MessageSchemas.js +22 -3
- package/dist/src/schemas/MessageSchemas.js.map +1 -1
- package/dist/src/schemas/index.d.ts +410 -68
- package/dist/src/schemas/index.d.ts.map +1 -1
- package/dist/src/schemas/index.js +8 -2
- package/dist/src/schemas/index.js.map +1 -1
- package/dist/src/server.js +1047 -615
- package/dist/src/server.js.map +1 -1
- package/dist/src/services/AIService.d.ts +1 -2
- package/dist/src/services/AIService.d.ts.map +1 -1
- package/dist/src/services/AIService.js +6 -32
- package/dist/src/services/AIService.js.map +1 -1
- package/dist/src/services/ApiKeyService.d.ts +38 -0
- package/dist/src/services/ApiKeyService.d.ts.map +1 -0
- package/dist/src/services/ApiKeyService.js +123 -0
- package/dist/src/services/ApiKeyService.js.map +1 -0
- package/dist/src/services/KnowledgeBaseService.d.ts +2 -2
- package/dist/src/services/KnowledgeBaseService.d.ts.map +1 -1
- package/dist/src/services/KnowledgeBaseService.js +9 -2
- package/dist/src/services/KnowledgeBaseService.js.map +1 -1
- package/dist/src/services/MigrationService.d.ts +1 -1
- package/dist/src/services/MigrationService.d.ts.map +1 -1
- package/dist/src/services/MigrationService.js +4 -8
- package/dist/src/services/MigrationService.js.map +1 -1
- package/dist/src/services/SetupService.d.ts +102 -0
- package/dist/src/services/SetupService.d.ts.map +1 -0
- package/dist/src/services/SetupService.js +343 -0
- package/dist/src/services/SetupService.js.map +1 -0
- package/dist/src/storage/ConversationRepository.d.ts.map +1 -1
- package/dist/src/storage/ConversationRepository.js +42 -8
- package/dist/src/storage/ConversationRepository.js.map +1 -1
- package/dist/src/storage/MessageRepository.d.ts.map +1 -1
- package/dist/src/storage/MessageRepository.js +23 -27
- package/dist/src/storage/MessageRepository.js.map +1 -1
- package/dist/src/types/index.d.ts +0 -8
- package/dist/src/types/index.d.ts.map +1 -1
- package/env.example +7 -5
- package/knexfile.ts +17 -8
- package/package.json +25 -16
- package/scripts/generate-key.js +124 -0
- package/scripts/seed-default.js +72 -0
- package/scripts/setup.js +410 -149
- package/scripts/validate-db.js +46 -13
|
@@ -9,7 +9,7 @@ async function up(knex) {
|
|
|
9
9
|
// CONVERSATIONS & MESSAGES SCHEMA (Modern 2-API Flow)
|
|
10
10
|
// ============================================================================
|
|
11
11
|
// Conversations table (renamed from chat_sessions)
|
|
12
|
-
await knex.schema.createTable('
|
|
12
|
+
await knex.schema.createTable('vezlo_conversations', (table) => {
|
|
13
13
|
table.bigIncrements('id').primary();
|
|
14
14
|
table.uuid('uuid').defaultTo(knex.raw('gen_random_uuid()')).unique().notNullable();
|
|
15
15
|
table.bigInteger('company_id').comment('Multi-tenancy support');
|
|
@@ -20,11 +20,11 @@ async function up(knex) {
|
|
|
20
20
|
table.timestamp('deleted_at', { useTz: true }).comment('Soft delete');
|
|
21
21
|
});
|
|
22
22
|
// Messages table (supports parent-child relationships for regeneration)
|
|
23
|
-
await knex.schema.createTable('
|
|
23
|
+
await knex.schema.createTable('vezlo_messages', (table) => {
|
|
24
24
|
table.bigIncrements('id').primary();
|
|
25
25
|
table.uuid('uuid').defaultTo(knex.raw('gen_random_uuid()')).unique().notNullable();
|
|
26
|
-
table.bigInteger('conversation_id').notNullable().references('id').inTable('
|
|
27
|
-
table.bigInteger('parent_message_id').references('id').inTable('
|
|
26
|
+
table.bigInteger('conversation_id').notNullable().references('id').inTable('vezlo_conversations').onDelete('CASCADE');
|
|
27
|
+
table.bigInteger('parent_message_id').references('id').inTable('vezlo_messages').comment('For regeneration chains');
|
|
28
28
|
table.text('type').notNullable().comment('user, assistant, system');
|
|
29
29
|
table.text('content').notNullable();
|
|
30
30
|
table.text('status').defaultTo('completed').comment('generating, completed, stopped, failed');
|
|
@@ -32,10 +32,10 @@ async function up(knex) {
|
|
|
32
32
|
table.timestamps(true, true); // created_at, updated_at with timezone
|
|
33
33
|
});
|
|
34
34
|
// Message feedback table
|
|
35
|
-
await knex.schema.createTable('
|
|
35
|
+
await knex.schema.createTable('vezlo_message_feedback', (table) => {
|
|
36
36
|
table.bigIncrements('id').primary();
|
|
37
37
|
table.uuid('uuid').defaultTo(knex.raw('gen_random_uuid()')).unique().notNullable();
|
|
38
|
-
table.bigInteger('message_id').notNullable().references('id').inTable('
|
|
38
|
+
table.bigInteger('message_id').notNullable().references('id').inTable('vezlo_messages').onDelete('CASCADE');
|
|
39
39
|
table.bigInteger('user_id').notNullable();
|
|
40
40
|
table.text('rating').notNullable().comment('positive, negative');
|
|
41
41
|
table.text('category');
|
|
@@ -47,10 +47,10 @@ async function up(knex) {
|
|
|
47
47
|
// KNOWLEDGE BASE SCHEMA (Unified Single Table)
|
|
48
48
|
// ============================================================================
|
|
49
49
|
// Knowledge items table (folders, documents, files, URLs - everything)
|
|
50
|
-
await knex.schema.createTable('
|
|
50
|
+
await knex.schema.createTable('vezlo_knowledge_items', (table) => {
|
|
51
51
|
table.bigIncrements('id').primary();
|
|
52
52
|
table.uuid('uuid').defaultTo(knex.raw('gen_random_uuid()')).unique().notNullable();
|
|
53
|
-
table.bigInteger('parent_id').references('id').inTable('
|
|
53
|
+
table.bigInteger('parent_id').references('id').inTable('vezlo_knowledge_items').comment('Hierarchical structure');
|
|
54
54
|
table.bigInteger('company_id').comment('Multi-tenancy support');
|
|
55
55
|
table.text('title').notNullable();
|
|
56
56
|
table.text('description');
|
|
@@ -69,76 +69,51 @@ async function up(knex) {
|
|
|
69
69
|
// INDEXES FOR PERFORMANCE
|
|
70
70
|
// ============================================================================
|
|
71
71
|
// Conversations indexes
|
|
72
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
73
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
74
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
75
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
76
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
72
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_conversations_uuid ON vezlo_conversations(uuid)');
|
|
73
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_conversations_company_id ON vezlo_conversations(company_id)');
|
|
74
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_conversations_creator_id ON vezlo_conversations(creator_id)');
|
|
75
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_conversations_deleted ON vezlo_conversations(deleted_at) WHERE deleted_at IS NULL');
|
|
76
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_conversations_updated_at ON vezlo_conversations(updated_at DESC)');
|
|
77
77
|
// Messages indexes
|
|
78
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
79
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
80
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
81
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
82
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
83
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
78
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_messages_uuid ON vezlo_messages(uuid)');
|
|
79
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_messages_conversation_id ON vezlo_messages(conversation_id)');
|
|
80
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_messages_parent_id ON vezlo_messages(parent_message_id)');
|
|
81
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_messages_type ON vezlo_messages(type)');
|
|
82
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_messages_status ON vezlo_messages(status)');
|
|
83
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_messages_created_at ON vezlo_messages(created_at DESC)');
|
|
84
84
|
// Message feedback indexes
|
|
85
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
86
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
87
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
88
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
85
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_feedback_uuid ON vezlo_message_feedback(uuid)');
|
|
86
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_feedback_message_id ON vezlo_message_feedback(message_id)');
|
|
87
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_feedback_user_id ON vezlo_message_feedback(user_id)');
|
|
88
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_feedback_rating ON vezlo_message_feedback(rating)');
|
|
89
89
|
// Knowledge items indexes
|
|
90
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
91
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
92
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
93
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
94
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
95
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
90
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_knowledge_uuid ON vezlo_knowledge_items(uuid)');
|
|
91
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_knowledge_company_id ON vezlo_knowledge_items(company_id)');
|
|
92
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_knowledge_parent_id ON vezlo_knowledge_items(parent_id)');
|
|
93
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_knowledge_type ON vezlo_knowledge_items(type)');
|
|
94
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_knowledge_created_by ON vezlo_knowledge_items(created_by)');
|
|
95
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_knowledge_created_at ON vezlo_knowledge_items(created_at DESC)');
|
|
96
96
|
// Full-text search index for knowledge items
|
|
97
97
|
await knex.schema.raw(`
|
|
98
|
-
CREATE INDEX IF NOT EXISTS
|
|
99
|
-
ON
|
|
98
|
+
CREATE INDEX IF NOT EXISTS idx_vezlo_knowledge_search
|
|
99
|
+
ON vezlo_knowledge_items USING gin(to_tsvector('english', title || ' ' || COALESCE(description, '') || ' ' || COALESCE(content, '')))
|
|
100
100
|
`);
|
|
101
101
|
// Vector similarity index for semantic search (only for items with content)
|
|
102
102
|
await knex.schema.raw(`
|
|
103
|
-
CREATE INDEX IF NOT EXISTS
|
|
104
|
-
ON
|
|
103
|
+
CREATE INDEX IF NOT EXISTS idx_vezlo_knowledge_embedding
|
|
104
|
+
ON vezlo_knowledge_items USING ivfflat (embedding vector_cosine_ops)
|
|
105
105
|
WHERE embedding IS NOT NULL
|
|
106
106
|
`);
|
|
107
107
|
// Sparse indexes for better performance
|
|
108
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
109
|
-
await knex.schema.raw('CREATE INDEX IF NOT EXISTS
|
|
110
|
-
// ============================================================================
|
|
111
|
-
// ROW LEVEL SECURITY (Optional but Recommended)
|
|
112
|
-
// ============================================================================
|
|
113
|
-
// Enable RLS on all tables
|
|
114
|
-
await knex.schema.raw('ALTER TABLE conversations ENABLE ROW LEVEL SECURITY');
|
|
115
|
-
await knex.schema.raw('ALTER TABLE messages ENABLE ROW LEVEL SECURITY');
|
|
116
|
-
await knex.schema.raw('ALTER TABLE message_feedback ENABLE ROW LEVEL SECURITY');
|
|
117
|
-
await knex.schema.raw('ALTER TABLE knowledge_items ENABLE ROW LEVEL SECURITY');
|
|
118
|
-
// Policies for service role access (full access)
|
|
119
|
-
await knex.schema.raw(`
|
|
120
|
-
CREATE POLICY "Service role can access all conversations" ON conversations
|
|
121
|
-
FOR ALL USING (auth.role() = 'service_role')
|
|
122
|
-
`);
|
|
123
|
-
await knex.schema.raw(`
|
|
124
|
-
CREATE POLICY "Service role can access all messages" ON messages
|
|
125
|
-
FOR ALL USING (auth.role() = 'service_role')
|
|
126
|
-
`);
|
|
127
|
-
await knex.schema.raw(`
|
|
128
|
-
CREATE POLICY "Service role can access all feedback" ON message_feedback
|
|
129
|
-
FOR ALL USING (auth.role() = 'service_role')
|
|
130
|
-
`);
|
|
131
|
-
await knex.schema.raw(`
|
|
132
|
-
CREATE POLICY "Service role can access all knowledge items" ON knowledge_items
|
|
133
|
-
FOR ALL USING (auth.role() = 'service_role')
|
|
134
|
-
`);
|
|
108
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_knowledge_content ON vezlo_knowledge_items(content) WHERE content IS NOT NULL');
|
|
109
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_knowledge_file_url ON vezlo_knowledge_items(file_url) WHERE file_url IS NOT NULL');
|
|
135
110
|
}
|
|
136
111
|
async function down(knex) {
|
|
137
112
|
// Drop tables in reverse order due to foreign key constraints
|
|
138
|
-
await knex.schema.dropTableIfExists('
|
|
139
|
-
await knex.schema.dropTableIfExists('
|
|
140
|
-
await knex.schema.dropTableIfExists('
|
|
141
|
-
await knex.schema.dropTableIfExists('
|
|
113
|
+
await knex.schema.dropTableIfExists('vezlo_message_feedback');
|
|
114
|
+
await knex.schema.dropTableIfExists('vezlo_messages');
|
|
115
|
+
await knex.schema.dropTableIfExists('vezlo_knowledge_items');
|
|
116
|
+
await knex.schema.dropTableIfExists('vezlo_conversations');
|
|
142
117
|
// Note: We don't drop the vector extension as it might be used by other tables
|
|
143
118
|
}
|
|
144
119
|
//# sourceMappingURL=001_initial_schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"001_initial_schema.js","sourceRoot":"","sources":["../../../src/migrations/001_initial_schema.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"001_initial_schema.js","sourceRoot":"","sources":["../../../src/migrations/001_initial_schema.ts"],"names":[],"mappings":";;AAEA,gBAuHC;AAED,oBAQC;AAj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G,CAAC,CAAC;IACxH,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,qGAAqG,CAAC,CAAC;IAE7H,6CAA6C;IAC7C,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;;;GAGrB,CAAC,CAAC;IAEH,4EAA4E;IAC5E,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;;;;GAIrB,CAAC,CAAC;IAEH,wCAAwC;IACxC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oHAAoH,CAAC,CAAC;IAC5I,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uHAAuH,CAAC,CAAC;AACjJ,CAAC;AAEM,KAAK,UAAU,IAAI,CAAC,IAAU;IACnC,8DAA8D;IAC9D,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,CAAC;IAC9D,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IACtD,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,uBAAuB,CAAC,CAAC;IAC7D,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;IAE3D,+EAA+E;AACjF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"002_multitenancy_schema.d.ts","sourceRoot":"","sources":["../../../src/migrations/002_multitenancy_schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAEjC,wBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA4GlD;AAED,wBAAsB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBpD"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.up = up;
|
|
4
|
+
exports.down = down;
|
|
5
|
+
async function up(knex) {
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// COMPANIES TABLE
|
|
8
|
+
// ============================================================================
|
|
9
|
+
await knex.schema.createTable('vezlo_companies', (table) => {
|
|
10
|
+
table.bigIncrements('id').primary();
|
|
11
|
+
table.uuid('uuid').defaultTo(knex.raw('gen_random_uuid()')).unique().notNullable();
|
|
12
|
+
table.text('name').notNullable();
|
|
13
|
+
table.text('domain').unique();
|
|
14
|
+
table.timestamps(true, true); // created_at, updated_at with timezone
|
|
15
|
+
});
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// USERS TABLE
|
|
18
|
+
// ============================================================================
|
|
19
|
+
await knex.schema.createTable('vezlo_users', (table) => {
|
|
20
|
+
table.bigIncrements('id').primary();
|
|
21
|
+
table.uuid('uuid').defaultTo(knex.raw('gen_random_uuid()')).unique().notNullable();
|
|
22
|
+
table.text('email').unique().notNullable();
|
|
23
|
+
table.text('name').notNullable();
|
|
24
|
+
table.text('password_hash').notNullable();
|
|
25
|
+
table.text('user_type').defaultTo('internal').comment('internal, external, admin');
|
|
26
|
+
table.timestamp('token_updated_at', { useTz: true }).defaultTo(knex.fn.now());
|
|
27
|
+
table.timestamps(true, true); // created_at, updated_at with timezone
|
|
28
|
+
});
|
|
29
|
+
// ============================================================================
|
|
30
|
+
// USER COMPANY PROFILES TABLE
|
|
31
|
+
// ============================================================================
|
|
32
|
+
await knex.schema.createTable('vezlo_user_company_profiles', (table) => {
|
|
33
|
+
table.bigIncrements('id').primary();
|
|
34
|
+
table.uuid('uuid').defaultTo(knex.raw('gen_random_uuid()')).unique().notNullable();
|
|
35
|
+
table.bigInteger('user_id').notNullable().references('id').inTable('vezlo_users').onDelete('CASCADE');
|
|
36
|
+
table.bigInteger('company_id').notNullable().references('id').inTable('vezlo_companies').onDelete('CASCADE');
|
|
37
|
+
table.text('role').defaultTo('user').comment('admin, user, viewer');
|
|
38
|
+
table.text('status').defaultTo('active').comment('active, inactive');
|
|
39
|
+
table.timestamps(true, true); // created_at, updated_at with timezone
|
|
40
|
+
table.unique(['user_id', 'company_id']);
|
|
41
|
+
});
|
|
42
|
+
// ============================================================================
|
|
43
|
+
// API KEYS TABLE
|
|
44
|
+
// ============================================================================
|
|
45
|
+
await knex.schema.createTable('vezlo_api_keys', (table) => {
|
|
46
|
+
table.bigIncrements('id').primary();
|
|
47
|
+
table.uuid('uuid').defaultTo(knex.raw('gen_random_uuid()')).unique().notNullable();
|
|
48
|
+
table.bigInteger('company_id').notNullable().references('id').inTable('vezlo_companies').onDelete('CASCADE');
|
|
49
|
+
table.text('name').notNullable();
|
|
50
|
+
table.text('key_hash').notNullable();
|
|
51
|
+
table.timestamp('expires_at', { useTz: true });
|
|
52
|
+
table.timestamps(true, true); // created_at, updated_at with timezone
|
|
53
|
+
});
|
|
54
|
+
// ============================================================================
|
|
55
|
+
// UPDATE EXISTING TABLES WITH FOREIGN KEYS
|
|
56
|
+
// ============================================================================
|
|
57
|
+
// Update conversations table
|
|
58
|
+
await knex.schema.alterTable('vezlo_conversations', (table) => {
|
|
59
|
+
// company_id already exists from Migration 001, just add foreign key constraint
|
|
60
|
+
table.foreign('company_id').references('id').inTable('vezlo_companies').onDelete('CASCADE');
|
|
61
|
+
});
|
|
62
|
+
// Update knowledge_items table
|
|
63
|
+
await knex.schema.alterTable('vezlo_knowledge_items', (table) => {
|
|
64
|
+
// company_id already exists from Migration 001, just add foreign key constraint
|
|
65
|
+
table.foreign('company_id').references('id').inTable('vezlo_companies').onDelete('CASCADE');
|
|
66
|
+
});
|
|
67
|
+
// Update message_feedback table
|
|
68
|
+
await knex.schema.alterTable('vezlo_message_feedback', (table) => {
|
|
69
|
+
// user_id already exists from Migration 001, just add foreign key constraint
|
|
70
|
+
table.foreign('user_id').references('id').inTable('vezlo_users').onDelete('CASCADE');
|
|
71
|
+
table.bigInteger('company_id').references('id').inTable('vezlo_companies').onDelete('CASCADE');
|
|
72
|
+
});
|
|
73
|
+
// ============================================================================
|
|
74
|
+
// INDEXES FOR PERFORMANCE
|
|
75
|
+
// ============================================================================
|
|
76
|
+
// Company indexes
|
|
77
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_companies_uuid ON vezlo_companies(uuid)');
|
|
78
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_companies_domain ON vezlo_companies(domain)');
|
|
79
|
+
// User indexes
|
|
80
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_users_uuid ON vezlo_users(uuid)');
|
|
81
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_users_email ON vezlo_users(email)');
|
|
82
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_users_user_type ON vezlo_users(user_type)');
|
|
83
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_users_token_updated_at ON vezlo_users(token_updated_at)');
|
|
84
|
+
// User-Company Profile indexes
|
|
85
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_user_company_profiles_user_id ON vezlo_user_company_profiles(user_id)');
|
|
86
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_user_company_profiles_company_id ON vezlo_user_company_profiles(company_id)');
|
|
87
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_user_company_profiles_uuid ON vezlo_user_company_profiles(uuid)');
|
|
88
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_user_company_profiles_role ON vezlo_user_company_profiles(role)');
|
|
89
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_user_company_profiles_status ON vezlo_user_company_profiles(status)');
|
|
90
|
+
// API Key indexes
|
|
91
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_api_keys_uuid ON vezlo_api_keys(uuid)');
|
|
92
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_api_keys_company_id ON vezlo_api_keys(company_id)');
|
|
93
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_api_keys_key_hash ON vezlo_api_keys(key_hash)');
|
|
94
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_api_keys_expires_at ON vezlo_api_keys(expires_at)');
|
|
95
|
+
// Updated foreign key indexes
|
|
96
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_conversations_company_id ON vezlo_conversations(company_id)');
|
|
97
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_knowledge_company_id ON vezlo_knowledge_items(company_id)');
|
|
98
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_feedback_user_id ON vezlo_message_feedback(user_id)');
|
|
99
|
+
await knex.schema.raw('CREATE INDEX IF NOT EXISTS idx_vezlo_feedback_company_id ON vezlo_message_feedback(company_id)');
|
|
100
|
+
}
|
|
101
|
+
async function down(knex) {
|
|
102
|
+
// Drop foreign key constraints first
|
|
103
|
+
await knex.schema.alterTable('vezlo_conversations', (table) => {
|
|
104
|
+
table.dropForeign('company_id');
|
|
105
|
+
});
|
|
106
|
+
await knex.schema.alterTable('vezlo_knowledge_items', (table) => {
|
|
107
|
+
table.dropForeign('company_id');
|
|
108
|
+
});
|
|
109
|
+
await knex.schema.alterTable('vezlo_message_feedback', (table) => {
|
|
110
|
+
table.dropForeign('user_id');
|
|
111
|
+
table.dropColumn('company_id');
|
|
112
|
+
});
|
|
113
|
+
// Drop tables in reverse order due to foreign key constraints
|
|
114
|
+
await knex.schema.dropTableIfExists('vezlo_api_keys');
|
|
115
|
+
await knex.schema.dropTableIfExists('vezlo_user_company_profiles');
|
|
116
|
+
await knex.schema.dropTableIfExists('vezlo_users');
|
|
117
|
+
await knex.schema.dropTableIfExists('vezlo_companies');
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=002_multitenancy_schema.js.map
|
|
@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AAC,KAAK,EAAE,EAAE;QAC5D,KAAK,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,uBAAuB,EAAE,CAAC,KAAK,EAAE,EAAE;QAC9D,KAAK,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,wBAAwB,EAAE,CAAC,KAAK,EAAE,EAAE;QAC/D,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAC7B,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,8DAA8D;IAC9D,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IACtD,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,6BAA6B,CAAC,CAAC;IACnE,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;IACnD,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication API Schemas
|
|
3
|
+
* All request/response schemas for authentication-related endpoints
|
|
4
|
+
*/
|
|
5
|
+
export declare const AuthSchemas: {
|
|
6
|
+
LoginRequest: {
|
|
7
|
+
type: string;
|
|
8
|
+
required: string[];
|
|
9
|
+
properties: {
|
|
10
|
+
email: {
|
|
11
|
+
type: string;
|
|
12
|
+
format: string;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
password: {
|
|
16
|
+
type: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
LogoutRequest: {
|
|
22
|
+
type: string;
|
|
23
|
+
properties: {};
|
|
24
|
+
};
|
|
25
|
+
LoginResponse: {
|
|
26
|
+
type: string;
|
|
27
|
+
properties: {
|
|
28
|
+
access_token: {
|
|
29
|
+
type: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
LogoutResponse: {
|
|
35
|
+
type: string;
|
|
36
|
+
properties: {
|
|
37
|
+
success: {
|
|
38
|
+
type: string;
|
|
39
|
+
};
|
|
40
|
+
message: {
|
|
41
|
+
type: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
MeResponse: {
|
|
46
|
+
type: string;
|
|
47
|
+
properties: {
|
|
48
|
+
user: {
|
|
49
|
+
type: string;
|
|
50
|
+
properties: {
|
|
51
|
+
uuid: {
|
|
52
|
+
type: string;
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
email: {
|
|
56
|
+
type: string;
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
name: {
|
|
60
|
+
type: string;
|
|
61
|
+
description: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
profile: {
|
|
66
|
+
type: string;
|
|
67
|
+
properties: {
|
|
68
|
+
uuid: {
|
|
69
|
+
type: string;
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
company_uuid: {
|
|
73
|
+
type: string;
|
|
74
|
+
description: string;
|
|
75
|
+
};
|
|
76
|
+
company_name: {
|
|
77
|
+
type: string;
|
|
78
|
+
description: string;
|
|
79
|
+
};
|
|
80
|
+
role: {
|
|
81
|
+
type: string;
|
|
82
|
+
description: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=AuthSchemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthSchemas.d.ts","sourceRoot":"","sources":["../../../src/schemas/AuthSchemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DvB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Authentication API Schemas
|
|
4
|
+
* All request/response schemas for authentication-related endpoints
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.AuthSchemas = void 0;
|
|
8
|
+
exports.AuthSchemas = {
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// AUTHENTICATION REQUEST SCHEMAS
|
|
11
|
+
// ============================================================================
|
|
12
|
+
LoginRequest: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
required: ['email', 'password'],
|
|
15
|
+
properties: {
|
|
16
|
+
email: { type: 'string', format: 'email', description: 'User email address' },
|
|
17
|
+
password: { type: 'string', description: 'User password' }
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
LogoutRequest: {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: {}
|
|
23
|
+
},
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// AUTHENTICATION RESPONSE SCHEMAS
|
|
26
|
+
// ============================================================================
|
|
27
|
+
LoginResponse: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
access_token: { type: 'string', description: 'JWT access token' }
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
LogoutResponse: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties: {
|
|
36
|
+
success: { type: 'boolean' },
|
|
37
|
+
message: { type: 'string' }
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
MeResponse: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: {
|
|
43
|
+
user: {
|
|
44
|
+
type: 'object',
|
|
45
|
+
properties: {
|
|
46
|
+
uuid: { type: 'string', description: 'User UUID' },
|
|
47
|
+
email: { type: 'string', description: 'User email' },
|
|
48
|
+
name: { type: 'string', description: 'User name' }
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
profile: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
properties: {
|
|
54
|
+
uuid: { type: 'string', description: 'Profile UUID' },
|
|
55
|
+
company_uuid: { type: 'string', description: 'Company UUID' },
|
|
56
|
+
company_name: { type: 'string', description: 'Company name' },
|
|
57
|
+
role: { type: 'string', description: 'User role in company' }
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=AuthSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthSchemas.js","sourceRoot":"","sources":["../../../src/schemas/AuthSchemas.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEU,QAAA,WAAW,GAAG;IACzB,+EAA+E;IAC/E,iCAAiC;IACjC,+EAA+E;IAC/E,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC;QAC/B,UAAU,EAAE;YACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE;YAC7E,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE;SAC3D;KACF;IAED,aAAa,EAAE;QACb,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,EAAE;KACf;IAED,+EAA+E;IAC/E,kCAAkC;IAClC,+EAA+E;IAC/E,aAAa,EAAE;QACb,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE;SAClE;KACF;IAED,cAAc,EAAE;QACd,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;YAC5B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC5B;KACF;IAED,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE;oBAClD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE;oBACpD,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE;iBACnD;aACF;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE;oBACrD,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE;oBAC7D,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE;oBAC7D,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sBAAsB,EAAE;iBAC9D;aACF;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common API Schemas
|
|
3
|
+
* Shared schemas for common responses across all endpoints
|
|
4
|
+
*/
|
|
5
|
+
export declare const CommonSchemas: {
|
|
6
|
+
HealthCheck: {
|
|
7
|
+
type: string;
|
|
8
|
+
properties: {
|
|
9
|
+
server: {
|
|
10
|
+
type: string;
|
|
11
|
+
description: string;
|
|
12
|
+
example: string;
|
|
13
|
+
};
|
|
14
|
+
timestamp: {
|
|
15
|
+
type: string;
|
|
16
|
+
format: string;
|
|
17
|
+
description: string;
|
|
18
|
+
example: string;
|
|
19
|
+
};
|
|
20
|
+
database: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
example: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
required: string[];
|
|
27
|
+
};
|
|
28
|
+
Error: {
|
|
29
|
+
type: string;
|
|
30
|
+
properties: {
|
|
31
|
+
error: {
|
|
32
|
+
type: string;
|
|
33
|
+
description: string;
|
|
34
|
+
example: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
required: string[];
|
|
38
|
+
};
|
|
39
|
+
Success: {
|
|
40
|
+
type: string;
|
|
41
|
+
properties: {
|
|
42
|
+
success: {
|
|
43
|
+
type: string;
|
|
44
|
+
description: string;
|
|
45
|
+
example: boolean;
|
|
46
|
+
};
|
|
47
|
+
message: {
|
|
48
|
+
type: string;
|
|
49
|
+
description: string;
|
|
50
|
+
example: string;
|
|
51
|
+
};
|
|
52
|
+
timestamp: {
|
|
53
|
+
type: string;
|
|
54
|
+
format: string;
|
|
55
|
+
description: string;
|
|
56
|
+
example: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
required: string[];
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=CommonSchemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommonSchemas.d.ts","sourceRoot":"","sources":["../../../src/schemas/CommonSchemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DzB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Common API Schemas
|
|
4
|
+
* Shared schemas for common responses across all endpoints
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.CommonSchemas = void 0;
|
|
8
|
+
exports.CommonSchemas = {
|
|
9
|
+
HealthCheck: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
server: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'Server health status',
|
|
15
|
+
example: 'healthy'
|
|
16
|
+
},
|
|
17
|
+
timestamp: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
format: 'date-time',
|
|
20
|
+
description: 'Current server timestamp',
|
|
21
|
+
example: '2025-10-27T06:52:40.215Z'
|
|
22
|
+
},
|
|
23
|
+
database: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'Database connection status',
|
|
26
|
+
example: 'connected'
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
required: ['server', 'timestamp', 'database']
|
|
30
|
+
},
|
|
31
|
+
Error: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
properties: {
|
|
34
|
+
error: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
description: 'Error message',
|
|
37
|
+
example: 'No token provided'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
required: ['error']
|
|
41
|
+
},
|
|
42
|
+
Success: {
|
|
43
|
+
type: 'object',
|
|
44
|
+
properties: {
|
|
45
|
+
success: {
|
|
46
|
+
type: 'boolean',
|
|
47
|
+
description: 'Indicates if the request was successful',
|
|
48
|
+
example: true
|
|
49
|
+
},
|
|
50
|
+
message: {
|
|
51
|
+
type: 'string',
|
|
52
|
+
description: 'Success message',
|
|
53
|
+
example: 'Operation completed successfully'
|
|
54
|
+
},
|
|
55
|
+
timestamp: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
format: 'date-time',
|
|
58
|
+
description: 'Success timestamp',
|
|
59
|
+
example: '2025-10-27T06:52:40.215Z'
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
required: ['success']
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=CommonSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommonSchemas.js","sourceRoot":"","sources":["../../../src/schemas/CommonSchemas.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEU,QAAA,aAAa,GAAG;IAC3B,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sBAAsB;gBACnC,OAAO,EAAE,SAAS;aACnB;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,WAAW;gBACnB,WAAW,EAAE,0BAA0B;gBACvC,OAAO,EAAE,0BAA0B;aACpC;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,4BAA4B;gBACzC,OAAO,EAAE,WAAW;aACrB;SACF;QACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,CAAC;KAC9C;IAED,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,eAAe;gBAC5B,OAAO,EAAE,mBAAmB;aAC7B;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,CAAC;KACpB;IAED,OAAO,EAAE;QACP,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,yCAAyC;gBACtD,OAAO,EAAE,IAAI;aACd;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iBAAiB;gBAC9B,OAAO,EAAE,kCAAkC;aAC5C;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,WAAW;gBACnB,WAAW,EAAE,mBAAmB;gBA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