2022-01-26 15:32:19 +00:00
|
|
|
// import moment from "moment";
|
|
|
|
import dayjs from "dayjs";
|
2021-12-14 15:47:05 +00:00
|
|
|
|
2021-11-12 09:13:22 +00:00
|
|
|
export interface Dataset {
|
|
|
|
abstract_additional: Array<string>;
|
|
|
|
abstract_output: string;
|
|
|
|
author: Array<string>;
|
|
|
|
author_sort: Array<string>;
|
|
|
|
belongs_to_bibliography: boolean;
|
|
|
|
creating_corporation: string;
|
|
|
|
doctype: string;
|
|
|
|
geo_location: string;
|
|
|
|
id: number;
|
|
|
|
identifier: Array<string>;
|
|
|
|
language: string;
|
|
|
|
licence: string;
|
|
|
|
publisher_name: string;
|
|
|
|
server_date_published: Array<number>;
|
|
|
|
subject: Array<string>;
|
|
|
|
title_output: string;
|
|
|
|
year: number;
|
|
|
|
year_inverted: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Suggestion {
|
|
|
|
constructor(public value: string, public type: SearchType) {}
|
|
|
|
// value!: string;
|
|
|
|
// type!: SearchType;
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum SearchType {
|
|
|
|
Title = "title",
|
|
|
|
Author = "author",
|
|
|
|
Subject = "subject",
|
|
|
|
}
|
2021-12-01 14:45:01 +00:00
|
|
|
|
2021-12-13 16:01:40 +00:00
|
|
|
export class DbDataset {
|
2021-12-14 15:47:05 +00:00
|
|
|
// public id!: number;
|
|
|
|
// public url!: string;
|
|
|
|
// public contributing_corporation!: string;
|
|
|
|
// public creating_corporation!: string;
|
|
|
|
// public publisher_name!: string;
|
|
|
|
// public embargo_date!: string;
|
|
|
|
// public publish_id!: number;
|
|
|
|
// public project_id!: number;
|
|
|
|
// public type!: string;
|
|
|
|
// public language!: string;
|
|
|
|
// public server_state!: string;
|
|
|
|
// public belongs_to_bibliography!: boolean;
|
|
|
|
// public created_at!: string;
|
|
|
|
// public server_date_modified!: string;
|
|
|
|
// public server_date_published!: string;
|
|
|
|
// public account_id!: number;
|
|
|
|
// public editor_id!: number;
|
|
|
|
// public reviewer_id!: number;
|
|
|
|
// public preferred_reviewer!: number;
|
|
|
|
// public preferred_reviewer_email!: string;
|
|
|
|
// public reject_editor_note!: string;
|
|
|
|
// public reject_reviewer_note!: string;
|
|
|
|
// public reviewer_note_visible!: string;
|
|
|
|
// public titles!: Array<Title>;
|
|
|
|
// public abstracts!: Array<Abstract>;
|
|
|
|
// public authors!: Array<Author>;
|
|
|
|
// public contributors!: Array<Author>;
|
|
|
|
// public user!: Person;
|
|
|
|
// public subjects!: Array<Subject>;
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
public id: string,
|
|
|
|
public url: string,
|
|
|
|
public contributing_corporation: string,
|
|
|
|
public creating_corporation: string,
|
|
|
|
public publisher_name: string,
|
|
|
|
public embargo_date: string,
|
|
|
|
public publish_id: number,
|
|
|
|
public project_id: number,
|
|
|
|
public type: string,
|
|
|
|
public language: string,
|
|
|
|
public server_state: string,
|
|
|
|
public belongs_to_bibliography: boolean,
|
|
|
|
public created_at: string,
|
|
|
|
public server_date_modified: string,
|
|
|
|
public server_date_published: string,
|
|
|
|
public account_id: number,
|
|
|
|
public editor_id: number,
|
|
|
|
public reviewer_id: number,
|
|
|
|
public preferred_reviewer: number,
|
|
|
|
public preferred_reviewer_email: string,
|
|
|
|
public reject_editor_note: string,
|
|
|
|
public reject_reviewer_note: string,
|
|
|
|
public reviewer_note_visible: string,
|
|
|
|
public titles: Array<Title>,
|
|
|
|
public abstracts: Array<Abstract>,
|
|
|
|
public authors: Array<Author>,
|
|
|
|
public contributors: Array<Author>,
|
|
|
|
public user: Person,
|
|
|
|
public subjects: Array<Subject>,
|
|
|
|
public licenses: Array<License>,
|
|
|
|
public files: Array<DbFile>,
|
|
|
|
private coverage?: Coverage,
|
|
|
|
public project?: Project,
|
|
|
|
) {}
|
2021-12-13 16:01:40 +00:00
|
|
|
|
2022-01-17 08:31:10 +00:00
|
|
|
public hasTranslatedTitle(): boolean {
|
|
|
|
if (this.titles.some((e) => e.type === TitleType.Translated)) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-13 16:01:40 +00:00
|
|
|
public hasTranslatedAbstract(): boolean {
|
|
|
|
if (this.abstracts.some((e) => e.type === "Translated")) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public hasSeriesInformationAbstract(): boolean {
|
2022-01-17 08:31:10 +00:00
|
|
|
if (this.abstracts.some((e) => e.type === AbstractType.Series_information && this.language == e.language)) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public hasTranslatedSeriesInformationAbstract(): boolean {
|
|
|
|
if (this.abstracts.some((e) => e.type === AbstractType.Series_information && this.language != e.language)) {
|
2021-12-13 16:01:40 +00:00
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-13 16:43:19 +00:00
|
|
|
public hasMethodsAbstract(): boolean {
|
2021-12-13 16:01:40 +00:00
|
|
|
if (this.abstracts.some((e) => e.type === AbstractType.Methods)) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-14 15:47:05 +00:00
|
|
|
public hasContributors(): boolean {
|
|
|
|
if (this.contributors.length > 0) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public hasLicenses(): boolean {
|
|
|
|
if (this.licenses.length > 0) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public hasEmbargoPassed(): boolean {
|
2021-12-15 12:22:32 +00:00
|
|
|
if (this.embargo_date === null) {
|
2021-12-14 15:47:05 +00:00
|
|
|
return true;
|
|
|
|
}
|
2022-01-26 15:32:19 +00:00
|
|
|
const embargoDate = dayjs(this.embargo_date); // moment(this.embargo_date);
|
|
|
|
const todayDate = dayjs(); //moment.now();
|
2021-12-14 15:47:05 +00:00
|
|
|
|
2021-12-15 12:22:32 +00:00
|
|
|
// Embargo has passed on the day after the specified date
|
2021-12-14 15:47:05 +00:00
|
|
|
if (embargoDate.isBefore(todayDate)) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// return ($embargoDate->lessThan($now));
|
|
|
|
}
|
|
|
|
|
2021-12-16 13:14:58 +00:00
|
|
|
public get MainTitle(): Nullable<Title> {
|
|
|
|
return this.titles.find((e) => e.type === TitleType.Main);
|
|
|
|
}
|
|
|
|
|
2022-01-17 08:31:10 +00:00
|
|
|
public get TranslatedTitle(): Nullable<Title> {
|
|
|
|
return this.titles.find((e) => e.type === TitleType.Translated);
|
|
|
|
}
|
|
|
|
|
2021-12-13 16:01:40 +00:00
|
|
|
public get MainAbstract(): Nullable<Abstract> {
|
|
|
|
return this.abstracts.find((e) => e.type === AbstractType.Abstract);
|
|
|
|
}
|
|
|
|
|
2022-01-13 16:43:19 +00:00
|
|
|
public get TranslatedAbstract(): Nullable<Abstract> {
|
2021-12-13 16:01:40 +00:00
|
|
|
return this.abstracts.find((e) => e.type === AbstractType.Translated);
|
|
|
|
}
|
|
|
|
|
2022-01-13 16:43:19 +00:00
|
|
|
public get SeriesInformationAbstract(): Nullable<Abstract> {
|
2022-01-17 08:31:10 +00:00
|
|
|
return this.abstracts.find((e) => e.type === AbstractType.Series_information && this.language == e.language);
|
|
|
|
}
|
|
|
|
|
|
|
|
public get TranslatedSeriesInformationAbstract(): Nullable<Abstract> {
|
|
|
|
return this.abstracts.find((e) => e.type === AbstractType.Series_information && this.language != e.language);
|
2021-12-13 16:01:40 +00:00
|
|
|
}
|
|
|
|
|
2022-01-13 16:43:19 +00:00
|
|
|
public get MethodsAbstract(): Nullable<Abstract> {
|
2021-12-13 16:01:40 +00:00
|
|
|
return this.abstracts.find((e) => e.type === AbstractType.Methods);
|
|
|
|
}
|
2021-12-14 15:47:05 +00:00
|
|
|
|
|
|
|
public get Coverage(): string {
|
|
|
|
if (this.coverage != undefined) {
|
|
|
|
const xMin = this.coverage.x_min;
|
|
|
|
const xMax = this.coverage.x_max;
|
|
|
|
const yMin = this.coverage.y_min;
|
|
|
|
const yMax = this.coverage.y_max;
|
2022-01-20 15:24:12 +00:00
|
|
|
const elevationAbsolut = this.coverage.elevation_absolut;
|
|
|
|
|
|
|
|
let geoLocation =
|
|
|
|
"* SOUTH-BOUND LATITUDE: " + xMin + "\n" + "* WEST-BOUND LONGITUDE: " + yMin + "\n" + "* NORTH-BOUND LATITUDE: " + xMax + "\n" + "* EAST-BOUND LONGITUDE: " + yMax;
|
|
|
|
|
|
|
|
// geoLocation += elevationAbsolut != null ? ` * ELEVATION ABSOLUT: ${elevationAbsolut}\n` : "";
|
|
|
|
|
|
|
|
// ${elevationAbsolut ? ` * ELEVATION ABSOLUT: ${elevationAbsolut}\n` : ""} `;
|
2022-01-20 13:23:01 +00:00
|
|
|
|
|
|
|
let elevation = "";
|
|
|
|
if (this.coverage.elevation_max != null && this.coverage.elevation_min != null) {
|
2022-01-20 15:24:12 +00:00
|
|
|
elevation += "\n* ELEVATION MIN: " + this.coverage.elevation_min + " *\nELEVATION MAX: " + this.coverage.elevation_max;
|
2022-01-20 13:23:01 +00:00
|
|
|
}
|
|
|
|
if (this.coverage.elevation_absolut != null) {
|
2022-01-20 15:24:12 +00:00
|
|
|
elevation += "\n* ELEVATION ABSOLUT: " + this.coverage.elevation_absolut;
|
2022-01-20 13:23:01 +00:00
|
|
|
}
|
|
|
|
if (elevation != "") geoLocation += elevation;
|
|
|
|
|
|
|
|
let depth = "";
|
|
|
|
if (this.coverage.depth_max != null && this.coverage.depth_min != null) {
|
2022-01-20 15:24:12 +00:00
|
|
|
depth += "\n* DEPTH MIN: " + this.coverage.depth_min + "\n* DEPTH MAX: " + this.coverage.depth_max;
|
2022-01-20 13:23:01 +00:00
|
|
|
}
|
|
|
|
if (this.coverage.elevation_absolut != null) {
|
2022-01-20 15:24:12 +00:00
|
|
|
depth += "\n* DEPTH ABSOLUT: " + this.coverage.depth_absolut;
|
2022-01-20 13:23:01 +00:00
|
|
|
}
|
|
|
|
if (depth != "") geoLocation += depth;
|
|
|
|
|
|
|
|
let time = "";
|
|
|
|
if (this.coverage.time_max != null && this.coverage.time_min != null) {
|
2022-01-20 15:24:12 +00:00
|
|
|
time += "\n* TIME MIN: " + this.coverage.time_min + "\n* TIME MAX: " + this.coverage.time_max;
|
2022-01-20 13:23:01 +00:00
|
|
|
}
|
|
|
|
if (this.coverage.time_absolut != null) {
|
2022-01-20 15:24:12 +00:00
|
|
|
time += "\n* TIME ABSOLUT: " + this.coverage.time_absolut;
|
2022-01-20 13:23:01 +00:00
|
|
|
}
|
|
|
|
if (time != "") geoLocation += time;
|
|
|
|
|
|
|
|
return geoLocation;
|
2021-12-14 15:47:05 +00:00
|
|
|
} else {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
2021-12-13 16:01:40 +00:00
|
|
|
}
|
|
|
|
type Nullable<T> = T | undefined;
|
|
|
|
|
|
|
|
export enum AbstractType {
|
|
|
|
Abstract = "Abstract",
|
|
|
|
Methods = "Methods",
|
|
|
|
Series_information = "Series_information",
|
|
|
|
Technical_info = "Technical_info",
|
|
|
|
Translated = "Translated",
|
|
|
|
Other = " Other",
|
|
|
|
}
|
|
|
|
|
2021-12-16 13:14:58 +00:00
|
|
|
export enum TitleType {
|
|
|
|
Main = "Main",
|
|
|
|
Translated = "Translated",
|
|
|
|
}
|
2021-12-13 16:01:40 +00:00
|
|
|
export interface Title {
|
2021-12-01 14:45:01 +00:00
|
|
|
id: number;
|
|
|
|
type: string;
|
2021-12-13 16:01:40 +00:00
|
|
|
value: string;
|
2021-12-01 14:45:01 +00:00
|
|
|
language: string;
|
2021-12-07 11:22:25 +00:00
|
|
|
}
|
|
|
|
|
2021-12-13 16:01:40 +00:00
|
|
|
export interface Abstract {
|
2021-12-07 11:22:25 +00:00
|
|
|
id: number;
|
|
|
|
type: string;
|
|
|
|
value: string;
|
|
|
|
language: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Author {
|
|
|
|
id: number;
|
|
|
|
academic_title: string;
|
|
|
|
date_of_birth: string;
|
|
|
|
email: string;
|
|
|
|
first_name: string;
|
|
|
|
last_name: string;
|
|
|
|
name_type: string;
|
2021-12-16 13:14:58 +00:00
|
|
|
full_name: string;
|
2021-12-01 14:45:01 +00:00
|
|
|
}
|
2021-12-13 16:01:40 +00:00
|
|
|
|
|
|
|
export interface Person {
|
|
|
|
id: number;
|
|
|
|
login: string;
|
|
|
|
email: string;
|
|
|
|
first_name: string;
|
|
|
|
last_name: string;
|
|
|
|
created_at: string;
|
|
|
|
}
|
2021-12-14 15:47:05 +00:00
|
|
|
|
|
|
|
export interface Subject {
|
|
|
|
id: number;
|
|
|
|
language: string;
|
|
|
|
type: string;
|
|
|
|
value: string;
|
|
|
|
external_key: string;
|
|
|
|
created_at: string;
|
|
|
|
updated_at: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Coverage {
|
|
|
|
x_min: string;
|
|
|
|
x_max: string;
|
|
|
|
y_min: string;
|
|
|
|
y_max: string;
|
2022-01-20 13:23:01 +00:00
|
|
|
elevation_min?: number;
|
|
|
|
elevation_max?: number;
|
|
|
|
elevation_absolut?: number;
|
|
|
|
depth_min?: number;
|
|
|
|
depth_max?: number;
|
|
|
|
depth_absolut?: number;
|
|
|
|
time_min?: string;
|
|
|
|
time_max?: string;
|
|
|
|
time_absolut?: string;
|
2021-12-14 15:47:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface License {
|
|
|
|
id: number;
|
|
|
|
active: boolean;
|
|
|
|
comment_internal?: string;
|
|
|
|
desc_markup?: string;
|
|
|
|
desc_text?: string;
|
|
|
|
language: string;
|
|
|
|
link_licence: string;
|
|
|
|
link_logo?: string;
|
|
|
|
link_sign?: string;
|
|
|
|
mime_type: string;
|
|
|
|
name_long: string; // "Creative Commons Attribution 4.0 International (CC BY 4.0)"
|
|
|
|
name: string; // "CC-BY-4.0"
|
|
|
|
pod_allowed: boolean;
|
|
|
|
sort_order: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Project {
|
|
|
|
id: number;
|
|
|
|
label: string; // "ALLG_FACHLICH"
|
|
|
|
name: string; // "Allgemein fachliche Arbeiten"
|
|
|
|
description: string; // "Allgemein fachlich interdisziplinäre Arbeiten"
|
|
|
|
created_at: string;
|
|
|
|
updated_at: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface DbFile {
|
|
|
|
id: number;
|
|
|
|
document_id: number;
|
|
|
|
path_name: string;
|
|
|
|
label: string;
|
|
|
|
comment?: string;
|
|
|
|
mime_type: string;
|
|
|
|
language?: string;
|
|
|
|
file_size: bigint;
|
|
|
|
visible_in_frontdoor: boolean;
|
|
|
|
visible_in_oai: boolean;
|
|
|
|
sort_order: Int16Array;
|
|
|
|
created_at: string;
|
|
|
|
updated_at: string;
|
|
|
|
}
|