- JDK 17+
- Any IDE with Java EE support
- MySQL installation
- Internet connection (first time build only)
- clone the project
- In
/student-initiatives-backend/src/main/resources/application.properties
,change the credentials to your MySQL details - Run the Schema generator.sql file to generate the database
- Run the
StudentInitiativesBackendApplication.java
at the root ofcom.woxsen.studentinitiatives
package. - The application will run on localhost:8080 by default and all APIs can be accessed from there.
Club -
{
"clubId": number,
"clubName": string,
"presidentName": string,
"vicePresidentName": string,
"mission": string,
"vision": string,
"school" : School
}
Event (Club) -
{
eventId: number,
title: string,
eventDesc: string,
date: string (format: "yyyy-MM-dd HH:mm:ss"),
club: Club
}
COE -
{
"id": number,
"name": string,
"coFounderName": string
"user": {
"email": string
},
"mentors": string,
"mission": string,
"vision": string
}
School -
{
"schoolId": number,
"schoolName" : string
}
COEPosts -
{
id: number,
title: string,
desc: string,
date: string (format: "yyyy-MM-dd HH:mm:ss")
coe: COE
}
URL | Method | Consumes | Produces | Description |
---|---|---|---|---|
/api/user/login | POST | JSON format - { "email" : string "password" : string |
JSON Format - {clubId: string} OR {coeId: string} |
Provided that the email-password combination is correct, returns a json containing either the clubId associated with it the account or the coeId associated with the account |
/api/user/ | POST | JSON.
Format - { "email" : string "password" : string } |
JSON format - {"success": string} | Adds a new user and returns success: "true" or success: "false" |
/api/user/ | DELETE | JSON Format - { "email":string, "password": string } |
JSON with success: "true" or "false" | Deletes the user with those credentials AND the club associated with that user |
/api/admin | POST | JSON format - { "email": string, "password": string } |
JSON with success: "true" or "false" | Adds the given credentials as an Admin |
/api/admin/login | POST | JSON format - { "email": string, "password": string } |
JSON with success: "true" or "false" | Returns success = "true" if credentials are correct or returns false |
/api/admin | DELETE | JSON format - { "email": string, "password": string } |
JSON with success: "true" or "false" | Returns success = "true" if given admin was removed successfully from the database or returns false |
URL | Method | Consumes | Produces | Description |
---|---|---|---|---|
/api/school/ | GET | Nothing | JSON JSON format - School[] |
Gets the list of all schools available in the DB |
/api/school/{schoolId}/clubs | GET | The {schoolId} path variable | JSON Format - Club[] |
Get the list of all the clubs associated with that schoolId |
/api/school/{schoolId} | GET | The {schoolId} path variable | JSON Format - School | Gets info on the specific school |
/api/school/ | POST | JSON Format - { "schoolName" : string } |
JSON format {"success":string} | Add a school to the database and return success ("true" or "false") |
/api/school/{schoolId} | DELETE | The {schoolId} path variable | JSON format - {"success":string} | Delete a school from DB by it's ID and returns success: "true" or "false" |
URL | Method | Consumes | Produces | Description |
---|---|---|---|---|
/api/club/ | GET | Nothing | JSON Format - Club[] | Returns list of all clubs |
/api/club/ | POST | JSON Format -
{ "clubName": string, "presidentName": string, "vicePresidentName": string, "mission":string | null, "vision": string | null, "email": string, "schoolId": number | null } |
JSON format - { "clubId": number } | Adds the given club to the DB and returns the generated clubId. The email and school with given schoolId must already exist in the DB. |
/api/club/{clubId} | GET | The path variable {clubId} | JSON Format - Club | Gets info on the specific club associated with the given clubId |
/api/club/{clubId} | DELETE | The path variable {clubId} | JSON format - {"success": string} | Deletes club with the given clubId and returns success: "true" or "false" |
/api/club | PATCH | JSON format -
{ "clubName": string, |
on success, Club | On success, returns the same club with the updated fields |
/api/club/{clubId}/image/{type} | GET | The {clubId} and {type} path variables. Type can only be "logos", "president" or "vice-president" | A JPEG,JPG or PNG image | Returns an image of the club associated with the given clubId. Image is of the president, vice-president or the club logo. |
/api/club/{clubId}/image/{type} | POST | The {clubId} and {type} path variables and a form-data as request body. Form-data should have a parameter "image" with the actual image (in JPEG,JPG or PNG format) attached as value. {type} can only be one of ["logos","president", "vice-president"] | JSON format - {success: string} | Adds the club logo, president or vice-president of the given club and returns success: "true" or "false" |
URL | Method | Consumes | Produces | Description |
---|---|---|---|---|
/api/event | GET | Nothing | JSON format - Event[] | Gets a list of all events available in the database |
/api/event/{eventId} | GET | The {eventId} path variable | JSON format - Event | Gets complete information on the given club |
/api/event/club/{clubId} | GET | The {clubId} path variable | JSON format - Event[] | Gets a list of all event associated with the club |
/api/event/dateRange | POST | JSON format - { "start": string (in format yyyy-mm-dd), "end": string (in format yyyy-mm-dd) } |
Event[] | Returns events between start date and end date (inclusive). Note: To get events for one date, put start and end as same |
/api/event | POST | JSON Format - { "title": string "eventDesc": string "clubId": number "date": "yyyy-MM-dd HH:mm:ss" } |
JSON Format - { "eventId": number } | Adds the given event to DB. |
/api/event/{eventId} | DELETE | The {eventId} path variable | JSON format - {success: string} | Deletes the given event from the DB and returns success: "true" or "false" |
/api/event/{eventId} | PATCH | The {eventId} path variable and JSON format -
{ "title": string "eventDesc": string "clubId": number "date": "yyyy-MM-dd HH:mm:ss" } |
JSON format - {"success" : string} | Updates the event associated with given event ID and returns success: "true" or "false" |
/api/event/image/{clubId}/{eventId} | GET | The {clubId} and {eventId} path variables | Image in .JPG, .JPEG or .PNG format | Gets image for the given eventId and clubId |
/api/event/image/{clubId}/{eventId} | PUT | The {clubId} and {eventId} path variables and a form-data as request body. Form-data should have a parameter "image" with the actual image (in JPEG,JPG or PNG format) attached as value | JSON format - {"success" : string} | Saves image and returns success = "true" or "false" |
URL | Method | Consumes | Produces | Description |
---|---|---|---|---|
/api/coe | GET | Nothing | JSON format - COE[] | Returns a list of all COEs in database |
/api/coe/{id} | GET | The {id} path variable | JSON format - COE | Returns information on a particular COE |
/api/coe/{coFounderEmail} | POST | the {coFounderEmail} path variable and Request body = JSON Format - { "name": string, "coFounderName": string "mentors": string | null, "mission": string | null, "vision": string | null } |
JSON format - { "id" : string } | Adds the given COE to database and returns it's id |
/api/coe/{id} | PATCH |
Request Body = JSON format - { "name": string, "coFounderName" : string "mentors": string | null, "mission": string | null, "vision": string | null } |
JSON format - COE | Returns the COE with updated information |
/api/coe/{id} | DELETE | The path variable {id} | JSON format - {"success" : string, "id": string} | Deletes the COE with given id and returns a success: "true" or "false" and returns the deleted COE's id if true |
/api/coe/{coeId}/image/{type} | GET | The path variable {coeId} and {type}. Valid type values = ["logo","cofounder"] | Image or JSON | Gets the image or returns a JSON in case of incorrect type or no image being found for those params. |
/api/coe/{coeId}/image/{type} | PUT | The path variable {coeId} and {type}. Also, a Form-Data as body with the image attached to key "image" .Valid type values = ["logo","cofounder"]. Only JPEG, JPG or PNG allowed. | JSON format - {"success": string} | Adds the given image to the backend |
URL | Method | Consumes | Produces | Description |
---|---|---|---|---|
/api/coe-post/ | GET | Nothing | COEPosts[] | Gets all COE Posts (Not recommended for general user-sided tasks) |
/api/coe-post/coe/{coeId} | GET | The path variable {coeId} | COEPosts[] | Gets all COE Posts from COE whose id = coeId |
/api/coe-post/{coePostId} | GET | The path variable {coePostId} | COEPosts | Gets info for COE Post with id = coePostId |
/api/coe-post/dateRange | POST | JSON format - { "start": string (in format yyyy-mm-dd), "end": string (in format yyyy-mm-dd) } |
COEPosts[] | Returns COE Posts between start date and end date (inclusive). Note: To get posts for one date, put start and end as same |
/api/coe-post/{coeId}/ | POST | The path variable {coeId} and request body = JSON Format - { "title" : string "desc" : string | null "date" : string (format: "yyyy-MM-dd HH:mm:ss") | null } |
JSON Format - {"coePostId": string} | Adds COE and returns it's ID in database |
/api/coe-post/{coePostId} | PATCH | The path variable {coePostId} and request body = JSON format - { "title" : string "desc" : string | null "date" : string (format: "yyyy-MM-dd HH:mm:ss") | null } |
The updated COEPosts as JSON | Updates the COE post with id = {coePostId} with given request body |
/api/coe-post/{coePostId} | DELETE | The path variable {coePostId} | JSON format - {"success" : string} | Deletes the given COE post which has id = {coePostId} and returns success = "true" or "false" |
/api/coe-post/{coeId}/image/{coePostId} | GET | The path variables {coeId} and {coePostId} | .JPEG, .PNG or .JPG in case of success or a JSON in case of error | Gets the image with the given coeId and coePostId |
/api/coe-post/{coeId}/image/{coePostId} | PUT | The path variables {coeId} and {coePostId} and a Form-Data as body with image attached to key "image" | JSON format - {"success": string} | Saves the image with given {coeId} and {coePostId} and returns "success" = "true" or "false" |
/api/coe-post/{coeId}/file/{coePostId} | GET | The variables {coeId} and {coePostId} | .zip, .pdf or JSON | Gets the file from the database otherwise returns a JSON with success:"false" in case of error |
/api/coe-post/{coeId}/file/{coePostId} | PUT | The variables {coeId} and {coePostId} and request body should have a Form-Data and the file attached to key "file" | JSON format = {"success": string} | Stores the file in database and returns success: "true" or "false". Accepted file types = [".zip",".pdf"] |