coifstackcommons


Namecoifstackcommons JSON
Version 1.0 PyPI version JSON
download
home_pagehttps://github.com/Urtats-Code/coifstack-commons
SummaryNone
upload_time2025-02-07 11:47:16
maintainerNone
docs_urlNone
authorcoifstackcommons
requires_pythonNone
licenseMIT
keywords utils authentification response validation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Commons 

Commons is a set of functions that all the services share such as: field validations, authentification, password hashing and checking ... 


## Utils 

The `utils` folder contains a collection of utility functions that provide standardized processing and validation across the entire project. These functions help ensure consistency, security, and reliability.


### Email handeling 

This module contains functions for validating email addresses to ensure they meet the required format and structure.

### Password handeling

This module provides functions for securely managing user passwords, including hashing and verification.

### Response handeling 

Defines the common response formats returned by the API, ensuring uniformity across endpoints. Below are the standardized response types with examples:

1. Base Success Response

General success response for API requests.

```{
    "data": {"id": 1, "name": "John Doe"},
    "message": "Success",
    "status": True
}
```

2. Base Success Response

General error response for client-side issues.

```
{
    "message": "Invalid request",
    "code": 400,
    "status": False
}
```

3. Unauthorized Response

When authentication is required but missing or incorrect.

```
{
    "message": "Unauthorized access",
    "code": 401,
    "status": False
}
```

4. Forbidden Response

When a user lacks the required permissions.

```
{
    "message": "Forbidden: Insufficient permissions",
    "code": 403,
    "status": False
}
```

5. Not Found Response

When the requested resource does not exist.

```
{
    "message": "Resource not found",
    "code": 404,
    "status": False
}
```

6. Validation Error Response

When input validation fails.

```
{
    "message": "Invalid input",
    "code": 422,
    "status": False,
    "errors": {
        "email": "Invalid email format",
        "password": "Too short"
    }
}
```

7. Server Error Response

When an unexpected error occurs on the server.

```
{
    "message": "Internal Server Error",
    "code": 500,
    "status": False
}
```

8. Conflict Response

When a request conflicts with existing data (e.g., duplicate entries).

```
{
    "message": "Conflict: Resource already exists",
    "code": 409,
    "status": False
}
```

9. Created Response

When a new resource is successfully created.

```
{
    "data": {"id": 1, "name": "New User"},
    "message": "Resource created successfully",
    "code": 201,
    "status": True
}
```

10. No Content Response

When a request is successful but has no content to return.

```
{
    "message": "No content available",
    "code": 204,
    "status": True
}
```



### Validation 

This module contains a set of validation tools to ensure the integrity of user-input data before it is processed or stored.

Supported Validations:
- **Full Name Validation:** Ensures that names contain only letters, are properly formatted, and include at least two words.
- **Company Name Validation:** Checks that company names are correctly structured, allowing only valid characters and ensuring they start with a letter.
- **Password Validation:** Verifies that passwords meet security standards when first entered, enforcing rules such as length, uppercase/lowercase letters, digits, and special characters.

These validation functions help maintain data integrity and prevent improper or malicious input from entering the system.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Urtats-Code/coifstack-commons",
    "name": "coifstackcommons",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "utils, authentification, response, validation",
    "author": "coifstackcommons",
    "author_email": "urtatsberrocal@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/2e/b1/e3fa9dc627e67799a363eb3aaf9b0dac558cbe4aff81ee52194235c7b952/coifstackcommons-1.0.tar.gz",
    "platform": null,
    "description": "# Commons \n\nCommons is a set of functions that all the services share such as: field validations, authentification, password hashing and checking ... \n\n\n## Utils \n\nThe `utils` folder contains a collection of utility functions that provide standardized processing and validation across the entire project. These functions help ensure consistency, security, and reliability.\n\n\n### Email handeling \n\nThis module contains functions for validating email addresses to ensure they meet the required format and structure.\n\n### Password handeling\n\nThis module provides functions for securely managing user passwords, including hashing and verification.\n\n### Response handeling \n\nDefines the common response formats returned by the API, ensuring uniformity across endpoints. Below are the standardized response types with examples:\n\n1. Base Success Response\n\nGeneral success response for API requests.\n\n```{\n    \"data\": {\"id\": 1, \"name\": \"John Doe\"},\n    \"message\": \"Success\",\n    \"status\": True\n}\n```\n\n2. Base Success Response\n\nGeneral error response for client-side issues.\n\n```\n{\n    \"message\": \"Invalid request\",\n    \"code\": 400,\n    \"status\": False\n}\n```\n\n3. Unauthorized Response\n\nWhen authentication is required but missing or incorrect.\n\n```\n{\n    \"message\": \"Unauthorized access\",\n    \"code\": 401,\n    \"status\": False\n}\n```\n\n4. Forbidden Response\n\nWhen a user lacks the required permissions.\n\n```\n{\n    \"message\": \"Forbidden: Insufficient permissions\",\n    \"code\": 403,\n    \"status\": False\n}\n```\n\n5. Not Found Response\n\nWhen the requested resource does not exist.\n\n```\n{\n    \"message\": \"Resource not found\",\n    \"code\": 404,\n    \"status\": False\n}\n```\n\n6. Validation Error Response\n\nWhen input validation fails.\n\n```\n{\n    \"message\": \"Invalid input\",\n    \"code\": 422,\n    \"status\": False,\n    \"errors\": {\n        \"email\": \"Invalid email format\",\n        \"password\": \"Too short\"\n    }\n}\n```\n\n7. Server Error Response\n\nWhen an unexpected error occurs on the server.\n\n```\n{\n    \"message\": \"Internal Server Error\",\n    \"code\": 500,\n    \"status\": False\n}\n```\n\n8. Conflict Response\n\nWhen a request conflicts with existing data (e.g., duplicate entries).\n\n```\n{\n    \"message\": \"Conflict: Resource already exists\",\n    \"code\": 409,\n    \"status\": False\n}\n```\n\n9. Created Response\n\nWhen a new resource is successfully created.\n\n```\n{\n    \"data\": {\"id\": 1, \"name\": \"New User\"},\n    \"message\": \"Resource created successfully\",\n    \"code\": 201,\n    \"status\": True\n}\n```\n\n10. No Content Response\n\nWhen a request is successful but has no content to return.\n\n```\n{\n    \"message\": \"No content available\",\n    \"code\": 204,\n    \"status\": True\n}\n```\n\n\n\n### Validation \n\nThis module contains a set of validation tools to ensure the integrity of user-input data before it is processed or stored.\n\nSupported Validations:\n- **Full Name Validation:** Ensures that names contain only letters, are properly formatted, and include at least two words.\n- **Company Name Validation:** Checks that company names are correctly structured, allowing only valid characters and ensuring they start with a letter.\n- **Password Validation:** Verifies that passwords meet security standards when first entered, enforcing rules such as length, uppercase/lowercase letters, digits, and special characters.\n\nThese validation functions help maintain data integrity and prevent improper or malicious input from entering the system.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": null,
    "version": "1.0",
    "project_urls": {
        "Download": "https://github.com/Urtats-Code/coifstack-commons/archive/refs/tags/v_02.tar.gz",
        "Homepage": "https://github.com/Urtats-Code/coifstack-commons"
    },
    "split_keywords": [
        "utils",
        " authentification",
        " response",
        " validation"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2eb1e3fa9dc627e67799a363eb3aaf9b0dac558cbe4aff81ee52194235c7b952",
                "md5": "8a4c759b0b7e7a8c24b61776bc4fa209",
                "sha256": "a619c19e245268fa61a9812b76a8c7c74e101fbc0036b6204ba896a1d0204920"
            },
            "downloads": -1,
            "filename": "coifstackcommons-1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8a4c759b0b7e7a8c24b61776bc4fa209",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4655,
            "upload_time": "2025-02-07T11:47:16",
            "upload_time_iso_8601": "2025-02-07T11:47:16.962155Z",
            "url": "https://files.pythonhosted.org/packages/2e/b1/e3fa9dc627e67799a363eb3aaf9b0dac558cbe4aff81ee52194235c7b952/coifstackcommons-1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-07 11:47:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Urtats-Code",
    "github_project": "coifstack-commons",
    "github_not_found": true,
    "lcname": "coifstackcommons"
}
        
Elapsed time: 0.44432s