ita-social-projects / TeachUA

The project aims to promote the Ukrainian language for study clubs in Russian-speaking regions of Ukraine. This is a web application that contains a database of clubs with the Ukrainian language of instruction. Clubs have the opportunity to register on the site and provide information about themselves. Users can search for clubs by various parameters (activity type, location, etc.)
MIT License
22 stars 10 forks source link

[API] Add error messages for entering invalid data #2108

Open AnnaMalibu opened 8 months ago

AnnaMalibu commented 8 months ago

Environment: Linux Arch/ ; Chrome 120.0.6099.71 (64-bit); Postman 2023 (v10.20).

Reproducible: Always Build found:DEV back:7dd7; front:d5b9; 04.01.2024

Preconditions It is necessary to add an error message that would clarify the subject of the error during API testing

Steps to reproduce

  1. For entering the invalid data into the "phone" field, the message should be: "The phone does not correspond to the specified format";

  2. For entering the invalid data into the "password" field, the message should be: "The password cannot be shorter than 8 and longer than 20 characters, must contain at least one capital letter, must contain at least one digit, must contain at least one special character";

  3. For entering the invalid data into the "latitude", and "longitude" while creating a new city, the message should be: "Not found address with such coordinates: {latitude}, {longitude}";

  4. For entering the invalid data into the "firstname" field, the message should be: "Name cannot contain more than 25 characters, cannot contain special characters, numbers, must begin and end with a letter"

  5. For entering the invalid data into the "lastname" field, the message should be: "Surname" cannot contain more than 25 characters, cannot contain special characters, numbers, must begin and end with a letter";

  6. For entering the invalid data into the "email" field, the message should be: "Invalid email format";

Actual result No error message beside the Status code 400, 403.

Expected result Error message that clearly describes the subject of the error in the response.