@you-are-hired/contracts 1.1.4 → 1.1.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.
@@ -2,4 +2,6 @@ export declare const PROTO_PATHS: {
2
2
  readonly AUTH: string;
3
3
  readonly ACCOUNT: string;
4
4
  readonly USERS: string;
5
+ readonly TAG: string;
6
+ readonly QUESTIONARY: string;
5
7
  };
@@ -5,5 +5,7 @@ const path_1 = require("path");
5
5
  exports.PROTO_PATHS = {
6
6
  AUTH: (0, path_1.join)(__dirname, '../../proto/auth.proto'),
7
7
  ACCOUNT: (0, path_1.join)(__dirname, '../../proto/account.proto'),
8
- USERS: (0, path_1.join)(__dirname, '../../proto/users.proto')
8
+ USERS: (0, path_1.join)(__dirname, '../../proto/users.proto'),
9
+ TAG: (0, path_1.join)(__dirname, '../../proto/tag.proto'),
10
+ QUESTIONARY: (0, path_1.join)(__dirname, '../../proto/questionary.proto')
9
11
  };
package/gen/account.ts CHANGED
@@ -11,8 +11,15 @@ import { Observable } from "rxjs";
11
11
  export const protobufPackage = "account.v1";
12
12
 
13
13
  export enum Role {
14
- USER = 0,
15
- ADMIN = 1,
14
+ CANDIDATE = 0,
15
+ INTERVIEWER = 1,
16
+ UNRECOGNIZED = -1,
17
+ }
18
+
19
+ export enum TwoFactorMethod {
20
+ TWO_FACTOR_METHOD_UNSPECIFIED = 0,
21
+ EMAIL = 1,
22
+ PHONE = 2,
16
23
  UNRECOGNIZED = -1,
17
24
  }
18
25
 
@@ -27,6 +34,8 @@ export interface GetAccountResponse {
27
34
  isPhoneVerified: boolean;
28
35
  isEmailVerified: boolean;
29
36
  role: Role;
37
+ isTwoFactorEnabled: boolean;
38
+ twoFactorMethod: TwoFactorMethod;
30
39
  }
31
40
 
32
41
  export interface InitEmailChangeRequest {
@@ -67,6 +76,33 @@ export interface ConfirmPhoneChangeResponse {
67
76
  ok: boolean;
68
77
  }
69
78
 
79
+ export interface InitTwoFactorRequest {
80
+ userId: string;
81
+ method: TwoFactorMethod;
82
+ }
83
+
84
+ export interface InitTwoFactorResponse {
85
+ ok: boolean;
86
+ }
87
+
88
+ export interface ConfirmTwoFactorRequest {
89
+ userId: string;
90
+ code: string;
91
+ method: TwoFactorMethod;
92
+ }
93
+
94
+ export interface ConfirmTwoFactorResponse {
95
+ ok: boolean;
96
+ }
97
+
98
+ export interface DisableTwoFactorRequest {
99
+ userId: string;
100
+ }
101
+
102
+ export interface DisableTwoFactorResponse {
103
+ ok: boolean;
104
+ }
105
+
70
106
  export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
71
107
 
72
108
  export interface AccountServiceClient {
@@ -79,6 +115,12 @@ export interface AccountServiceClient {
79
115
  initPhoneChange(request: InitPhoneChangeRequest): Observable<InitPhoneChangeResponse>;
80
116
 
81
117
  confirmPhoneChange(request: ConfirmPhoneChangeRequest): Observable<ConfirmPhoneChangeResponse>;
118
+
119
+ initTwoFactor(request: InitTwoFactorRequest): Observable<InitTwoFactorResponse>;
120
+
121
+ confirmTwoFactor(request: ConfirmTwoFactorRequest): Observable<ConfirmTwoFactorResponse>;
122
+
123
+ disableTwoFactor(request: DisableTwoFactorRequest): Observable<DisableTwoFactorResponse>;
82
124
  }
83
125
 
84
126
  export interface AccountServiceController {
@@ -101,6 +143,18 @@ export interface AccountServiceController {
101
143
  confirmPhoneChange(
102
144
  request: ConfirmPhoneChangeRequest,
103
145
  ): Promise<ConfirmPhoneChangeResponse> | Observable<ConfirmPhoneChangeResponse> | ConfirmPhoneChangeResponse;
146
+
147
+ initTwoFactor(
148
+ request: InitTwoFactorRequest,
149
+ ): Promise<InitTwoFactorResponse> | Observable<InitTwoFactorResponse> | InitTwoFactorResponse;
150
+
151
+ confirmTwoFactor(
152
+ request: ConfirmTwoFactorRequest,
153
+ ): Promise<ConfirmTwoFactorResponse> | Observable<ConfirmTwoFactorResponse> | ConfirmTwoFactorResponse;
154
+
155
+ disableTwoFactor(
156
+ request: DisableTwoFactorRequest,
157
+ ): Promise<DisableTwoFactorResponse> | Observable<DisableTwoFactorResponse> | DisableTwoFactorResponse;
104
158
  }
105
159
 
106
160
  export function AccountServiceControllerMethods() {
@@ -111,6 +165,9 @@ export function AccountServiceControllerMethods() {
111
165
  "confirmEmailChange",
112
166
  "initPhoneChange",
113
167
  "confirmPhoneChange",
168
+ "initTwoFactor",
169
+ "confirmTwoFactor",
170
+ "disableTwoFactor",
114
171
  ];
115
172
  for (const method of grpcMethods) {
116
173
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
package/gen/auth.ts CHANGED
@@ -7,72 +7,86 @@
7
7
  /* eslint-disable */
8
8
  import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
9
  import { Observable } from "rxjs";
10
- import { Empty } from "./google/protobuf/empty";
11
10
 
12
11
  export const protobufPackage = "auth.v1";
13
12
 
14
- export interface SendOTPPRequest {
15
- identifier: string;
16
- type: string;
13
+ export enum Role {
14
+ CANDIDATE = 0,
15
+ INTERVIEWER = 1,
16
+ UNRECOGNIZED = -1,
17
17
  }
18
18
 
19
- export interface SendOTPPResponse {
19
+ export enum TwoFactorMethod {
20
+ TWO_FACTOR_METHOD_UNSPECIFIED = 0,
21
+ EMAIL = 1,
22
+ PHONE = 2,
23
+ UNRECOGNIZED = -1,
24
+ }
25
+
26
+ export interface RegisterRequest {
27
+ email: string;
28
+ password: string;
29
+ role: Role;
30
+ }
31
+
32
+ export interface RegisterResponse {
20
33
  ok: boolean;
21
34
  }
22
35
 
23
- export interface VerifyOTPPRequest {
24
- identifier: string;
25
- type: string;
26
- code: string;
36
+ export interface StartLoginRequest {
37
+ email: string;
38
+ password: string;
27
39
  }
28
40
 
29
- export interface VerifyOTPPResponse {
30
- accessToken: string;
31
- refreshToken: string;
41
+ export interface StartLoginResponse {
42
+ ok: boolean;
32
43
  }
33
44
 
34
- export interface RefreshRequest {
35
- refreshToken: string;
45
+ export interface VerifyLoginCodeRequest {
46
+ email: string;
47
+ code: string;
36
48
  }
37
49
 
38
- export interface RefreshResponse {
50
+ export interface VerifyLoginCodeResponse {
51
+ requiresTwoFactor: boolean;
52
+ twoFactorMethod: TwoFactorMethod;
39
53
  accessToken: string;
40
54
  refreshToken: string;
41
55
  }
42
56
 
43
- export interface TelegramInitResponse {
44
- url: string;
57
+ export interface VerifyTwoFactorCodeRequest {
58
+ email: string;
59
+ code: string;
45
60
  }
46
61
 
47
- export interface TelegramVerifyRequest {
48
- query: { [key: string]: string };
62
+ export interface VerifyTwoFactorCodeResponse {
63
+ accessToken: string;
64
+ refreshToken: string;
49
65
  }
50
66
 
51
- export interface TelegramVerifyRequest_QueryEntry {
52
- key: string;
53
- value: string;
67
+ export interface StartPasswordResetRequest {
68
+ email: string;
54
69
  }
55
70
 
56
- export interface TelegramVerifyResponse {
57
- url?: string | undefined;
58
- accessToken?: string | undefined;
59
- refreshToken?: string | undefined;
71
+ export interface StartPasswordResetResponse {
72
+ ok: boolean;
60
73
  }
61
74
 
62
- export interface TelegramCompleteRequest {
63
- sessionId: string;
64
- phone: string;
75
+ export interface ConfirmPasswordResetRequest {
76
+ email: string;
77
+ code: string;
78
+ newPassword: string;
65
79
  }
66
80
 
67
- export interface TelegramCompleteResponse {
68
- sessionId: string;
81
+ export interface ConfirmPasswordResetResponse {
82
+ ok: boolean;
69
83
  }
70
84
 
71
- export interface TelegramConsumeRequest {
72
- sessionId: string;
85
+ export interface RefreshRequest {
86
+ refreshToken: string;
73
87
  }
74
88
 
75
- export interface TelegramConsumeResponse {
89
+ export interface RefreshResponse {
76
90
  accessToken: string;
77
91
  refreshToken: string;
78
92
  }
@@ -80,55 +94,57 @@ export interface TelegramConsumeResponse {
80
94
  export const AUTH_V1_PACKAGE_NAME = "auth.v1";
81
95
 
82
96
  export interface AuthServiceClient {
83
- sendOtp(request: SendOTPPRequest): Observable<SendOTPPResponse>;
97
+ register(request: RegisterRequest): Observable<RegisterResponse>;
84
98
 
85
- verifyOtp(request: VerifyOTPPRequest): Observable<VerifyOTPPResponse>;
99
+ startLogin(request: StartLoginRequest): Observable<StartLoginResponse>;
86
100
 
87
- refresh(request: RefreshRequest): Observable<RefreshResponse>;
101
+ verifyLoginCode(request: VerifyLoginCodeRequest): Observable<VerifyLoginCodeResponse>;
88
102
 
89
- telegramInit(request: Empty): Observable<TelegramInitResponse>;
103
+ verifyTwoFactorCode(request: VerifyTwoFactorCodeRequest): Observable<VerifyTwoFactorCodeResponse>;
90
104
 
91
- telegramVerify(request: TelegramVerifyRequest): Observable<TelegramVerifyResponse>;
105
+ startPasswordReset(request: StartPasswordResetRequest): Observable<StartPasswordResetResponse>;
92
106
 
93
- telegramComplete(request: TelegramCompleteRequest): Observable<TelegramCompleteResponse>;
107
+ confirmPasswordReset(request: ConfirmPasswordResetRequest): Observable<ConfirmPasswordResetResponse>;
94
108
 
95
- telegramConsume(request: TelegramConsumeRequest): Observable<TelegramConsumeResponse>;
109
+ refresh(request: RefreshRequest): Observable<RefreshResponse>;
96
110
  }
97
111
 
98
112
  export interface AuthServiceController {
99
- sendOtp(request: SendOTPPRequest): Promise<SendOTPPResponse> | Observable<SendOTPPResponse> | SendOTPPResponse;
113
+ register(request: RegisterRequest): Promise<RegisterResponse> | Observable<RegisterResponse> | RegisterResponse;
100
114
 
101
- verifyOtp(
102
- request: VerifyOTPPRequest,
103
- ): Promise<VerifyOTPPResponse> | Observable<VerifyOTPPResponse> | VerifyOTPPResponse;
115
+ startLogin(
116
+ request: StartLoginRequest,
117
+ ): Promise<StartLoginResponse> | Observable<StartLoginResponse> | StartLoginResponse;
104
118
 
105
- refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
119
+ verifyLoginCode(
120
+ request: VerifyLoginCodeRequest,
121
+ ): Promise<VerifyLoginCodeResponse> | Observable<VerifyLoginCodeResponse> | VerifyLoginCodeResponse;
106
122
 
107
- telegramInit(request: Empty): Promise<TelegramInitResponse> | Observable<TelegramInitResponse> | TelegramInitResponse;
123
+ verifyTwoFactorCode(
124
+ request: VerifyTwoFactorCodeRequest,
125
+ ): Promise<VerifyTwoFactorCodeResponse> | Observable<VerifyTwoFactorCodeResponse> | VerifyTwoFactorCodeResponse;
108
126
 
109
- telegramVerify(
110
- request: TelegramVerifyRequest,
111
- ): Promise<TelegramVerifyResponse> | Observable<TelegramVerifyResponse> | TelegramVerifyResponse;
127
+ startPasswordReset(
128
+ request: StartPasswordResetRequest,
129
+ ): Promise<StartPasswordResetResponse> | Observable<StartPasswordResetResponse> | StartPasswordResetResponse;
112
130
 
113
- telegramComplete(
114
- request: TelegramCompleteRequest,
115
- ): Promise<TelegramCompleteResponse> | Observable<TelegramCompleteResponse> | TelegramCompleteResponse;
131
+ confirmPasswordReset(
132
+ request: ConfirmPasswordResetRequest,
133
+ ): Promise<ConfirmPasswordResetResponse> | Observable<ConfirmPasswordResetResponse> | ConfirmPasswordResetResponse;
116
134
 
117
- telegramConsume(
118
- request: TelegramConsumeRequest,
119
- ): Promise<TelegramConsumeResponse> | Observable<TelegramConsumeResponse> | TelegramConsumeResponse;
135
+ refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
120
136
  }
121
137
 
122
138
  export function AuthServiceControllerMethods() {
123
139
  return function (constructor: Function) {
124
140
  const grpcMethods: string[] = [
125
- "sendOtp",
126
- "verifyOtp",
141
+ "register",
142
+ "startLogin",
143
+ "verifyLoginCode",
144
+ "verifyTwoFactorCode",
145
+ "startPasswordReset",
146
+ "confirmPasswordReset",
127
147
  "refresh",
128
- "telegramInit",
129
- "telegramVerify",
130
- "telegramComplete",
131
- "telegramConsume",
132
148
  ];
133
149
  for (const method of grpcMethods) {
134
150
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
@@ -1,7 +1,7 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
3
  // protoc-gen-ts_proto v2.10.1
4
- // protoc v3.21.12
4
+ // protoc v6.33.2
5
5
  // source: google/protobuf/empty.proto
6
6
 
7
7
  /* eslint-disable */
@@ -0,0 +1,140 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.10.1
4
+ // protoc v3.21.12
5
+ // source: questionary.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "questionary.v1";
12
+
13
+ export interface QuestionTag {
14
+ tagId: string;
15
+ }
16
+
17
+ export interface Question {
18
+ id: string;
19
+ content: string;
20
+ tags: QuestionTag[];
21
+ createdAt: string;
22
+ updatedAt: string;
23
+ }
24
+
25
+ export interface CreateQuestionRequest {
26
+ content: string;
27
+ tagIds: string[];
28
+ }
29
+
30
+ export interface CreateQuestionResponse {
31
+ question: Question | undefined;
32
+ }
33
+
34
+ export interface UpdateQuestionRequest {
35
+ id: string;
36
+ content: string;
37
+ }
38
+
39
+ export interface UpdateQuestionResponse {
40
+ question: Question | undefined;
41
+ }
42
+
43
+ export interface GetQuestionRequest {
44
+ id: string;
45
+ }
46
+
47
+ export interface GetQuestionResponse {
48
+ question: Question | undefined;
49
+ }
50
+
51
+ export interface ListQuestionsRequest {
52
+ }
53
+
54
+ export interface ListQuestionsResponse {
55
+ questions: Question[];
56
+ }
57
+
58
+ export interface AttachTagToQuestionRequest {
59
+ questionId: string;
60
+ tagId: string;
61
+ }
62
+
63
+ export interface AttachTagToQuestionResponse {
64
+ question: Question | undefined;
65
+ }
66
+
67
+ export interface DetachTagFromQuestionRequest {
68
+ questionId: string;
69
+ tagId: string;
70
+ }
71
+
72
+ export interface DetachTagFromQuestionResponse {
73
+ question: Question | undefined;
74
+ }
75
+
76
+ export const QUESTIONARY_V1_PACKAGE_NAME = "questionary.v1";
77
+
78
+ export interface QuestionaryServiceClient {
79
+ createQuestion(request: CreateQuestionRequest): Observable<CreateQuestionResponse>;
80
+
81
+ updateQuestion(request: UpdateQuestionRequest): Observable<UpdateQuestionResponse>;
82
+
83
+ getQuestion(request: GetQuestionRequest): Observable<GetQuestionResponse>;
84
+
85
+ listQuestions(request: ListQuestionsRequest): Observable<ListQuestionsResponse>;
86
+
87
+ attachTagToQuestion(request: AttachTagToQuestionRequest): Observable<AttachTagToQuestionResponse>;
88
+
89
+ detachTagFromQuestion(request: DetachTagFromQuestionRequest): Observable<DetachTagFromQuestionResponse>;
90
+ }
91
+
92
+ export interface QuestionaryServiceController {
93
+ createQuestion(
94
+ request: CreateQuestionRequest,
95
+ ): Promise<CreateQuestionResponse> | Observable<CreateQuestionResponse> | CreateQuestionResponse;
96
+
97
+ updateQuestion(
98
+ request: UpdateQuestionRequest,
99
+ ): Promise<UpdateQuestionResponse> | Observable<UpdateQuestionResponse> | UpdateQuestionResponse;
100
+
101
+ getQuestion(
102
+ request: GetQuestionRequest,
103
+ ): Promise<GetQuestionResponse> | Observable<GetQuestionResponse> | GetQuestionResponse;
104
+
105
+ listQuestions(
106
+ request: ListQuestionsRequest,
107
+ ): Promise<ListQuestionsResponse> | Observable<ListQuestionsResponse> | ListQuestionsResponse;
108
+
109
+ attachTagToQuestion(
110
+ request: AttachTagToQuestionRequest,
111
+ ): Promise<AttachTagToQuestionResponse> | Observable<AttachTagToQuestionResponse> | AttachTagToQuestionResponse;
112
+
113
+ detachTagFromQuestion(
114
+ request: DetachTagFromQuestionRequest,
115
+ ): Promise<DetachTagFromQuestionResponse> | Observable<DetachTagFromQuestionResponse> | DetachTagFromQuestionResponse;
116
+ }
117
+
118
+ export function QuestionaryServiceControllerMethods() {
119
+ return function (constructor: Function) {
120
+ const grpcMethods: string[] = [
121
+ "createQuestion",
122
+ "updateQuestion",
123
+ "getQuestion",
124
+ "listQuestions",
125
+ "attachTagToQuestion",
126
+ "detachTagFromQuestion",
127
+ ];
128
+ for (const method of grpcMethods) {
129
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
130
+ GrpcMethod("QuestionaryService", method)(constructor.prototype[method], method, descriptor);
131
+ }
132
+ const grpcStreamMethods: string[] = [];
133
+ for (const method of grpcStreamMethods) {
134
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
135
+ GrpcStreamMethod("QuestionaryService", method)(constructor.prototype[method], method, descriptor);
136
+ }
137
+ };
138
+ }
139
+
140
+ export const QUESTIONARY_SERVICE_NAME = "QuestionaryService";
package/gen/tag.ts ADDED
@@ -0,0 +1,89 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.10.1
4
+ // protoc v3.21.12
5
+ // source: tag.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "tag.v1";
12
+
13
+ export interface Tag {
14
+ id: string;
15
+ name: string;
16
+ createdAt: string;
17
+ updatedAt: string;
18
+ }
19
+
20
+ export interface CreateTagRequest {
21
+ name: string;
22
+ }
23
+
24
+ export interface CreateTagResponse {
25
+ tag: Tag | undefined;
26
+ }
27
+
28
+ export interface UpdateTagRequest {
29
+ id: string;
30
+ name: string;
31
+ }
32
+
33
+ export interface UpdateTagResponse {
34
+ tag: Tag | undefined;
35
+ }
36
+
37
+ export interface GetTagRequest {
38
+ id: string;
39
+ }
40
+
41
+ export interface GetTagResponse {
42
+ tag: Tag | undefined;
43
+ }
44
+
45
+ export interface ListTagsRequest {
46
+ }
47
+
48
+ export interface ListTagsResponse {
49
+ tags: Tag[];
50
+ }
51
+
52
+ export const TAG_V1_PACKAGE_NAME = "tag.v1";
53
+
54
+ export interface TagServiceClient {
55
+ createTag(request: CreateTagRequest): Observable<CreateTagResponse>;
56
+
57
+ updateTag(request: UpdateTagRequest): Observable<UpdateTagResponse>;
58
+
59
+ getTag(request: GetTagRequest): Observable<GetTagResponse>;
60
+
61
+ listTags(request: ListTagsRequest): Observable<ListTagsResponse>;
62
+ }
63
+
64
+ export interface TagServiceController {
65
+ createTag(request: CreateTagRequest): Promise<CreateTagResponse> | Observable<CreateTagResponse> | CreateTagResponse;
66
+
67
+ updateTag(request: UpdateTagRequest): Promise<UpdateTagResponse> | Observable<UpdateTagResponse> | UpdateTagResponse;
68
+
69
+ getTag(request: GetTagRequest): Promise<GetTagResponse> | Observable<GetTagResponse> | GetTagResponse;
70
+
71
+ listTags(request: ListTagsRequest): Promise<ListTagsResponse> | Observable<ListTagsResponse> | ListTagsResponse;
72
+ }
73
+
74
+ export function TagServiceControllerMethods() {
75
+ return function (constructor: Function) {
76
+ const grpcMethods: string[] = ["createTag", "updateTag", "getTag", "listTags"];
77
+ for (const method of grpcMethods) {
78
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
79
+ GrpcMethod("TagService", method)(constructor.prototype[method], method, descriptor);
80
+ }
81
+ const grpcStreamMethods: string[] = [];
82
+ for (const method of grpcStreamMethods) {
83
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
84
+ GrpcStreamMethod("TagService", method)(constructor.prototype[method], method, descriptor);
85
+ }
86
+ };
87
+ }
88
+
89
+ export const TAG_SERVICE_NAME = "TagService";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@you-are-hired/contracts",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Proto || RabbitMQ",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -27,6 +27,7 @@
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^25.0.3",
30
+ "grpc-tools": "^1.13.1",
30
31
  "typescript": "^5.9.3"
31
32
  }
32
33
  }
@@ -4,13 +4,13 @@ package account.v1;
4
4
 
5
5
  service AccountService {
6
6
  rpc GetAccount(GetAccountRequest) returns (GetAccountResponse);
7
-
8
7
  rpc InitEmailChange (InitEmailChangeRequest) returns (InitEmailChangeResponse);
9
8
  rpc ConfirmEmailChange (ConfirmEmailChangeRequest) returns (ConfirmEmailChangeResponse);
10
-
11
9
  rpc InitPhoneChange (InitPhoneChangeRequest) returns (InitPhoneChangeResponse);
12
10
  rpc ConfirmPhoneChange (ConfirmPhoneChangeRequest) returns (ConfirmPhoneChangeResponse);
13
-
11
+ rpc InitTwoFactor (InitTwoFactorRequest) returns (InitTwoFactorResponse);
12
+ rpc ConfirmTwoFactor (ConfirmTwoFactorRequest) returns (ConfirmTwoFactorResponse);
13
+ rpc DisableTwoFactor (DisableTwoFactorRequest) returns (DisableTwoFactorResponse);
14
14
  }
15
15
 
16
16
  message GetAccountRequest {
@@ -24,6 +24,8 @@ message GetAccountResponse {
24
24
  bool is_phone_verified = 4;
25
25
  bool is_email_verified = 5;
26
26
  Role role = 6;
27
+ bool is_two_factor_enabled = 7;
28
+ TwoFactorMethod two_factor_method = 8;
27
29
  }
28
30
 
29
31
  message InitEmailChangeRequest {
@@ -64,7 +66,40 @@ message ConfirmPhoneChangeResponse {
64
66
  bool ok = 1;
65
67
  }
66
68
 
69
+ message InitTwoFactorRequest {
70
+ string user_id = 1;
71
+ TwoFactorMethod method = 2;
72
+ }
73
+
74
+ message InitTwoFactorResponse {
75
+ bool ok = 1;
76
+ }
77
+
78
+ message ConfirmTwoFactorRequest {
79
+ string user_id = 1;
80
+ string code = 2;
81
+ TwoFactorMethod method = 3;
82
+ }
83
+
84
+ message ConfirmTwoFactorResponse {
85
+ bool ok = 1;
86
+ }
87
+
88
+ message DisableTwoFactorRequest {
89
+ string user_id = 1;
90
+ }
91
+
92
+ message DisableTwoFactorResponse {
93
+ bool ok = 1;
94
+ }
95
+
67
96
  enum Role {
68
- USER = 0;
69
- ADMIN = 1;
97
+ CANDIDATE = 0;
98
+ INTERVIEWER = 1;
99
+ }
100
+
101
+ enum TwoFactorMethod {
102
+ TWO_FACTOR_METHOD_UNSPECIFIED = 0;
103
+ EMAIL = 1;
104
+ PHONE = 2;
70
105
  }
package/proto/auth.proto CHANGED
@@ -2,78 +2,91 @@ syntax = "proto3";
2
2
 
3
3
  package auth.v1;
4
4
 
5
- import "google/protobuf/empty.proto";
6
-
7
5
  service AuthService {
8
- rpc SendOTP(SendOTPPRequest) returns (SendOTPPResponse);
9
- rpc VerifyOTP(VerifyOTPPRequest) returns (VerifyOTPPResponse);
6
+ rpc Register (RegisterRequest) returns (RegisterResponse);
7
+ rpc StartLogin (StartLoginRequest) returns (StartLoginResponse);
8
+ rpc VerifyLoginCode (VerifyLoginCodeRequest) returns (VerifyLoginCodeResponse);
9
+ rpc VerifyTwoFactorCode (VerifyTwoFactorCodeRequest) returns (VerifyTwoFactorCodeResponse);
10
+ rpc StartPasswordReset (StartPasswordResetRequest) returns (StartPasswordResetResponse);
11
+ rpc ConfirmPasswordReset (ConfirmPasswordResetRequest) returns (ConfirmPasswordResetResponse);
10
12
  rpc Refresh (RefreshRequest) returns (RefreshResponse);
13
+ }
14
+
15
+ enum Role {
16
+ CANDIDATE = 0;
17
+ INTERVIEWER = 1;
18
+ }
11
19
 
12
- rpc TelegramInit (google.protobuf.Empty) returns (TelegramInitResponse);
13
- rpc TelegramVerify (TelegramVerifyRequest) returns (TelegramVerifyResponse);
14
- rpc TelegramComplete (TelegramCompleteRequest) returns (TelegramCompleteResponse);
15
- rpc TelegramConsume (TelegramConsumeRequest) returns (TelegramConsumeResponse);
20
+ enum TwoFactorMethod {
21
+ TWO_FACTOR_METHOD_UNSPECIFIED = 0;
22
+ EMAIL = 1;
23
+ PHONE = 2;
16
24
  }
17
25
 
18
- message SendOTPPRequest {
19
- string identifier = 1;
20
- string type = 2;
26
+ message RegisterRequest {
27
+ string email = 1;
28
+ string password = 2;
29
+ Role role = 3;
21
30
  }
22
31
 
23
- message SendOTPPResponse {
32
+ message RegisterResponse {
24
33
  bool ok = 1;
25
34
  }
26
35
 
27
- message VerifyOTPPRequest {
28
- string identifier = 1;
29
- string type = 2;
30
- string code = 3;
36
+ message StartLoginRequest {
37
+ string email = 1;
38
+ string password = 2;
31
39
  }
32
40
 
33
- message VerifyOTPPResponse {
34
- string access_token = 1;
35
- string refresh_token = 2;
41
+ message StartLoginResponse {
42
+ bool ok = 1;
36
43
  }
37
44
 
38
- message RefreshRequest {
39
- string refresh_token = 1;
45
+ message VerifyLoginCodeRequest {
46
+ string email = 1;
47
+ string code = 2;
40
48
  }
41
49
 
42
- message RefreshResponse {
43
- string access_token = 1;
44
- string refresh_token = 2;
50
+ message VerifyLoginCodeResponse {
51
+ bool requires_two_factor = 1;
52
+ TwoFactorMethod two_factor_method = 2;
53
+ string access_token = 3;
54
+ string refresh_token = 4;
55
+ }
56
+
57
+ message VerifyTwoFactorCodeRequest {
58
+ string email = 1;
59
+ string code = 2;
45
60
  }
46
61
 
47
- message TelegramInitResponse {
48
- string url = 1;
62
+ message VerifyTwoFactorCodeResponse {
63
+ string access_token = 1;
64
+ string refresh_token = 2;
49
65
  }
50
66
 
51
- message TelegramVerifyRequest {
52
- map<string, string> query = 1;
67
+ message StartPasswordResetRequest {
68
+ string email = 1;
53
69
  }
54
70
 
55
- message TelegramVerifyResponse {
56
- oneof result {
57
- string url = 1;
58
- string access_token = 2;
59
- string refresh_token = 3;
60
- }
71
+ message StartPasswordResetResponse {
72
+ bool ok = 1;
61
73
  }
62
74
 
63
- message TelegramCompleteRequest {
64
- string session_id = 1;
65
- string phone = 2;
75
+ message ConfirmPasswordResetRequest {
76
+ string email = 1;
77
+ string code = 2;
78
+ string new_password = 3;
66
79
  }
67
80
 
68
- message TelegramCompleteResponse {
69
- string session_id = 1;
81
+ message ConfirmPasswordResetResponse {
82
+ bool ok = 1;
70
83
  }
71
84
 
72
- message TelegramConsumeRequest {
73
- string session_id = 1;
85
+ message RefreshRequest {
86
+ string refresh_token = 1;
74
87
  }
75
88
 
76
- message TelegramConsumeResponse {
89
+ message RefreshResponse {
77
90
  string access_token = 1;
78
91
  string refresh_token = 2;
79
92
  }
@@ -0,0 +1,74 @@
1
+ syntax = "proto3";
2
+
3
+ package questionary.v1;
4
+
5
+ service QuestionaryService {
6
+ rpc CreateQuestion (CreateQuestionRequest) returns (CreateQuestionResponse);
7
+ rpc UpdateQuestion (UpdateQuestionRequest) returns (UpdateQuestionResponse);
8
+ rpc GetQuestion (GetQuestionRequest) returns (GetQuestionResponse);
9
+ rpc ListQuestions (ListQuestionsRequest) returns (ListQuestionsResponse);
10
+ rpc AttachTagToQuestion (AttachTagToQuestionRequest) returns (AttachTagToQuestionResponse);
11
+ rpc DetachTagFromQuestion (DetachTagFromQuestionRequest) returns (DetachTagFromQuestionResponse);
12
+ }
13
+
14
+ message QuestionTag {
15
+ string tag_id = 1;
16
+ }
17
+
18
+ message Question {
19
+ string id = 1;
20
+ string content = 2;
21
+ repeated QuestionTag tags = 3;
22
+ string created_at = 4;
23
+ string updated_at = 5;
24
+ }
25
+
26
+ message CreateQuestionRequest {
27
+ string content = 1;
28
+ repeated string tag_ids = 2;
29
+ }
30
+
31
+ message CreateQuestionResponse {
32
+ Question question = 1;
33
+ }
34
+
35
+ message UpdateQuestionRequest {
36
+ string id = 1;
37
+ string content = 2;
38
+ }
39
+
40
+ message UpdateQuestionResponse {
41
+ Question question = 1;
42
+ }
43
+
44
+ message GetQuestionRequest {
45
+ string id = 1;
46
+ }
47
+
48
+ message GetQuestionResponse {
49
+ Question question = 1;
50
+ }
51
+
52
+ message ListQuestionsRequest {}
53
+
54
+ message ListQuestionsResponse {
55
+ repeated Question questions = 1;
56
+ }
57
+
58
+ message AttachTagToQuestionRequest {
59
+ string question_id = 1;
60
+ string tag_id = 2;
61
+ }
62
+
63
+ message AttachTagToQuestionResponse {
64
+ Question question = 1;
65
+ }
66
+
67
+ message DetachTagFromQuestionRequest {
68
+ string question_id = 1;
69
+ string tag_id = 2;
70
+ }
71
+
72
+ message DetachTagFromQuestionResponse {
73
+ Question question = 1;
74
+ }
@@ -0,0 +1,48 @@
1
+ syntax = "proto3";
2
+
3
+ package tag.v1;
4
+
5
+ service TagService {
6
+ rpc CreateTag (CreateTagRequest) returns (CreateTagResponse);
7
+ rpc UpdateTag (UpdateTagRequest) returns (UpdateTagResponse);
8
+ rpc GetTag (GetTagRequest) returns (GetTagResponse);
9
+ rpc ListTags (ListTagsRequest) returns (ListTagsResponse);
10
+ }
11
+
12
+ message Tag {
13
+ string id = 1;
14
+ string name = 2;
15
+ string created_at = 3;
16
+ string updated_at = 4;
17
+ }
18
+
19
+ message CreateTagRequest {
20
+ string name = 1;
21
+ }
22
+
23
+ message CreateTagResponse {
24
+ Tag tag = 1;
25
+ }
26
+
27
+ message UpdateTagRequest {
28
+ string id = 1;
29
+ string name = 2;
30
+ }
31
+
32
+ message UpdateTagResponse {
33
+ Tag tag = 1;
34
+ }
35
+
36
+ message GetTagRequest {
37
+ string id = 1;
38
+ }
39
+
40
+ message GetTagResponse {
41
+ Tag tag = 1;
42
+ }
43
+
44
+ message ListTagsRequest {}
45
+
46
+ message ListTagsResponse {
47
+ repeated Tag tags = 1;
48
+ }