Skip to content

Commit

Permalink
-ch(swagger docs):correct swagger for header setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Niwemugisha authored and RwigimbaP-dev committed Apr 2, 2024
2 parents eea6655 + eb0bfcf commit e9af973
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 57 deletions.
74 changes: 46 additions & 28 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"airbnb-base",
"prettier"
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".ts"]
}
}
},
"env": {
"node": true,
"es6": true,
"mocha": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"one-var": 0,
"no-console":0,
"no-undef": 0,
"import/extensions":"off",
"import/no-unresolved": "off",
"global-require": 0,
"mocha/max-top-level-suites": 0,
"mocha/no-identical-title": 0,
"one-var-declaration-per-line": 0,
"new-cap": 0,
"import/no-import-module-exports": 0,
"consistent-return": 0,
"no-param-reassign": 0,
"func-names": [0, "always"],
"comma-dangle": 0,
"curly": ["error", "multi-line"],
"import/no-unresolved": [2, { "commonjs": true }],
"no-shadow": ["error", { "allow": ["req", "res", "err"] }],
"valid-jsdoc": [
"error",
Expand All @@ -42,15 +37,38 @@
"requireReturnDescription": true
}
],
"arrow-body-style": "error",
"require-jsdoc": ["error", {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true
"import/extensions": [
"error",
"ignorePackages",
{
"": "never",
"js": "never",
"ts": "never"
}
],
"import/prefer-default-export": 0,
"require-jsdoc": [
"error",
{
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true
}
}
}],
"@typescript-eslint/no-var-requires": "error",
"quotes": ["error", "double"]
}
]
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["prettier", "node", "mocha", "jsdoc", "@typescript-eslint"],
"overrides": [
{
"extends": ["plugin:@typescript-eslint/disable-type-checked"],
"files": ["*.js", "*.ts"]
}
]
}

23 changes: 12 additions & 11 deletions .hound.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
eslint:
enabled: true
config_file: .eslintrc.json
file_patterns:
- "*.js"
- "*.ts"
enabled_plugins:
- eslint-plugin-react
- eslint-plugin-import
- eslint-plugin-prettier
- eslint-plugin:@typescript-eslint
linters:
eslint:
enabled: true
config_file: .eslintrc
file_patterns:
- '*.js'
- '*.ts'
enabled_plugins:
- eslint-plugin-react
- eslint-plugin-import
- eslint-plugin-prettier
- eslint-plugin:@typescript-eslintnp
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
[![Coverage Status](https://coveralls.io/repos/github/atlp-rwanda/champs-ec-be/badge.svg?branch=development)](https://coveralls.io/github/atlp-rwanda/champs-ec-be?branch=development)
### champs-ec-be

[![Coverage Status](https://coveralls.io/repos/github/atlp-rwanda/champs-ec-be/badge.svg?branch=development)](https://coveralls.io/github/atlp-rwanda/champs-ec-be?branch=development)
![Code Climate coverage](https://img.shields.io/codeclimate/coverage/atlp-rwanda/champs-ec-be)

[![Maintainability](https://api.codeclimate.com/v1/badges/44cd8dee96aeb01f2dd0/maintainability)](https://codeclimate.com/github/atlp-rwanda/champs-ec-be/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/44cd8dee96aeb01f2dd0/test_coverage)](https://codeclimate.com/github/atlp-rwanda/champs-ec-be/test_coverage)
![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white) ![Express.js](https://img.shields.io/badge/express.js-%23404d59.svg?style=for-the-badge&logo=express&logoColor=%2361DAFB) ![CircleCI](https://img.shields.io/badge/circle%20ci-%23161616.svg?style=for-the-badge&logo=circleci&logoColor=white)

# champs-ec-be
# How to use the project

## How to use the project online

-

## How to run the project locally

To run the project you have to and run the following command :

- git clone https://github.com/atlp-rwanda/champs-ec-be.git
- npm install
- npm run build
- npm run dev

## To test the project you run

- npm run test
2 changes: 1 addition & 1 deletion src/middlewares/user.auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Request, Response, NextFunction } from "express";
import passport from "../config/passport.config";

const authenticate = (req: Request, res: Response, next: NextFunction) => {
passport.authenticate("jwt", { session: false }, (error:any, user:any) => {
passport.authenticate("jwt", { session: false }, (error: any, user: any) => {
if (error) {
return res.status(500).json({ error: error.message });
}
Expand Down
5 changes: 1 addition & 4 deletions src/validations/user.validations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ const userSchema = z.object({
password: z
.string()
.min(8, "password should be atleast 8 characters length")
.regex(
passwordStrength,
"Password sholud contain capital letter, small letter and symbol"
)
.regex(passwordStrength, "Password should be alphanumeric ")
});

export { userSchema };
20 changes: 10 additions & 10 deletions swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@
},
"servers": [
{
"url": "http://localhost:5500",
"url": "http://localhost:5000",
"description": "Development server"
},
{
"url": "https://champs-ec-be.onrender.com",
"description": "Production server (HTTPS)"
},
{
"url": "https://champs-ec-be.onrender.com",
"description": "Production server (HTTP)"
}
],
"tags": [
Expand Down Expand Up @@ -48,7 +44,11 @@
}
}
}
}

},

"security": [{ "Bearer": [] }]


}
},
Expand Down Expand Up @@ -155,10 +155,10 @@

},
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
"Bearer": {
"type": "apiKey",
"name":"Authorization",
"in": "header"
}
}
}
Expand Down

0 comments on commit e9af973

Please sign in to comment.