Skip to content

Commit

Permalink
Merge pull request #6 from TheDevOpsCorp/7-feat-login-de-usuário
Browse files Browse the repository at this point in the history
7 feat login de usuário
  • Loading branch information
heyitsmepablo authored Aug 26, 2024
2 parents 8cb8458 + 090569d commit 33440ff
Show file tree
Hide file tree
Showing 15 changed files with 1,453 additions and 194 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
name: Testes Unitarios

on: [push, pull_request]
env:
POSTGRES_USER: ${{vars.POSTGRES_USER}}
POSTGRES_PASSWORD: ${{vars.POSTGRES_PASSWORD}}
POSTGRES_HOST: ${{vars.POSTGRES_HOST}}
POSTGRES_PORT: ${{vars.POSTGRES_PORT}}
POSTGRES_DATABASE: ${{vars.POSTGRES_DATABASE}}
JWT_SECRET: ${{secrets.JWT_SECRET}}


jobs:
CI:
runs-on: ubuntu-latest
steps:
- name: Verificação do Repositorio
uses: actions/[email protected]

- name: Iniciando Docker Compose
uses: hoverkraft-tech/[email protected]
with:
services: database
compose-file: ./docker-compose.yml

- name: Configurando Node.Js
uses: actions/[email protected]
with:
node-version: '20'

- name: Instalando Dependencias
run: npm clean-install

- name: Executando Testes
run: npm run test

env:
POSTGRES_HOST: ${{env.POSTGRES_HOST}}
POSTGRES_PORT: ${{env.POSTGRES_PORT}}
POSTGRES_USER: ${{env.POSTGRES_USER}}
POSTGRES_PASSWORD: ${{env.POSTGRES_PASSWORD}}
POSTGRES_DATABASE: ${{env.POSTGRES_DATABASE}}
JWT_SECRET: ${{env.JWT_SECRET}}
11 changes: 6 additions & 5 deletions docker/postgres/projeto-final-ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ CREATE TABLE "follows" (
);

CREATE TABLE "users" (
"id" integer PRIMARY KEY,
"id" serial PRIMARY KEY,
"username" varchar NOT NULL,
"password" varchar NOT NULL,
"created_at" timestamp NOT NULL DEFAULT 'NOW()'
);

CREATE TABLE "posts" (
"id" integer PRIMARY KEY NOT NULL,
"id" serial PRIMARY KEY,
"title" varchar NOT NULL,
"body" text NOT NULL,
"user_id" integer NOT NULL,
Expand All @@ -21,8 +21,9 @@ CREATE TABLE "posts" (

COMMENT ON COLUMN "posts"."body" IS 'Content of the post';

ALTER TABLE "posts" ADD FOREIGN KEY ("user_id") REFERENCES "users" ("id");
ALTER TABLE "posts" ADD FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE;

ALTER TABLE "follows" ADD FOREIGN KEY ("following_user_id") REFERENCES "users" ("id");
ALTER TABLE "follows" ADD FOREIGN KEY ("following_user_id") REFERENCES "users" ("id") ON DELETE CASCADE;

ALTER TABLE "follows" ADD FOREIGN KEY ("followed_user_id") REFERENCES "users" ("id") ON DELETE CASCADE;

ALTER TABLE "follows" ADD FOREIGN KEY ("followed_user_id") REFERENCES "users" ("id");
Loading

0 comments on commit 33440ff

Please sign in to comment.