Skip to content

Commit

Permalink
Merge pull request #32 from Code-Hammers/profile-model
Browse files Browse the repository at this point in the history
Name Field Added to Profile Model
  • Loading branch information
brok3turtl3 authored Dec 1, 2023
2 parents c4d3b54 + 814763d commit 11e9988
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/controllers/profileController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ const createProfile = async (
res: Response,
next: NextFunction
) => {
const { user, bio, job, socials } = req.body;
const { user, name, bio, job, socials } = req.body;

try {
const profile: IProfile = await Profile.create({
user,
name,
bio,
job,
socials,
Expand All @@ -41,8 +42,9 @@ const updateProfile = async (
next: NextFunction
) => {
const { userID } = req.params;
const { bio, job, socials } = req.body;
const { name, bio, job, socials } = req.body;
const newProfile = {
name,
bio,
job,
socials,
Expand Down
3 changes: 3 additions & 0 deletions server/models/profileModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const profileSchema = new mongoose.Schema<IProfile>({
bio: {
type: String,
},
name: {
type: String,
},
job: {
title: String,
company: String,
Expand Down
1 change: 1 addition & 0 deletions server/types/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface IJob {

export interface IProfile extends Document {
user: ObjectId;
name: String;
bio?: string;
job?: IJob;
socials?: ISocial;
Expand Down

0 comments on commit 11e9988

Please sign in to comment.