Add ability to make junk-drawer private-ish
This commit is contained in:
@@ -74,8 +74,12 @@ export class JunkDrawerController {
|
||||
async handleFileUpload(
|
||||
@UploadedFiles() files: Express.Multer.File[],
|
||||
@Body('description') description: string,
|
||||
@Body('private-ish') privateIsh: boolean,
|
||||
): Promise<any> {
|
||||
const uniqueSlug = generateUniqueSlug();
|
||||
console.log(privateIsh);
|
||||
const uniqueSlug = generateUniqueSlug({
|
||||
random: privateIsh,
|
||||
});
|
||||
const metadata: JunkDrawerMetadata = {
|
||||
slug: uniqueSlug,
|
||||
version: '1.0.0',
|
||||
|
@@ -1,3 +1,5 @@
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
interface SlugOptions {
|
||||
year: boolean;
|
||||
month: boolean;
|
||||
@@ -36,7 +38,7 @@ export const generateUniqueSlug = (
|
||||
hour ? String(date.getHours()).padStart(2, '0') : '',
|
||||
minute ? String(date.getMinutes()).padStart(2, '0') : '',
|
||||
second ? String(date.getSeconds()).padStart(2, '0') : '',
|
||||
random ? Math.random().toString(36).substring(2, 15) : '',
|
||||
random ? '-' + v4() : '',
|
||||
].filter(Boolean);
|
||||
|
||||
return parts.join(separator);
|
||||
|
Reference in New Issue
Block a user