Back End Methods Guide - ihsantaha/Revature-ProjectII-Simploy GitHub Wiki

Users


Add user:
/User/
Post
takes user in format:
{
      "firstName": "asd",
      "lastName": "asd",
      "email": "asd32423",
      "pnumber": "asd",
      "password": "asd",
      "role": 0
  }
(DONT SEND ID)
returns user sent in with id
(use: registration)


LOGIN:
POST
/User/login
 takes user in format:
 {"email":"ui","password":"pls"}
(only needs proper  email and password)
returns user if found
returns blank/(null?) if not
(use:login)


Update:
POST
/User/update
takes user in format:
{
      "firstName": "asdqwd",
      "lastName": "aqwdsd",
      "email": "dwqwd",
      "pnumber": "333333",
      "password": "pqwdls",
      "role": 0,
      "id": 2

  }
DO NOT SEND BLANKS OR NULLS FOR ANY PART OF THIS, it will store it. NEEDS id
returns user if found
returns exception if not ( id isn't present)
(Use:update user)



----------------------------------------------------------------------------------------------------
Resume's

All resume's
GET
/Resume
returns all resumes AND USER ASSOCIATED  AND SKILLS[]
(use: filling out data tables)


Add resume's
POST
/Resumes
Takes resume in format :
    {
        "description": "egfergr23ey",
        "user": {
            "id": 3
        }
    }
user.id in above is the corresponding user's ID to the resume
(ONLY ONE PER USER, server will accept multiple.. don't do it,
use get resume by uid beFORE adding a resume to make sure there isn't one associated)
returns the resume object created (will send back blanks for user object but server side it is full) +  skills object array
(first time making a resume, not sending in an ID)



Find Resume by User ID
POST
/Resumes/uid
Takes User in format :
 {
   "id": 3
 }
(can accept a full fledged user as well)
returns the FULL resume with all user object + skills
returns status 400 if id isn't found
(use: view profile of user. Must send a VALID user
to get a resume, if non-valid user, will cause error.)


Update resume DESCRIPTION
POST
/Resumes/update
Takes User in format :
 {
        "description": "eyyy11",
        "resId": 0
    }
(can accept a full fledged resume/user as well)
Updates a resume's description.
(use: edit profile/resume of user)


Update resume SKILLS
POST
/Resumes/addskill
Takes User in format :
{
	"skills" :[
		{
			"skillId":6,
			"title":"AJAX"

		}
	],
	"resId": 0

}
(can accept a full fledged resume/user as well)
Updates a resume's SKILLS
returns: Resume /user/skills
returns error if skills are existent on resume/ typo on title
WILL ADD A SKILL IF THE SKILLID ISNT FOUND
(use: add skill/ profile editing of user )


-----Resume - Skills

resume's add skills can add as many as you want initially
after that one at a time


you need just id to delete but you need both to add


----Skills









-----------------project-------------

Add Project
POST
/Project
Takes Project in format :
{
       "description": "pls",
        "startDate": "12-11-09",
        "endDate": "12-11-10",
        "title": "Wedostuff",
        "groupSize": 3,
       "resume": {
           "resId": 0
       }
}
(can accept a full fledged resume/user as well)
Updates a resume's Project, there can be multiple projects PER resume
returns: new project object, resume is nulled sans resId
returns error if resid cannot be found ;
(use - add project to resume)


grab all projects
get
/Project

(can accept a full fledged resume/user as well)
Updates a resume's Project, there can be multiple projects PER resume
returns: Resume /user/skills
(use ???? )



delete Project
POST
/Project/delete
Takes Project in format :
{
       "proId": 18
}
(can accept a full fledged resume/user as well)
Remove a resume's Project based off of ID
returns: null/ empty
returns error if proid cannot be found ;
(use - add project to resume)



get  Project  by RESUME id
POST
/Project/resid
Takes Resume in format :
{
        "resId": 0
}
(can accept a full fledged resume/user as well)
Grabs all associated projects with the resume
returns all projects (inside of that object skills/resume/user)
returns [] if resID not found
(use - profile view)









//////////////////experience
get all gets all
GET

add
POST
 {
        "company": "testusko",
        "title": "papasmurf",
        "startYear": "2000",
        "endYear": "2009",
        "resume": {
        	"resId": 0
        }
}




delete
/delete
POST
{
       "expId": 0
}



Experience/id
{
       "expId": 0
}

gets exp by id
(not needed except for test purposes)


Grab all

/resid
{
        "resId": 0
}
grab all associated exp with the resume id




/////////////education
get all educations
GET

add education
POST
    {
        "school": "University",
        "type": "Bachelors",
        "gradYear": 2090,
        "resume": {
            "resId": 0
        }
    }



 delete education
{
        "edu_id": 1
}
on success sends back education object



//////////////////////certifications

check all certs
GET
/Certification



add certifications
POST
/Certification
 {
        "title": "Journeymon1",
        "gotYear": "1901",
        "resume": {
            "resId": 0
        }
    }
returns added cert ( with other fields null'd



/Certification/delete
 {
		"cert_id": 3
    }
grab single cert
returns what was deleted
returns nothing if not exist





////////////////////////Jobs
Get all jobs
/Job
GET



Post to jobs
/Job
POST
{
        "description": "p1123l23ease d",
        "title": "Prog32rammer1",
        "location": "Tx2",
        "company": "nexus1",
        "website": "www.no.com",
        "postDate": "12-11-91",
        "user": {
            "id": 3
        }
    }
returns jobs object (willl have a partially filled out user as well with only uid)

Delete a job
/Job/delete
POST
 {
        "jobId": 1
}


Add a skill to a  job
/Job/addskill
POST
Update resume SKILLS
Takes Job in format :
{
	"skills" :[
		{
			"skillId":6,
			"title":"AJAX"

		}
	],
	"jobId": 2

}


Get all jobs by userid
Job/uidjobs
POST
(user object)
{
            "id": 3
}








































// no job controller no skill controller



------------------------------------------------------------------------------------------
Functions strictly for testing:
(no actual use on website)
/////////resume/////////

Get Resume by ResumeID:
Resume/id
Post
takes in Resume object:
  {
		"resId": 4
    }
returns the Resume build (user object/skills object array /Resume members)




///////////Users////////////

get all users:
/User/
GET
returns all users


Find user by ID:
POST
/User/id
takes user in format:
{"id":2}
also accepts a blank user sans id... because that just makes sense.
returns  user if found
returns blank/ (null?) if not


//////////projects ////////////////////////

All Projects
GET
/Project
returns all Projects -user object associated -resume associated- skill object array  associated
(use: filling out data tables)



get  Project  by id
POST
/Project/id
Takes Project in format :
{
       "proId": 18
}
(can accept a full fledged resume/user as well)
Updates a resume's Project, there can be multiple projects PER resume
returns: new project object, resume is nulled sans resId
returns error if resid cannot be found ;
(use - ??)



get  Project  by title
POST
/Project/title
Takes Project in format :
{
       "title": "??????"
}

(use - NONE)



/////////////cert

/Certification/id
 {
		"cert_id": 3
    }
grab single cert

//////////////job

get individual job
/Job/id
POST
 {
        "jobId": 1
    }
get first users job
/Job/uid
{
    "id": 3
}
⚠️ **GitHub.com Fallback** ⚠️