Skip to content

Commit

Permalink
feat: implement /api/v1/auth/sign_up
Browse files Browse the repository at this point in the history
  • Loading branch information
siloneco committed Jan 11, 2024
1 parent e0680f7 commit 8ea79a0
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 6 deletions.
88 changes: 82 additions & 6 deletions openapi/api_definition.swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
swagger: "2.0"
swagger: '2.0'
info:
title: proto/schema/auth/discord/callback/callback.proto
version: version not set
tags:
- name: DiscordCallbackService
- name: SignUpService
- name: TagsService
consumes:
- application/json
Expand All @@ -14,11 +15,11 @@ paths:
get:
operationId: DiscordCallbackService_GetDiscordCallback
responses:
"200":
'200':
description: A successful response.
schema:
$ref: '#/definitions/resourcesDiscordToken'
"422":
'422':
description: Validation Error
schema: {}
examples:
Expand All @@ -36,15 +37,57 @@ paths:
type: string
tags:
- DiscordCallbackService
/v1/auth/sign_up:
post:
operationId: SignUpService_PostSignUp
responses:
'200':
description: A successful response.
schema:
$ref: '#/definitions/resourcesAccount'
'422':
description: Validation Error
schema: {}
examples:
application/json:
detail:
- loc:
- string
- 0
msg: string
type: string
parameters:
- name: name
in: query
required: false
type: string
- name: email
in: query
required: false
type: string
- name: password
in: query
required: false
type: string
- name: display_name
in: query
required: false
type: string
- name: avatar_url
in: query
required: false
type: string
tags:
- SignUpService
/v1/tags:
get:
operationId: TagsService_GetTags
responses:
"200":
'200':
description: A successful response.
schema:
$ref: '#/definitions/rpcGetTagsResponse'
"422":
'422':
description: Validation Error
schema: {}
examples:
Expand Down Expand Up @@ -76,6 +119,39 @@ paths:
tags:
- TagsService
definitions:
resourcesAccount:
type: object
example:
avatar_url: https://example.com/
created_at: '2024-01-11T07:56:02.206Z'
display_name: string
github_id: string
id: string
name: string
profile: string
twitter_id: string
updated_at: '2024-01-11T07:56:02.206Z'
properties:
id:
type: string
name:
type: string
display_name:
type: string
avatar_url:
type: string
profile:
type: string
twitter_id:
type: string
github_id:
type: string
created_at:
type: string
title: google.type.Date ?
updated_at:
type: string
title: google.type.Date ?
resourcesDiscordToken:
type: object
example:
Expand All @@ -101,7 +177,7 @@ definitions:
type: object
example:
color: '#000000'
id: "1"
id: '1'
name: tag1
properties:
id:
Expand Down
36 changes: 36 additions & 0 deletions proto/schema/auth/sign_up/resources/signup.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
syntax = "proto3";

package proto.schema.auth.sign_up.resources;
import "proto/third_party/grpc/openapiv2/options/annotations.proto";

option go_package = "./";

message InitialAccountTemplate {
string name = 1;
string email = 2;
string password = 3;
string display_name = 4;
string avatar_url = 5;
}

message Account {
string id = 1;
string name = 2;
string display_name = 3;
string avatar_url = 4;
string profile = 5;
string twitter_id = 6;
string github_id = 7;
string created_at = 8; // google.type.Date ?
string updated_at = 9; // google.type.Date ?

option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = {
example : "{\"id\": \"string\",\"name\": \"string\",\"display_name\": "
"\"string\",\"avatar_url\": "
"\"https://example.com/\",\"profile\": "
"\"string\",\"twitter_id\": \"string\",\"github_id\": "
"\"string\",\"created_at\": "
"\"2024-01-11T07:56:02.206Z\",\"updated_at\": "
"\"2024-01-11T07:56:02.206Z\"}"
};
}
17 changes: 17 additions & 0 deletions proto/schema/auth/sign_up/signup.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";

package proto.schema.auth.sign_up;

import "proto/schema/auth/sign_up/resources/signup.proto";
import "proto/third_party/google/api/annotations.proto";

option go_package = "./";

service SignUpService {
rpc PostSignUp(proto.schema.auth.sign_up.resources.InitialAccountTemplate)
returns (proto.schema.auth.sign_up.resources.Account) {
option (google.api.http) = {
post : "/v1/auth/sign_up"
};
};
}

0 comments on commit 8ea79a0

Please sign in to comment.