-
Notifications
You must be signed in to change notification settings - Fork 0
RESTful services API
Our app: https://ecse321-group12.herokuapp.com/
To run locally, run CoopApplication.java then go to http://localhost:8080/
We never pass model/dto obects as parameters, but rather the primary keys. For GET methods, if one of the parameters does not correspond to an object in the database or in the wrong format, (or non-unique id when creating an object with POST), the method returns null (if it is returning) These are the methods we implemented in CoopController.java and related to our viewpoint (Employer) Please check our domain model and the DTO notes page to undertand the fields of these objects. Nt all these methods are stricly related to our viewpoint. Howvwer, we needed to be able to create the CoopSystem, Student and Employer to be able to test .... this is why you will find these methods here:
-
Any HTTP method "/"
-
POST "/coopsystem" These 2 requests have the same functionality. Create a new CoopSystem and return the CoopSystemDto. Our CoopSystem class is behaving like a singleton. So if an CoopSystem instance already exists, these methods will always return it (not create a new one). Note: You cannot use any other methods unless a CoopSystem instance is already there, so as a precautionary measure (always run one of these 2 requests first to avoid any HTTP 500 later on)
-
GET "/coopsystem" This method returnsthe CoopSystemDto (if the coopsystem exists)... Otherwise, HTTP 500 (returns null)
-
DELETE "/coopsystem" This method returns nothing and clears the whole database (if it is filled)
-
POST "/students/{userName}" This method creates a student with a specific userName (String) if no other user has this username. It returns the StudentDto
-
GET "/students/{userName}" This method returns a StudentDto of the student with this username
-
DELETE "/students/{userName}" This method returns nothing, deletes the student with this username.
-
GET "/students" This method returns an ArrayList of StudentDTO for all the students currently in the system.
-
POST "/employers/{userName}" This method creates an employer with a specific userName (String) if no other user has this username. It returns the EmployerDto
-
GET "/employers/{userName}" This method returns an EmployerDto of the employer with this username
-
DELETE "/employers/{userName}" This method returns nothing, deletes the employer with this username.
-
GET "/employers" This method returns an ArrayList of EmployerDTO for all the employers currently in the system.
-
GET "/coopusers/{userName}" This method returns the coopuserdto (Student or Employer)with the specific username
-
GET "/coopusers" This method returns an ArrayList of CoopUserDTO for all the students or employers currently in the system.
-
POST "/setPassword?username={username}&Password={password}" This method sets the password from null (first time this method is called) or change the password for the user with this username. The method returns a CoopUserDto
-
GET "/login?username={username}&password={password}" This method returns true if the username and the password correspond to those of a coopuser in the system, false otherwise
-
POST "/studentPersonal?StudentName={studentName}&PersonalDocumentsIds={personalDocumentsIds}" This method sets the student's personal documents (CV and Transcript) . The studentName is the student's username. personalDocumentsIds is an arraylist of the document's ids (must already be in the system). The method returns a StudentDto.
-
POST "/studentPreferences?StudentName={studentName}&AllowCV={a}&AllowTranscript={b}" This method sets the student's (with the String studentName as username) as privacy settings. a and b are booleans. This method returns a StudentDto. If a=false & b=true (nothing will change. The default when we create a student is false,false)
-
POST "/createDocument?DocumentId={docId}&UserName={userName}&Type={type}" This method return nothing. It creates a document. If the string docId was already used, or the String userName does not correspond to a username in the system, nothing is created. This user is now the author of this document. type is a DocumentType enum specifying what is the type of this document.
-
GET "/getDocument?DocumentId={docId}" This method returns a DocumentDto for the document withis specific docId String.
-
GET "/getDocuments?AuthortId={authorId}" This method returns an arraylist of DocumentDto for all the documents authored by the user with the specified username
-
DELETE "/deleteDocument?DocumentId={docId}" This method returns nothing. It deletes the document with the specified document Id.
-
POST "/createEventNotification?EventNotificationId={enId}" This method returns nothing. it creates an eventNotification with specified primary key enID (attribute "name" in our model) only if this name was notused before for any eventnotification
-
POST "/setEventSettings?EventNotificationId={enId}&Type={type}&Location={location}&Date={date}&StartTime={startTime}&EndTime={endTime}" This method returns nothing. It sets the eventNotification with the enId primary key. All parameters are strings (the date format is "yyyy-mm-dd" , the time format is "hh:mm:ss" ). If the end time is before the start time, then no change is done
-
GET "/getEventNotifications?EventNotificationId={eventNotificationId}" This method returns an EventNotificationDto for the EventNotification with the specified id
-
GET "/getEventNotifications" This method return an arrayList of EventNotificationDto for all event notifications
-
GET "/getEventNotificationsinXdays?NumberOfDays={x}" This method return an arrayList of EventNotificationDto for all event notifications in the coming x days. x is int
-
DELETE "/Event?EentId={mId}" This method deletes an event notification with the specified id
-
POST "/newMessage?MessageId={mId}&SenderName={sender}&ReceiverName={receiver}&Content={content}&ListofAttachementsIds={attachementsIds}" This method returns nothing. All parameters are strings except attachementsIds (which is an arraylist String of the document attachementIds). It creates a message only if the mId is unique among messages, the sender and receiver are usernames for users who exist in the database.
-
GET "/Message?MessageId={mId}" This method returns a MessageDto for the message with the specified id.
-
DELETE "/Message?MessageId={mId}" This method returns nothing. It deletes a message with the specified id.
-
GET "/SentMessages?SenderName={sender}" This method returns an arraylist of MessageDto of a user's (identified by username) sent messages
-
GET "/ReceivedMessages?ReceiverName={receiver}" This method returns an arraylist of MessageDto of a user's (identified by username) received messages
-
GET "/OneWayMessages?SenderName={sender}&ReceiverName={receiver}"This method returns an arraylist of MessageDto of messages sent from a sender to a receiver (both identified by username)
-
POST "/newJob?JobId={jobId}&EmployerName={employerName}&StudentName={studentName}" This methods returns the CoopJobDto for the coopjob it just created. The job id is a unique string andd employerName, studentName are usernames for exisiting student and employer.
-
GET "/CoopJob?JobId={jobId}" This method returns a CoopJobDto for the exisiting coopjob with the specified job id.
-
GET "/JobsByEmployer?EmployerName={employerName}" This method returns an arraylist of CoopJobDto for the list of coopjobs of this employer
-
GET "/JobsByStudent?StudentName={studentName}" This method returns an arraylist of CoopJobDto for the list of coopjobs of this student
-
GET "/JobsByEmployerAndStudent?EmployerName={employerName}&StudentName={studentName}" This method returns an arraylist of CoopJobDto for the list of coopjobs between this employer and student
-
GET "/JobsByEmployerAndStudentAndEndDate?EmployerName={employerName}&StudentName={studentName}&EndDate={endDate}" This method returns a CoopJobDto with the specified enddate(String in the format yyyy-mm-dd) between the employer and the student
-
POST "/JobSettings?JobId={jobId}&StartDate={startDate}&EndDate={endDate}&JobName={name}&State={state}" This method returns nothing. It sets/changes the settings of an existing CoopJob with the specified id. Start And Enddates are Strings with the format yyyy-mm-dd. State is an enum type
-
POST "/JobState?JobId={jobId}&State={state}" This method returns nothing. It sets/changes the state of an existing CoopJob with the specified id. State is an enum type
-
POST "/addDocumentToJob?JobId={jobId}&DocumentId={documentId}" This method returns nothing. it adds the existing document (with the specified document id) to the list of documents of the existing job (with the specified job id)
-
GET "/AuthoredDocuments?userName={username}" This method returns an arraylist of DocumentDto for the list of documents authored by the user with the specified username
-
GET "/Attachements?MessageId={messageId}" This method returns an arraylist of DocumentDto for the list of documents in a message with the specified id
-
GET "/CoopJobDocuments?JobId={jobId}" This method returns an arraylist of DocumentDto for the list of documents in a coopjob (with the specified id)
-
GET "/CoopJobDocumentsType?JobId={jobId}&DocumentType={type}" This method returns an arraylist of DocumentDto for the list of documents (with the specified enum type) in a coopjob (with the specified id)
-
GET "/ArchivedInterns?EmployerName={employerName}" This method returns a list of StudentDto for the list of students who interned with an employer (with specified username)
-
GET "/ArchivedInternDocuments?EmployerName={employerName}&StudentName={studentName}" This method returns a list of DocumentDto for the list of personal documents of a student (with the specified username) who interned with an employer (with specified username). It takes into account the student's privacy settings (if the student does not allow CV and transcript to be shared, an empty list will return)
-
GET "/ArchivedInternsDocuments?EmployerName={employerName}" This method returns an arraylist of arraylists of DocumentDto for the personal documents of students who interned with the employer (with the specified username).It takes into account the student's privacy settings (if the student does not allow CV and transcript to be shared, an empty list will return)