-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
17,561 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import mongoose from "mongoose"; | ||
|
||
export const AddSchema = new mongoose.Schema({ | ||
title: { | ||
type: String, | ||
}, | ||
description: { | ||
type: String, | ||
minlength: 30, | ||
maxlength: 400, | ||
trim: true, | ||
}, | ||
budget: { | ||
type: Number, | ||
}, | ||
currency: { | ||
type: String, | ||
enum: ["SEK", "EUR", "USD", "NOK", "GBP", "DKK", "CNY"], | ||
}, | ||
category: { | ||
type: String, | ||
enum: [ | ||
"Frontend", | ||
"Backend", | ||
"Graphics and Design", | ||
"Fullstack", | ||
"App Developer", | ||
"Chatbots", | ||
"Project Lead", | ||
"QA", | ||
"Legal Consulting", | ||
"Financial Consulting", | ||
"Analytics", | ||
"Game Developer", | ||
], | ||
}, | ||
time: { | ||
type: Date, | ||
}, | ||
createdAt: { | ||
type: Number, | ||
default: () => Date.now(), | ||
}, | ||
typeOf: { | ||
type: String, | ||
enum: ["Looking for", "Join"], | ||
}, | ||
user: { | ||
type: mongoose.Schema.Types.ObjectId, | ||
ref: "User", | ||
}, | ||
}); | ||
|
||
const Add = mongoose.model("Add", AddSchema); | ||
module.exports = Add; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import mongoose from "mongoose"; | ||
import crypto from "crypto"; | ||
|
||
//to validate the email when signing up/in | ||
const validateEmail = (email) => { | ||
const re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; | ||
return re.test(email); | ||
}; | ||
|
||
export const UserSchema = new mongoose.Schema({ | ||
username: { | ||
type: String, | ||
unique: true, | ||
required: true, | ||
}, | ||
email: { | ||
type: String, | ||
trim: true, | ||
lowercase: true, | ||
unique: true, | ||
required: "Email address is required", | ||
validate: [validateEmail, "Please fill a valid email address"], | ||
match: [ | ||
/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/, | ||
"Please fill a valid email address", | ||
], | ||
}, | ||
password: { | ||
type: String, | ||
required: true, | ||
}, | ||
accessToken: { | ||
type: String, | ||
default: () => crypto.randomBytes(128).toString("hex"), | ||
}, | ||
location: { | ||
type: String, | ||
}, | ||
name: { | ||
type: String, | ||
trim: true, | ||
minlength: 2, | ||
}, | ||
memberSince: { | ||
// type: Date, | ||
// default: () => new Date(), | ||
type: Number, | ||
default: () => Date.now(), | ||
}, | ||
bio: { | ||
type: String, | ||
trim: true, | ||
minlength: 10, | ||
maxlength: 250, | ||
}, | ||
linkedIn: { | ||
type: String, | ||
}, | ||
github: { | ||
type: String, | ||
}, | ||
userImage: { | ||
type: mongoose.Schema.Types.ObjectId, | ||
ref: "UserImage", | ||
}, | ||
}); | ||
|
||
const User = mongoose.model("User", UserSchema); | ||
module.exports = User; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.