Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add integration between user service and user repository #11

Merged
merged 5 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .env

This file was deleted.

2 changes: 0 additions & 2 deletions .env.dev

This file was deleted.

3 changes: 0 additions & 3 deletions .env.example

This file was deleted.

2 changes: 0 additions & 2 deletions .env.prod

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: Tests
name: Build and Test

on:
push:
branches: ['main']
pull_request:
branches: ['main']

jobs:
build:
test:
runs-on: ubuntu-latest
steps:
- name: Code Checkout
Expand All @@ -17,7 +15,7 @@ jobs:
uses: ./.github/actions/install-deps

- name: Run unit Tests
run: pnpm test:coverage --silent
run: pnpm vitest --coverage --silent

- name: 'Report Coverage'
if: ${{ always() && !github.event.pull_request.head.repo.fork }}
Expand All @@ -29,6 +27,15 @@ jobs:
with:
name: coverage
path: coverage
build:
runs-on: ubuntu-latest
needs: test
steps:
- name: Code Checkout
uses: actions/checkout@v3

- name: Setup deps
uses: ./.github/actions/install-deps

- name: Build
run: pnpm build
run: pnpm build
2 changes: 1 addition & 1 deletion .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ jobs:
uses: ataylorme/eslint-annotate-action@v2
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
report-json: 'eslint_report.json'
report-json: 'eslint_report.json'
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
node_modules
.vscode
!.vscode/settings.json
build
dist
coverage
.env
.idea/
*.env*
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"arrowParens": "always",
"endOfLine": "lf",
"printWidth": 80
}
}
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"eslint.experimental.useFlatConfig": true,
"eslint.options": {
"overrideConfigFile": "./eslint.config.js"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# octopost-backend


## Nomenclatura

### Verbos

FindById - Buscar um por Id
FindAll - Buscar todos
Create - Criar
Remove - Remover
Update - Atualizar
Update - Atualizar
8 changes: 8 additions & 0 deletions __mocks__/prisma.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { PrismaClient as PrismaClientType } from '@prisma/client';
import { mockDeep } from 'vitest-mock-extended';

export const prisma = mockDeep<PrismaClientType>();

export const PrismaClient = vi.fn(() => prisma);

export default { PrismaClient };
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ services:
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: 'password'
POSTGRES_DB: 'octopost-api'

2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export default defineFlatConfig([
'import/no-absolute-path': 'warn',
'import/no-default-export': 'warn',
'import/no-duplicates': 'warn',
'import/no-extraneous-dependencies': 'warn',
'import/no-named-as-default': 'warn',
'import/no-named-as-default-member': 'warn',
'import/no-unused-modules': 'warn',
Expand Down Expand Up @@ -187,6 +186,7 @@ export default defineFlatConfig([
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/unbound-method': 'off',
'vitest/expect-expect': 'warn',
'vitest/no-commented-out-tests': 'warn',
Expand Down
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@
"start": "cross-env MODE=PROD node build/index.js",
"prestart": "pnpm run build",
"build": "tsc -p tsconfig.build.json",
"prebuild": "ts-patch install -s",
"prebuild": "prisma generate && ts-patch install -s",
"lint": "eslint . --max-warnings=0 --no-warn-ignored",
"format": "prettier . --check --ignore-unknown",
"prepare": "husky",
"commit": "git-cz",
"typecheck": "tsc -p tsconfig.build.json --noEmit",
"test": "vitest",
"test:coverage": "vitest --coverage",
"test:ui": "vitest --coverage --ui"
"test:coverage": "vitest --coverage --watch",
"test:ui": "vitest --coverage --ui --watch",
"migrate": "dotenv -e .env.dev -- npx prisma migrate deploy",
"migrate:dev": "dotenv -e .env.dev -- npx prisma migrate dev"
},
"devDependencies": {
"@commitlint/cli": "19.2.1",
Expand All @@ -35,6 +37,7 @@
"@vitest/ui": "1.5.0",
"commitizen": "4.3.0",
"cross-env": "7.0.3",
"dotenv-cli": "7.4.1",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-define-config": "2.1.0",
Expand All @@ -57,9 +60,11 @@
"typescript-eslint": "7.6.0",
"typescript-transform-paths": "3.4.7",
"vite-tsconfig-paths": "4.3.2",
"vitest": "1.5.0"
"vitest": "1.5.0",
"vitest-mock-extended": "1.3.1"
},
"dependencies": {
"@prisma/client": "5.13.0",
"axios": "1.6.8",
"dotenv": "16.4.5",
"express": "4.19.2",
Expand Down
78 changes: 65 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading