Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TreeApi
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
TreeApi
Commits
fdbb5c05
Commit
fdbb5c05
authored
3 years ago
by
L. Ellenbeck
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Ude resources (rpdm/issues#71)
parent
0007628f
No related branches found
No related tags found
1 merge request
!50
Hotfix/0071 fix resource create
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/Tree/Controllers/TreeController.cs
+14
-16
14 additions, 16 deletions
src/Tree/Controllers/TreeController.cs
src/Tree/Program.cs
+1
-1
1 addition, 1 deletion
src/Tree/Program.cs
src/Tree/Startup.cs
+4
-4
4 additions, 4 deletions
src/Tree/Startup.cs
src/Tree/Tree.csproj
+2
-1
2 additions, 1 deletion
src/Tree/Tree.csproj
with
21 additions
and
22 deletions
src/Tree/Controllers/TreeController.cs
+
14
−
16
View file @
fdbb5c05
using
Coscine.WaterbutlerHelper
;
using
Coscine.WaterbutlerHelper.ReturnObjects
;
using
Coscine.ApiCommons
;
using
Coscine.ApiCommons.Factories
;
using
Coscine.Configuration
;
using
Coscine.Database.DataModel
;
using
Coscine.Database.Models
;
using
Coscine.Database.Util
;
using
Coscine.Logging
;
using
Coscine.Metadata
;
using
Coscine.ResourceLoader
;
using
Coscine.ResourceTypeBase
;
using
Coscine.WaterbutlerHelper
;
using
Coscine.WaterbutlerHelper.ReturnObjects
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.Extensions.Logging
;
...
...
@@ -20,9 +23,6 @@ using System.Web;
using
VDS.RDF
;
using
VDS.RDF.Parsing
;
using
VDS.RDF.Writing
;
using
Coscine.ResourceLoader
;
using
Coscine.Configuration
;
using
Coscine.ResourceTypeBase
;
namespace
Coscine.Api.Tree.Controllers
{
...
...
@@ -81,7 +81,7 @@ namespace Coscine.Api.Tree.Controllers
/// </summary>
/// <param name="resourceId"> Id of a resource</param>
/// <param name="path">Path to the file</param>
/// <returns> JSON Object with the metadata if
ok
, otherwise
S
tatuscode 400 or 401 or 404</returns>
/// <returns> JSON Object with the metadata if
OK
, otherwise
s
tatus
code 400 or 401 or 404</returns>
[
HttpGet
(
"[controller]/{resourceId}/{*path}"
)]
public
async
Task
<
IActionResult
>
GetMetadata
(
string
resourceId
,
string
path
=
""
)
{
...
...
@@ -118,7 +118,7 @@ namespace Coscine.Api.Tree.Controllers
return
BadRequest
(
$"No provider for: \"
{
resource
.
Type
.
DisplayName
}
\"."
);
}
var
fileInfos
=
await
resourceTypeDefinition
.
ListEntries
(
resourceId
,
path
,
resourceTypeOptions
);
var
fileInfos
=
await
resourceTypeDefinition
.
ListEntries
(
null
,
path
,
resourceTypeOptions
);
var
metadataInfos
=
new
List
<
ResourceEntry
>(
fileInfos
);
if
(
path
.
EndsWith
(
"/"
))
...
...
@@ -126,7 +126,6 @@ namespace Coscine.Api.Tree.Controllers
metadataInfos
.
Insert
(
0
,
new
ResourceEntry
(
path
,
false
,
0
,
null
,
null
,
new
DateTime
(),
new
DateTime
()));
}
var
graphs
=
new
List
<
JToken
>();
int
metadataCount
=
0
;
foreach
(
var
info
in
metadataInfos
)
...
...
@@ -211,7 +210,7 @@ namespace Coscine.Api.Tree.Controllers
{
var
lastSlash
=
x
.
Key
.
LastIndexOf
(
"/"
)
+
1
;
var
name
=
x
.
Key
[
lastSlash
..];
if
(
name
==
""
)
if
(
name
?.
Length
==
0
)
{
var
tempPath
=
x
.
Key
[..(
lastSlash
-
1
)];
if
(
tempPath
.
Contains
(
"/"
))
...
...
@@ -229,7 +228,7 @@ namespace Coscine.Api.Tree.Controllers
/// </summary>
/// <param name="resourceId">Id of the resource</param>
/// <param name="path">Path to the file</param>
/// <returns>If
ok S
tatuscode 204, otherwise
S
tatuscode 400 or 401</returns>
/// <returns>If
OK s
tatus
code 204, otherwise
s
tatus
code 400 or 401</returns>
[
HttpPut
(
"[controller]/{resourceId}/{*path}"
)]
public
IActionResult
StoreMetadataForFile
(
string
resourceId
,
string
path
)
{
...
...
@@ -356,7 +355,6 @@ namespace Coscine.Api.Tree.Controllers
_rdfStoreConnector
.
AddGraph
(
graph
);
return
NoContent
();
}
/// <summary>
...
...
@@ -365,7 +363,7 @@ namespace Coscine.Api.Tree.Controllers
/// <param name="resourceId">Id of the resource</param>
/// <param name="path">Path to the file</param>
/// <param name="resource">Resource</param>
/// <returns>null, otherwise
S
tatuscode 400 or 404 </returns>
/// <returns>null, otherwise
s
tatus
code 400 or 404 </returns>
private
IActionResult
CheckResourceIdAndPath
(
string
resourceId
,
string
path
,
out
Resource
resource
)
{
resource
=
null
;
...
...
@@ -383,7 +381,7 @@ namespace Coscine.Api.Tree.Controllers
if
(!
Guid
.
TryParse
(
resourceId
,
out
Guid
resourceGuid
))
{
return
BadRequest
(
$"
{
resourceId
}
is not a
guid
."
);
return
BadRequest
(
$"
{
resourceId
}
is not a
GUID
."
);
}
try
...
...
This diff is collapsed.
Click to expand it.
src/Tree/Program.cs
+
1
−
1
View file @
fdbb5c05
This diff is collapsed.
Click to expand it.
src/Tree/Startup.cs
+
4
−
4
View file @
fdbb5c05
using
Coscine.
WaterbutlerHelper.Service
s
;
using
Coscine.
ApiCommon
s
;
using
Coscine.
ApiCommon
s
;
using
Coscine.
WaterbutlerHelper.Service
s
;
using
Microsoft.Extensions.DependencyInjection
;
using
System
;
...
...
@@ -15,8 +15,8 @@ namespace Coscine.Api.Tree
/// </summary>
public
Startup
()
{
}
/// <summary>
/// Configures custom service extension
/// </summary>
...
...
This diff is collapsed.
Click to expand it.
src/Tree/Tree.csproj
+
2
−
1
View file @
fdbb5c05
...
...
@@ -22,6 +22,7 @@
<PackageReference Include="Coscine.Logging" Version="2.*-*" />
<PackageReference Include="Coscine.Metadata" Version="2.*-*" />
<PackageReference Include="Coscine.ResourceLoader" Version="2.*-*" />
<PackageReference Include="Coscine.WaterbutlerHelper" Version="2.*-*" />
<PackageReference Include="Coscine.ResourceTypeBase" Version="2.3.1-gitkeep0001" />
<PackageReference Include="Coscine.WaterbutlerHelper" Version="2.1.2-beta0003" />
</ItemGroup>
</Project>
\ No newline at end of file
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