-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/atlp-rwanda/eagles-ec-be int…
…o ft-user-signup-#187431242
- Loading branch information
Showing
16 changed files
with
198 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Eagle e-commerce CI/CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
|
||
pull_request: | ||
branches: | ||
- main | ||
- dev | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Building code | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout the code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20" | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Running test | ||
env: | ||
DB_CONNECTION: ${{ secrets.DB_CONNECTION }} | ||
TEST_DB: ${{ secrets.TEST_DB }} | ||
run: npm run test | ||
|
||
- name: Build application | ||
run: npm run build | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: soleil00/eagles-ec-be | ||
|
||
- name: Trigger Render Deployment | ||
env: | ||
RENDER_DEPLOYMENT_HOOK_URL: ${{ secrets.RENDER_DEPLOYMENT_HOOK_URL }} | ||
run: | | ||
curl -X POST $RENDER_DEPLOYMENT_HOOK_URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,21 @@ | ||
# eagles-ec-be | ||
|
||
<div style="display: flex; justify-content: center;" align="center"> | ||
<img src="https://codecov.io/gh/soleil00/eagles-ec-be/branch/dev/graph/badge.svg?token=9c1e8e93-1062-4e49-a58d-b2777a75fb70" alt="Codecov" > | ||
<img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/soleil00/eagles-ec-be/test.yml" > | ||
<a href="https://codeclimate.com/github/atlp-rwanda/eagles-ec-be/maintainability"><img src="https://api.codeclimate.com/v1/badges/dfe8454356fb9da65407/maintainability" /></a> | ||
|
||
</div> | ||
|
||
### Technology used | ||
|
||
![Node.js](https://img.shields.io/badge/-Node.js-000000?style=flat&logo=node.js) | ||
[![Passport.js](https://img.shields.io/badge/auth%20library-Passport.js-green)](http://www.passportjs.org/) | ||
[![PostgreSQL](https://img.shields.io/badge/database-PostgreSQL-blue)](https://www.postgresql.org/) | ||
[![Sequelize](https://img.shields.io/badge/ORM-Sequelize-orange)](https://sequelize.org/) | ||
[![Jest](https://img.shields.io/badge/testing-Jest-red)](https://jestjs.io/) | ||
[![ESLint](https://img.shields.io/badge/code%20style-ESLint-blueviolet)](https://eslint.org/) | ||
|
||
### Deployed link | ||
|
||
[Eagles EC](https://eagles-ec-be-development.onrender.com/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
testMatch: ["**/**/*.test.ts"], | ||
verbose: true, | ||
forceExit: true, | ||
clearMocks: true, | ||
resetMocks: true, | ||
restoreMocks: true, | ||
}; | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
testMatch: ["**/**/*.test.ts"], | ||
verbose: true, | ||
forceExit: true, | ||
clearMocks: true, | ||
resetMocks: true, | ||
restoreMocks: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import express from "express"; | ||
import { serve, setup } from "swagger-ui-express"; | ||
import { env } from "../utils/env"; | ||
import { getUsers, userSchema } from "./users"; | ||
|
||
const docRouter = express.Router(); | ||
|
||
const options = { | ||
openapi: "3.0.1", | ||
info: { | ||
title: "Eagles E-commerce API", | ||
version: "1.0.0", | ||
description: "Documentation for Eagles E-commerce Backend", | ||
}, | ||
|
||
servers: [{ | ||
url: `http://localhost:${env.port}`, | ||
description: 'Development server', | ||
}, { | ||
url: 'https://eagles-ec-be-development.onrender.com/', | ||
description: 'Production server', | ||
}], | ||
|
||
basePath: "/", | ||
|
||
tags: [ | ||
{ name: "Users", description: "Endpoints related to users" } | ||
], | ||
|
||
paths: { | ||
"/api/v1/users": { | ||
get: getUsers | ||
} | ||
}, | ||
|
||
components: { | ||
schemas: { | ||
User: userSchema, | ||
}, | ||
securitySchemes: { | ||
bearerAuth: { | ||
type: "http", | ||
scheme: "bearer", | ||
bearerFormat: "JWT", | ||
in: "header", | ||
name: "Authorization", | ||
}, | ||
}, | ||
} | ||
|
||
} | ||
|
||
docRouter.use("/", serve, setup(options)); | ||
|
||
export default docRouter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
export const userSchema = { | ||
type: "object", | ||
properties: { | ||
name: { | ||
type: "string", | ||
}, | ||
username: { | ||
type: "string" | ||
}, | ||
email: { | ||
type: "string", | ||
format: "email", | ||
}, | ||
password: { | ||
type: "string", | ||
}, | ||
}, | ||
} | ||
|
||
export const getUsers = { | ||
tags: ["Users"], | ||
summary: "Get all users", | ||
responses: { | ||
200: { | ||
description: "OK", | ||
content: { | ||
"application/json": { | ||
schema: { | ||
type: "array", | ||
items: { | ||
$ref: "#/components/schemas/User", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters