Skip to content

Make mentioned changes in resources files to follow the same convention #898

Open
@PrashanthPuneriya

Description

@PrashanthPuneriya

Description

As a contributor,
I need consistent style followed in resources file,
so that I don't get confused that whether some part of the code is missing or not.

Mocks

@users_ns.response(HTTPStatus.CREATED, "%s" % messages.PASSWORD_SUCCESSFULLY_UPDATED)
@users_ns.response(HTTPStatus.BAD_REQUEST, "%s" % messages.USER_ENTERED_INCORRECT_PASSWORD)
@users_ns.response(
HTTPStatus.UNAUTHORIZED,
"%s\n%s\n%s"
% (
messages.TOKEN_HAS_EXPIRED,
messages.TOKEN_IS_INVALID,
messages.AUTHORISATION_TOKEN_IS_MISSING,
),
)
@users_ns.route("user/change_password")

Here the route is below the responses which breaks the convention.
@users_ns.route("register")
class UserRegister(Resource):
@classmethod
@users_ns.doc("create_user")
@users_ns.response(HTTPStatus.CREATED, "%s" % messages.USER_WAS_CREATED_SUCCESSFULLY)
@users_ns.response(
HTTPStatus.BAD_REQUEST,
"%s\n%s\n%s"
% (
messages.USERNAME_FIELD_IS_EMPTY,
messages.PASSWORD_INPUT_BY_USER_HAS_INVALID_LENGTH,
messages.EMAIL_INPUT_BY_USER_IS_INVALID
),
)
@users_ns.response(
HTTPStatus.CONFLICT,
"%s\n%s"
% (
messages.USER_USES_A_USERNAME_THAT_ALREADY_EXISTS,
messages.USER_USES_AN_EMAIL_ID_THAT_ALREADY_EXISTS
),
)

Here the responses aren't attached with the route function but with the put().

Acceptance Criteria

Update [Required]

  • Make the above mentioned changes in the code to follow the same convention throughout the file.
  • Check the same with other resources files and fix them if such convetion is broken.

Definition of Done

  • All of the required items are completed.
  • Approval by 1 mentor.

Estimation

4 hours

Metadata

Metadata

Assignees

Labels

Category: CodingChanges to code base or refactored code that doesn't fix a bug.Status: On HoldIssue or PR needs more info, a discussion, a review or approval from a Maintainer/Code Owner.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions