Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2f24abb
feat: Criar service de autenticação e erro
lucaslinyker Jun 18, 2025
a7eaef8
build: Adicionar @fastify/cookie e @fastify/jwt
lucaslinyker Jun 24, 2025
df746fb
chore(env): Adicionar verificação do secret JWT
lucaslinyker Jun 24, 2025
bae9298
chore(types): Adicionar interface user para o @fastify/jwt
lucaslinyker Jun 24, 2025
d28cc6b
feat: Configurar fastifyJwt e cookie no fastify
lucaslinyker Jun 24, 2025
b9a2bf6
feat: Criar factory de autenticação
lucaslinyker Jun 24, 2025
5c3b31e
feat: Criar controller de autenticação
lucaslinyker Jun 24, 2025
1e8052c
feat: Criar controller de refresh token
lucaslinyker Jun 24, 2025
f5f0b93
feat: Criar controller de logout
lucaslinyker Jun 24, 2025
3f053c8
feat: Adicionar rotas para os controllers de autenticação
lucaslinyker Jun 24, 2025
c43649e
feat: Criar middleware para verificar jwt
lucaslinyker Jun 24, 2025
21f12ae
feat: Criar middleware para verificar role do user
lucaslinyker Jun 24, 2025
ad83d51
feat: Adicionar middlewares para algumas rotas
lucaslinyker Jun 24, 2025
a43c76c
refact: Remover a necessidade de passar o email para buscar o profile
lucaslinyker Jun 24, 2025
709b4fe
refact: Passar o id do usuário pelo token jwt
lucaslinyker Jun 25, 2025
8873b2b
refact: Passar o id pelo jwt
lucaslinyker Jun 25, 2025
94e366a
refact: Adicionar logout ao deletar a conta
lucaslinyker Jun 26, 2025
3877547
refact: Adicionar verificação para o token existir
lucaslinyker Jun 26, 2025
5096e2b
feat: Habilitar CORS
lucaslinyker Jun 28, 2025
d7b234b
Merge pull request #16 from MLKP1/dev
lucaslinyker Jun 28, 2025
0975b26
Merge pull request #17 from MLKP1/main
lucaslinyker Jun 30, 2025
05be1dc
fix: Adicionar hash a senhas no seed
lucaslinyker Jun 30, 2025
cccac75
Merge pull request #18 from MLKP1/feat/make-db
lucaslinyker Jun 30, 2025
39c6adb
Merge pull request #19 from MLKP1/main
lucaslinyker Jun 30, 2025
a2bf7cc
fix: Melhorar mensagem de erro para origem não permitida no CORS
lucaslinyker Jun 30, 2025
fec64c9
Merge pull request #20 from MLKP1/feat/auth
lucaslinyker Jun 30, 2025
711569f
fix: Remover barra extra de origem permitida no CORS
lucaslinyker Jun 30, 2025
2b6d300
Merge pull request #21 from MLKP1/feat/auth
lucaslinyker Jun 30, 2025
c59afc4
Merge pull request #22 from MLKP1/dev
lucaslinyker Jul 1, 2025
08e7a55
Merge pull request #23 from MLKP1/dev
lucaslinyker Jul 26, 2025
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
5 changes: 3 additions & 2 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { fakerPT_BR as faker } from '@faker-js/faker'
import { hash } from 'bcryptjs'
import { prisma } from '../src/lib/prisma'

console.time('time')
Expand All @@ -16,7 +17,7 @@ async function seed() {
data: {
email: 'admin@gmail.com',
name: 'Admin',
password: 'dnx42697',
password: await hash('dnx42697', 10),
role: 'ADMIN',
},
})
Expand All @@ -29,7 +30,7 @@ async function seed() {
data: {
name: faker.person.fullName(),
email: faker.internet.email(),
password: faker.internet.password(),
password: await hash(faker.internet.password(), 10),
createdAt: faker.date.recent({ days: 40 }),
updatedAt: faker.date.recent({ days: 30 }),
},
Expand Down
7 changes: 2 additions & 5 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ export const app = fastify()

app.register(fastifyCors, {
origin: (origin, cb) => {
const allowedOrigins = [
'http://localhost:5500',
'https://mlkp1.github.io/Front2/',
]
const allowedOrigins = ['http://localhost:5500', 'https://mlkp1.github.io']
if (!origin || allowedOrigins.includes(origin)) {
cb(null, true)
return
}
cb(new Error('Not allowed'), false)
cb(new Error(`Not allowed from origin ${origin}`), false)
},
credentials: true,
methods: '*',
Expand Down