@urga-panel/ur-panels-core 1.0.5 → 1.0.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/dist/ServiceManager.js +4 -0
- package/dist/TestRun.d.ts +1 -1
- package/dist/TestRun.js +1 -1
- package/dist/commands/createDB.d.ts +2 -0
- package/dist/commands/createDB.js +47 -0
- package/dist/commands/createTS.d.ts +2 -0
- package/dist/commands/createTS.js +29 -0
- package/dist/services/abstract/authServices/AuthService.d.ts +1 -0
- package/dist/services/abstract/authServices/AuthService.js +15 -9
- package/package.json +6 -3
- package/src/ServiceManager.ts +4 -0
- package/src/TestRun.ts +1 -1
- package/src/commands/createDB.ts +59 -0
- package/src/commands/createTS.ts +35 -0
- package/src/services/abstract/authServices/AuthService.ts +28 -10
package/dist/ServiceManager.js
CHANGED
|
@@ -123,6 +123,7 @@ export class _ServiceManager {
|
|
|
123
123
|
// await _PageControllerService.start();
|
|
124
124
|
}
|
|
125
125
|
const createdServices = [];
|
|
126
|
+
const _this = this;
|
|
126
127
|
for (const serviceInfo of services) {
|
|
127
128
|
const { serviceName, service, tag, dynamicTag, isAbstract, requiredServices } = serviceInfo;
|
|
128
129
|
// Fill usedService according to requiredServices
|
|
@@ -145,6 +146,7 @@ export class _ServiceManager {
|
|
|
145
146
|
usedService,
|
|
146
147
|
tag: tag,
|
|
147
148
|
type: type,
|
|
149
|
+
ServiceManager: _this,
|
|
148
150
|
abilities: {
|
|
149
151
|
createChildService: (tag, PageCtor) => {
|
|
150
152
|
//console.log("createChildService called for ---", tag);
|
|
@@ -154,6 +156,8 @@ export class _ServiceManager {
|
|
|
154
156
|
usedService: {},
|
|
155
157
|
tag: tag,
|
|
156
158
|
type: type,
|
|
159
|
+
//@ts-ignore
|
|
160
|
+
ServiceManager: _this
|
|
157
161
|
}),
|
|
158
162
|
status: "waitSetup",
|
|
159
163
|
});
|
package/dist/TestRun.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
declare function main(): Promise<void>;
|
package/dist/TestRun.js
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { MongoClient } from 'mongodb';
|
|
5
|
+
async function createMongoDB() {
|
|
6
|
+
const baseDir = process.cwd();
|
|
7
|
+
const databasePath = path.join(baseDir, 'src', 'project', 'database');
|
|
8
|
+
// MongoDB bağlantısı
|
|
9
|
+
const uri = 'mongodb://localhost:27017'; // kendi bağlantını yaz
|
|
10
|
+
const client = new MongoClient(uri);
|
|
11
|
+
await client.connect();
|
|
12
|
+
// Database klasörlerini al
|
|
13
|
+
const dbFolders = fs.readdirSync(databasePath, { withFileTypes: true })
|
|
14
|
+
.filter(f => f.isDirectory())
|
|
15
|
+
.map(f => f.name);
|
|
16
|
+
for (const dbName of dbFolders) {
|
|
17
|
+
//const db = client.db(dbName); // klasör adı database ismi
|
|
18
|
+
const entitiesPath = path.join(databasePath, dbName, 'Entities');
|
|
19
|
+
if (!fs.existsSync(entitiesPath))
|
|
20
|
+
continue;
|
|
21
|
+
// 1. Eğer varsa önceki veritabanını sil
|
|
22
|
+
const oldDb = client.db(dbName);
|
|
23
|
+
await oldDb.dropDatabase();
|
|
24
|
+
console.log(`🗑️ ${dbName} veritabanı silindi.`);
|
|
25
|
+
// 2. Aynı isimle yeni veritabanı oluştur
|
|
26
|
+
const newDb = client.db(dbName);
|
|
27
|
+
const files = fs.readdirSync(entitiesPath).filter(f => f.endsWith('.json'));
|
|
28
|
+
for (const file of files) {
|
|
29
|
+
const collectionName = file.replace('.json', '');
|
|
30
|
+
const collection = await newDb.createCollection(collectionName);
|
|
31
|
+
//JSON dosyasını oku
|
|
32
|
+
const data = JSON.parse(fs.readFileSync(path.join(entitiesPath, file), 'utf-8'));
|
|
33
|
+
// Tek obje veya array olabilir
|
|
34
|
+
/*
|
|
35
|
+
const docs = Array.isArray(data) ? data : [data];
|
|
36
|
+
|
|
37
|
+
// Collection’a ekle
|
|
38
|
+
if (docs.length > 0) {
|
|
39
|
+
await collection.insertMany(docs);
|
|
40
|
+
console.log(`Inserted ${docs.length} docs into ${dbName}.${collectionName}`);
|
|
41
|
+
}*/
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
await client.close();
|
|
45
|
+
console.log('All databases and collections created!');
|
|
46
|
+
}
|
|
47
|
+
createMongoDB().catch(console.error);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { execSync } from 'child_process';
|
|
5
|
+
async function createInterfaces() {
|
|
6
|
+
const baseDir = process.cwd();
|
|
7
|
+
const databasePath = path.join(baseDir, 'src', 'project', 'database');
|
|
8
|
+
// Database içindeki tüm klasörleri al
|
|
9
|
+
const entityFolders = fs.readdirSync(databasePath, { withFileTypes: true })
|
|
10
|
+
.filter(f => f.isDirectory())
|
|
11
|
+
.map(f => f.name);
|
|
12
|
+
for (const folder of entityFolders) {
|
|
13
|
+
const entitiesPath = path.join(databasePath, folder, 'Entities');
|
|
14
|
+
const interfacePath = path.join(databasePath, folder, 'Interface');
|
|
15
|
+
if (!fs.existsSync(entitiesPath))
|
|
16
|
+
continue; // Entities klasörü yoksa atla
|
|
17
|
+
if (!fs.existsSync(interfacePath))
|
|
18
|
+
fs.mkdirSync(interfacePath, { recursive: true });
|
|
19
|
+
const files = fs.readdirSync(entitiesPath).filter(f => f.endsWith('.json'));
|
|
20
|
+
for (const file of files) {
|
|
21
|
+
const input = path.join(entitiesPath, file);
|
|
22
|
+
const output = path.join(interfacePath, file.replace('.json', '.d.ts'));
|
|
23
|
+
console.log(`Converting ${folder}/${file} -> ${folder}/Interface/${path.basename(output)}`);
|
|
24
|
+
execSync(`json2ts -i "${input}" -o "${output}"`, { stdio: 'inherit' });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
console.log('All JSON files converted to TypeScript interfaces.');
|
|
28
|
+
}
|
|
29
|
+
createInterfaces().catch(console.error);
|
|
@@ -101,24 +101,27 @@ export class AuthService extends Service {
|
|
|
101
101
|
id: result.user.id,
|
|
102
102
|
username: result.user.username,
|
|
103
103
|
role: result.user.role,
|
|
104
|
-
databaseId: result.user.databaseId
|
|
104
|
+
databaseId: result.user.databaseId,
|
|
105
|
+
databases: result.user.databases // databaseId eklendi
|
|
105
106
|
}, JWT_SECRET, { expiresIn: '15m' });
|
|
106
107
|
// 5. Refresh Token üret
|
|
107
108
|
const refreshToken = jwt.sign({
|
|
108
109
|
id: result.user.id,
|
|
109
110
|
username: result.user.username,
|
|
110
111
|
role: result.user.role,
|
|
111
|
-
databaseId: result.user.databaseId
|
|
112
|
+
databaseId: result.user.databaseId,
|
|
113
|
+
databases: result.user.databases // databaseId eklendi
|
|
112
114
|
}, JWT_REFRESH_SECRET, { expiresIn: '7d' });
|
|
113
115
|
// return { status: "success", accessToken: accessToken,
|
|
114
116
|
// refreshToken: refreshToken };
|
|
115
117
|
// // ...tokenları ürettikten sonra...
|
|
118
|
+
const headers = new Headers();
|
|
119
|
+
headers.append("Set-Cookie", `accessToken=${accessToken}; Path=/; Domain=.local.test; HttpOnly; SameSite=Lax; Max-Age=900`);
|
|
120
|
+
headers.append("Set-Cookie", `refreshToken=${refreshToken}; Path=/; Domain=.local.test; HttpOnly; SameSite=Lax; Max-Age=604800`);
|
|
121
|
+
headers.append("Content-Type", `application/json`);
|
|
116
122
|
return new Response(JSON.stringify({ status: "success", message: "valid credentials", data: { user: result.user } }), {
|
|
117
123
|
status: 200,
|
|
118
|
-
headers:
|
|
119
|
-
"Set-Cookie": `accessToken=${accessToken}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=900, refreshToken=${refreshToken}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=604800`,
|
|
120
|
-
'Content-Type': 'application/json'
|
|
121
|
-
}
|
|
124
|
+
headers: headers
|
|
122
125
|
});
|
|
123
126
|
}
|
|
124
127
|
return this.resposeHandler({ status: "fail", message: "Invalid credentials" });
|
|
@@ -190,13 +193,15 @@ export class AuthService extends Service {
|
|
|
190
193
|
id: decodedRefresh.id,
|
|
191
194
|
username: decodedRefresh.username,
|
|
192
195
|
role: decodedRefresh.role,
|
|
193
|
-
databaseId: decodedRefresh.databaseId // databaseId eklendi
|
|
196
|
+
databaseId: decodedRefresh.databaseId, // databaseId eklendi
|
|
197
|
+
databases: decodedRefresh.databases // databases eklendi
|
|
194
198
|
}, JWT_SECRET, { expiresIn: '15m' });
|
|
195
199
|
const newRefreshToken = jwt.sign({
|
|
196
200
|
id: decodedRefresh.id,
|
|
197
201
|
username: decodedRefresh.username,
|
|
198
202
|
role: decodedRefresh.role,
|
|
199
|
-
databaseId: decodedRefresh.databaseId // databaseId eklendi
|
|
203
|
+
databaseId: decodedRefresh.databaseId, // databaseId eklendi
|
|
204
|
+
databases: decodedRefresh.databases // databases eklendi
|
|
200
205
|
}, JWT_REFRESH_SECRET, { expiresIn: '7d' });
|
|
201
206
|
return { valid: true, newAccessToken, newRefreshToken, user: res.user };
|
|
202
207
|
}
|
|
@@ -242,7 +247,8 @@ export class AuthService extends Service {
|
|
|
242
247
|
id: user?.id || null,
|
|
243
248
|
username: user?.username || null,
|
|
244
249
|
role: user?.role || null,
|
|
245
|
-
databaseId: user?.databaseId || null // databaseId eklendi
|
|
250
|
+
databaseId: user?.databaseId || null, // databaseId eklendi
|
|
251
|
+
databases: user?.databases || null // databases eklendi
|
|
246
252
|
}
|
|
247
253
|
}
|
|
248
254
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@urga-panel/ur-panels-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"test": "jest",
|
|
10
10
|
"lint": "eslint src --ext .ts",
|
|
11
11
|
"start": "npx cross-env MODE=DEBUG ts-node src/TestRun.ts",
|
|
12
|
-
"addServiceStatic": "npx ts-node src/
|
|
12
|
+
"addServiceStatic": "npx ts-node src/TestRun.ts"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@types/jest": "^29.0.0",
|
|
@@ -27,9 +27,12 @@
|
|
|
27
27
|
"bcryptjs": "^3.0.2",
|
|
28
28
|
"js-yaml": "^4.1.0",
|
|
29
29
|
"jsonwebtoken": "^9.0.2",
|
|
30
|
+
"mongodb": "^6.19.0",
|
|
30
31
|
"yargs": "^18.0.0"
|
|
31
32
|
},
|
|
32
33
|
"bin": {
|
|
33
|
-
"urga-core-cli": "dist/
|
|
34
|
+
"urga-core-cli": "dist/TestRun.js",
|
|
35
|
+
"createTS": "dist/commands/createTS.js",
|
|
36
|
+
"createDB": "dist/commands/createDB.js"
|
|
34
37
|
}
|
|
35
38
|
}
|
package/src/ServiceManager.ts
CHANGED
|
@@ -142,6 +142,7 @@ export class _ServiceManager {
|
|
|
142
142
|
// await _PageControllerService.start();
|
|
143
143
|
}
|
|
144
144
|
const createdServices: Service[] = [];
|
|
145
|
+
const _this = this;
|
|
145
146
|
for (const serviceInfo of services) {
|
|
146
147
|
const { serviceName, service, tag, dynamicTag, isAbstract, requiredServices } = serviceInfo;
|
|
147
148
|
// Fill usedService according to requiredServices
|
|
@@ -164,6 +165,7 @@ export class _ServiceManager {
|
|
|
164
165
|
usedService,
|
|
165
166
|
tag: tag,
|
|
166
167
|
type: type,
|
|
168
|
+
ServiceManager: _this,
|
|
167
169
|
abilities: {
|
|
168
170
|
createChildService: (tag: string, PageCtor?: ServiceConstructor<Service>) => {
|
|
169
171
|
//console.log("createChildService called for ---", tag);
|
|
@@ -173,6 +175,8 @@ export class _ServiceManager {
|
|
|
173
175
|
usedService: {},
|
|
174
176
|
tag: tag,
|
|
175
177
|
type: type,
|
|
178
|
+
//@ts-ignore
|
|
179
|
+
ServiceManager: _this
|
|
176
180
|
}),
|
|
177
181
|
status: "waitSetup",
|
|
178
182
|
});
|
package/src/TestRun.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ServiceManager } from './ServiceManager';
|
|
2
1
|
|
|
3
2
|
async function main() {
|
|
4
3
|
//const serviceManager = new ServiceManager();
|
|
@@ -12,6 +11,7 @@ async function main() {
|
|
|
12
11
|
// LayoutService: _service
|
|
13
12
|
// }
|
|
14
13
|
// );
|
|
14
|
+
console.log("Services initialized2222");
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
main().catch(console.error);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { MongoClient } from 'mongodb';
|
|
5
|
+
|
|
6
|
+
async function createMongoDB() {
|
|
7
|
+
const baseDir = process.cwd();
|
|
8
|
+
const databasePath = path.join(baseDir, 'src', 'project', 'database');
|
|
9
|
+
|
|
10
|
+
// MongoDB bağlantısı
|
|
11
|
+
const uri = 'mongodb://localhost:27017'; // kendi bağlantını yaz
|
|
12
|
+
const client = new MongoClient(uri);
|
|
13
|
+
await client.connect();
|
|
14
|
+
|
|
15
|
+
// Database klasörlerini al
|
|
16
|
+
const dbFolders = fs.readdirSync(databasePath, { withFileTypes: true })
|
|
17
|
+
.filter(f => f.isDirectory())
|
|
18
|
+
.map(f => f.name);
|
|
19
|
+
|
|
20
|
+
for (const dbName of dbFolders) {
|
|
21
|
+
//const db = client.db(dbName); // klasör adı database ismi
|
|
22
|
+
const entitiesPath = path.join(databasePath, dbName, 'Entities');
|
|
23
|
+
if (!fs.existsSync(entitiesPath)) continue;
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// 1. Eğer varsa önceki veritabanını sil
|
|
27
|
+
const oldDb = client.db(dbName);
|
|
28
|
+
await oldDb.dropDatabase();
|
|
29
|
+
console.log(`🗑️ ${dbName} veritabanı silindi.`);
|
|
30
|
+
|
|
31
|
+
// 2. Aynı isimle yeni veritabanı oluştur
|
|
32
|
+
const newDb = client.db(dbName);
|
|
33
|
+
|
|
34
|
+
const files = fs.readdirSync(entitiesPath).filter(f => f.endsWith('.json'));
|
|
35
|
+
|
|
36
|
+
for (const file of files) {
|
|
37
|
+
const collectionName = file.replace('.json', '');
|
|
38
|
+
const collection = await newDb.createCollection(collectionName);
|
|
39
|
+
|
|
40
|
+
//JSON dosyasını oku
|
|
41
|
+
const data = JSON.parse(fs.readFileSync(path.join(entitiesPath, file), 'utf-8'));
|
|
42
|
+
|
|
43
|
+
// Tek obje veya array olabilir
|
|
44
|
+
/*
|
|
45
|
+
const docs = Array.isArray(data) ? data : [data];
|
|
46
|
+
|
|
47
|
+
// Collection’a ekle
|
|
48
|
+
if (docs.length > 0) {
|
|
49
|
+
await collection.insertMany(docs);
|
|
50
|
+
console.log(`Inserted ${docs.length} docs into ${dbName}.${collectionName}`);
|
|
51
|
+
}*/
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
await client.close();
|
|
56
|
+
console.log('All databases and collections created!');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
createMongoDB().catch(console.error);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { execSync } from 'child_process';
|
|
5
|
+
|
|
6
|
+
async function createInterfaces() {
|
|
7
|
+
const baseDir = process.cwd();
|
|
8
|
+
const databasePath = path.join(baseDir, 'src', 'project', 'database');
|
|
9
|
+
|
|
10
|
+
// Database içindeki tüm klasörleri al
|
|
11
|
+
const entityFolders = fs.readdirSync(databasePath, { withFileTypes: true })
|
|
12
|
+
.filter(f => f.isDirectory())
|
|
13
|
+
.map(f => f.name);
|
|
14
|
+
|
|
15
|
+
for (const folder of entityFolders) {
|
|
16
|
+
const entitiesPath = path.join(databasePath, folder, 'Entities');
|
|
17
|
+
const interfacePath = path.join(databasePath, folder, 'Interface');
|
|
18
|
+
|
|
19
|
+
if (!fs.existsSync(entitiesPath)) continue; // Entities klasörü yoksa atla
|
|
20
|
+
if (!fs.existsSync(interfacePath)) fs.mkdirSync(interfacePath, { recursive: true });
|
|
21
|
+
|
|
22
|
+
const files = fs.readdirSync(entitiesPath).filter(f => f.endsWith('.json'));
|
|
23
|
+
|
|
24
|
+
for (const file of files) {
|
|
25
|
+
const input = path.join(entitiesPath, file);
|
|
26
|
+
const output = path.join(interfacePath, file.replace('.json', '.d.ts'));
|
|
27
|
+
console.log(`Converting ${folder}/${file} -> ${folder}/Interface/${path.basename(output)}`);
|
|
28
|
+
execSync(`json2ts -i "${input}" -o "${output}"`, { stdio: 'inherit' });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
console.log('All JSON files converted to TypeScript interfaces.');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
createInterfaces().catch(console.error);
|
|
@@ -79,6 +79,7 @@ export abstract class AuthService extends Service {
|
|
|
79
79
|
password: string; // Optional password field for internal use
|
|
80
80
|
role?: string; // Optional role field
|
|
81
81
|
databaseId?: string; // Optional database ID field
|
|
82
|
+
databases?: string[]; // Optional databases field
|
|
82
83
|
};
|
|
83
84
|
}>;
|
|
84
85
|
|
|
@@ -153,7 +154,8 @@ export abstract class AuthService extends Service {
|
|
|
153
154
|
id: result.user.id,
|
|
154
155
|
username: result.user.username,
|
|
155
156
|
role: result.user.role,
|
|
156
|
-
databaseId: result.user.databaseId
|
|
157
|
+
databaseId: result.user.databaseId,
|
|
158
|
+
databases: result.user.databases // databaseId eklendi
|
|
157
159
|
},
|
|
158
160
|
JWT_SECRET,
|
|
159
161
|
{ expiresIn: '15m' }
|
|
@@ -165,7 +167,8 @@ export abstract class AuthService extends Service {
|
|
|
165
167
|
id: result.user.id,
|
|
166
168
|
username: result.user.username,
|
|
167
169
|
role: result.user.role,
|
|
168
|
-
databaseId: result.user.databaseId
|
|
170
|
+
databaseId: result.user.databaseId,
|
|
171
|
+
databases: result.user.databases // databaseId eklendi
|
|
169
172
|
},
|
|
170
173
|
JWT_REFRESH_SECRET,
|
|
171
174
|
{ expiresIn: '7d' }
|
|
@@ -174,15 +177,26 @@ export abstract class AuthService extends Service {
|
|
|
174
177
|
// return { status: "success", accessToken: accessToken,
|
|
175
178
|
// refreshToken: refreshToken };
|
|
176
179
|
// // ...tokenları ürettikten sonra...
|
|
180
|
+
const headers = new Headers();
|
|
181
|
+
|
|
182
|
+
headers.append(
|
|
183
|
+
"Set-Cookie",
|
|
184
|
+
`accessToken=${accessToken}; Path=/; Domain=.local.test; HttpOnly; SameSite=Lax; Max-Age=900`
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
headers.append(
|
|
188
|
+
"Set-Cookie",
|
|
189
|
+
`refreshToken=${refreshToken}; Path=/; Domain=.local.test; HttpOnly; SameSite=Lax; Max-Age=604800`
|
|
190
|
+
);
|
|
191
|
+
headers.append(
|
|
192
|
+
"Content-Type",
|
|
193
|
+
`application/json`
|
|
194
|
+
);
|
|
177
195
|
return new Response(
|
|
178
196
|
JSON.stringify({ status: "success", message: "valid credentials", data: { user: result.user } }),
|
|
179
197
|
{
|
|
180
198
|
status: 200,
|
|
181
|
-
headers:
|
|
182
|
-
"Set-Cookie":
|
|
183
|
-
`accessToken=${accessToken}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=900, refreshToken=${refreshToken}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=604800`,
|
|
184
|
-
'Content-Type': 'application/json'
|
|
185
|
-
}
|
|
199
|
+
headers: headers
|
|
186
200
|
}
|
|
187
201
|
);
|
|
188
202
|
}
|
|
@@ -241,6 +255,7 @@ export abstract class AuthService extends Service {
|
|
|
241
255
|
username: string;
|
|
242
256
|
role: string; // Refresh token'da rol bilgisi varsa
|
|
243
257
|
databaseId?: string;
|
|
258
|
+
databases?: string[];
|
|
244
259
|
} = jwt.verify(refreshToken, JWT_REFRESH_SECRET) as unknown as any;
|
|
245
260
|
//debugger;
|
|
246
261
|
|
|
@@ -270,7 +285,8 @@ export abstract class AuthService extends Service {
|
|
|
270
285
|
id: decodedRefresh.id,
|
|
271
286
|
username: decodedRefresh.username,
|
|
272
287
|
role: decodedRefresh.role,
|
|
273
|
-
databaseId: decodedRefresh.databaseId // databaseId eklendi
|
|
288
|
+
databaseId: decodedRefresh.databaseId, // databaseId eklendi
|
|
289
|
+
databases: decodedRefresh.databases // databases eklendi
|
|
274
290
|
},
|
|
275
291
|
JWT_SECRET,
|
|
276
292
|
{ expiresIn: '15m' }
|
|
@@ -280,7 +296,8 @@ export abstract class AuthService extends Service {
|
|
|
280
296
|
id: decodedRefresh.id,
|
|
281
297
|
username: decodedRefresh.username,
|
|
282
298
|
role: decodedRefresh.role,
|
|
283
|
-
databaseId: decodedRefresh.databaseId // databaseId eklendi
|
|
299
|
+
databaseId: decodedRefresh.databaseId, // databaseId eklendi
|
|
300
|
+
databases: decodedRefresh.databases // databases eklendi
|
|
284
301
|
},
|
|
285
302
|
JWT_REFRESH_SECRET,
|
|
286
303
|
{ expiresIn: '7d' }
|
|
@@ -332,7 +349,8 @@ export abstract class AuthService extends Service {
|
|
|
332
349
|
id: user?.id || null,
|
|
333
350
|
username: user?.username || null,
|
|
334
351
|
role: user?.role || null,
|
|
335
|
-
databaseId: user?.databaseId || null // databaseId eklendi
|
|
352
|
+
databaseId: user?.databaseId || null, // databaseId eklendi
|
|
353
|
+
databases: user?.databases || null // databases eklendi
|
|
336
354
|
}
|
|
337
355
|
}
|
|
338
356
|
});
|