#67 added blob storage service + endpoints for profile picture. WIP
This commit is contained in:
@@ -9,11 +9,17 @@ public class GetMyUser : EndpointGroupBase
|
||||
{
|
||||
app.MapGroup(this)
|
||||
.RequireAuthorization()
|
||||
.MapGet(GetCurrentUser);
|
||||
.MapGet(GetCurrentUser)
|
||||
.MapGet(GetCurrentUserProfilePicture, "profile-picture");
|
||||
}
|
||||
|
||||
private static async Task<UserDto> GetCurrentUser(ISender sender, [AsParameters] GetCurrentUserQuery query)
|
||||
{
|
||||
return await sender.Send(query);
|
||||
}
|
||||
|
||||
private static async Task<Stream> GetCurrentUserProfilePicture(ISender sender, [AsParameters] GetCurrentUserProfilePictureQuery query)
|
||||
{
|
||||
return await sender.Send(query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ public class Users : EndpointGroupBase
|
||||
app.MapGroup(this)
|
||||
.MapPost(CreateUser)
|
||||
.MapPost(Login, "/login")
|
||||
.MapPost(UploadProfilePicture, "/upload-profile-picture")
|
||||
.MapGet(GetMinimalUser);
|
||||
}
|
||||
|
||||
@@ -27,4 +28,13 @@ public class Users : EndpointGroupBase
|
||||
{
|
||||
return await sender.Send(command);
|
||||
}
|
||||
|
||||
private static async Task<string> UploadProfilePicture(ISender sender, Stream stream)
|
||||
{
|
||||
var command = new UploadProfilePictureCommand
|
||||
{
|
||||
ProfilePicture = stream
|
||||
};
|
||||
return await sender.Send(command);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,56 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/GetMyUser/profile-picture": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"GetMyUser"
|
||||
],
|
||||
"operationId": "GetCurrentUserProfilePicture",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Stream"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"JWT": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/GetMyUser/profile-picture-2": {
|
||||
"patch": {
|
||||
"tags": [
|
||||
"GetMyUser"
|
||||
],
|
||||
"operationId": "PatchApiGetMyUserProfilePicture2",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Stream"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"JWT": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/JoinUs": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -313,6 +363,40 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/Users/upload-profile-picture": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Users"
|
||||
],
|
||||
"operationId": "UploadProfilePicture",
|
||||
"requestBody": {
|
||||
"x-name": "stream",
|
||||
"content": {
|
||||
"application/octet-stream": {
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"format": "binary",
|
||||
"nullable": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true,
|
||||
"x-position": 1
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/WeatherForecasts": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -448,6 +532,53 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Stream": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/MarshalByRefObject"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"x-abstract": true,
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"canRead": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"canWrite": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"canSeek": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"canTimeout": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"length": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"position": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"readTimeout": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"writeTimeout": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"MarshalByRefObject": {
|
||||
"type": "object",
|
||||
"x-abstract": true,
|
||||
"additionalProperties": false
|
||||
},
|
||||
"PaginatedListOfFutureCreatorListDto": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
|
||||
Reference in New Issue
Block a user