frontend converted to ts
This commit is contained in:
Executable
+52
@@ -0,0 +1,52 @@
|
||||
const mongoose = require("mongoose");
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
const PostSchema = new Schema({
|
||||
user: {
|
||||
type: Schema.Types.ObjectId,
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
},
|
||||
avatar: {
|
||||
type: String,
|
||||
},
|
||||
likes: [
|
||||
{
|
||||
user: {
|
||||
type: Schema.Types.ObjectId,
|
||||
},
|
||||
},
|
||||
],
|
||||
comments: [
|
||||
{
|
||||
user: {
|
||||
type: Schema.Types.ObjectId,
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
},
|
||||
avatar: {
|
||||
type: String,
|
||||
},
|
||||
date: {
|
||||
type: Date,
|
||||
default: Date.now,
|
||||
},
|
||||
},
|
||||
],
|
||||
date: {
|
||||
type: Date,
|
||||
default: Date.now,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = mongoose.model("post", PostSchema);
|
||||
Executable
+113
@@ -0,0 +1,113 @@
|
||||
const mongoose = require("mongoose");
|
||||
|
||||
const ProfileSchema = new mongoose.Schema({
|
||||
user: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: "user",
|
||||
},
|
||||
company: {
|
||||
type: String,
|
||||
},
|
||||
website: {
|
||||
type: String,
|
||||
},
|
||||
location: {
|
||||
type: String,
|
||||
},
|
||||
status: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
skills: {
|
||||
type: [String],
|
||||
required: true,
|
||||
},
|
||||
bio: {
|
||||
type: String,
|
||||
},
|
||||
githubusername: {
|
||||
type: String,
|
||||
},
|
||||
experience: [
|
||||
{
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
company: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
location: {
|
||||
type: String,
|
||||
},
|
||||
from: {
|
||||
type: Date,
|
||||
required: true,
|
||||
},
|
||||
to: {
|
||||
type: Date,
|
||||
},
|
||||
current: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
],
|
||||
education: [
|
||||
{
|
||||
school: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
degree: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
fieldofstudy: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
from: {
|
||||
type: Date,
|
||||
required: true,
|
||||
},
|
||||
to: {
|
||||
type: Date,
|
||||
},
|
||||
current: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
],
|
||||
social: {
|
||||
youtube: {
|
||||
type: String,
|
||||
},
|
||||
twitter: {
|
||||
type: String,
|
||||
},
|
||||
facebook: {
|
||||
type: String,
|
||||
},
|
||||
linkedin: {
|
||||
type: String,
|
||||
},
|
||||
instagram: {
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
date: {
|
||||
type: Date,
|
||||
default: Date.now,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = mongoose.model("profile", ProfileSchema);
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
const mongoose = require("mongoose");
|
||||
|
||||
const UserSchema = new mongoose.Schema({
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
email: {
|
||||
type: String,
|
||||
required: true,
|
||||
unique: true,
|
||||
},
|
||||
password: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
avatar: {
|
||||
type: String,
|
||||
},
|
||||
date: {
|
||||
type: Date,
|
||||
default: Date.now,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = mongoose.model("user", UserSchema);
|
||||
Reference in New Issue
Block a user