@drax/identity-back 0.3.1 → 0.5.1
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/routes/UserAvatarRoutes.js +7 -6
- package/package.json +8 -8
- package/src/interfaces/IRoleRepository.ts +1 -1
- package/src/interfaces/ITenantRepository.ts +1 -1
- package/src/interfaces/IUserApiKeyRepository.ts +1 -1
- package/src/interfaces/IUserRepository.ts +1 -1
- package/src/repository/mongo/RoleMongoRepository.ts +1 -1
- package/src/repository/mongo/TenantMongoRepository.ts +1 -1
- package/src/repository/mongo/UserApiKeyMongoRepository.ts +1 -1
- package/src/repository/mongo/UserMongoRepository.ts +1 -1
- package/src/repository/sqlite/RoleSqliteRepository.ts +1 -1
- package/src/repository/sqlite/TenantSqliteRepository.ts +1 -1
- package/src/repository/sqlite/UserApiKeySqliteRepository.ts +1 -1
- package/src/repository/sqlite/UserSqliteRepository.ts +1 -1
- package/src/routes/RoleRoutes.ts +1 -1
- package/src/routes/TenantRoutes.ts +1 -1
- package/src/routes/UserApiKeyRoutes.ts +1 -1
- package/src/routes/UserAvatarRoutes.ts +7 -6
- package/src/routes/UserRoutes.ts +1 -1
- package/src/services/RoleService.ts +1 -1
- package/src/services/TenantService.ts +1 -1
- package/src/services/UserApiKeyService.ts +1 -1
- package/src/services/UserService.ts +1 -1
- package/test/repository/mongo/role-mongo-repository.test.ts +1 -1
- package/test/repository/mongo/user-apikey-mongo-repository.test.ts +1 -1
- package/test/repository/mongo/user-mongo-repository.test.ts +1 -1
- package/test/repository/sqlite/role-sqlite-repository.test.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/types/graphql/resolvers/role.resolvers.d.ts +1 -1
- package/types/graphql/resolvers/tenant.resolvers.d.ts +1 -1
- package/types/graphql/resolvers/user-api-key.resolvers.d.ts +1 -1
- package/types/graphql/resolvers/user.resolvers.d.ts +1 -1
- package/types/interfaces/IRoleRepository.d.ts +1 -1
- package/types/interfaces/IRoleRepository.d.ts.map +1 -1
- package/types/interfaces/ITenantRepository.d.ts +1 -1
- package/types/interfaces/ITenantRepository.d.ts.map +1 -1
- package/types/interfaces/IUserApiKeyRepository.d.ts +1 -1
- package/types/interfaces/IUserApiKeyRepository.d.ts.map +1 -1
- package/types/interfaces/IUserRepository.d.ts +1 -1
- package/types/interfaces/IUserRepository.d.ts.map +1 -1
- package/types/models/RoleModel.d.ts +0 -5
- package/types/models/RoleModel.d.ts.map +1 -1
- package/types/models/TenantModel.d.ts +0 -5
- package/types/models/TenantModel.d.ts.map +1 -1
- package/types/models/UserApiKeyModel.d.ts +0 -5
- package/types/models/UserApiKeyModel.d.ts.map +1 -1
- package/types/models/UserGroupModel.d.ts +0 -5
- package/types/models/UserGroupModel.d.ts.map +1 -1
- package/types/models/UserModel.d.ts +0 -5
- package/types/models/UserModel.d.ts.map +1 -1
- package/types/repository/mongo/RoleMongoRepository.d.ts +1 -1
- package/types/repository/mongo/RoleMongoRepository.d.ts.map +1 -1
- package/types/repository/mongo/TenantMongoRepository.d.ts +1 -1
- package/types/repository/mongo/TenantMongoRepository.d.ts.map +1 -1
- package/types/repository/mongo/UserApiKeyMongoRepository.d.ts +1 -1
- package/types/repository/mongo/UserApiKeyMongoRepository.d.ts.map +1 -1
- package/types/repository/mongo/UserMongoRepository.d.ts +1 -1
- package/types/repository/mongo/UserMongoRepository.d.ts.map +1 -1
- package/types/repository/sqlite/RoleSqliteRepository.d.ts +1 -1
- package/types/repository/sqlite/RoleSqliteRepository.d.ts.map +1 -1
- package/types/repository/sqlite/TenantSqliteRepository.d.ts +1 -1
- package/types/repository/sqlite/TenantSqliteRepository.d.ts.map +1 -1
- package/types/repository/sqlite/UserApiKeySqliteRepository.d.ts +1 -1
- package/types/repository/sqlite/UserApiKeySqliteRepository.d.ts.map +1 -1
- package/types/repository/sqlite/UserSqliteRepository.d.ts +1 -1
- package/types/repository/sqlite/UserSqliteRepository.d.ts.map +1 -1
- package/types/routes/UserAvatarRoutes.d.ts.map +1 -1
- package/types/services/RoleService.d.ts +1 -1
- package/types/services/RoleService.d.ts.map +1 -1
- package/types/services/TenantService.d.ts +1 -1
- package/types/services/TenantService.d.ts.map +1 -1
- package/types/services/UserApiKeyService.d.ts +1 -1
- package/types/services/UserApiKeyService.d.ts.map +1 -1
- package/types/services/UserService.d.ts +1 -1
- package/types/services/UserService.d.ts.map +1 -1
- package/types/zod/UserZod.d.ts +6 -6
|
@@ -3,7 +3,8 @@ import UnauthorizedError from "../errors/UnauthorizedError.js";
|
|
|
3
3
|
import { StoreManager, UploadFileError, DraxConfig, CommonConfig } from "@drax/common-back";
|
|
4
4
|
import UserServiceFactory from "../factory/UserServiceFactory.js";
|
|
5
5
|
import IdentityConfig from "../config/IdentityConfig.js";
|
|
6
|
-
const
|
|
6
|
+
const BASE_FILE_DIR = DraxConfig.getOrLoad(CommonConfig.FileDir) || 'files';
|
|
7
|
+
const AVATAR_DIR = DraxConfig.getOrLoad(IdentityConfig.AvatarDir) || 'avatar';
|
|
7
8
|
const BASE_URL = DraxConfig.getOrLoad(CommonConfig.BaseUrl) ? DraxConfig.get(CommonConfig.BaseUrl).replace(/\/$/, '') : '';
|
|
8
9
|
async function UserAvatarRoutes(fastify, options) {
|
|
9
10
|
fastify.post('/api/user/avatar', async (request, reply) => {
|
|
@@ -16,12 +17,12 @@ async function UserAvatarRoutes(fastify, options) {
|
|
|
16
17
|
fileStream: data.file,
|
|
17
18
|
mimetype: data.mimetype
|
|
18
19
|
};
|
|
19
|
-
const destinationPath = join(
|
|
20
|
+
const destinationPath = join(BASE_FILE_DIR, AVATAR_DIR);
|
|
20
21
|
const storedFile = await StoreManager.saveFile(file, destinationPath);
|
|
21
22
|
const urlFile = BASE_URL + '/api/user/avatar/' + storedFile.filename;
|
|
22
23
|
//Save into DB
|
|
23
24
|
const userService = UserServiceFactory();
|
|
24
|
-
|
|
25
|
+
await userService.changeAvatar(userId, urlFile);
|
|
25
26
|
return {
|
|
26
27
|
filename: storedFile.filename,
|
|
27
28
|
size: storedFile.size,
|
|
@@ -48,9 +49,9 @@ async function UserAvatarRoutes(fastify, options) {
|
|
|
48
49
|
fastify.get('/api/user/avatar/:filename', async (request, reply) => {
|
|
49
50
|
try {
|
|
50
51
|
const filename = request.params.filename;
|
|
51
|
-
const
|
|
52
|
-
const fileDir = join(
|
|
53
|
-
|
|
52
|
+
const subPath = 'avatar';
|
|
53
|
+
const fileDir = join(BASE_FILE_DIR, subPath);
|
|
54
|
+
console.log("FILE_DIR: ", fileDir, " FILENAME:", filename);
|
|
54
55
|
return reply.sendFile(filename, fileDir);
|
|
55
56
|
}
|
|
56
57
|
catch (e) {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.5.1",
|
|
7
7
|
"description": "Identity module for user management, authentication and authorization.",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"types": "types/index.d.ts",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"author": "Cristian Incarnato & Drax Team",
|
|
29
29
|
"license": "ISC",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@drax/common-back": "^0.
|
|
32
|
-
"@drax/
|
|
33
|
-
"@drax/identity-share": "^0.
|
|
31
|
+
"@drax/common-back": "^0.5.1",
|
|
32
|
+
"@drax/crud-share": "^0.5.1",
|
|
33
|
+
"@drax/identity-share": "^0.5.1",
|
|
34
34
|
"bcryptjs": "^2.4.3",
|
|
35
35
|
"express-jwt": "^8.4.1",
|
|
36
36
|
"graphql": "^16.8.2",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"better-sqlite3": "^11.0.0",
|
|
42
42
|
"fastify": "^4.27.0",
|
|
43
|
-
"mongoose": "^8.3
|
|
44
|
-
"mongoose-paginate-v2": "^1.8.
|
|
45
|
-
"mongoose-unique-validator": "^5.0.
|
|
43
|
+
"mongoose": "^8.6.3",
|
|
44
|
+
"mongoose-paginate-v2": "^1.8.3",
|
|
45
|
+
"mongoose-unique-validator": "^5.0.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/bcryptjs": "^2.4.6",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"debug": "0"
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "6f507c8b52e134f10839fd7698c2466ff65a3d08"
|
|
65
65
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {IRole, IRoleBase} from "@drax/identity-share";
|
|
2
|
-
import {IDraxCrud} from "@drax/
|
|
2
|
+
import {IDraxCrud} from "@drax/crud-share";
|
|
3
3
|
|
|
4
4
|
interface IRoleRepository extends IDraxCrud<IRole, IRoleBase, IRoleBase> {
|
|
5
5
|
findById(id: string): Promise<IRole | null>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {ITenant, ITenantBase} from '@drax/identity-share'
|
|
2
|
-
import {IDraxCrud} from "@drax/
|
|
2
|
+
import {IDraxCrud} from "@drax/crud-share";
|
|
3
3
|
interface ITenantRepository extends IDraxCrud<ITenant,ITenantBase,ITenantBase>{
|
|
4
4
|
findById(id: string): Promise<ITenant | null>;
|
|
5
5
|
findByName(name: string): Promise<ITenant | null>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {IUserApiKey, IUserApiKeyBase} from '@drax/identity-share'
|
|
2
|
-
import {IDraxCrud} from "@drax/
|
|
2
|
+
import {IDraxCrud} from "@drax/crud-share";
|
|
3
3
|
|
|
4
4
|
interface IUserApiKeyRepository extends IDraxCrud<IUserApiKey, IUserApiKeyBase, IUserApiKeyBase>{
|
|
5
5
|
findBySecret(username: string): Promise<IUserApiKey | null>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {IUser, IUserCreate, IUserUpdate} from '@drax/identity-share'
|
|
2
|
-
import {IDraxCrud} from "@drax/
|
|
2
|
+
import {IDraxCrud} from "@drax/crud-share";
|
|
3
3
|
|
|
4
4
|
interface IUserRepository extends IDraxCrud<IUser, IUserCreate, IUserUpdate>{
|
|
5
5
|
findById(id: string): Promise<IUser | null>;
|
|
@@ -3,7 +3,7 @@ import {IRoleRepository} from '../../interfaces/IRoleRepository'
|
|
|
3
3
|
import {mongoose, MongooseQueryFilter, MongooseSort} from "@drax/common-back";
|
|
4
4
|
import {PaginateOptions, PaginateResult} from "mongoose";
|
|
5
5
|
import {DeleteResult} from "mongodb";
|
|
6
|
-
import {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/
|
|
6
|
+
import {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/crud-share";
|
|
7
7
|
import {IRoleBase, IRole} from "@drax/identity-share";
|
|
8
8
|
|
|
9
9
|
class RoleMongoRepository implements IRoleRepository{
|
|
@@ -3,7 +3,7 @@ import {ITenantRepository} from '../../interfaces/ITenantRepository'
|
|
|
3
3
|
import {mongoose, MongooseSort, MongooseQueryFilter} from "@drax/common-back";
|
|
4
4
|
import { PaginateOptions, PaginateResult} from "mongoose";
|
|
5
5
|
import {DeleteResult} from "mongodb";
|
|
6
|
-
import {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/
|
|
6
|
+
import {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/crud-share";
|
|
7
7
|
import {ITenant, ITenantBase} from "@drax/identity-share";
|
|
8
8
|
|
|
9
9
|
class TenantMongoRepository implements ITenantRepository{
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import type {IUserApiKey, IUserApiKeyBase, IUserApiKeySoftDelete} from "@drax/identity-share";
|
|
9
9
|
import {DeleteResult, MongoServerError} from "mongodb";
|
|
10
10
|
import {PaginateResult} from "mongoose";
|
|
11
|
-
import {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/
|
|
11
|
+
import {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/crud-share";
|
|
12
12
|
import {IUserApiKeyRepository} from "../../interfaces/IUserApiKeyRepository";
|
|
13
13
|
|
|
14
14
|
class UserMongoRepository implements IUserApiKeyRepository {
|
|
@@ -11,7 +11,7 @@ import {DeleteResult, MongoServerError} from "mongodb";
|
|
|
11
11
|
import type {IUserRepository} from "../../interfaces/IUserRepository";
|
|
12
12
|
import {PaginateResult} from "mongoose";
|
|
13
13
|
import RoleMongoRepository from "./RoleMongoRepository.js";
|
|
14
|
-
import {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/
|
|
14
|
+
import {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/crud-share";
|
|
15
15
|
|
|
16
16
|
class UserMongoRepository implements IUserRepository {
|
|
17
17
|
private roleRepository: RoleMongoRepository;
|
|
@@ -2,7 +2,7 @@ import {IRoleRepository} from '../../interfaces/IRoleRepository'
|
|
|
2
2
|
import {UUID} from "crypto";
|
|
3
3
|
import sqlite from "better-sqlite3";
|
|
4
4
|
import {randomUUID} from "node:crypto";
|
|
5
|
-
import {IDraxPaginateResult, IDraxPaginateOptions} from "@drax/
|
|
5
|
+
import {IDraxPaginateResult, IDraxPaginateOptions} from "@drax/crud-share";
|
|
6
6
|
import {IRole, IRoleBase} from "@drax/identity-share";
|
|
7
7
|
import {
|
|
8
8
|
SqliteErrorToValidationError,
|
|
@@ -3,7 +3,7 @@ import {ITenantRepository} from '../../interfaces/ITenantRepository'
|
|
|
3
3
|
import {UUID} from "crypto";
|
|
4
4
|
import sqlite from "better-sqlite3";
|
|
5
5
|
import {randomUUID} from "node:crypto";
|
|
6
|
-
import {IDraxPaginateResult, IDraxPaginateOptions} from "@drax/
|
|
6
|
+
import {IDraxPaginateResult, IDraxPaginateOptions} from "@drax/crud-share";
|
|
7
7
|
import {SqliteErrorToValidationError, SqliteTableBuilder, SqlQueryFilter, SqlSort} from "@drax/common-back";
|
|
8
8
|
import type {SqliteTableField} from "@drax/common-back";
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ import {IUserApiKeyRepository} from '../../interfaces/IUserApiKeyRepository'
|
|
|
3
3
|
import {UUID} from "crypto";
|
|
4
4
|
import sqlite from "better-sqlite3";
|
|
5
5
|
import {randomUUID} from "node:crypto";
|
|
6
|
-
import {IDraxPaginateResult, IDraxPaginateOptions} from "@drax/
|
|
6
|
+
import {IDraxPaginateResult, IDraxPaginateOptions} from "@drax/crud-share";
|
|
7
7
|
import {SqliteErrorToValidationError, SqliteTableBuilder, SqlQueryFilter, SqlSort} from "@drax/common-back";
|
|
8
8
|
import type {SqliteTableField} from "@drax/common-back";
|
|
9
9
|
import UserSqliteRepository from "./UserSqliteRepository.js";
|
|
@@ -3,7 +3,7 @@ import sqlite from "better-sqlite3";
|
|
|
3
3
|
import {randomUUID} from "node:crypto";
|
|
4
4
|
import {UUID} from "crypto";
|
|
5
5
|
import {IUserRepository} from "../../interfaces/IUserRepository";
|
|
6
|
-
import {IDraxPaginateResult, IDraxPaginateOptions} from "@drax/
|
|
6
|
+
import {IDraxPaginateResult, IDraxPaginateOptions} from "@drax/crud-share";
|
|
7
7
|
import {
|
|
8
8
|
SqliteErrorToValidationError,
|
|
9
9
|
SqliteTableBuilder,
|
package/src/routes/RoleRoutes.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {IRole} from "@drax/identity-share";
|
|
|
4
4
|
import {IdentityPermissions} from "../permissions/IdentityPermissions.js";
|
|
5
5
|
import {PermissionService} from "../services/PermissionService.js";
|
|
6
6
|
import UnauthorizedError from "../errors/UnauthorizedError.js";
|
|
7
|
-
import {IDraxPaginateResult} from "@drax/
|
|
7
|
+
import {IDraxPaginateResult} from "@drax/crud-share";
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -3,7 +3,7 @@ import TenantServiceFactory from "../factory/TenantServiceFactory.js";
|
|
|
3
3
|
import {ITenant} from "@drax/identity-share";
|
|
4
4
|
import {IdentityPermissions} from "../permissions/IdentityPermissions.js";
|
|
5
5
|
import UnauthorizedError from "../errors/UnauthorizedError.js";
|
|
6
|
-
import {IDraxPaginateResult} from "@drax/
|
|
6
|
+
import {IDraxPaginateResult} from "@drax/crud-share";
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ import type {IUserApiKey} from "@drax/identity-share";
|
|
|
3
3
|
import {ValidationError} from "@drax/common-back";
|
|
4
4
|
import {IdentityPermissions} from "../permissions/IdentityPermissions.js";
|
|
5
5
|
import UnauthorizedError from "../errors/UnauthorizedError.js";
|
|
6
|
-
import {IDraxPaginateResult} from "@drax/
|
|
6
|
+
import {IDraxPaginateResult} from "@drax/crud-share";
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
async function UserApiKeyRoutes(fastify, options) {
|
|
@@ -4,7 +4,8 @@ import {StoreManager, UploadFileError, DraxConfig, CommonConfig} from "@drax/com
|
|
|
4
4
|
import UserServiceFactory from "../factory/UserServiceFactory.js";
|
|
5
5
|
import IdentityConfig from "../config/IdentityConfig.js";
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const BASE_FILE_DIR = DraxConfig.getOrLoad(CommonConfig.FileDir) || 'files';
|
|
8
|
+
const AVATAR_DIR = DraxConfig.getOrLoad(IdentityConfig.AvatarDir) || 'avatar';
|
|
8
9
|
const BASE_URL = DraxConfig.getOrLoad(CommonConfig.BaseUrl) ? DraxConfig.get(CommonConfig.BaseUrl).replace(/\/$/, '') : ''
|
|
9
10
|
|
|
10
11
|
|
|
@@ -24,13 +25,13 @@ async function UserAvatarRoutes(fastify, options) {
|
|
|
24
25
|
mimetype: data.mimetype
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
const destinationPath = join(
|
|
28
|
+
const destinationPath = join(BASE_FILE_DIR, AVATAR_DIR)
|
|
28
29
|
const storedFile = await StoreManager.saveFile(file, destinationPath)
|
|
29
30
|
const urlFile = BASE_URL + '/api/user/avatar/' + storedFile.filename
|
|
30
31
|
|
|
31
32
|
//Save into DB
|
|
32
33
|
const userService = UserServiceFactory()
|
|
33
|
-
|
|
34
|
+
await userService.changeAvatar(userId, urlFile)
|
|
34
35
|
|
|
35
36
|
return {
|
|
36
37
|
filename: storedFile.filename,
|
|
@@ -58,9 +59,9 @@ async function UserAvatarRoutes(fastify, options) {
|
|
|
58
59
|
fastify.get('/api/user/avatar/:filename', async (request, reply): Promise<any> => {
|
|
59
60
|
try {
|
|
60
61
|
const filename = request.params.filename
|
|
61
|
-
const
|
|
62
|
-
const fileDir = join(
|
|
63
|
-
|
|
62
|
+
const subPath = 'avatar'
|
|
63
|
+
const fileDir = join(BASE_FILE_DIR, subPath)
|
|
64
|
+
console.log("FILE_DIR: ",fileDir, " FILENAME:", filename)
|
|
64
65
|
return reply.sendFile(filename, fileDir)
|
|
65
66
|
} catch (e) {
|
|
66
67
|
console.error(e)
|
package/src/routes/UserRoutes.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {ValidationError} from "@drax/common-back";
|
|
|
4
4
|
import {IdentityPermissions} from "../permissions/IdentityPermissions.js";
|
|
5
5
|
import UnauthorizedError from "../errors/UnauthorizedError.js";
|
|
6
6
|
import BadCredentialsError from "../errors/BadCredentialsError.js";
|
|
7
|
-
import {IDraxPaginateResult} from "@drax/
|
|
7
|
+
import {IDraxPaginateResult} from "@drax/crud-share";
|
|
8
8
|
|
|
9
9
|
async function UserRoutes(fastify, options) {
|
|
10
10
|
fastify.post('/api/auth', async (request, reply) => {
|
|
@@ -2,7 +2,7 @@ import {IRoleRepository} from "../interfaces/IRoleRepository";
|
|
|
2
2
|
import { ZodErrorToValidationError} from "@drax/common-back"
|
|
3
3
|
import {roleSchema} from "../zod/RoleZod.js";
|
|
4
4
|
import {ZodError} from "zod";
|
|
5
|
-
import {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/
|
|
5
|
+
import {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/crud-share";
|
|
6
6
|
import type {IRoleBase, IRole} from "@drax/identity-share";
|
|
7
7
|
|
|
8
8
|
class RoleService {
|
|
@@ -3,7 +3,7 @@ import {ValidationError, ZodErrorToValidationError} from "@drax/common-back"
|
|
|
3
3
|
import {tenantSchema} from "../zod/TenantZod.js";
|
|
4
4
|
import {ZodError} from "zod";
|
|
5
5
|
import {ITenantBase, ITenant} from "@drax/identity-share";
|
|
6
|
-
import {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/
|
|
6
|
+
import {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/crud-share";
|
|
7
7
|
|
|
8
8
|
class TenantService {
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ import {DraxConfig, ValidationError, ZodErrorToValidationError} from "@drax/comm
|
|
|
3
3
|
import {userApiKeySchema} from "../zod/UserApiKeyZod.js";
|
|
4
4
|
import {ZodError} from "zod";
|
|
5
5
|
import {IUserApiKeyBase, IUserApiKey} from "@drax/identity-share";
|
|
6
|
-
import {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/
|
|
6
|
+
import {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/crud-share";
|
|
7
7
|
import crypto from "node:crypto";
|
|
8
8
|
import AuthUtils from "../utils/AuthUtils.js";
|
|
9
9
|
import IdentityConfig from "../config/IdentityConfig.js";
|
|
@@ -5,7 +5,7 @@ import {ValidationError, ZodErrorToValidationError} from "@drax/common-back";
|
|
|
5
5
|
import AuthUtils from "../utils/AuthUtils.js";
|
|
6
6
|
import {createUserSchema, editUserSchema,} from "../zod/UserZod.js";
|
|
7
7
|
import BadCredentialsError from "../errors/BadCredentialsError.js";
|
|
8
|
-
import {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/
|
|
8
|
+
import {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/crud-share";
|
|
9
9
|
|
|
10
10
|
class UserService {
|
|
11
11
|
|
|
@@ -3,7 +3,7 @@ import {equal} from "assert";
|
|
|
3
3
|
import RoleMongoRepository from "../../../src/repository/mongo/RoleMongoRepository";
|
|
4
4
|
import MongoInMemory from "../../db/MongoInMemory";
|
|
5
5
|
import {IRole} from "../../../../identity-share/src/interfaces/IRole";
|
|
6
|
-
import {IDraxPaginateResult} from "@drax/
|
|
6
|
+
import {IDraxPaginateResult} from "@drax/crud-share";
|
|
7
7
|
|
|
8
8
|
describe("RoleRepositoryTest", function() {
|
|
9
9
|
|
|
@@ -5,7 +5,7 @@ import MongoInMemory from "../../db/MongoInMemory";
|
|
|
5
5
|
import RoleMongoInitializer from "../../initializers/RoleMongoInitializer";
|
|
6
6
|
import UserMongoInitializer from "../../initializers/UserMongoInitializer";
|
|
7
7
|
import {IUserApiKey} from "../../../../identity-share/src/interfaces/IUserApiKey";
|
|
8
|
-
import type {IDraxPaginateResult} from "@drax/
|
|
8
|
+
import type {IDraxPaginateResult} from "@drax/crud-share";
|
|
9
9
|
import {mongoose, ValidationError} from "@drax/common-back";
|
|
10
10
|
|
|
11
11
|
|
|
@@ -4,7 +4,7 @@ import UserMongoRepository from "../../../src/repository/mongo/UserMongoReposito
|
|
|
4
4
|
import MongoInMemory from "../../db/MongoInMemory";
|
|
5
5
|
import RoleMongoInitializer from "../../initializers/RoleMongoInitializer";
|
|
6
6
|
import {IUser} from "../../../../identity-share/src/interfaces/IUser";
|
|
7
|
-
import type {IDraxPaginateResult} from "@drax/
|
|
7
|
+
import type {IDraxPaginateResult} from "@drax/crud-share";
|
|
8
8
|
import {mongoose, ValidationError} from "@drax/common-back";
|
|
9
9
|
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {describe,it, before, after} from "node:test"
|
|
2
2
|
import {equal} from "assert";
|
|
3
3
|
import {IRole} from "../../../../identity-share/src/interfaces/IRole";
|
|
4
|
-
import {IDraxPaginateResult} from "@drax/
|
|
4
|
+
import {IDraxPaginateResult} from "@drax/crud-share";
|
|
5
5
|
import RoleSqliteRepository from "../../../src/repository/sqlite/RoleSqliteRepository";
|
|
6
6
|
import {UUID} from "crypto";
|
|
7
7
|
|