// Connections
import mongoConnection from "$connections/mongo/mongo.connection.js";

import mongoose from "mongoose";
const mongooseSchema = mongoose.Schema;

export const schemaModel = {
  name: {
    type: String,
    trim: true,
    unique: true,
    sparse: true,
    index: true,
  },
  content: {
    type: Buffer,
    default: "",
  },
  type: {
    type: String,
    default: "",
  },
  extension: {
    type: String,
    default: "",
  },
};

export const schema = new mongooseSchema(schemaModel, { timestamps: true });

export default mongoConnection.model("File", schema);
