Skip to content

Commit

Permalink
bugfixes and missing impls for accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
holycrab13 committed Jan 31, 2025
1 parent fb1127e commit 4289eea
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions search/indexer/artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ indexFields:
documentVariable: artifact
type: uri
query: >
SELECT ?artifact ?group WHERE {
SELECT ?artifact (REPLACE(STR(?groupUri), "(.*)(/)", "") AS ?group) WHERE {
GRAPH ?g {
?artifact a <https://dataid.dbpedia.org/databus#Artifact>.
?artifact <https://dataid.dbpedia.org/databus#group> ?group .
?artifact <https://dataid.dbpedia.org/databus#group> ?groupUri .
}
#VALUES#
}
Expand Down
3 changes: 2 additions & 1 deletion server/app/api/lib/artifact-writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ArtifactWriter extends ResourceWriter {
var artifactGraph = {};
artifactGraph[DatabusUris.JSONLD_ID] = this.uri;
artifactGraph[DatabusUris.JSONLD_TYPE] = DatabusUris.DATABUS_ARTIFACT;
artifactGraph[DatabusUris.DATABUS_NAME] = this.resource.getArtifact();
artifactGraph[DatabusUris.DATABUS_ACCOUNT_PROPERTY] = JsonldUtils.refTo(this.resource.getAccountURI());
artifactGraph[DatabusUris.DATABUS_GROUP_PROPERTY] = JsonldUtils.refTo(this.resource.getGroupURI());

Expand All @@ -29,7 +30,7 @@ class ArtifactWriter extends ResourceWriter {

if(inputArtifactGraph[DatabusUris.DCT_ABSTRACT] != null) {
artifactGraph[DatabusUris.DCT_ABSTRACT] = inputArtifactGraph[DatabusUris.DCT_ABSTRACT];
} else if (groupGraph[DatabusUris.DCT_DESCRIPTION] != null) {
} else if (artifactGraph[DatabusUris.DCT_DESCRIPTION] != null) {
artifactGraph[DatabusUris.DCT_DESCRIPTION] = DatabusUtils.createAbstractFromDescription(artifactGraph[DatabusUris.DCT_DESCRIPTION]);
}

Expand Down
1 change: 1 addition & 0 deletions server/app/api/lib/group-writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class GroupWriter extends ResourceWriter {
var groupGraph = {};
groupGraph[DatabusUris.JSONLD_ID] = this.uri;
groupGraph[DatabusUris.JSONLD_TYPE] = DatabusUris.DATABUS_GROUP;
groupGraph[DatabusUris.DATABUS_NAME] = this.resource.getGroup();
groupGraph[DatabusUris.DATABUS_ACCOUNT_PROPERTY] = JsonldUtils.refTo(this.resource.getAccountURI());

if(inputGroupGraph[DatabusUris.DCT_TITLE] != null) {
Expand Down
2 changes: 2 additions & 0 deletions server/app/api/routes/artifact.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ module.exports = function (router, protector) {
return;
}

res.status(200).json(logger.getReport())

} catch (err) {
console.log(err);
res.status(500).send(err);
Expand Down
6 changes: 6 additions & 0 deletions server/app/api/routes/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ module.exports = function (router, protector, webdav) {
router.post('/api/register', protector.protect(true), registerData);
router.post('/api/publish', protector.protect(true), registerData);

/**
* Tries to create a new user in the user database
* @param {subect of the logged in user} sub
* @param {account name of the logged in user} accountName
* @returns
*/
async function createUser(sub, accountName) {
var accountExists = await protector.hasUser(accountName);

Expand Down
2 changes: 2 additions & 0 deletions server/app/api/routes/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ module.exports = function (router, protector) {
res.status(apiError.statusCode).json(logger.getReport());
return;
}

res.status(200).json(logger.getReport())

} catch (err) {
console.log(err);
Expand Down

0 comments on commit 4289eea

Please sign in to comment.