- add iso19139 metadata schema for oai interface

- modified licence file
- npm updates
This commit is contained in:
Arno Kaimbacher 2022-11-16 13:30:56 +01:00
parent b754f02210
commit 15f3572ef9
14 changed files with 2283 additions and 624 deletions

View file

@ -6,7 +6,7 @@ import { initDB } from "./config/db.config";
import { DatasetController } from "./controllers/dataset.controller";
import { OaiController } from "./controllers/oai.controller";
import { FileController } from "./controllers/file.controller";
import * as path from 'path';
import * as path from "path";
export class App extends Server {
// private app;
@ -14,10 +14,10 @@ export class App extends Server {
constructor() {
super();
// this.app = express();
this.app.use('/assets', express.static(path.join(__dirname, '../assets')));
this.app.use("/assets", express.static(path.join(__dirname, "../assets")));
this.applyMiddleWares();
// init db and add routes
this.boostrap();
this.boostrap();
}
public start(): void {

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@ import * as fs from "fs";
@Controller("file")
export class FileController {
constructor() {}
// constructor() {}
@Get("download/:id")
public async findOne(req: Request, res: Response) {
@ -16,9 +16,9 @@ export class FileController {
where: { id: id },
});
if (file) {
let filePath = "/storage/app/public/" + file.path_name;
const filePath = "/storage/app/public/" + file.path_name;
const ext = path.extname(filePath);
let fileName = file.label + ext;
const fileName = file.label + ext;
try {
fs.accessSync(filePath, fs.constants.R_OK | fs.constants.W_OK);
// console.log("can read/write:", path);

View file

@ -416,7 +416,7 @@ export class OaiController {
}
} else if (setArray[0] == "open_access") {
const openAccessLicences = ["CC-BY-4.0", "CC-BY-SA-4.0"];
let icncludeFilter = {
const icncludeFilter = {
model: License,
as: "licenses",
required: true, //return only records which have an associated model INNER JOIN

View file

@ -36,7 +36,7 @@ export default class ResumptionToken {
//#region properties
get Key(): string{
get Key(): string {
return this.MetadataPrefix + this.StartPosition + this.TotalIds;
}

View file

@ -15,7 +15,7 @@ export default class TokenWorker {
private cache: RedisClientType;
private ttl: number;
private url: string;
private connected: boolean = false;
private connected = false;
constructor(ttl: number) {
// if (resPath) {
@ -23,7 +23,7 @@ export default class TokenWorker {
// }
// [1] define ttl and create redis connection
this.ttl = ttl;
this.url = process.env.REDIS_URL || "redis://127.0.0.1:6379";
this.url = process.env.REDIS_URL || "redis://127.0.0.1:6379";
// this.cache.on("connect", () => {
// console.log(`Redis connection established`);
@ -66,7 +66,7 @@ export default class TokenWorker {
const result = await this.cache.get(key);
return result !== undefined && result !== null;
}
public async set(token: ResumptionToken) {
let fc = 0;
const uniqueId = dayjs().unix().toString(); // 1548381600;
@ -122,17 +122,17 @@ export default class TokenWorker {
this.connected = false;
}
private checksum(str: string, algorithm?: string, encoding?: string): string {
private checksum(str: string, algorithm?: string): string {
/**
* @type {BinaryToTextEncoding}
*/
const ENCODING_OUT = "hex"; // Initializer type string is not assignable to variable type BinaryToTextEncoding
return crypto
.createHash(algorithm || 'md5')
.update(str, 'utf8')
.digest(ENCODING_OUT)
}
.createHash(algorithm || "md5")
.update(str, "utf8")
.digest(ENCODING_OUT);
}
/**
* Set resumption path where the resumption token files are stored.

View file

@ -56,7 +56,6 @@ File.init(
allowNull: false,
},
created_at: DataTypes.DATE,
updated_at: DataTypes.DATE,
},

View file

@ -42,7 +42,7 @@ const License = sequelizeConnection.define(
},
},
{
timestamps: false,
timestamps: false,
tableName: "document_licences",
},
);