Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BlobApi
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Coscine
backend
apis
BlobApi
Commits
63f53a96
Commit
63f53a96
authored
3 years ago
by
Petar Hristov
Browse files
Options
Downloads
Patches
Plain Diff
Update: Add Logs and Docs (coscine/issues#1711)
parent
9e9cf296
Branches
Branches containing commit
No related tags found
1 merge request
!45
Hotfix/64 release ude
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+2
-31
2 additions, 31 deletions
README.md
src/Blob/Controllers/BlobController.cs
+9
-4
9 additions, 4 deletions
src/Blob/Controllers/BlobController.cs
with
11 additions
and
35 deletions
README.md
+
2
−
31
View file @
63f53a96
## C# Template
# Blob API
This template includes:
*
Automatic building using cake
*
Automatic testing with NUnit
*
Automatic linting with Resharper
*
Automatic documentation publishing using Gitlab CI / CD and a self written script which puts the docs in the docs folder to the wiki
*
Automatic releases using semantic-release (
[
ESLint Code Convention
](
docs/ESLintConvention
)
), cake and Gitlab CI / CD
## What you need to do
Place you C# project solution file in .src/.
Make sure Create directory for solution is unticked.

Delete unused docs and update this README.
Add
[
NUnit
](
docs/nunit.md
)
tests to your solution.
## Building
Build this project by running either the build.ps1 or the build
<span></span>
.sh script.
The project will be build and tested.
### Links
*
[
Commit convention
](
docs/ESLintConvention.md
)
*
[
Everything possible with markup
](
docs/testdoc.md
)
*
[
Adding NUnit tests
](
docs/nunit.md
)
This API handles the connection to the data stored in Coscine.
This diff is collapsed.
Click to expand it.
src/Blob/Controllers/BlobController.cs
+
9
−
4
View file @
63f53a96
...
@@ -122,8 +122,9 @@ namespace Coscine.Api.Blob.Controllers
...
@@ -122,8 +122,9 @@ namespace Coscine.Api.Blob.Controllers
var
totalFileSize
=
resourceTypeDefinition
.
GetResourceQuotaUsed
(
resourceId
,
resourceTypeOptions
).
Result
;
var
totalFileSize
=
resourceTypeDefinition
.
GetResourceQuotaUsed
(
resourceId
,
resourceTypeOptions
).
Result
;
return
Ok
(
$"
{{
\
"data\": {{ \"usedSizeByte\": {totalFileSize} }}}}"
);
return
Ok
(
$"
{{
\
"data\": {{ \"usedSizeByte\": {totalFileSize} }}}}"
);
}
}
catch
catch
(
Exception
e
)
{
{
_coscineLogger
.
Log
(
"Get Quota failed"
,
e
);
return
BadRequest
(
$"Error in communication with the resource"
);
return
BadRequest
(
$"Error in communication with the resource"
);
}
}
}
}
...
@@ -174,8 +175,9 @@ namespace Coscine.Api.Blob.Controllers
...
@@ -174,8 +175,9 @@ namespace Coscine.Api.Blob.Controllers
LogAnalytics
(
"Download File"
,
resourceId
,
path
.
Substring
(
1
),
user
);
LogAnalytics
(
"Download File"
,
resourceId
,
path
.
Substring
(
1
),
user
);
return
File
(
response
,
contentType
??
"application/octet-stream"
);
return
File
(
response
,
contentType
??
"application/octet-stream"
);
}
}
catch
catch
(
Exception
e
)
{
{
_coscineLogger
.
Log
(
"Get File failed"
,
e
);
return
BadRequest
(
$"Error in communication with the resource"
);
return
BadRequest
(
$"Error in communication with the resource"
);
}
}
}
}
...
@@ -252,6 +254,7 @@ namespace Coscine.Api.Blob.Controllers
...
@@ -252,6 +254,7 @@ namespace Coscine.Api.Blob.Controllers
}
}
catch
(
Exception
e
)
catch
(
Exception
e
)
{
{
_coscineLogger
.
Log
(
"Upload File failed"
,
e
);
return
BadRequest
(
$"Error in communication with the resource"
);
return
BadRequest
(
$"Error in communication with the resource"
);
}
}
}
}
...
@@ -300,8 +303,9 @@ namespace Coscine.Api.Blob.Controllers
...
@@ -300,8 +303,9 @@ namespace Coscine.Api.Blob.Controllers
LogAnalytics
(
"Delete File"
,
resourceId
,
path
,
user
);
LogAnalytics
(
"Delete File"
,
resourceId
,
path
,
user
);
return
NoContent
();
return
NoContent
();
}
}
catch
catch
(
Exception
e
)
{
{
_coscineLogger
.
Log
(
"Delete failed"
,
e
);
return
BadRequest
(
$"Error in communication with the resource"
);
return
BadRequest
(
$"Error in communication with the resource"
);
}
}
}
}
...
@@ -339,8 +343,9 @@ namespace Coscine.Api.Blob.Controllers
...
@@ -339,8 +343,9 @@ namespace Coscine.Api.Blob.Controllers
await
resourceTypeDefinition
.
IsResourceCreated
(
""
,
resourceTypeOptions
);
await
resourceTypeDefinition
.
IsResourceCreated
(
""
,
resourceTypeOptions
);
return
NoContent
();
return
NoContent
();
}
}
catch
catch
(
Exception
e
)
{
{
_coscineLogger
.
Log
(
"Resource validation failed"
,
e
);
return
BadRequest
(
$"Error in communication with the resource"
);
return
BadRequest
(
$"Error in communication with the resource"
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment