@venturialstd/organization 0.0.1 → 0.0.3
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 +910 -678
- package/dist/constants/repository-provider.constant.d.ts +6 -0
- package/dist/constants/repository-provider.constant.d.ts.map +1 -0
- package/dist/constants/repository-provider.constant.js +10 -0
- package/dist/constants/repository-provider.constant.js.map +1 -0
- package/dist/constants/settings-type.constant.d.ts +12 -0
- package/dist/constants/settings-type.constant.d.ts.map +1 -0
- package/dist/constants/settings-type.constant.js +16 -0
- package/dist/constants/settings-type.constant.js.map +1 -0
- package/dist/controllers/organization-repository.controller.d.ts +16 -0
- package/dist/controllers/organization-repository.controller.d.ts.map +1 -0
- package/dist/controllers/organization-repository.controller.js +84 -0
- package/dist/controllers/organization-repository.controller.js.map +1 -0
- package/dist/decorators/organization.decorator.d.ts.map +1 -1
- package/dist/decorators/organization.decorator.js +6 -2
- package/dist/decorators/organization.decorator.js.map +1 -1
- package/dist/dtos/repository-auth.dto.d.ts +6 -0
- package/dist/dtos/repository-auth.dto.d.ts.map +1 -0
- package/dist/dtos/repository-auth.dto.js +28 -0
- package/dist/dtos/repository-auth.dto.js.map +1 -0
- package/dist/entities/organization-settings.entity.d.ts +19 -0
- package/dist/entities/organization-settings.entity.d.ts.map +1 -0
- package/dist/entities/organization-settings.entity.js +124 -0
- package/dist/entities/organization-settings.entity.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/organization.module.d.ts.map +1 -1
- package/dist/organization.module.js +11 -4
- package/dist/organization.module.js.map +1 -1
- package/dist/services/organization-settings.service.d.ts +15 -0
- package/dist/services/organization-settings.service.d.ts.map +1 -0
- package/dist/services/organization-settings.service.js +114 -0
- package/dist/services/organization-settings.service.js.map +1 -0
- package/package.json +42 -42
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.OrganizationSettingsService = void 0;
|
|
16
|
+
const crud_typeorm_1 = require("@dataui/crud-typeorm");
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
19
|
+
const typeorm_2 = require("typeorm");
|
|
20
|
+
const organization_settings_entity_1 = require("../entities/organization-settings.entity");
|
|
21
|
+
let OrganizationSettingsService = class OrganizationSettingsService extends crud_typeorm_1.TypeOrmCrudService {
|
|
22
|
+
organizationSettingsRepo;
|
|
23
|
+
constructor(organizationSettingsRepo) {
|
|
24
|
+
super(organizationSettingsRepo);
|
|
25
|
+
this.organizationSettingsRepo = organizationSettingsRepo;
|
|
26
|
+
}
|
|
27
|
+
async get(organizationId, key) {
|
|
28
|
+
const keyParts = key.split(':');
|
|
29
|
+
if (keyParts.length !== 3) {
|
|
30
|
+
throw new Error('Invalid key format. Expected format: module:section:key');
|
|
31
|
+
}
|
|
32
|
+
const [module, section, configKey] = keyParts;
|
|
33
|
+
const orgSetting = await this.organizationSettingsRepo.findOne({
|
|
34
|
+
where: {
|
|
35
|
+
organizationId,
|
|
36
|
+
module,
|
|
37
|
+
section,
|
|
38
|
+
key: configKey,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
return orgSetting?.value;
|
|
42
|
+
}
|
|
43
|
+
async getManySettings(organizationId, keys) {
|
|
44
|
+
const results = {};
|
|
45
|
+
for (const key of keys) {
|
|
46
|
+
const value = await this.get(organizationId, key);
|
|
47
|
+
if (value !== undefined) {
|
|
48
|
+
results[key] = value;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return results;
|
|
52
|
+
}
|
|
53
|
+
async getAllForOrganization(organizationId, module) {
|
|
54
|
+
const whereClause = { organizationId };
|
|
55
|
+
if (module) {
|
|
56
|
+
whereClause.module = module;
|
|
57
|
+
}
|
|
58
|
+
const orgSettings = await this.organizationSettingsRepo.find({
|
|
59
|
+
where: whereClause,
|
|
60
|
+
order: { sortOrder: 'ASC' },
|
|
61
|
+
});
|
|
62
|
+
return orgSettings;
|
|
63
|
+
}
|
|
64
|
+
async setOrganizationSetting(organizationId, dto) {
|
|
65
|
+
const existingSetting = await this.organizationSettingsRepo.findOne({
|
|
66
|
+
where: {
|
|
67
|
+
organizationId,
|
|
68
|
+
module: dto.module,
|
|
69
|
+
section: dto.section,
|
|
70
|
+
key: dto.key,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
if (existingSetting) {
|
|
74
|
+
return this.organizationSettingsRepo.save({
|
|
75
|
+
...existingSetting,
|
|
76
|
+
...dto,
|
|
77
|
+
organizationId,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return this.organizationSettingsRepo.save({
|
|
81
|
+
...dto,
|
|
82
|
+
organizationId,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
async deleteOrganizationSetting(organizationId, module, section, key) {
|
|
86
|
+
await this.organizationSettingsRepo.delete({
|
|
87
|
+
organizationId,
|
|
88
|
+
module,
|
|
89
|
+
section,
|
|
90
|
+
key,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
async resetModuleSettings(organizationId, module) {
|
|
94
|
+
await this.organizationSettingsRepo.delete({
|
|
95
|
+
organizationId,
|
|
96
|
+
module,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
async bulkUpdateSettings(organizationId, settings) {
|
|
100
|
+
const results = [];
|
|
101
|
+
for (const setting of settings) {
|
|
102
|
+
const result = await this.setOrganizationSetting(organizationId, setting);
|
|
103
|
+
results.push(result);
|
|
104
|
+
}
|
|
105
|
+
return results;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
exports.OrganizationSettingsService = OrganizationSettingsService;
|
|
109
|
+
exports.OrganizationSettingsService = OrganizationSettingsService = __decorate([
|
|
110
|
+
(0, common_1.Injectable)(),
|
|
111
|
+
__param(0, (0, typeorm_1.InjectRepository)(organization_settings_entity_1.OrganizationSettings)),
|
|
112
|
+
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
113
|
+
], OrganizationSettingsService);
|
|
114
|
+
//# sourceMappingURL=organization-settings.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization-settings.service.js","sourceRoot":"","sources":["../../src/services/organization-settings.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uDAA0D;AAC1D,2CAA4C;AAC5C,6CAAmD;AACnD,qCAAkD;AAElD,2FAAgF;AAQzE,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,iCAAwC;IAGpE;IAFnB,YAEmB,wBAA0D;QAE3E,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAFf,6BAAwB,GAAxB,wBAAwB,CAAkC;IAG7E,CAAC;IAQD,KAAK,CAAC,GAAG,CAAC,cAAsB,EAAE,GAAW;QAC3C,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAChC,IAA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A,IAAA,0BAAgB,EAAC,mDAAoB,CAAC,CAAA;qCACI,oBAAU;GAH5C,2BAA2B,CAgKvC"}
|
package/package.json
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@venturialstd/organization",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Organization Management Module for Venturial",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"type": "commonjs",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist"
|
|
10
|
-
],
|
|
11
|
-
"publishConfig": {
|
|
12
|
-
"access": "public"
|
|
13
|
-
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc -p tsconfig.json",
|
|
16
|
-
"prepublishOnly": "npm run build",
|
|
17
|
-
"release:patch": "npm run build && npm version patch --no-git-tag-version && npm publish",
|
|
18
|
-
"test:dev": "ts-node -r tsconfig-paths/register test/main.ts",
|
|
19
|
-
"test:watch": "nodemon --watch src --watch test --ext ts --exec npm run test:dev",
|
|
20
|
-
"migration:generate": "ts-node node_modules/.bin/typeorm migration:generate -d test/data-source.ts test/migrations/$npm_config_name",
|
|
21
|
-
"migration:run": "ts-node node_modules/.bin/typeorm migration:run -d test/data-source.ts",
|
|
22
|
-
"migration:revert": "ts-node node_modules/.bin/typeorm migration:revert -d test/data-source.ts"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@nestjs/config": "^3.0.0",
|
|
26
|
-
"@types/node": "^20.0.0",
|
|
27
|
-
"dotenv": "^17.2.3",
|
|
28
|
-
"nodemon": "^3.0.0",
|
|
29
|
-
"ts-node": "^10.9.0",
|
|
30
|
-
"tsconfig-paths": "^4.2.0",
|
|
31
|
-
"typescript": "^5.9.3"
|
|
32
|
-
},
|
|
33
|
-
"peerDependencies": {
|
|
34
|
-
"@nestjs/common": "^11.0.11",
|
|
35
|
-
"@nestjs/core": "^11.0.5",
|
|
36
|
-
"@nestjs/typeorm": "^10.0.0",
|
|
37
|
-
"@venturialstd/core": "^1.0.16",
|
|
38
|
-
"class-transformer": "^0.5.1",
|
|
39
|
-
"class-validator": "^0.14.1",
|
|
40
|
-
"typeorm": "^0.3.20"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@venturialstd/organization",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"description": "Organization Management Module for Venturial",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "commonjs",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.json",
|
|
16
|
+
"prepublishOnly": "npm run build",
|
|
17
|
+
"release:patch": "npm run build && npm version patch --no-git-tag-version && npm publish",
|
|
18
|
+
"test:dev": "ts-node -r tsconfig-paths/register test/main.ts",
|
|
19
|
+
"test:watch": "nodemon --watch src --watch test --ext ts --exec npm run test:dev",
|
|
20
|
+
"migration:generate": "ts-node node_modules/.bin/typeorm migration:generate -d test/data-source.ts test/migrations/$npm_config_name",
|
|
21
|
+
"migration:run": "ts-node node_modules/.bin/typeorm migration:run -d test/data-source.ts",
|
|
22
|
+
"migration:revert": "ts-node node_modules/.bin/typeorm migration:revert -d test/data-source.ts"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@nestjs/config": "^3.0.0",
|
|
26
|
+
"@types/node": "^20.0.0",
|
|
27
|
+
"dotenv": "^17.2.3",
|
|
28
|
+
"nodemon": "^3.0.0",
|
|
29
|
+
"ts-node": "^10.9.0",
|
|
30
|
+
"tsconfig-paths": "^4.2.0",
|
|
31
|
+
"typescript": "^5.9.3"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@nestjs/common": "^11.0.11",
|
|
35
|
+
"@nestjs/core": "^11.0.5",
|
|
36
|
+
"@nestjs/typeorm": "^10.0.0",
|
|
37
|
+
"@venturialstd/core": "^1.0.16",
|
|
38
|
+
"class-transformer": "^0.5.1",
|
|
39
|
+
"class-validator": "^0.14.1",
|
|
40
|
+
"typeorm": "^0.3.20"
|
|
41
|
+
}
|
|
42
|
+
}
|