Skip to content

Commit

Permalink
Merge pull request #750 from OpenSourceBrain/feature/666
Browse files Browse the repository at this point in the history
Group page and user quotas
  • Loading branch information
filippomc authored May 26, 2023
2 parents 27c2600 + fcba192 commit 0e98e57
Show file tree
Hide file tree
Showing 25 changed files with 1,506 additions and 29 deletions.
88 changes: 88 additions & 0 deletions applications/accounts-api/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,66 @@ paths:
type: string
in: path
required: true
'/groups/{groupname}/':
get:
tags:
- groups
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Group'
description: Get a user's public information
operationId: getGroup
put:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/User'
required: true
tags:
- groups
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/User'
description: The user as just saved
security:
-
bearerAuth: []
operationId: updateGroup
parameters:
-
name: groupname
schema:
type: string
in: path
required: true
'/groups/{groupname}/users':
get:
tags:
- groups
responses:
'200':
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
description: Get a user's public information
operationId: getGroupUsers
parameters:
-
name: groupname
schema:
type: string
in: path
required: true
components:
schemas:
Valid:
Expand Down Expand Up @@ -166,6 +226,34 @@ components:
$ref: '#/components/schemas/Profiles'
description: ''
additionalProperties: true
Group:
description: ''
required:
- name
type: object
properties:
quotas:
$ref: '#/components/schemas/Profiles'
description: ''
name:
description: ''
type: string
description:
description: ''
links:
$ref: '#/components/schemas/Profiles'
description: ''
keywords:
description: ''
type: array
items:
type: string
image:
$ref: '#/components/schemas/Url'
description: Image url
email:
description: ''
type: string
securitySchemes:
bearerAuth:
scheme: bearer
Expand Down
5 changes: 3 additions & 2 deletions applications/accounts-api/backend/.openapi-generator-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
setup.py
*/controllers/*
Dockerfile
src/__main__.py
**/__main__.py
requirements.txt
test-requirements.txt
test-requirements.txt
*/.openapi-generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import connexion
import six
from typing import Dict
from typing import Tuple
from typing import Union

from accounts_api.models.group import Group # noqa: E501
from accounts_api.models.user import User # noqa: E501
from accounts_api import util

from accounts_api.services import group_service

def get_group(groupname): # noqa: E501
"""get_group
# noqa: E501
:param groupname:
:type groupname: str
:rtype: Union[Group, Tuple[Group, int], Tuple[Group, int, Dict[str, str]]
"""
try:
return group_service.get_group_by_name(groupname)
except group_service.GroupNotFound as e:
return "Group not found", 404



def get_group_users(groupname): # noqa: E501
"""get_group_users
# noqa: E501
:param groupname:
:type groupname: str
:rtype: Union[Group, Tuple[Group, int], Tuple[Group, int, Dict[str, str]]
"""
try:
return group_service.get_group_users(groupname)
except group_service.GroupNotFound as e:
return "Group not found", 404


def update_group(groupname, request_body): # noqa: E501
"""update_group
# noqa: E501
:param groupname:
:type groupname: str
:param request_body:
:type request_body: Dict[str, ]
:rtype: Union[User, Tuple[User, int], Tuple[User, int, Dict[str, str]]
"""
return 'do some magic!'
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
# flake8: noqa
from __future__ import absolute_import
# import models into model package
from accounts_api.models.group import Group
from accounts_api.models.user import User
from accounts_api.models.valid import Valid
Loading

0 comments on commit 0e98e57

Please sign in to comment.