itlab-internal-services 2.16.23 → 2.16.24

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.
@@ -82,4 +82,5 @@ export declare class FilesService extends BaseHttpService {
82
82
  uploadAvatarV1(accountId: string, avatar: File): Promise<void>;
83
83
  deleteAvatarV1(accountId: string): Promise<void>;
84
84
  cropImageV1(image: File, options?: CropImageOptionsDtoV1): Promise<Buffer>;
85
+ downloadBlobV1(container: 'file' | 'avatar' | 'pass', blobName: string): Promise<Buffer>;
85
86
  }
@@ -137,6 +137,20 @@ let FilesService = class FilesService extends base_http_service_1.BaseHttpServic
137
137
  throw new common_1.HttpException(data, status);
138
138
  }
139
139
  }
140
+ // ─────────────────────────────────────────────────────────────
141
+ // Storage Blob Methods
142
+ // ─────────────────────────────────────────────────────────────
143
+ async downloadBlobV1(container, blobName) {
144
+ try {
145
+ const { data } = await this.httpClient.get(`v1/internal/blob/${container}/${blobName}`);
146
+ return data;
147
+ }
148
+ catch (error) {
149
+ const { status, data, message } = this.parseError(error);
150
+ this.logger.error(`Error downloading blob: ${message}`);
151
+ throw new common_1.HttpException(data, status);
152
+ }
153
+ }
140
154
  };
141
155
  exports.FilesService = FilesService;
142
156
  exports.FilesService = FilesService = __decorate([
@@ -12,24 +12,23 @@ export type CreateTeamMemberPassDtoV1 = {
12
12
  */
13
13
  memberId: string;
14
14
  /**
15
- * Optional: HTTPS URL pointing to the members avatar image.
16
- * Must be served from a trusted domain for security.
15
+ * Optional: Blobname of the member's avatar.
17
16
  *
18
- * @example 'https://example.com/avatar.jpg'
17
+ * @example 'avatar/507f1f77bcf86cd799439022'
19
18
  */
20
- avatar?: string;
19
+ avatarBlob?: `${'avatar' | 'file'}/${string}`;
21
20
  /**
22
21
  * Full name of the team member, displayed prominently on the pass.
23
22
  *
24
23
  * @example 'John Smith'
25
24
  */
26
- fullName: string;
25
+ name: string;
27
26
  /**
28
- * Email address of the team member.
27
+ * Optional: Email address of the team member.
29
28
  *
30
29
  * @example 'john.smith@example.com'
31
30
  */
32
- email: string;
31
+ email?: string;
33
32
  /**
34
33
  * Descriptive job title or role within the organization.
35
34
  *
@@ -0,0 +1,52 @@
1
+ /**
2
+ * CreateTechScoutPassDtoV1
3
+ *
4
+ * Data structure used to generate a digital Apple Wallet pass for a Tech Scout.
5
+ * Captures personal identity and membership history.
6
+ */
7
+ export type CreateTechScoutPassDtoV1 = {
8
+ /**
9
+ * MongoDB ObjectId uniquely identifying the tech scout.
10
+ *
11
+ * @example '507f1f77bcf86cd799439011'
12
+ */
13
+ techScoutId: string;
14
+ /**
15
+ * Optional: Blobname of the tech-scout's avatar.
16
+ *
17
+ * @example 'avatar/507f1f77bcf86cd799439022'
18
+ */
19
+ avatarBlob?: `${'avatar' | 'file'}/${string}`;
20
+ /**
21
+ * Full name of the member as it should appear on the digital pass.
22
+ *
23
+ * @example 'Jane Doe'
24
+ */
25
+ name: string;
26
+ /**
27
+ * Email address used to identify and contact the guild member.
28
+ *
29
+ * @example 'jane.doe@example.com'
30
+ */
31
+ email: string;
32
+ /**
33
+ * Department of the tech scout
34
+ *
35
+ * @example IGF1
36
+ */
37
+ department: string;
38
+ /**
39
+ * Optional: Role of the tech scout
40
+ *
41
+ * @example Developer
42
+ */
43
+ role?: string;
44
+ /**
45
+ * Timestamp when the member joined.
46
+ */
47
+ memberSince: number;
48
+ /**
49
+ * Timestamp when the member left.
50
+ */
51
+ memberUntil?: number;
52
+ };
@@ -1,2 +1,2 @@
1
- export * from './create-guild-member-pass.dto.v1';
2
1
  export * from './create-team-member-pass.dto.v1';
2
+ export * from './create-tech-scout-pass.dto.v1';
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./create-guild-member-pass.dto.v1"), exports);
18
17
  __exportStar(require("./create-team-member-pass.dto.v1"), exports);
18
+ __exportStar(require("./create-tech-scout-pass.dto.v1"), exports);
@@ -1,8 +1,8 @@
1
- import { CreateGuildMemberPassDtoV1, CreateTeamMemberPassDtoV1 } from './dtos';
1
+ import { CreateTeamMemberPassDtoV1, CreateTechScoutPassDtoV1 } from './dtos';
2
2
  /**
3
3
  * Constant list of supported digital pass types.
4
4
  */
5
- declare const supportedPassTypes: readonly ["team-member", "guild-member"];
5
+ declare const supportedPassTypes: readonly ["v1.team-member", "v1.tech-scout"];
6
6
  /**
7
7
  * Union type representing valid pass types.
8
8
  */
@@ -12,7 +12,8 @@ export type PassType = (typeof supportedPassTypes)[number];
12
12
  * This enables type-safe payload handling when creating passes.
13
13
  */
14
14
  export type PassTypeDtoMap = {
15
- 'team-member': CreateTeamMemberPassDtoV1;
16
- 'guild-member': CreateGuildMemberPassDtoV1;
15
+ 'v1.team-member': CreateTeamMemberPassDtoV1;
16
+ 'v1.tech-scout': CreateTechScoutPassDtoV1;
17
17
  };
18
+ export declare const PassTypeEndpointMap: Record<PassType, string>;
18
19
  export {};
@@ -1,7 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PassTypeEndpointMap = void 0;
3
4
  /**
4
5
  * Constant list of supported digital pass types.
5
6
  */
6
7
  // eslint-disable-next-line
7
- const supportedPassTypes = ['team-member', 'guild-member'];
8
+ const supportedPassTypes = ['v1.team-member', 'v1.tech-scout'];
9
+ exports.PassTypeEndpointMap = {
10
+ 'v1.team-member': 'v1/internal/team-member',
11
+ 'v1.tech-scout': 'v1/internal/tech-scout',
12
+ };
@@ -1,8 +1,7 @@
1
1
  import { ConfigService } from '@nestjs/config';
2
2
  import { AuthenticationModuleOptions } from '../../../authentication';
3
3
  import { BaseHttpService } from '../../base-http.service';
4
- import { CreateGuildMemberPassDtoV1, CreateTeamMemberPassDtoV1 } from './dtos';
5
- import { PassType, PassTypeDtoMap } from './pass-types';
4
+ import { CreateTeamMemberPassDtoV1, CreateTechScoutPassDtoV1 } from './dtos';
6
5
  /**
7
6
  * PassService
8
7
  *
@@ -19,80 +18,37 @@ export declare class PassService extends BaseHttpService {
19
18
  */
20
19
  constructor(authenticationOptions: AuthenticationModuleOptions, configService: ConfigService);
21
20
  /**
22
- * Fetches a digital pass by its serial number.
21
+ * Creates a pass of the given type with the provided payload
23
22
  *
24
- * @param {string} serialNumber - Unique serial number of the pass.
25
- * @returns {Promise<string>} - Returns the SAS URL of the pass.
23
+ * @template Type - One of the supported PassType keys
24
+ * @param type - The type of the pass to create
25
+ * @param payload - The payload DTO corresponding to the type
26
26
  */
27
- getPassBySerialV1(serialNumber: string): Promise<string>;
27
+ private createPass;
28
28
  /**
29
- * Deletes a digital pass by its serial number.
30
- *
31
- * @param {string} serialNumber - Unique serial number of the pass.
32
- */
33
- deletePassBySerialV1(serialNumber: string): void;
34
- /**
35
- * Fetches a pass based on its type and associated member ID.
36
- *
37
- * @param {PassType} type - Type of the pass.
38
- * @param {string} memberId - Identifier of the associated member.
39
- * @returns {Promise<string>} - Returns the SAS URL of the pass.
40
- */
41
- private getPassByTypeV1;
42
- /**
43
- * Deletes a pass based on its type and associated member ID.
44
- *
45
- * @param {PassType} type - Type of the pass.
46
- * @param {string} memberId - Identifier of the associated member.
47
- */
48
- private deletePassByTypeV1;
49
- /**
50
- * Creates a pass using its type and corresponding payload DTO.
51
- *
52
- * @template Type - A specific pass type from PassType.
53
- * @param {Type} type - Type of the pass to create.
54
- * @param {PassTypeDtoMap[Type]} payload - DTO matching the type of pass.
55
- * @returns {Promise<string>} - The resulting pass URL or identifier.
29
+ * Deletes a pass of the given type with the provided passId
30
+ * @param type - The type of the pass to delete
31
+ * @param passId - The ID of the pass to delete
56
32
  */
57
- createPassV1<Type extends PassType>(type: Type, payload: PassTypeDtoMap[Type]): Promise<string>;
33
+ private deletePass;
58
34
  /**
59
- * Retrieves the digital pass for a specific team member.
60
- *
61
- * @param {string} memberId - Identifier of the team member.
62
- * @returns {Promise<string>} - SAS URL of the team member's pass.
63
- */
64
- getTeamMemberPassV1(memberId: string): Promise<string>;
65
- /**
66
- * Creates a pass for a team member.
67
- *
68
- * @param {CreateTeamMemberPassDtoV1} data - Required details to generate the team member pass.
69
- * @returns {Promise<string>} - URL or ID of the created pass.
70
- */
71
- createTeamMemberPassV1(data: CreateTeamMemberPassDtoV1): Promise<string>;
72
- /**
73
- * Deletes a team member’s pass.
74
- *
75
- * @param {string} memberId - Identifier of the team member.
35
+ * Creates a team-member pass
36
+ * @param {CreateTeamMemberPassDtoV1} payload - DTO containing relevant data
76
37
  */
77
- deleteTeamMemberPassV1(memberId: string): void;
38
+ createTeamMemberPassV1(payload: CreateTeamMemberPassDtoV1): void;
78
39
  /**
79
- * Retrieves the digital pass for a specific guild member.
80
- *
81
- * @param {string} memberId - Identifier of the guild member.
82
- * @returns {Promise<string>} - SAS URL of the guild member's pass.
40
+ * Deletes a team-member pass
41
+ * @param {string} passId - The ID of the pass to delete
83
42
  */
84
- getGuildMemberPassV1(memberId: string): Promise<string>;
43
+ deleteTeamMemberPassV1(passId: string): void;
85
44
  /**
86
- * Creates a pass for a guild member.
87
- *
88
- * @param {CreateGuildMemberPassDtoV1} data - Required details to generate the guild member pass.
89
- * @returns {Promise<string>} - URL or ID of the created pass.
45
+ * Creates a tech-scout pass
46
+ * @param {CreateTechScoutPassDtoV1} payload - DTO containing relevant data
90
47
  */
91
- createGuildMemberPassV1(data: CreateGuildMemberPassDtoV1): Promise<string>;
48
+ createTechScoutPassV1(payload: CreateTechScoutPassDtoV1): void;
92
49
  /**
93
- * Deletes a guild member’s pass.
94
- *
95
- * @param {string} memberId - Identifier of the guild member.
50
+ * Deletes a tech-scout pass
51
+ * @param {string} passId - The ID of the pass to delete
96
52
  */
97
- deleteGuildMemberPassV1(memberId: string): void;
53
+ deleteTechScoutPassV1(passId: string): void;
98
54
  }
@@ -18,6 +18,7 @@ const config_1 = require("@nestjs/config");
18
18
  const authentication_1 = require("../../../authentication");
19
19
  const base_http_service_1 = require("../../base-http.service");
20
20
  const base_urls_1 = require("../../base-urls");
21
+ const pass_types_1 = require("./pass-types");
21
22
  /**
22
23
  * PassService
23
24
  *
@@ -35,161 +36,75 @@ let PassService = class PassService extends base_http_service_1.BaseHttpService
35
36
  constructor(authenticationOptions, configService) {
36
37
  super('Pass', base_urls_1.BaseUrls.passService, authenticationOptions, configService);
37
38
  }
38
- // ─────────────────────────────────────────────
39
- // Serial Number-Based Operations
40
- // ─────────────────────────────────────────────
41
- /**
42
- * Fetches a digital pass by its serial number.
43
- *
44
- * @param {string} serialNumber - Unique serial number of the pass.
45
- * @returns {Promise<string>} - Returns the SAS URL of the pass.
46
- */
47
- async getPassBySerialV1(serialNumber) {
48
- try {
49
- const { data } = await this.httpClient.get(`v1/internal/pass/${serialNumber}`);
50
- this.logger.log(`Pass retrieved using serial: ${serialNumber}`);
51
- return data;
52
- }
53
- catch (error) {
54
- const { status, data, message } = this.parseError(error);
55
- this.logger.error(`Error retrieving pass with serial ${serialNumber}: ${message}`);
56
- throw new common_1.HttpException(data, status);
57
- }
58
- }
59
39
  /**
60
- * Deletes a digital pass by its serial number.
40
+ * Creates a pass of the given type with the provided payload
61
41
  *
62
- * @param {string} serialNumber - Unique serial number of the pass.
42
+ * @template Type - One of the supported PassType keys
43
+ * @param type - The type of the pass to create
44
+ * @param payload - The payload DTO corresponding to the type
63
45
  */
64
- deletePassBySerialV1(serialNumber) {
46
+ createPass(type, payload) {
47
+ this.logger.log(`Creating pass ${type}`);
65
48
  this.httpClient
66
- .delete(`v1/internal/pass/${serialNumber}`)
49
+ .post(pass_types_1.PassTypeEndpointMap[type], payload)
67
50
  .then(() => {
68
- this.logger.log(`Pass deleted for serial: ${serialNumber}`);
51
+ this.logger.log(`${type} pass created successfully`);
69
52
  })
70
53
  .catch((error) => {
71
54
  const { message } = this.parseError(error);
72
- this.logger.error(`Error deleting pass with serial ${serialNumber}: ${message}`);
55
+ this.logger.error(`Failed to create ${type} pass: ${message}`);
73
56
  });
74
57
  }
75
- // ─────────────────────────────────────────────
76
- // Type/Member-Based Operations
77
- // ─────────────────────────────────────────────
78
58
  /**
79
- * Fetches a pass based on its type and associated member ID.
80
- *
81
- * @param {PassType} type - Type of the pass.
82
- * @param {string} memberId - Identifier of the associated member.
83
- * @returns {Promise<string>} - Returns the SAS URL of the pass.
59
+ * Deletes a pass of the given type with the provided passId
60
+ * @param type - The type of the pass to delete
61
+ * @param passId - The ID of the pass to delete
84
62
  */
85
- async getPassByTypeV1(type, memberId) {
86
- const endpoint = `v1/internal/${type}/${memberId}`;
87
- try {
88
- const { data } = await this.httpClient.get(endpoint);
89
- this.logger.log(`Pass retrieved for ${type} member ID: ${memberId}`);
90
- return data;
91
- }
92
- catch (error) {
93
- const { status, data, message } = this.parseError(error);
94
- this.logger.error(`Error retrieving ${type} pass for ${memberId}: ${message}`);
95
- throw new common_1.HttpException(data, status);
96
- }
97
- }
98
- /**
99
- * Deletes a pass based on its type and associated member ID.
100
- *
101
- * @param {PassType} type - Type of the pass.
102
- * @param {string} memberId - Identifier of the associated member.
103
- */
104
- deletePassByTypeV1(type, memberId) {
105
- const endpoint = `v1/internal/${type}/${memberId}`;
63
+ deletePass(type, passId) {
64
+ this.logger.log(`Deleting pass ${type} ${passId}`);
106
65
  this.httpClient
107
- .delete(endpoint)
66
+ .delete(`${pass_types_1.PassTypeEndpointMap[type]}/${passId}`)
108
67
  .then(() => {
109
- this.logger.log(`Pass deleted for ${type} member ID: ${memberId}`);
68
+ this.logger.log(`${type} ${passId} pass deleted successfully`);
110
69
  })
111
70
  .catch((error) => {
112
71
  const { message } = this.parseError(error);
113
- this.logger.error(`Error deleting ${type} pass for ${memberId}: ${message}`);
72
+ this.logger.error(`Failed to delete ${type} ${passId} pass: ${message}`);
114
73
  });
115
74
  }
116
- /**
117
- * Creates a pass using its type and corresponding payload DTO.
118
- *
119
- * @template Type - A specific pass type from PassType.
120
- * @param {Type} type - Type of the pass to create.
121
- * @param {PassTypeDtoMap[Type]} payload - DTO matching the type of pass.
122
- * @returns {Promise<string>} - The resulting pass URL or identifier.
123
- */
124
- async createPassV1(type, payload) {
125
- try {
126
- const { data } = await this.httpClient.post(`v1/internal/${type}`, payload);
127
- this.logger.log(`Pass successfully created for ${type}`);
128
- return data;
129
- }
130
- catch (error) {
131
- const { status, data, message } = this.parseError(error);
132
- this.logger.error(`Error creating pass for ${type}: ${message}`);
133
- throw new common_1.HttpException(data, status);
134
- }
135
- }
136
75
  // ─────────────────────────────────────────────
137
- // Team Member Pass Helpers
76
+ // Team Member Pass
138
77
  // ─────────────────────────────────────────────
139
78
  /**
140
- * Retrieves the digital pass for a specific team member.
141
- *
142
- * @param {string} memberId - Identifier of the team member.
143
- * @returns {Promise<string>} - SAS URL of the team member's pass.
144
- */
145
- async getTeamMemberPassV1(memberId) {
146
- return this.getPassByTypeV1('team-member', memberId);
147
- }
148
- /**
149
- * Creates a pass for a team member.
150
- *
151
- * @param {CreateTeamMemberPassDtoV1} data - Required details to generate the team member pass.
152
- * @returns {Promise<string>} - URL or ID of the created pass.
79
+ * Creates a team-member pass
80
+ * @param {CreateTeamMemberPassDtoV1} payload - DTO containing relevant data
153
81
  */
154
- async createTeamMemberPassV1(data) {
155
- return this.createPassV1('team-member', data);
82
+ createTeamMemberPassV1(payload) {
83
+ this.createPass('v1.team-member', payload);
156
84
  }
157
85
  /**
158
- * Deletes a team member’s pass.
159
- *
160
- * @param {string} memberId - Identifier of the team member.
86
+ * Deletes a team-member pass
87
+ * @param {string} passId - The ID of the pass to delete
161
88
  */
162
- deleteTeamMemberPassV1(memberId) {
163
- this.deletePassByTypeV1('team-member', memberId);
89
+ deleteTeamMemberPassV1(passId) {
90
+ this.deletePass('v1.team-member', passId);
164
91
  }
165
92
  // ─────────────────────────────────────────────
166
- // Guild Member Pass Helpers
93
+ // Tech Scout Pass
167
94
  // ─────────────────────────────────────────────
168
95
  /**
169
- * Retrieves the digital pass for a specific guild member.
170
- *
171
- * @param {string} memberId - Identifier of the guild member.
172
- * @returns {Promise<string>} - SAS URL of the guild member's pass.
96
+ * Creates a tech-scout pass
97
+ * @param {CreateTechScoutPassDtoV1} payload - DTO containing relevant data
173
98
  */
174
- async getGuildMemberPassV1(memberId) {
175
- return this.getPassByTypeV1('guild-member', memberId);
99
+ createTechScoutPassV1(payload) {
100
+ this.createPass('v1.tech-scout', payload);
176
101
  }
177
102
  /**
178
- * Creates a pass for a guild member.
179
- *
180
- * @param {CreateGuildMemberPassDtoV1} data - Required details to generate the guild member pass.
181
- * @returns {Promise<string>} - URL or ID of the created pass.
182
- */
183
- async createGuildMemberPassV1(data) {
184
- return this.createPassV1('guild-member', data);
185
- }
186
- /**
187
- * Deletes a guild member’s pass.
188
- *
189
- * @param {string} memberId - Identifier of the guild member.
103
+ * Deletes a tech-scout pass
104
+ * @param {string} passId - The ID of the pass to delete
190
105
  */
191
- deleteGuildMemberPassV1(memberId) {
192
- this.deletePassByTypeV1('guild-member', memberId);
106
+ deleteTechScoutPassV1(passId) {
107
+ this.deletePass('v1.tech-scout', passId);
193
108
  }
194
109
  };
195
110
  exports.PassService = PassService;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Timo Scheuermann",
5
5
  "email": "timo.scheuermann@sv-informatik.de"
6
6
  },
7
- "version": "2.16.23",
7
+ "version": "2.16.24",
8
8
  "type": "commonjs",
9
9
  "files": [
10
10
  "dist"
@@ -35,7 +35,7 @@
35
35
  "cache-manager": "^7.2.4",
36
36
  "class-transformer": "^0.5.1",
37
37
  "class-validator": "^0.14.2",
38
- "itlab-functions": "^1.0.13",
38
+ "itlab-functions": "1.0.15",
39
39
  "mongoose": "^8.19.2",
40
40
  "rxjs": "^7.8.2"
41
41
  },
@@ -1,33 +0,0 @@
1
- /**
2
- * CreateGuildMemberPassDtoV1
3
- *
4
- * Data structure used to generate a digital Apple Wallet pass for a Technology Guild member.
5
- * Captures personal identity and membership history.
6
- */
7
- export type CreateGuildMemberPassDtoV1 = {
8
- /**
9
- * MongoDB ObjectId uniquely identifying the guild member.
10
- *
11
- * @example '507f1f77bcf86cd799439011'
12
- */
13
- memberId: string;
14
- /**
15
- * Full legal name of the member as it should appear on the digital pass.
16
- *
17
- * @example 'Jane Doe'
18
- */
19
- fullName: string;
20
- /**
21
- * Email address used to identify and contact the guild member.
22
- *
23
- * @example 'jane.doe@example.com'
24
- */
25
- email: string;
26
- /**
27
- * Human-readable date string indicating when the member joined.
28
- * Format should be: 'Month Year' (e.g., 'June 2020').
29
- *
30
- * @example 'June 2020'
31
- */
32
- memberSince: string;
33
- };