delete old version

This commit is contained in:
titver968
2025-04-11 11:29:00 +02:00
parent 9b02c40c3f
commit 104e86136b
84 changed files with 0 additions and 8758 deletions

View File

@@ -1,22 +0,0 @@
import { client } from '$lib/minio';
/**
* Check if caseNumber is used
* @param {string} caseNumber
* @returns {Promise<boolean}
*/
export default async function caseNumberOccupied(caseNumber) {
const prefix = `${caseNumber}/config.json`;
const promise = new Promise((resolve) => {
let stream = client.listObjectsV2('tatort', prefix, false, '');
stream.on('data', () => {
stream.destroy();
resolve(true);
});
stream.on('end', () => {
resolve(false);
});
});
return promise;
}

View File

@@ -1,22 +0,0 @@
const KILO = 1024;
const MEGA = KILO * KILO;
const GIGA = MEGA * KILO;
/**
* Shortens the size in bytes
* @param {number} size
* @returns{string}
*/
export default function shortenFileSize(size) {
const giga = Math.floor(size / GIGA);
let remainder = size % GIGA;
const mega = Math.floor(remainder / MEGA);
remainder %= MEGA;
const kilo = Math.floor(remainder / KILO);
remainder %= KILO;
if (giga > 0) return `${giga} GB`;
if (mega > 0) return `${mega} MB`;
if (kilo > 0) return `${kilo} kB`;
return `${remainder} B`;
}

View File

@@ -1,33 +0,0 @@
const MINUTE = 60;
const HOUR = 60 * MINUTE;
const DAY = 24 * HOUR;
const YEAR = 365 * DAY;
const MONTH = YEAR / 12;
/**
* get readable string of time elapsed since date
* @param {Date} date
* @returns string
*/
export default function timeElapsed(date) {
const now = new Date();
const age = Math.floor((now.getTime() - date.getTime()) / 1000);
const years = Math.floor(age / YEAR);
let remainder = age % YEAR;
const months = Math.floor(remainder / MONTH);
remainder %= MONTH;
const days = Math.floor(remainder / DAY);
remainder %= DAY;
const hours = Math.floor(remainder / HOUR);
remainder %= HOUR;
const minutes = Math.floor(remainder / MINUTE);
const seconds = remainder % MINUTE;
if (years > 0) return years === 1 ? 'vor 1 Jahr' : `vor ${years} Jahren`;
if (months > 0) return months === 1 ? 'vor 1 Monat' : `vor ${months} Monaten`;
if (days > 0) return days === 1 ? 'vor 1 Tag' : `vor ${days} Tagen`;
if (hours > 0) return hours === 1 ? 'vor 1 Stunde' : `vor ${hours} Stunden`;
if (minutes > 0) return minutes === 1 ? 'vor 1 Minute' : `vor ${minutes} Minuten`;
return seconds === 1 ? 'vor 1 Sekunde' : `vor ${seconds} Sekunden`;
}