Skip to content

Commit

Permalink
feat: add, edit, delete cards
Browse files Browse the repository at this point in the history
  • Loading branch information
nunocaseiro committed Jan 30, 2022
1 parent d99cfa5 commit 78b5715
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 9 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/tests_backend_frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]

workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build_test:
# The type of runner that the job will run on
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 17.x]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Cache multiple paths
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: npm ci, build and test
run: |
cd backend
npm ci
npm run build --if-present
npm test
- name: npm ci, build and test frontend
run: |
cd frontend
npm ci
npm run build --if-present
npm run jest
2 changes: 1 addition & 1 deletion backend/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
HttpStatus,
} from '@nestjs/common';
import { Response } from 'express';
import { USER_NOT_FOUND } from 'src/constants/httpExceptions';
import { USER_NOT_FOUND } from '../constants/httpExceptions';
import AuthService from './auth.service';
import RegisterDto from '../models/users/dto/register.dto';
import LocalAuthGuard from '../guards/localAuth.guard';
Expand Down
6 changes: 0 additions & 6 deletions backend/src/auth/tests/auth.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import * as request from 'supertest';
import { INestApplication, ValidationPipe } from '@nestjs/common';
import UsersService from '../../models/users/users.service';
import AuthController from '../auth.controller';
import User from '../../models/users/schemas/user.schema';
import mockedUser from '../../mocks/user.mock';
import AuthService from '../auth.service';
import jwtService from '../../mocks/jwtService.mock';
import configService from '../../mocks/configService.mock';

describe('AuthController', () => {
let app: INestApplication;
let userData: User;

beforeEach(async () => {
const usersRepository = {
Expand Down Expand Up @@ -51,10 +49,6 @@ describe('AuthController', () => {
describe('when registering', () => {
describe('and using valid data', () => {
it('should respond with the data of the user without the password', async () => {
const expectedData = {
...userData,
};
delete expectedData.password;
return request(app.getHttpServer())
.post('/auth/register')
.send({
Expand Down
2 changes: 2 additions & 0 deletions backend/src/models/boards/tests/boards.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { getModelToken } from '@nestjs/mongoose';
import { Test } from '@nestjs/testing';
import SocketGateway from '../../../socket/socket.gateway';
import UsersService from '../../users/users.service';
import BoardsController from '../boards.controller';
import BoardsService from '../boards.service';
Expand All @@ -13,6 +14,7 @@ describe('BoardsController', () => {
providers: [
BoardsService,
UsersService,
SocketGateway,
{
provide: getModelToken('User'),
useValue: {},
Expand Down
2 changes: 1 addition & 1 deletion backend/src/models/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class UsersService {
constructor(@InjectModel(User.name) private userModel: Model<UserDocument>) {}

async getByEmail(email: string) {
const user = await this.userModel.findOne({ email }).exec();
const user = await this.userModel.findOne({ email });
if (user) return user;
throw new HttpException(EMAIL_NOT_EXISTS, HttpStatus.NOT_FOUND);
}
Expand Down
3 changes: 3 additions & 0 deletions frontend/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["next/babel"]
}
2 changes: 1 addition & 1 deletion frontend/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
swcMinify: true,
swcMinify: false,
};

0 comments on commit 78b5715

Please sign in to comment.