Skip to content

Commit b677356

Browse files
authored
Merge pull request #262 from oqtopus-team/develop
release: 2025-09-12 15:55
2 parents 4f8083c + 231e0f7 commit b677356

File tree

73 files changed

+2588
-499
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2588
-499
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Python CI](https://github.com/oqtopus-team/oqtopus-cloud/actions/workflows/python-ci.yaml/badge.svg)](https://github.com/oqtopus-team/oqtopus-cloud/actions/workflows/python-ci.yaml)
77
[![TFLint](https://github.com/oqtopus-team/oqtopus-cloud/actions/workflows/tflint.yaml/badge.svg)](https://github.com/oqtopus-team/oqtopus-cloud/actions/workflows/tflint.yaml)
88
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
9-
[![slack](https://img.shields.io/badge/slack-OQTOPUS-pink.svg?logo=slack&style=plastic")](https://oqtopus.slack.com/archives/C08JKNLVDMM)
9+
[![slack](https://img.shields.io/badge/slack-OQTOPUS-pink.svg?logo=slack&style=plastic")](https://join.slack.com/t/oqtopus/shared_invite/zt-3bpjb7yc3-Vg8IYSMY1m5wV3DR~TMSnw)
1010

1111
## Overview
1212

@@ -42,7 +42,7 @@ or you can contact us by email:
4242

4343
or you can join our Slack workspace:
4444

45-
[![slack](https://img.shields.io/badge/slack-OQTOPUS-pink.svg?logo=slack&style=plastic")](https://oqtopus.slack.com/archives/C08JKNLVDMM)
45+
[![slack](https://img.shields.io/badge/slack-OQTOPUS-pink.svg?logo=slack&style=plastic")](https://join.slack.com/t/oqtopus/shared_invite/zt-3bpjb7yc3-Vg8IYSMY1m5wV3DR~TMSnw)
4646

4747
## LICENSE
4848

backend/db/init/01.schema.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ drop table if exists main.users;
4848
api_token_secret VARCHAR(255) UNIQUE,
4949
organization VARCHAR(255),
5050
group_id VARCHAR(255),
51+
available_devices TEXT,
5152
api_token_expiration TIMESTAMP,
5253
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
5354
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
@@ -61,6 +62,7 @@ CREATE TABLE IF NOT EXISTS whitelist_users (
6162
is_signup_completed BOOLEAN DEFAULT FALSE,
6263
username VARCHAR(255),
6364
organization VARCHAR(255),
65+
available_devices TEXT,
6466
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
6567
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
6668
);
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
INSERT INTO main.users (cognito_id,email,username,userstatus,api_token_secret,organization,group_id,api_token_expiration) SELECT '3704aaf8-a0e1-70c5-b5eb-e3879fd201dd','admin-email','admin','approved','admin-api_token_secret','admin-organization','admin-group_id','2021-01-01 00:00:05' WHERE NOT EXISTS (SELECT * FROM main.users WHERE username = 'admin');
2-
INSERT INTO main.users (cognito_id,email,username,userstatus,api_token_secret,organization,group_id,api_token_expiration) SELECT 'c7740a88-4011-70b9-f031-4656382f880e','admin-email@admin-email','admin2','approved','admin-api_token_secret2','admin-organization2','admin-group_id2','2021-01-01 00:00:04' WHERE NOT EXISTS (SELECT * FROM main.users WHERE username = 'admin2');
3-
INSERT INTO main.users (cognito_id,email,username,userstatus,api_token_secret,organization,group_id,api_token_expiration) SELECT 'd7740a88-4011-70b9-f031-4656382f880e','email-admin','admin3','approved','admin-api_token_secret3','admin-organization3','admin-group_id3','2021-01-01 00:00:04' WHERE NOT EXISTS ( SELECT * FROM main.users WHERE username = 'admin3');
1+
INSERT INTO main.users (cognito_id,email,username,userstatus,api_token_secret,organization,group_id,available_devices,api_token_expiration) SELECT '3704aaf8-a0e1-70c5-b5eb-e3879fd201dd','admin-email','admin','approved','admin-api_token_secret','admin-organization','admin-group_id','*','2021-01-01 00:00:05' WHERE NOT EXISTS (SELECT * FROM main.users WHERE username = 'admin');
2+
INSERT INTO main.users (cognito_id,email,username,userstatus,api_token_secret,organization,group_id,available_devices,api_token_expiration) SELECT 'c7740a88-4011-70b9-f031-4656382f880e','admin-email@admin-email','admin2','approved','admin-api_token_secret2','admin-organization2','admin-group_id2','*','2021-01-01 00:00:04' WHERE NOT EXISTS (SELECT * FROM main.users WHERE username = 'admin2');
3+
INSERT INTO main.users (cognito_id,email,username,userstatus,api_token_secret,organization,group_id,available_devices,api_token_expiration) SELECT 'd7740a88-4011-70b9-f031-4656382f880e','email-admin','admin3','approved','admin-api_token_secret3','admin-organization3','admin-group_id3','*','2021-01-01 00:00:04' WHERE NOT EXISTS ( SELECT * FROM main.users WHERE username = 'admin3');
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
INSERT INTO main.whitelist_users (group_id,email,username,organization,is_signup_completed) VALUES ('group1','[email protected]','exampleuser1','Example Organization1',TRUE);
2-
INSERT INTO main.whitelist_users (group_id,email,username,organization,is_signup_completed) VALUES ('group2','[email protected]','exampleuser2','Example Organization2',FALSE);
3-
INSERT INTO main.whitelist_users (group_id,email,username,organization,is_signup_completed) VALUES ('group3','[email protected]','exampleuser3','Example Organization3',TRUE);
4-
INSERT INTO main.whitelist_users (group_id,email,username,organization,is_signup_completed) VALUES ('group4','[email protected]','userexample4','Example Organization2',FALSE);
1+
INSERT INTO main.whitelist_users (group_id,email,username,organization,is_signup_completed,available_devices) VALUES ('group1','[email protected]','exampleuser1','Example Organization1',TRUE,'*');
2+
INSERT INTO main.whitelist_users (group_id,email,username,organization,is_signup_completed,available_devices) VALUES ('group2','[email protected]','exampleuser2','Example Organization2',FALSE,'*');
3+
INSERT INTO main.whitelist_users (group_id,email,username,organization,is_signup_completed,available_devices) VALUES ('group3','[email protected]','exampleuser3','Example Organization3',TRUE,'*');
4+
INSERT INTO main.whitelist_users (group_id,email,username,organization,is_signup_completed,available_devices) VALUES ('group4','[email protected]','userexample4','Example Organization2',FALSE,'*');

backend/oas/admin/openapi.yaml

Lines changed: 93 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,44 @@ paths:
9393
example:
9494
message: Internal Server Error
9595
/users/{user_id}:
96+
get:
97+
tags:
98+
- user
99+
summary: get one user
100+
description: get one user
101+
operationId: get_one_user_by_id
102+
security:
103+
- BearerAuth: []
104+
parameters:
105+
- name: user_id
106+
in: path
107+
description: User ID
108+
required: true
109+
schema:
110+
type: integer
111+
responses:
112+
'200':
113+
description: Success
114+
content:
115+
application/json:
116+
schema:
117+
$ref: '#/components/schemas/users.GetOneUserResponse'
118+
'404':
119+
description: Not found
120+
content:
121+
application/json:
122+
schema:
123+
$ref: '#/components/schemas/error.NotFoundError'
124+
example:
125+
message: User not found
126+
'500':
127+
description: Internal Server Error
128+
content:
129+
application/json:
130+
schema:
131+
$ref: '#/components/schemas/error.InternalServerError'
132+
example:
133+
message: Internal Server Error
96134
patch:
97135
tags:
98136
- user
@@ -113,7 +151,7 @@ paths:
113151
content:
114152
application/json:
115153
schema:
116-
$ref: '#/components/schemas/users.UpdateUserStatusRequest'
154+
$ref: '#/components/schemas/users.UpdateUserRequest'
117155
responses:
118156
'200':
119157
description: Success
@@ -179,7 +217,7 @@ paths:
179217
$ref: '#/components/schemas/error.InternalServerError'
180218
example:
181219
message: Internal Server Error
182-
/whitelist:
220+
/whitelist_users:
183221
get:
184222
tags:
185223
- WhitelistUsers
@@ -208,6 +246,12 @@ paths:
208246
application/json:
209247
schema:
210248
$ref: '#/components/schemas/whitelist_users.ListWhitelistUsersResponse'
249+
'400':
250+
description: Bad Request
251+
content:
252+
application/json:
253+
schema:
254+
$ref: '#/components/schemas/error.BadRequestError'
211255
'401':
212256
description: Unauthorized
213257
'403':
@@ -262,13 +306,12 @@ paths:
262306
operationId: delete_whitelist_user
263307
security:
264308
- BearerAuth: []
265-
parameters:
266-
- name: user_emails
267-
in: query
268-
description: email of the user to be deleted
269-
required: true
270-
schema:
271-
$ref: '#/components/schemas/whitelist_users.WhitelistUsersDeleteRequest'
309+
requestBody:
310+
required: true
311+
content:
312+
application/json:
313+
schema:
314+
$ref: '#/components/schemas/whitelist_users.WhitelistUsersDeleteRequest'
272315
responses:
273316
'204':
274317
description: Delete success
@@ -782,6 +825,14 @@ components:
782825
$ref: '#/components/schemas/users.UserStatus'
783826
group_id:
784827
type: string
828+
available_devices:
829+
oneOf:
830+
- type: array
831+
items:
832+
type: string
833+
- type: string
834+
enum:
835+
- '*'
785836
xml:
786837
name: User
787838
required:
@@ -817,11 +868,27 @@ components:
817868
type: string
818869
required:
819870
- message
820-
users.UpdateUserStatusRequest:
871+
users.UpdateUserRequest:
821872
type: object
822873
properties:
874+
email:
875+
type: string
876+
name:
877+
type: string
878+
organization:
879+
type: string
823880
status:
824881
$ref: '#/components/schemas/users.UserStatus'
882+
group_id:
883+
type: string
884+
available_devices:
885+
oneOf:
886+
- type: array
887+
items:
888+
type: string
889+
- type: string
890+
enum:
891+
- '*'
825892
whitelist_users.Email:
826893
type: string
827894
@@ -845,6 +912,14 @@ components:
845912
is_signup_completed:
846913
type: boolean
847914
example: true
915+
available_devices:
916+
oneOf:
917+
- type: array
918+
items:
919+
type: string
920+
- type: string
921+
enum:
922+
- '*'
848923
required:
849924
- id
850925
- group_id
@@ -874,6 +949,14 @@ components:
874949
type: string
875950
organization:
876951
type: string
952+
available_devices:
953+
oneOf:
954+
- type: array
955+
items:
956+
type: string
957+
- type: string
958+
enum:
959+
- '*'
877960
whitelist_users.RegisterWhitelistUsersRequest:
878961
properties:
879962
users:

backend/oas/admin/paths/users.yaml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,43 @@ users:
7373
message: "Internal Server Error"
7474

7575
users.user_id:
76+
get:
77+
tags:
78+
- user
79+
summary: "get one user"
80+
description: "get one user"
81+
operationId: "get_one_user_by_id"
82+
security:
83+
- BearerAuth: []
84+
parameters:
85+
- name: user_id
86+
in: path
87+
description: "User ID"
88+
required: true
89+
schema: {type: integer}
90+
responses:
91+
"200":
92+
description: Success
93+
content:
94+
application/json:
95+
schema:
96+
$ref: "../schemas/users.yaml#/users.GetOneUserResponse"
97+
"404":
98+
description: "Not found"
99+
content:
100+
application/json:
101+
schema:
102+
$ref: "../schemas/error.yaml#/error.NotFoundError"
103+
example:
104+
message: "User not found"
105+
"500":
106+
description: "Internal Server Error"
107+
content:
108+
application/json:
109+
schema:
110+
$ref: "../schemas/error.yaml#/error.InternalServerError"
111+
example:
112+
message: "Internal Server Error"
76113
patch:
77114
tags:
78115
- user
@@ -92,7 +129,7 @@ users.user_id:
92129
content:
93130
application/json:
94131
schema:
95-
$ref: "../schemas/users.yaml#/users.UpdateUserStatusRequest"
132+
$ref: "../schemas/users.yaml#/users.UpdateUserRequest"
96133
responses:
97134
"200":
98135
description: Success

backend/oas/admin/paths/whitelist_users.yaml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ whitelist_users:
2525
application/json:
2626
schema:
2727
$ref: "../schemas/whitelist_users.yaml#/whitelist_users.ListWhitelistUsersResponse"
28+
'400':
29+
description: "Bad Request"
30+
content:
31+
application/json:
32+
schema:
33+
$ref: '../schemas/error.yaml#/error.BadRequestError'
2834
"401":
2935
description: Unauthorized
3036
"403":
@@ -79,13 +85,12 @@ whitelist_users:
7985
operationId: delete_whitelist_user
8086
security:
8187
- BearerAuth: []
82-
parameters:
83-
- name: user_emails
84-
in: query
85-
description: "email of the user to be deleted"
86-
required: true
87-
schema:
88-
$ref: "../schemas/whitelist_users.yaml#/whitelist_users.WhitelistUsersDeleteRequest"
88+
requestBody:
89+
required: true
90+
content:
91+
application/json:
92+
schema:
93+
$ref: "../schemas/whitelist_users.yaml#/whitelist_users.WhitelistUsersDeleteRequest"
8994
responses:
9095
"204":
9196
description: "Delete success"

backend/oas/admin/root.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ paths:
1717
$ref: ./paths/users.yaml#/users
1818
/users/{user_id}:
1919
$ref: ./paths/users.yaml#/users.user_id
20-
/whitelist:
20+
/whitelist_users:
2121
$ref: ./paths/whitelist_users.yaml#/whitelist_users
2222
/devices:
2323
$ref: ./paths/devices.yaml#/devices

backend/oas/admin/schemas/users.yaml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ users.GetOneUserResponse:
1414
$ref: "#/users.UserStatus"
1515
group_id:
1616
type: string
17+
available_devices:
18+
oneOf:
19+
- type: array
20+
items:
21+
type: string
22+
- type: string
23+
enum:
24+
- '*'
1725
xml:
1826
name: User
1927
required: [
@@ -28,11 +36,27 @@ users.UserStatus:
2836
- suspended
2937
example: approved
3038

31-
users.UpdateUserStatusRequest:
39+
users.UpdateUserRequest:
3240
type: object
3341
properties:
42+
email:
43+
type: string
44+
name:
45+
type: string
46+
organization:
47+
type: string
3448
status:
3549
$ref: "#/users.UserStatus"
50+
group_id:
51+
type: string
52+
available_devices:
53+
oneOf:
54+
- type: array
55+
items:
56+
type: string
57+
- type: string
58+
enum:
59+
- '*'
3660

3761
users.GetUsersResponse:
3862
properties:

backend/oas/admin/schemas/whitelist_users.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ whitelist_users.RegisterWhitelistUserRequest:
1414
type: string
1515
organization:
1616
type: string
17+
available_devices:
18+
oneOf:
19+
- type: array
20+
items:
21+
type: string
22+
- type: string
23+
enum:
24+
- '*'
1725

1826
whitelist_users.ListWhitelistUserResponse:
1927
type: object
@@ -35,6 +43,14 @@ whitelist_users.ListWhitelistUserResponse:
3543
is_signup_completed:
3644
type: boolean
3745
example: true
46+
available_devices:
47+
oneOf:
48+
- type: array
49+
items:
50+
type: string
51+
- type: string
52+
enum:
53+
- '*'
3854
required:
3955
- id
4056
- group_id

0 commit comments

Comments
 (0)