@alacard-project/shared 1.0.7 → 1.0.10

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.
@@ -8,6 +8,7 @@ export declare const ENV_KEYS: {
8
8
  readonly KAFKA_BROKERS: "KAFKA_BROKERS";
9
9
  readonly JWT_SECRET: "JWT_SECRET";
10
10
  readonly JWT_EXPIRES_IN: "JWT_EXPIRES_IN";
11
+ readonly JWT_REFRESH_SECRET: "JWT_REFRESH_SECRET";
11
12
  readonly JWT_REFRESH_EXPIRES_IN: "JWT_REFRESH_EXPIRES_IN";
12
13
  readonly GRPC_PORT: "GRPC_PORT";
13
14
  readonly GRPC_URL: "GRPC_URL";
@@ -11,6 +11,7 @@ exports.ENV_KEYS = {
11
11
  KAFKA_BROKERS: 'KAFKA_BROKERS',
12
12
  JWT_SECRET: 'JWT_SECRET',
13
13
  JWT_EXPIRES_IN: 'JWT_EXPIRES_IN',
14
+ JWT_REFRESH_SECRET: 'JWT_REFRESH_SECRET',
14
15
  JWT_REFRESH_EXPIRES_IN: 'JWT_REFRESH_EXPIRES_IN',
15
16
  GRPC_PORT: 'GRPC_PORT',
16
17
  GRPC_URL: 'GRPC_URL',
@@ -1 +1 @@
1
- {"version":3,"file":"env.constants.js","sourceRoot":"","sources":["../../src/constants/env.constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;IACpB,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MAAM;IACZ,YAAY,EAAE,cAAc;IAC5B,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,YAAY;IACxB,cAAc,EAAE,gBAAgB;IAChC,aAAa,EAAE,eAAe;IAC9B,UAAU,EAAE,YAAY;IACxB,cAAc,EAAE,gBAAgB;IAChC,sBAAsB,EAAE,wBAAwB;IAChD,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;IAEpB,kBAAkB,EAAE,oBAAoB;IACxC,eAAe,EAAE,iBAAiB;IAClC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E,mBAAmB;IACtC,eAAe,EAAE,iBAAiB;IAClC,sBAAsB,EAAE,wBAAwB;IAChD,gBAAgB,EAAE,kBAAkB;IAEpC,mBAAmB,EAAE,qBAAqB;IAC1C,kBAAkB,EAAE,oBAAoB;IACxC,gBAAgB,EAAE,kBAAkB;IACpC,gBAAgB,EAAE,kBAAkB;IACpC,wBAAwB,EAAE,0BAA0B;IACpD,iBAAiB,EAAE,mBAAmB;IAEtC,sBAAsB,EAAE,wBAAwB;IAChD,mBAAmB,EAAE,qBAAqB;IAC1C,cAAc,EAAE,gBAAgB;IAChC,cAAc,EAAE,gBAAgB;IAEhC,aAAa,EAAE,eAAe;IAC9B,kBAAkB,EAAE,oBAAoB;IACxC,YAAY,EAAE,cAAc;CACtB,CAAC;AAEE,QAAA,UAAU,GAAG;IACtB,QAAQ,EAAE;QACN,WAAW,EAAE,aAAa;QAC1B,UAAU,EAAE,YAAY;QACxB,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,SAAS;QAClB,KAAK,EAAE,OAAO;KACjB;CACK,CAAC"}
@@ -18,13 +18,14 @@ export declare const GRPC_METHODS: {
18
18
  readonly AUTH: {
19
19
  readonly SERVICE: "AuthService";
20
20
  readonly LOGIN: "Login";
21
- readonly REGISTER: "Register";
21
+ readonly CREATE_IDENTITY: "CreateIdentity";
22
22
  readonly VALIDATE: "Validate";
23
23
  readonly GET_USER_BY_ID: "GetUserById";
24
24
  readonly GET_USER_BY_EMAIL: "GetUserByEmail";
25
25
  readonly VALIDATE_TOKEN: "ValidateToken";
26
26
  readonly REFRESH_TOKEN: "RefreshToken";
27
27
  readonly REVOKE_TOKEN: "RevokeToken";
28
+ readonly GENERATE_TOKENS: "GenerateTokens";
28
29
  readonly CHECK_PERMISSION: "CheckPermission";
29
30
  readonly GET_USER_PERMISSIONS: "GetUserPermissions";
30
31
  };
@@ -21,13 +21,14 @@ exports.GRPC_METHODS = {
21
21
  AUTH: {
22
22
  SERVICE: 'AuthService',
23
23
  LOGIN: 'Login',
24
- REGISTER: 'Register',
24
+ CREATE_IDENTITY: 'CreateIdentity',
25
25
  VALIDATE: 'Validate',
26
26
  GET_USER_BY_ID: 'GetUserById',
27
27
  GET_USER_BY_EMAIL: 'GetUserByEmail',
28
28
  VALIDATE_TOKEN: 'ValidateToken',
29
29
  REFRESH_TOKEN: 'RefreshToken',
30
30
  REVOKE_TOKEN: 'RevokeToken',
31
+ GENERATE_TOKENS: 'GenerateTokens',
31
32
  CHECK_PERMISSION: 'CheckPermission',
32
33
  GET_USER_PERMISSIONS: 'GetUserPermissions',
33
34
  },
@@ -1 +1 @@
1
- {"version":3,"file":"grpc.constants.js","sourceRoot":"","sources":["../../src/constants/grpc.constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IACzB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;CACR,CAAC;AAEE,QAAA,YAAY,GAAG;IACxB,OAAO,EAAE;QACL,OAAO,EAAE,gBAAgB;QACzB,SAAS,EAAE,UAAU;QACrB,eAAe,EAAE,eAAe;QAChC,qBAAqB,EAAE,qBAAqB;QAC5C,gBAAgB,EAAE,gBAAgB;QAClC,kBAAkB,EAAE,kBAAkB;QACtC,gBAAgB,EAAE,gBAAgB;KACrC;IACD,IAAI,EAAE;QACF,OAAO,EAAE,aAAa;QACtB,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,UAAU;QACpB,cAAc,EAAE,aAAa;QAC7B,iBAAiB,EAAE,gBAAgB;QACnC,cAAc,EAAE,eAAe;QAC/B,aAAa,EAAE,cAAc;QAC7B,YAAY,EAAE,aAAa;QAC3B,gBAAgB,EAAE,iBAAiB;QACnC,oBAAoB,EAAE,oBAAoB;KAC7C;IACD,IAAI,EAAE;QACF,OAAO,EAAE,aAAa;QACtB,cAAc,EAAE,aAAa;QAC7B,iBAA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7 @@
1
1
  import { Observable } from 'rxjs';
2
- import { RegisterDto, LoginDto } from '../dto/auth.dto';
2
+ import { LoginDto } from '../dto/auth.dto';
3
3
  import { JwtTokens } from '../types/auth.types';
4
+ import { GenerateTokensRequest } from './token.contract';
4
5
  export interface GetUserByIdGrpcRequest {
5
6
  userId: string;
6
7
  }
@@ -41,6 +42,13 @@ export interface CheckPermissionGrpcResponse {
41
42
  export interface GetUserPermissionsGrpcRequest {
42
43
  userId: string;
43
44
  }
45
+ export interface CreateIdentityRequest {
46
+ email: string;
47
+ password: string;
48
+ name?: string;
49
+ userId: string;
50
+ role: string;
51
+ }
44
52
  export interface GetUserPermissionsGrpcResponse {
45
53
  userId: string;
46
54
  permissions: Array<{
@@ -53,18 +61,30 @@ export interface CreateUserRequest {
53
61
  userId?: string;
54
62
  email: string;
55
63
  role: string;
64
+ password?: string;
56
65
  firstName?: string;
57
66
  lastName?: string;
58
- password?: string;
67
+ middleName?: string;
68
+ position?: string;
69
+ department?: string;
70
+ companyName?: string;
71
+ taxId?: string;
72
+ contactPhone?: string;
59
73
  }
60
74
  export interface UpdateUserRequest {
61
75
  userId: string;
62
76
  email?: string;
63
77
  role?: string;
64
- firstName?: string;
65
- lastName?: string;
66
78
  password?: string;
67
79
  isActive?: boolean;
80
+ firstName?: string;
81
+ lastName?: string;
82
+ middleName?: string;
83
+ position?: string;
84
+ department?: string;
85
+ companyName?: string;
86
+ taxId?: string;
87
+ contactPhone?: string;
68
88
  }
69
89
  export interface UpdateProfileRequest {
70
90
  userId: string;
@@ -90,9 +110,10 @@ export type DeleteUserResponse = {
90
110
  success: boolean;
91
111
  };
92
112
  export interface IAuthService {
93
- loginGrpc(data: LoginDto): Observable<JwtTokens>;
94
- registerGrpc(data: RegisterDto): Observable<any>;
95
- validateGrpc(data: {
113
+ login(data: LoginDto): Observable<JwtTokens>;
114
+ generateTokens(data: GenerateTokensRequest): Observable<JwtTokens>;
115
+ createIdentity(data: CreateIdentityRequest): Observable<any>;
116
+ validate(data: {
96
117
  token: string;
97
118
  }): Observable<{
98
119
  valid: boolean;
@@ -100,11 +121,11 @@ export interface IAuthService {
100
121
  email?: string;
101
122
  role?: string;
102
123
  }>;
103
- validateTokenGrpc(data: ValidateTokenGrpcRequest): Observable<ValidateTokenGrpcResponse>;
104
- refreshTokenGrpc(data: RefreshTokenGrpcRequest): Observable<JwtTokens>;
105
- revokeTokenGrpc(data: RevokeTokenGrpcRequest): Observable<RevokeTokenGrpcResponse>;
106
- checkPermissionGrpc(data: CheckPermissionGrpcRequest): Observable<CheckPermissionGrpcResponse>;
107
- getUserPermissionsGrpc(data: GetUserPermissionsGrpcRequest): Observable<GetUserPermissionsGrpcResponse>;
108
- getUserByIdGrpc(data: GetUserByIdGrpcRequest): Observable<GetUserByIdGrpcResponse>;
109
- getUserByEmailGrpc(data: GetUserByEmailGrpcRequest): Observable<GetUserByEmailGrpcResponse>;
124
+ validateToken(data: ValidateTokenGrpcRequest): Observable<ValidateTokenGrpcResponse>;
125
+ refreshToken(data: RefreshTokenGrpcRequest): Observable<JwtTokens>;
126
+ revokeToken(data: RevokeTokenGrpcRequest): Observable<RevokeTokenGrpcResponse>;
127
+ checkPermission(data: CheckPermissionGrpcRequest): Observable<CheckPermissionGrpcResponse>;
128
+ getUserPermissions(data: GetUserPermissionsGrpcRequest): Observable<GetUserPermissionsGrpcResponse>;
129
+ getUserById(data: GetUserByIdGrpcRequest): Observable<GetUserByIdGrpcResponse>;
130
+ getUserByEmail(data: GetUserByEmailGrpcRequest): Observable<GetUserByEmailGrpcResponse>;
110
131
  }
@@ -1,4 +1,4 @@
1
1
  export * from './config.contract';
2
2
  export * from './logging.contract';
3
3
  export * from './auth.contract';
4
- export * from './token.contract';
4
+ export type { GenerateTokensRequest, TokensResponse, ITokenService, ValidateTokenRequest, ValidateTokenResponse, RefreshTokensRequest, RevokeTokenRequest, RevokeTokenResponse } from './token.contract';
@@ -17,5 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./config.contract"), exports);
18
18
  __exportStar(require("./logging.contract"), exports);
19
19
  __exportStar(require("./auth.contract"), exports);
20
- __exportStar(require("./token.contract"), exports);
21
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,qDAAmC;AACnC,kDAAgC;AAChC,mDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,qDAAmC;AACnC,kDAAgC"}
@@ -15,24 +15,31 @@ export interface UserResponse {
15
15
  id: string;
16
16
  email: string;
17
17
  role: UserRole;
18
- firstName: string;
19
- lastName: string;
20
- middleName?: string;
21
- name?: string;
22
18
  isActive: boolean;
19
+ status: string;
23
20
  createdAt?: string;
24
21
  updatedAt?: string;
25
- password?: string;
22
+ firstName?: string;
23
+ lastName?: string;
24
+ middleName?: string;
26
25
  shortName?: string;
26
+ position?: string;
27
+ department?: string;
27
28
  internalPhone?: string;
28
29
  mobilePhone?: string;
29
30
  facsimileSignature?: string;
31
+ companyName?: string;
32
+ taxId?: string;
33
+ address?: string;
34
+ contactPhone?: string;
35
+ avatar?: string;
30
36
  }
31
37
  export interface UserProfileDto {
32
38
  id: string;
33
39
  email: string;
34
40
  role: string;
35
41
  isActive: boolean;
42
+ status: string;
36
43
  createdAt: Date;
37
44
  updatedAt: Date;
38
45
  fullName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.dto.js","sourceRoot":"","sources":["../../src/dto/auth.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmF;AACnF,kDAA8C;AAE9C,MAAa,WAAW;CAuBvB;AAvBD,kCAuBC;AArBG;IADC,IAAA,yBAAO,GAAE;;0CACK;AAIf;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS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IhB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;8CACM;AAInB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;6CACK;AAIlB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;2CACG;AAGpB,MAAa,QAAQ;CAMpB;AAND,4BAMC;AAJG;IADC,IAAA,yBAAO,GAAE;;uCACK;AAGf;IADC,IAAA,0BAAQ,GAAE;;0CACO;AAgDtB,MAAa,iBAAiB;CAM7B;AAND,8CAMC;AAJG;IADC,IAAA,yBAAO,GAAE;;gDACK;AAGf;IADC,IAAA,wBAAM,EAAC,oBAAQ,CAAC;;+CACD;AAGpB,MAAa,oBAAqB,SAAQ,WAAW;CAGpD;AAHD,oDAGC;AADG;IADC,IAAA,0BAAQ,GAAE;;mDACI;AAGnB,MAAa,wBAAwB;CAGpC;AAHD,4DAGC;AADG;IADC,IAAA,yBAAO,GAAE;;uDACK;AAGnB,MAAa,wBAAwB;CAOpC;AAPD,4DAOC;AALG;IADC,IAAA,0BAAQ,GAAE;;uDACI;AAIf;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,CAAC;;6DACQ"}
@@ -4,8 +4,7 @@ export declare enum UserRole {
4
4
  MANAGER = "MANAGER",
5
5
  ACCOUNTANT = "ACCOUNTANT",
6
6
  PARTNER = "PARTNER",
7
- CLIENT = "CLIENT",
8
- USER = "USER"
7
+ CLIENT = "CLIENT"
9
8
  }
10
9
  export declare enum UserStatus {
11
10
  ACTIVE = "ACTIVE",
@@ -9,7 +9,6 @@ var UserRole;
9
9
  UserRole["ACCOUNTANT"] = "ACCOUNTANT";
10
10
  UserRole["PARTNER"] = "PARTNER";
11
11
  UserRole["CLIENT"] = "CLIENT";
12
- UserRole["USER"] = "USER";
13
12
  })(UserRole || (exports.UserRole = UserRole = {}));
14
13
  var UserStatus;
15
14
  (function (UserStatus) {
@@ -1 +1 @@
1
- {"version":3,"file":"user.enum.js","sourceRoot":"","sources":["../../src/enums/user.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAQX;AARD,WAAY,QAAQ;IAChB,uCAA2B,CAAA;IAC3B,2BAAe,CAAA;IACf,+BAAmB,CAAA;IACnB,qCAAyB,CAAA;IACzB,+BAAmB,CAAA;IACnB,6BAAiB,CAAA;IACjB,yBAAa,CAAA;AACjB,CAAC,EARW,QAAQ,wBAAR,QAAQ,QAQnB;AAED,IAAY,UAMX;AAND,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,mCAAqB,CAAA;IACrB,iCAAmB,CAAA;IACnB,qCAAuB,CAAA;IACvB,iCAAmB,CAAA;AACvB,CAAC,EANW,UAAU,0BAAV,UAAU,QAMrB;AAED,IAAY,SASX;AATD,WAAY,SAAS;IACjB,0BAAa,CAAA;IACb,4BAAe,CAAA;IACf,8BAAiB,CAAA;IACjB,4BAAe,CAAA;IACf,0CAA6B,CAAA;IAC7B,sCAAyB,CAAA;IACzB,oDAAuC,CAAA;IACvC,oCAAuB,CAAA;AAC3B,CAAC,EATW,SAAS,yBAAT,SAAS,QASpB"}
1
+ {"version":3,"file":"user.enum.js","sourceRoot":"","sources":["../../src/enums/user.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAOX;AAPD,WAAY,QAAQ;IAChB,uCAA2B,CAAA;IAC3B,2BAAe,CAAA;IACf,+BAAmB,CAAA;IACnB,qCAAyB,CAAA;IACzB,+BAAmB,CAAA;IACnB,6BAAiB,CAAA;AACrB,CAAC,EAPW,QAAQ,wBAAR,QAAQ,QAOnB;AAED,IAAY,UAMX;AAND,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,mCAAqB,CAAA;IACrB,iCAAmB,CAAA;IACnB,qCAAuB,CAAA;IACvB,iCAAmB,CAAA;AACvB,CAAC,EANW,UAAU,0BAAV,UAAU,QAMrB;AAED,IAAY,SASX;AATD,WAAY,SAAS;IACjB,0BAAa,CAAA;IACb,4BAAe,CAAA;IACf,8BAAiB,CAAA;IACjB,4BAAe,CAAA;IACf,0CAA6B,CAAA;IAC7B,sCAAyB,CAAA;IACzB,oDAAuC,CAAA;IACvC,oCAAuB,CAAA;AAC3B,CAAC,EATW,SAAS,yBAAT,SAAS,QASpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"app.utils.js","sourceRoot":"","sources":["../../src/utils/app.utils.ts"],"names":[],"mappings":";;AAkBA,4CAmCC;AAjDD,2CAAkE;AAClE,gEAAyD;AACzD,mCAA4B;AAY5B,SAAgB,gBAAgB,CAC5B,GAAqB,EACrB,UAA2B,EAAE;IAE7B,MAAM,EACF,WAAW,GAAG,CAAC,GAAG,CAAC,EACnB,SAAS,GAAG,2BAAU,CAAC,EAAE,EACzB,MAAM,EAAE,SAAS,GAAG,IAAI,EACxB,UAAU,GAAG,IAAI,GACpB,GAAG,OAAO,CAAC;IAGZ,GAAG,CAAC,UAAU,CAAC;QACX,MAAM,EAAE,WAAW;QACnB,WAAW,EAAE,IAAI;KACpB,CAAC,CAAC;IAGH,GAAG,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAG/B,IAAI,SAAS,EAAE,CAAC;QACZ,GAAG,CAAC,GAAG,CAAC,IAAA,gBAAM,GAAE,CAAC,CAAC;IACtB,CAAC;IAGD,IAAI,UAAU,EAAE,CAAC;QACb,GAAG,CAAC,cAAc,CACd,IAAI,uBAAc,CAAC;YACf,SAAS,EAAE,IAAI;YACf,oBAAoB,EAAE,IAAI;YAC1B,SAAS,EAAE,IAAI;SAClB,CAAC,CACL,CAAC;IACN,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"app.utils.js","sourceRoot":"","sources":["../../src/utils/app.utils.ts"],"names":[],"mappings":";;AAWA,4CA+BC;AA1CD,2CAAkE;AAClE,gEAAyD;AACzD,mCAA4B;AAS5B,SAAgB,gBAAgB,CAC5B,GAAqB,EACrB,UAA2B,EAAE;IAE7B,MAAM,EACF,WAAW,GAAG,CAAC,GAAG,CAAC,EACnB,SAAS,GAAG,2BAAU,CAAC,EAAE,EACzB,MAAM,EAAE,SAAS,GAAG,IAAI,EACxB,UAAU,GAAG,IAAI,GACpB,GAAG,OAAO,CAAC;IAEZ,GAAG,CAAC,UAAU,CAAC;QACX,MAAM,EAAE,WAAW;QACnB,WAAW,EAAE,IAAI;KACpB,CAAC,CAAC;IAEH,GAAG,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAE/B,IAAI,SAAS,EAAE,CAAC;QACZ,GAAG,CAAC,GAAG,CAAC,IAAA,gBAAM,GAAE,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,UAAU,EAAE,CAAC;QACb,GAAG,CAAC,cAAc,CACd,IAAI,uBAAc,CAAC;YACf,SAAS,EAAE,IAAI;YACf,oBAAoB,EAAE,IAAI;YAC1B,SAAS,EAAE,IAAI;SAClB,CAAC,CACL,CAAC;IACN,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alacard-project/shared",
3
- "version": "1.0.7",
3
+ "version": "1.0.10",
4
4
  "engines": {
5
5
  "node": ">=24.0.0"
6
6
  },
@@ -32,4 +32,4 @@
32
32
  "@types/node": "^24.10.0",
33
33
  "typescript": "^5.9.3"
34
34
  }
35
- }
35
+ }
package/proto/auth.proto CHANGED
@@ -3,7 +3,7 @@ syntax = "proto3";
3
3
  package auth;
4
4
 
5
5
  service AuthService {
6
- rpc Register (RegisterRequest) returns (TokenResponse);
6
+ rpc CreateIdentity (CreateIdentityRequest) returns (TokenResponse);
7
7
  rpc Login (LoginRequest) returns (TokenResponse);
8
8
  rpc Validate (ValidateRequest) returns (ValidateResponse);
9
9
  rpc GetUserById (GetUserByIdRequest) returns (UserResponse);
@@ -11,14 +11,23 @@ service AuthService {
11
11
  rpc ValidateToken (ValidateTokenRequest) returns (ValidateTokenResponse);
12
12
  rpc RefreshToken (RefreshTokenRequest) returns (TokenResponse);
13
13
  rpc RevokeToken (RevokeTokenRequest) returns (RevokeTokenResponse);
14
+ rpc GenerateTokens (GenerateTokensRequest) returns (TokenResponse);
14
15
  rpc CheckPermission (CheckPermissionRequest) returns (CheckPermissionResponse);
15
16
  rpc GetUserPermissions (GetUserPermissionsRequest) returns (GetUserPermissionsResponse);
16
17
  }
17
18
 
18
- message RegisterRequest {
19
+ message GenerateTokensRequest {
20
+ string userId = 1;
21
+ string email = 2;
22
+ string role = 3;
23
+ }
24
+
25
+ message CreateIdentityRequest {
19
26
  string email = 1;
20
27
  string password = 2;
21
28
  string name = 3;
29
+ string userId = 4;
30
+ string role = 5;
22
31
  }
23
32
 
24
33
  message LoginRequest {
@@ -30,6 +39,10 @@ message TokenResponse {
30
39
  string accessToken = 1;
31
40
  string refreshToken = 2;
32
41
  int32 expiresIn = 3;
42
+ string userId = 4;
43
+ string role = 5;
44
+ string email = 6;
45
+ string status = 7;
33
46
  }
34
47
 
35
48
  message ValidateRequest {
@@ -66,6 +79,7 @@ message ValidateTokenResponse {
66
79
  string userId = 2;
67
80
  string email = 3;
68
81
  string role = 4;
82
+ string status = 5;
69
83
  }
70
84
 
71
85
  message RefreshTokenRequest {
package/proto/user.proto CHANGED
@@ -27,25 +27,48 @@ message GetUserPermissionsRequest {
27
27
  message CreateUserRequest {
28
28
  string email = 1;
29
29
  string password = 2;
30
- string name = 3;
31
- string role = 4;
30
+ string role = 3;
31
+
32
+ // Employee Fields
33
+ optional string firstName = 4;
34
+ optional string lastName = 5;
35
+ optional string middleName = 6;
36
+ optional string position = 7;
37
+ optional string department = 8;
38
+
39
+ // Client Fields
40
+ optional string companyName = 9;
41
+ optional string taxId = 10;
42
+ optional string contactPhone = 11;
32
43
  }
33
44
 
34
45
  message UpdateUserRequest {
35
46
  string userId = 1;
36
- optional string name = 2;
37
- optional string email = 3;
38
- optional string role = 4;
39
- optional bool isActive = 5;
40
- optional string password = 6;
47
+ optional string email = 2;
48
+ optional string role = 3;
49
+ optional bool isActive = 4;
50
+ optional string password = 5;
51
+
52
+ // Employee Fields
53
+ optional string firstName = 6;
54
+ optional string lastName = 7;
55
+ optional string middleName = 8;
56
+ optional string position = 9;
57
+ optional string department = 10;
58
+
59
+ // Client Fields
60
+ optional string companyName = 11;
61
+ optional string taxId = 12;
62
+ optional string contactPhone = 13;
41
63
  }
42
64
 
43
65
  message UpdateProfileRequest {
44
66
  string userId = 1;
45
- optional string name = 2;
46
- optional string phone = 3;
47
- optional string avatar = 4;
48
- optional string metadata = 5;
67
+ optional string firstName = 2;
68
+ optional string lastName = 3;
69
+ optional string phone = 4;
70
+ optional string avatar = 5;
71
+ optional string companyName = 6;
49
72
  }
50
73
 
51
74
  message DeleteUserRequest {
@@ -55,19 +78,31 @@ message DeleteUserRequest {
55
78
  message UserResponse {
56
79
  string id = 1;
57
80
  string email = 2;
58
- string name = 3;
59
- string role = 4;
60
- bool isActive = 5;
61
- string createdAt = 6;
62
- string updatedAt = 7;
63
- string password = 8;
64
- string lastName = 9;
65
- string firstName = 10;
66
- optional string middleName = 11;
67
- string shortName = 12;
81
+ string role = 3;
82
+ bool isActive = 4;
83
+ string createdAt = 5;
84
+ string updatedAt = 6;
85
+
86
+ // Profile Fields (Shared/Employee)
87
+ optional string firstName = 7;
88
+ optional string lastName = 8;
89
+ optional string middleName = 9;
90
+ optional string shortName = 10;
91
+
92
+ // Employee Specific
93
+ optional string position = 11;
94
+ optional string department = 12;
68
95
  optional string internalPhone = 13;
69
96
  optional string mobilePhone = 14;
70
97
  optional string facsimileSignature = 15;
98
+
99
+ // Client Specific
100
+ optional string companyName = 16;
101
+ optional string taxId = 17;
102
+ optional string address = 18;
103
+ optional string contactPhone = 19;
104
+
105
+ optional string avatar = 20;
71
106
  }
72
107
 
73
108
  message DeleteUserResponse {
@@ -8,6 +8,7 @@ export const ENV_KEYS = {
8
8
  KAFKA_BROKERS: 'KAFKA_BROKERS',
9
9
  JWT_SECRET: 'JWT_SECRET',
10
10
  JWT_EXPIRES_IN: 'JWT_EXPIRES_IN',
11
+ JWT_REFRESH_SECRET: 'JWT_REFRESH_SECRET',
11
12
  JWT_REFRESH_EXPIRES_IN: 'JWT_REFRESH_EXPIRES_IN',
12
13
  GRPC_PORT: 'GRPC_PORT',
13
14
  GRPC_URL: 'GRPC_URL',
@@ -19,13 +19,14 @@ export const GRPC_METHODS = {
19
19
  AUTH: {
20
20
  SERVICE: 'AuthService',
21
21
  LOGIN: 'Login',
22
- REGISTER: 'Register',
22
+ CREATE_IDENTITY: 'CreateIdentity',
23
23
  VALIDATE: 'Validate',
24
24
  GET_USER_BY_ID: 'GetUserById',
25
25
  GET_USER_BY_EMAIL: 'GetUserByEmail',
26
26
  VALIDATE_TOKEN: 'ValidateToken',
27
27
  REFRESH_TOKEN: 'RefreshToken',
28
28
  REVOKE_TOKEN: 'RevokeToken',
29
+ GENERATE_TOKENS: 'GenerateTokens',
29
30
  CHECK_PERMISSION: 'CheckPermission',
30
31
  GET_USER_PERMISSIONS: 'GetUserPermissions',
31
32
  },
@@ -1,6 +1,7 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { RegisterDto, LoginDto } from '../dto/auth.dto';
3
3
  import { JwtTokens } from '../types/auth.types';
4
+ import { GenerateTokensRequest } from './token.contract';
4
5
 
5
6
  export interface GetUserByIdGrpcRequest {
6
7
  userId: string;
@@ -54,6 +55,14 @@ export interface GetUserPermissionsGrpcRequest {
54
55
  userId: string;
55
56
  }
56
57
 
58
+ export interface CreateIdentityRequest {
59
+ email: string;
60
+ password: string;
61
+ name?: string;
62
+ userId: string;
63
+ role: string;
64
+ }
65
+
57
66
  export interface GetUserPermissionsGrpcResponse {
58
67
  userId: string;
59
68
  permissions: Array<{ resource: string; action: string }>;
@@ -64,19 +73,39 @@ export interface CreateUserRequest {
64
73
  userId?: string;
65
74
  email: string;
66
75
  role: string;
76
+ password?: string;
77
+
78
+ // Employee Fields
67
79
  firstName?: string;
68
80
  lastName?: string;
69
- password?: string;
81
+ middleName?: string;
82
+ position?: string;
83
+ department?: string;
84
+
85
+ // Client Fields
86
+ companyName?: string;
87
+ taxId?: string;
88
+ contactPhone?: string;
70
89
  }
71
90
 
72
91
  export interface UpdateUserRequest {
73
92
  userId: string;
74
93
  email?: string;
75
94
  role?: string;
76
- firstName?: string;
77
- lastName?: string;
78
95
  password?: string;
79
96
  isActive?: boolean;
97
+
98
+ // Employee Fields
99
+ firstName?: string;
100
+ lastName?: string;
101
+ middleName?: string;
102
+ position?: string;
103
+ department?: string;
104
+
105
+ // Client Fields
106
+ companyName?: string;
107
+ taxId?: string;
108
+ contactPhone?: string;
80
109
  }
81
110
 
82
111
  export interface UpdateProfileRequest {
@@ -102,14 +131,15 @@ export type GetUserPermissionsRequest = GetUserPermissionsGrpcRequest;
102
131
  export type DeleteUserResponse = { success: boolean };
103
132
 
104
133
  export interface IAuthService {
105
- loginGrpc(data: LoginDto): Observable<JwtTokens>;
106
- registerGrpc(data: RegisterDto): Observable<any>;
107
- validateGrpc(data: { token: string }): Observable<{ valid: boolean; userId?: string; email?: string; role?: string }>;
108
- validateTokenGrpc(data: ValidateTokenGrpcRequest): Observable<ValidateTokenGrpcResponse>;
109
- refreshTokenGrpc(data: RefreshTokenGrpcRequest): Observable<JwtTokens>;
110
- revokeTokenGrpc(data: RevokeTokenGrpcRequest): Observable<RevokeTokenGrpcResponse>;
111
- checkPermissionGrpc(data: CheckPermissionGrpcRequest): Observable<CheckPermissionGrpcResponse>;
112
- getUserPermissionsGrpc(data: GetUserPermissionsGrpcRequest): Observable<GetUserPermissionsGrpcResponse>;
113
- getUserByIdGrpc(data: GetUserByIdGrpcRequest): Observable<GetUserByIdGrpcResponse>;
114
- getUserByEmailGrpc(data: GetUserByEmailGrpcRequest): Observable<GetUserByEmailGrpcResponse>;
134
+ login(data: LoginDto): Observable<JwtTokens>;
135
+ generateTokens(data: GenerateTokensRequest): Observable<JwtTokens>;
136
+ createIdentity(data: CreateIdentityRequest): Observable<any>;
137
+ validate(data: { token: string }): Observable<{ valid: boolean; userId?: string; email?: string; role?: string }>;
138
+ validateToken(data: ValidateTokenGrpcRequest): Observable<ValidateTokenGrpcResponse>;
139
+ refreshToken(data: RefreshTokenGrpcRequest): Observable<JwtTokens>;
140
+ revokeToken(data: RevokeTokenGrpcRequest): Observable<RevokeTokenGrpcResponse>;
141
+ checkPermission(data: CheckPermissionGrpcRequest): Observable<CheckPermissionGrpcResponse>;
142
+ getUserPermissions(data: GetUserPermissionsGrpcRequest): Observable<GetUserPermissionsGrpcResponse>;
143
+ getUserById(data: GetUserByIdGrpcRequest): Observable<GetUserByIdGrpcResponse>;
144
+ getUserByEmail(data: GetUserByEmailGrpcRequest): Observable<GetUserByEmailGrpcResponse>;
115
145
  }
@@ -1,4 +1,14 @@
1
1
  export * from './config.contract';
2
2
  export * from './logging.contract';
3
3
  export * from './auth.contract';
4
- export * from './token.contract';
4
+ // export * from './token.contract';
5
+ export type {
6
+ GenerateTokensRequest,
7
+ TokensResponse,
8
+ ITokenService,
9
+ ValidateTokenRequest,
10
+ ValidateTokenResponse,
11
+ RefreshTokensRequest,
12
+ RevokeTokenRequest,
13
+ RevokeTokenResponse
14
+ } from './token.contract';
@@ -38,18 +38,31 @@ export interface UserResponse {
38
38
  id: string;
39
39
  email: string;
40
40
  role: UserRole;
41
- firstName: string;
42
- lastName: string;
43
- middleName?: string;
44
- name?: string;
45
41
  isActive: boolean;
42
+ status: string;
46
43
  createdAt?: string;
47
44
  updatedAt?: string;
48
- password?: string;
45
+
46
+ // Profile Fields (Shared/Employee)
47
+ firstName?: string;
48
+ lastName?: string;
49
+ middleName?: string;
49
50
  shortName?: string;
51
+
52
+ // Employee Specific
53
+ position?: string;
54
+ department?: string;
50
55
  internalPhone?: string;
51
56
  mobilePhone?: string;
52
57
  facsimileSignature?: string;
58
+
59
+ // Client/Partner Specific
60
+ companyName?: string;
61
+ taxId?: string;
62
+ address?: string;
63
+ contactPhone?: string;
64
+
65
+ avatar?: string;
53
66
  }
54
67
 
55
68
  export interface UserProfileDto {
@@ -57,6 +70,7 @@ export interface UserProfileDto {
57
70
  email: string;
58
71
  role: string;
59
72
  isActive: boolean;
73
+ status: string;
60
74
  createdAt: Date;
61
75
  updatedAt: Date;
62
76
  fullName: string;
@@ -5,7 +5,6 @@ export enum UserRole {
5
5
  ACCOUNTANT = 'ACCOUNTANT',
6
6
  PARTNER = 'PARTNER',
7
7
  CLIENT = 'CLIENT',
8
- USER = 'USER',
9
8
  }
10
9
 
11
10
  export enum UserStatus {
@@ -1,7 +1,3 @@
1
- /**
2
- * Application Setup Utilities
3
- */
4
-
5
1
  import { INestApplication, ValidationPipe } from '@nestjs/common';
6
2
  import { API_PREFIX } from '../constants/http.constants';
7
3
  import helmet from 'helmet';
@@ -13,9 +9,6 @@ export interface AppSetupOptions {
13
9
  validation?: boolean;
14
10
  }
15
11
 
16
- /**
17
- * Setup standard NestJS application middleware
18
- */
19
12
  export function setupStandardApp(
20
13
  app: INestApplication,
21
14
  options: AppSetupOptions = {}
@@ -27,21 +20,17 @@ export function setupStandardApp(
27
20
  validation = true,
28
21
  } = options;
29
22
 
30
- // CORS
31
23
  app.enableCors({
32
24
  origin: corsOrigins,
33
25
  credentials: true,
34
26
  });
35
27
 
36
- // API Prefix
37
28
  app.setGlobalPrefix(apiPrefix);
38
29
 
39
- // Security
40
30
  if (useHelmet) {
41
31
  app.use(helmet());
42
32
  }
43
33
 
44
- // Validation
45
34
  if (validation) {
46
35
  app.useGlobalPipes(
47
36
  new ValidationPipe({