Add documentation
This commit is contained in:
parent
3c27a724a0
commit
abbba82e61
@ -1,13 +1,17 @@
|
|||||||
import mongoose, { Schema } from "mongoose";
|
import mongoose, { Schema } from "mongoose";
|
||||||
|
|
||||||
const schema = new Schema({
|
const schema = new Schema({
|
||||||
uploader: mongoose.Types.ObjectId,
|
uploader: mongoose.Types.ObjectId, // The users id who uploaded the file
|
||||||
fileId: String,
|
// The id of the file
|
||||||
originalFileName: String,
|
fileId: {
|
||||||
uploadDate: Date,
|
type: String,
|
||||||
contentType: String,
|
index: true,
|
||||||
ext: String,
|
},
|
||||||
size: Number,
|
originalFileName: String, // The name of the original file
|
||||||
|
uploadDate: Date, // The date when the file was uploaded
|
||||||
|
contentType: String, // The mimetype of the file
|
||||||
|
ext: String, // The extention of the file
|
||||||
|
size: Number, // The size of the file
|
||||||
|
|
||||||
// Image/Video specific properties
|
// Image/Video specific properties
|
||||||
width: Number, // The width of the image/video in pixels
|
width: Number, // The width of the image/video in pixels
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect to the database
|
||||||
|
*/
|
||||||
export async function connectMongo() {
|
export async function connectMongo() {
|
||||||
try {
|
try {
|
||||||
await mongoose.connect(process.env.MONGODB_CONNECTION_STRING);
|
await mongoose.connect(process.env.MONGODB_CONNECTION_STRING);
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Downloads a file to the users browser
|
||||||
|
*
|
||||||
|
* @param {string} uri The url to the file
|
||||||
|
* @param {string} name The name of the file to be saved
|
||||||
|
*/
|
||||||
export function downloadURI(uri, name) {
|
export function downloadURI(uri, name) {
|
||||||
var link = document.createElement("a");
|
var link = document.createElement("a");
|
||||||
link.download = name;
|
link.download = name;
|
||||||
|
Reference in New Issue
Block a user