Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions models/url.model.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const mongoose = require('mongoose')
const Schema = mongoose.Schema
const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const ShortUrlSchema = new Schema({
const shortUrlSchema = new Schema({
url: {
type: String,
required: true
Expand All @@ -12,34 +12,33 @@ const ShortUrlSchema = new Schema({
},
custom: {
type: Boolean,
required: false
default: false
},
count: {
type: Number,
default: 0,
required: true
},
TimeCreation: {
timeCreation: {
type: Date,
required: true,
default: new Date()
default: Date.now,
required: true
},
TimeDeletion: {
timeDeletion: {
type: Date,
required: true
},
password:{
password: {
type: Boolean,
default: false,
required: true
},
passwordHash: {
type: String,
default: "",
required: false
default: ""
}
})
});

const ShortUrl = mongoose.model('shortUrl', ShortUrlSchema)
const ShortUrl = mongoose.model('ShortUrl', shortUrlSchema);

module.exports = ShortUrl
module.exports = ShortUrl;