Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

[RestServer] API for user requests (sign up, vc request, storage) #4948

Open
wants to merge 39 commits into
base: master
Choose a base branch
from

Conversation

yiyione
Copy link
Contributor

@yiyione yiyione commented Oct 11, 2020

This PR is a part of feature Group & VC request management for user and admin #4949

APIs for user request:

The request struct example:

VC request
{
    "type": "vc",
    "id": "fdbb95de-eb61-48e7-aba5-e9811de14049",
    "username": "yiyione",
    "message": "Need permission for vc1.",
    "state": "new",
    "requestTime": "2020-10-12T03:22:04.407Z",
    "vc": [ "vc1" ]
}

User request
{
    "type": "user",
    "id": "b3610b79-9273-468c-8cba-615665ed321a",
    "username": null,
    "message": "test user sign up in basic mode",
    "state": "new",
    "requestTime": "2020-10-12T03:22:04.407Z",
    "user": {
        "username": "testuser",
        "email": "[email protected]",
        "passwordHash": "51f25c2a2c265e461083ca8492c024bf8dc02d14ae306f5f07dde8388a3cfb8a174c77cda596bb48292e4cb70328b84ceeb200e59eb0d6aa4d17f195bfb4567c"
    }
}

POST /api/v2/requests/user

Create a user request, it's the API for user sign up (without token check)

POST /api/v2/requests/:requestType

Create a request, for vc/storage request

GET /api/v2/requests/:requestType

Get requests, the requestType should be one of [ user, vc, storage ].

PUT /api/v2/requests/:requestId

Update a request state (new, approved or rejected), the requestId should be an uuid.
Admin only.

DELETE /api/v2/requests/:requestId

Delete a request
Admin only.

@yiyione yiyione changed the title [restserver] API for user requests (sign up, vc request, storage) [RestServer] API for user requests (sign up, vc request, storage) Oct 11, 2020
@coveralls
Copy link

coveralls commented Oct 11, 2020

Coverage Status

Coverage decreased (-0.1%) to 33.894% when pulling 40f63a4 on yiyi/restserver_user_vc_request into b8c57ad on master.

@yiyione yiyione requested review from abuccts and debuggy October 12, 2020 03:25
@yiyione yiyione marked this pull request as ready for review October 12, 2020 03:26
@@ -42,6 +42,7 @@ declare type Code =
'NoGroupError' |
'NoStorageError' |
'NoVirtualClusterError' |
'NoRequestError' |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name is strange, sounds like no http request received

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to NoUserRequestError.

@@ -35,6 +36,7 @@ router.use('/storages', storageRouter);
router.use('/storage', storageDeprecatedRouter);
router.use('/tokens', tokenRouter);
router.use('/kubernetes', k8sRouter);
router.use('/requests', requestRouter);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update api docs accordingly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants