- npm updates
- uncomment eprints description inside datasetxml2oai-pmh.xslt - test with multer for uploading files multipart/form-data - allow post and get methods dor oai.controller.ts
This commit is contained in:
parent
05e9273823
commit
6944deac83
|
@ -144,7 +144,7 @@
|
|||
</sampleIdentifier>
|
||||
</oai-identifier>
|
||||
</description>
|
||||
<description>
|
||||
<!-- <description>
|
||||
<eprints xmlns="http://www.openarchives.org/OAI/1.1/eprints" xsi:schemaLocation="http://www.openarchives.org/OAI/1.1/eprints http://www.openarchives.org/OAI/1.1/eprints.xsd">
|
||||
<content>
|
||||
<text>
|
||||
|
@ -166,7 +166,7 @@
|
|||
See https://gitea.geologie.ac.at/geolba/tethys/ for more information.
|
||||
</comment>
|
||||
</eprints>
|
||||
</description>
|
||||
</description> -->
|
||||
</Identify>
|
||||
</xsl:template>
|
||||
|
||||
|
|
|
@ -105,4 +105,11 @@ git config --global user.name
|
|||
git config --global user.email
|
||||
|
||||
git remote add origin https://gitea.geologie.ac.at/geolba/tethys.api.git
|
||||
git push -o repo.private=false --set-upstream origin master
|
||||
git push -o repo.private=false --set-upstream origin master
|
||||
|
||||
|
||||
|
||||
npm install --save multer
|
||||
|
||||
curl -X POST -d "verb=identify" -H "Content-Type: application/xml" http://localhost:3000/oai
|
||||
curl -X POST -H "Content-Type: application/xml" -d '{"verb": "Identify"}' http://localhost:8080/oai
|
|
@ -40,11 +40,14 @@ export class App extends Server {
|
|||
next();
|
||||
});
|
||||
|
||||
// this.app.use(bodyParser.json());
|
||||
// this.app.use(bodyParser.urlencoded({ extended: true }));
|
||||
// this.app.use(bodyParser.json());
|
||||
// for parsing application/json
|
||||
this.app.use(bodyParser.json({ limit: "100mb" }));
|
||||
// for parsing application/xwww-
|
||||
this.app.use(bodyParser.urlencoded({ limit: "50mb", extended: true }));
|
||||
this.app.use(bodyParser.json({ type: "application/vnd.api+json" }));
|
||||
// this.app.use(forms.array());
|
||||
// for parsing multipart/form-data = uploads
|
||||
// this.app.use(upload.array());
|
||||
}
|
||||
|
||||
private boostrap(): void {
|
||||
|
|
|
@ -88,7 +88,16 @@ export class OaiController {
|
|||
(earliestDateFromDb = dayjs(firstPublishedDataset.server_date_published).format("YYYY-MM-DDTHH:mm:ss[Z]"));
|
||||
this.xsltParameter["earliestDatestamp"] = earliestDateFromDb;
|
||||
|
||||
const oaiRequest: OaiParameter = request.query;
|
||||
let oaiRequest: OaiParameter = {};
|
||||
if (request.method == "POST") {
|
||||
oaiRequest = request.body;
|
||||
} else if (request.method == "GET") {
|
||||
oaiRequest = request.query;
|
||||
} else {
|
||||
this.xsltParameter["oai_error_code"] = "unknown";
|
||||
this.xsltParameter["oai_error_message"] = "An internal error occured.";
|
||||
}
|
||||
// const oaiRequest: OaiParameter = request.body;
|
||||
try {
|
||||
await this.handleRequest(oaiRequest, request);
|
||||
} catch (error) {
|
||||
|
@ -450,7 +459,7 @@ export class OaiController {
|
|||
};
|
||||
includeArray.push(icncludeFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// const timeZone = "Europe/Vienna"; // Canonical time zone name
|
||||
// &from=2020-09-03&until2020-09-03
|
||||
|
@ -506,7 +515,7 @@ export class OaiController {
|
|||
OaiErrorCodes.BADARGUMENT,
|
||||
);
|
||||
}
|
||||
fromDate = dayjs.tz(from, "Europe/Vienna")
|
||||
fromDate = dayjs.tz(from, "Europe/Vienna");
|
||||
fromDate.hour() == 0 && (fromDate = fromDate.startOf("day"));
|
||||
|
||||
const now = dayjs();
|
||||
|
@ -534,7 +543,7 @@ export class OaiController {
|
|||
OaiErrorCodes.BADARGUMENT,
|
||||
);
|
||||
}
|
||||
untilDate = dayjs.tz(until, "Europe/Vienna");
|
||||
untilDate = dayjs.tz(until, "Europe/Vienna");
|
||||
untilDate.hour() == 0 && (untilDate = untilDate.endOf("day"));
|
||||
|
||||
const firstPublishedDataset: Dataset = (await Dataset.earliestPublicationDate()) as Dataset;
|
||||
|
|
Loading…
Reference in New Issue
Block a user