From aa43e13880191a1f04a212eb2d7cc22b4ab802f5 Mon Sep 17 00:00:00 2001 From: xXEmilioXx <38227115+xXEmilioXx@users.noreply.github.com> Date: Thu, 26 Dec 2019 17:08:22 +0100 Subject: [PATCH] Update API reference to version 8.0 --- API_reference.yaml | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/API_reference.yaml b/API_reference.yaml index 98deef06..03bc1f35 100644 --- a/API_reference.yaml +++ b/API_reference.yaml @@ -1,7 +1,7 @@ swagger: "2.0" info: description: "This is the API reference of The Spoon project.\n \n VERSIONING: The version number works in this way: it's composed of two numbers separated by a point. The first number identifies the Sprint, so for example the version 2.1 of the API reference is related to the Sprint number 2. The second number starts from 0 and has to be increased by one each time the file is modified. The person who modifies this document is responsible for increasing the number.\n \n GROUPING OF ENDPOINTS: The endpoints are grouped by dividing them into customers' operations and owners' operations. All the endpoints that are not strictly related to customers nor owners remain inside the default group.\n \n AUTHENTICATION/AUTHORIZATION: The json web token returned when the login is performed is supposed to be put into x-auth-token header in the endpoints that require authorization" - version: "7.2" + version: "8.0" title: "The Spoon API reference" tags: - name: "customer" @@ -948,6 +948,7 @@ paths: put: tags: - "customer" + - "Frikk" summary: "Edit profile data of the customer" description: "Edit profile data of the logged in customer. All the customer data must be sent with this endpoint, even if it's not changed (in that case the fields must contain the current values). The password can't be changed through this endpoint, but the dedicated one should be used instead.\n Valid values for Gender are 'Male/Female/Other'.\n The username, the name and the surname can't be changed.\n The age is a range, for example '26-30'." consumes: @@ -986,6 +987,7 @@ paths: delete: tags: - "customer" + - "Frikk" summary: "Delete profile of the customer" description: "Delete profile of the logged in customer." responses: @@ -1020,7 +1022,7 @@ paths: schema: type: "array" items: - $ref: "#/definitions/PendingReview" + $ref: "#/definitions/PendingReviewWithPhoto" 404: description: "No restaurant associated to this account found" schema: @@ -1169,6 +1171,7 @@ paths: get: tags: - "owner" + - "Emilio" summary: "Return profile data of the owner" description: "Return own data of logged in owner. This endpoint should be used when the frontend has to visualize the profile of the owner." produces: @@ -1195,6 +1198,7 @@ paths: put: tags: - "owner" + - "Emilio" summary: "Edit profile data of the owner" description: "Edit profile data of the logged in owner. The password can't be changed through this endpoint, but the dedicated one should be used instead.\n The username can't be changed." consumes: @@ -1233,6 +1237,7 @@ paths: delete: tags: - "owner" + - "Emilio" summary: "Delete profile of the owner" description: "Delete profile of the logged in owner." responses: @@ -1256,6 +1261,7 @@ paths: put: tags: - "customer" + - "Marin" summary: "Change the password of the customer" description: "Change the password of the logged in customer. The current password must be provided, for security reasons. A 400 is sent back if the current password provided doesn't match, and the password change is not performed." consumes: @@ -1295,6 +1301,7 @@ paths: put: tags: - "owner" + - "Emilio" summary: "Change the password of the owner" description: "Change the password of the logged in owner. The current password must be provided, for security reasons. A 400 is sent back if the current password provided doesn't match, and the password change is not performed." consumes: @@ -1334,6 +1341,7 @@ paths: post: tags: - "consultant" + - "Marin" summary: "Creates consultant" description: "Creates a new consultant profile. This endpoint is used only for consultant registration. Since the consultant is a special user, it is required that a secret word of the company is sent in order to register, that secred word is stored in the backend as an environment variable.\n The endpoint, if the registration succeeds, returns the username of the account as a confirmation." operationId: "createConsultant" @@ -1367,6 +1375,7 @@ paths: post: tags: - "consultant" + - "Marin" summary: "Logs consultant into the system" description: "Logs consultant into the system. If the login succeeds, returns the json web token." operationId: "loginConsultant" @@ -1400,8 +1409,9 @@ paths: get: tags: - "consultant" + - "Marin" summary: "Return the global statistics" - description: "Return the aggregate statistics of ALL the users/restaurants in the application. The consultant must be logged in to access this endpoint (reserved to him). To be more precise, this is what is sent: \n - For each nationality, the number of customers\n - For each gender, the number of customers\n - For each age range, the number of customers\n - For each searched word, the number of customers\n - List of all the menu names with their ratings. It will be frontend's duty to sort them and show the top 10 and the bottom 10" + description: "Return the aggregate statistics of ALL the users/restaurants in the application. The consultant must be logged in to access this endpoint (reserved to him). To be more precise, this is what is sent: \n - The total number of registered customers\n - For each nationality, the number of customers\n - For each gender, the number of customers\n - For each age range, the number of customers\n - For each searched word, the number of customers\n - List of all the menu names with their ratings. It will be frontend's duty to sort them and show the top 10 and the bottom 10" operationId: "getStatistics" produces: - "application/json" @@ -1428,6 +1438,7 @@ paths: get: tags: - "consultant" + - "Marin" summary: "Return statistics of a specific nationality" description: "Return the statistics of the given nationality. The consultant must be logged in to access this endpoint (reserved to him)." operationId: "getStatisticOfNationality" @@ -1987,6 +1998,27 @@ definitions: reviewID: 988 menuName: "Sea menu" menuItemNames: [{"menuItemName": "Spaghetti allo scoglio"}, {"menuItemName": "Sashimi"}] + PendingReviewWithPhoto: + type: "object" + properties: + reviewID: + type: "integer" + receiptPhotoLink: + type: "string" + menuName: + type: "string" + menuItemNames: + type: "array" + items: + type: "object" + properties: + menuItemName: + type: "string" + example: + reviewID: 988 + receiptPhotoLink: "www.cloud.com/receiptPhoto" + menuName: "Sea menu" + menuItemNames: [{"menuItemName": "Spaghetti allo scoglio"}, {"menuItemName": "Sashimi"}] ApprovalStatus: type: "object" properties: @@ -2163,6 +2195,8 @@ definitions: Statistics: type: "object" properties: + totalRegisteredCustomers: + type: "integer" customersPerNationality: type: "array" items: @@ -2184,6 +2218,7 @@ definitions: items: $ref: "#/definitions/MenuForStatistics" example: + totalRegisteredCustomers: 120 customersPerNationality: [{"nationality": "Italian", "numberOfCustomers": 10}, {"nationality": "French", "numberOfCustomers": 8}, {"nationality": "Croatian", "numberOfCustomers": 11}] customersPerGender: [{"gender": "Male", "numberOfCustomers": 10}, {"gender": "Female", "numberOfCustomers": 8}, {"gender": "Other", "numberOfCustomers": 3}] customersPerAgeRange: [{"ageRange": "18-25", "numberOfCustomers": 34}, {"ageRange": "25-35", "numberOfCustomers": 28}, {"ageRange": "35-50", "numberOfCustomers": 15}] @@ -2227,6 +2262,8 @@ definitions: StatisticsOfNationality: type: "object" properties: + totalRegisteredCustomers: + type: "integer" customersPerGender: type: "array" items: @@ -2244,6 +2281,7 @@ definitions: items: $ref: "#/definitions/MenuForStatistics" example: + totalRegisteredCustomers: 120 customersPerGender: [{"gender": "Male", "numberOfCustomers": 10}, {"gender": "Female", "numberOfCustomers": 8}, {"gender": "Other", "numberOfCustomers": 3}] customersPerAgeRange: [{"ageRange": "18-25", "numberOfCustomers": 34}, {"ageRange": "25-35", "numberOfCustomers": 28}, {"ageRange": "35-50", "numberOfCustomers": 15}] numberOfSearchesPerWord: [{"word": "Pasta", "numberOfSearches": 51}, {"word": "Pizza", "numberOfSearches": 83}, {"word": "Spaghetti", "numberOfSearches": 31}]