Skip to content

Commit

Permalink
Merge branch 'main' into 1518-cards-implement-terminate-card
Browse files Browse the repository at this point in the history
  • Loading branch information
Tymmmy committed Sep 17, 2024
2 parents 38de045 + 18e5bff commit 07054e1
Show file tree
Hide file tree
Showing 57 changed files with 1,707 additions and 841 deletions.
2 changes: 2 additions & 0 deletions docker/dev/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ SENDGRID_API_KEY=
AUTH_IDENTITY_SERVER_SECRET=
AUTH_COOKIE_KEY=
RATE_API_KEY=
GATEHUB_ACCESS_KEY=
GATEHUB_SECRET_KEY=

# commerce env variables
# encoded base 64 private key
Expand Down
4 changes: 3 additions & 1 deletion docker/dev/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ services:
RATE_API_KEY: ${RATE_API_KEY}
REDIS_URL: redis://redis:6379/0
KRATOS_ADMIN_URL: 'http://kratos:4434/admin'
GATEHUB_ACCESS_KEY: ${GATEHUB_ACCESS_KEY}
GATEHUB_SECRET_KEY: ${GATEHUB_SECRET_KEY}
restart: always
networks:
- testnet
Expand Down Expand Up @@ -196,7 +198,7 @@ services:
- testnet

tigerbeetle:
image: ghcr.io/tigerbeetle/tigerbeetle:0.16.0
image: ghcr.io/tigerbeetle/tigerbeetle:0.16.1
privileged: true
volumes:
- tigerbeetle-data:/var/lib/tigerbeetle
Expand Down
2 changes: 2 additions & 0 deletions docker/prod/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ WALLET_BACKEND_FROM_EMAIL=
WALLET_BACKEND_SEND_EMAIL=
WALLET_BACKEND_AUTH_DOMAIN=
WALLET_BACKEND_RATE_API_KEY=
WALLET_BACKEND_GATEHUB_ACCESS_KEY=
WALLET_BACKEND_GATEHUB_SECRET_KEY=

# BOUTIQUE
BOUTIQUE_BACKEND_PORT=
Expand Down
4 changes: 3 additions & 1 deletion docker/prod/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ services:
AUTH_DOMAIN: ${WALLET_BACKEND_AUTH_DOMAIN}
RATE_API_KEY: ${WALLET_BACKEND_RATE_API_KEY}
REDIS_URL: ${WALLET_BACKEND_REDIS_URL}
GATEHUB_ACCESS_KEY: ${WALLET_BACKEND_GATEHUB_ACCESS_KEY}
GATEHUB_SECRET_KEY: ${WALLET_BACKEND_GATEHUB_SECRET_KEY}
networks:
- testnet
ports:
Expand Down Expand Up @@ -231,7 +233,7 @@ services:
<<: *logging

tigerbeetle:
image: ghcr.io/tigerbeetle/tigerbeetle:0.16.0
image: ghcr.io/tigerbeetle/tigerbeetle:0.16.1
privileged: true
volumes:
- tigerbeetle-data:/var/lib/tigerbeetle
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"concurrently": "^8.2.2",
"concurrently": "^9.0.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react": "^7.35.2",
"eslint-plugin-react": "^7.36.1",
"eslint-plugin-react-hooks": "^4.6.2",
"only-allow": "^1.2.1",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.6",
"typescript": "^5.5.4"
"typescript": "^5.6.2"
},
"engines": {
"pnpm": "^9.1.4",
Expand Down
8 changes: 4 additions & 4 deletions packages/boutique/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"awilix": "^10.0.2",
"axios": "^1.7.7",
"cors": "^2.8.5",
"express": "^4.19.2",
"express": "^4.21.0",
"helmet": "^7.1.0",
"knex": "^3.1.0",
"objection": "^3.1.4",
Expand All @@ -25,12 +25,12 @@
"devDependencies": {
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.12",
"@types/jest": "^29.5.13",
"@types/node": "^20.12.11",
"jest": "^29.7.0",
"node-mocks-http": "^1.15.1",
"node-mocks-http": "^1.16.0",
"ts-jest": "^29.2.5",
"tsc-alias": "^1.8.10",
"typescript": "^5.5.4"
"typescript": "^5.6.2"
}
}
18 changes: 9 additions & 9 deletions packages/boutique/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tabs": "^1.1.0",
"@radix-ui/react-toast": "^1.2.1",
"@tanstack/react-query": "^5.54.1",
"@tanstack/react-query": "^5.56.2",
"@boutique/shared": "workspace:*",
"class-variance-authority": "^0.7.0",
"framer-motion": "^11.3.21",
"framer-motion": "^11.5.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.53.0",
"react-router-dom": "^6.26.1",
"react-router-dom": "^6.26.2",
"remix-params-helper": "^0.5.1",
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7",
"valtio": "^1.13.2",
"valtio": "^2.0.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.8",
"@tailwindcss/forms": "^0.5.9",
"@tailwindcss/typography": "^0.5.15",
"@types/react": "18.3.5",
"@types/react-dom": "18.3.0",
"@vitejs/plugin-react-swc": "^3.7.0",
"autoprefixer": "^10.4.20",
"postcss": "^8.4.44",
"tailwindcss": "^3.4.10",
"typescript": "^5.5.4",
"vite": "^5.4.3"
"postcss": "^8.4.45",
"tailwindcss": "^3.4.11",
"typescript": "^5.6.2",
"vite": "^5.4.5"
}
}
4 changes: 2 additions & 2 deletions packages/shared/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"devDependencies": {
"@types/node": "^20.12.11",
"tsc-alias": "^1.8.10",
"typescript": "^5.5.4",
"typescript": "^5.6.2",
"@types/express": "^4.17.21",
"ioredis": "^5.4.1"
},
"dependencies": {
"@google-cloud/logging-winston": "^6.0.0",
"awilix": "^10.0.2",
"express": "^4.19.2",
"express": "^4.21.0",
"objection": "^3.1.4",
"knex": "^3.1.0",
"winston": "^3.14.2",
Expand Down
1 change: 1 addition & 0 deletions packages/shared/backend/src/errors/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './bad-request'
export * from './conflict'
export * from './not-verified'
export * from './not-found'
export * from './unauthorized'
export * from './forbidden'
Expand Down
8 changes: 8 additions & 0 deletions packages/shared/backend/src/errors/not-verified.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { BaseError } from './base'

export class NotVerified extends BaseError {
constructor(message?: string) {
super(403, message ?? 'Not Validated', { email: 'Not verified' })
Object.setPrototypeOf(this, NotVerified.prototype)
}
}
20 changes: 10 additions & 10 deletions packages/wallet/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,43 @@
"axios": "^1.7.7",
"cors": "^2.8.5",
"crypto-js": "^4.2.0",
"date-fns": "^3.6.0",
"date-fns": "^4.0.0",
"disposable-email-domains": "^1.0.62",
"express": "^4.19.2",
"express": "^4.21.0",
"express-rate-limit": "^7.4.0",
"graphql": "^16.9.0",
"graphql-request": "^6.1.0",
"hash-wasm": "^4.11.0",
"helmet": "^7.1.0",
"ioredis": "^5.4.1",
"iron-session": "^6.3.1",
"iron-session": "^8.0.3",
"knex": "^3.1.0",
"moment": "^2.30.1",
"node-cache": "^5.1.2",
"objection": "^3.1.4",
"pg": "^8.12.0",
"randexp": "^0.5.3",
"socket.io": "^4.7.5",
"uuid": "^9.0.1",
"uuid": "^10.0.0",
"winston": "^3.14.2",
"zod": "^3.23.8"
},
"devDependencies": {
"@faker-js/faker": "^9.0.0",
"@faker-js/faker": "^9.0.1",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/typescript": "^4.0.9",
"@graphql-codegen/typescript-operations": "^4.2.3",
"@types/cors": "^2.8.17",
"@types/crypto-js": "^4.2.2",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.12",
"@types/jest": "^29.5.13",
"@types/node": "^20.12.11",
"@types/uuid": "^9.0.8",
"@types/uuid": "^10.0.0",
"jest": "^29.7.0",
"node-mocks-http": "^1.15.1",
"testcontainers": "^10.13.0",
"node-mocks-http": "^1.16.0",
"testcontainers": "^10.13.1",
"ts-jest": "^29.2.5",
"tsc-alias": "^1.8.10",
"typescript": "^5.5.4"
"typescript": "^5.6.2"
}
}
9 changes: 9 additions & 0 deletions packages/wallet/backend/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ import { GrantService } from '@/grant/service'
import { AwilixContainer } from 'awilix'
import { Cradle } from '@/createContainer'
import { initErrorHandler, RedisClient } from '@shared/backend'
import { GateHubController } from '@/gatehub/controller'
import { GateHubClient } from '@/gatehub/client'

export interface Bindings {
env: Env
Expand Down Expand Up @@ -77,6 +79,8 @@ export interface Bindings {
grantService: GrantService
emailService: EmailService
socketService: SocketService
gateHubClient: GateHubClient
gateHubController: GateHubController
}

export class App {
Expand Down Expand Up @@ -145,6 +149,7 @@ export class App {
const grantController = await this.container.resolve('grantController')
const accountController = await this.container.resolve('accountController')
const rafikiController = await this.container.resolve('rafikiController')
const gateHubController = await this.container.resolve('gateHubController')

app.use(
cors({
Expand All @@ -171,6 +176,7 @@ export class App {
router.get('/reset-password/:token/validate', userController.checkToken)
router.post('/reset-password/:token', userController.resetPassword)
router.post('/verify-email/:token', authController.verifyEmail)
router.post('/resend-verify-email', authController.resendVerifyEmail)
router.patch('/change-password', isAuth, userController.changePassword)

// Me Endpoint
Expand Down Expand Up @@ -300,6 +306,9 @@ export class App {
router.get('/rates', rafikiController.getRates)
router.post('/webhooks', rafikiController.onWebHook)

// GateHub
router.get('/iframe-urls/:type', isAuth, gateHubController.getIframeUrl)

// Return an error for invalid routes
router.use('*', (req: Request, res: CustomResponse) => {
const e = Error(`Requested path ${req.path} was not found`)
Expand Down
8 changes: 0 additions & 8 deletions packages/wallet/backend/src/asset/validation.ts

This file was deleted.

36 changes: 33 additions & 3 deletions packages/wallet/backend/src/auth/controller.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { validate } from '@/shared/validate'
import { NextFunction, Request } from 'express'
import { AuthService } from './service'
import { logInSchema, signUpSchema } from './validation'
import {
logInBodySchema,
signUpBodySchema,
emailBodySchema
} from './validation'
import { UserService } from '@/user/service'
import { Controller, toSuccessResponse, Unauthorized } from '@shared/backend'

interface IAuthController {
signUp: Controller
logIn: Controller
verifyEmail: Controller
resendVerifyEmail: Controller
}

export class AuthController implements IAuthController {
Expand All @@ -22,7 +27,7 @@ export class AuthController implements IAuthController {
try {
const {
body: { email, password }
} = await validate(signUpSchema, req)
} = await validate(signUpBodySchema, req)

await this.authService.signUp({ email, password })

Expand All @@ -38,7 +43,7 @@ export class AuthController implements IAuthController {
try {
const {
body: { email, password }
} = await validate(logInSchema, req)
} = await validate(logInBodySchema, req)

const { user, session } = await this.authService.authorize({
email,
Expand Down Expand Up @@ -95,4 +100,29 @@ export class AuthController implements IAuthController {
next(e)
}
}

resendVerifyEmail = async (
req: Request,
res: CustomResponse,
next: NextFunction
) => {
try {
const {
body: { email }
} = await validate(emailBodySchema, req)

await this.authService.resendVerifyEmail({ email })

res
.status(201)
.json(
toSuccessResponse(
undefined,
'Verification email has been sent successfully'
)
)
} catch (e) {
next(e)
}
}
}
Loading

0 comments on commit 07054e1

Please sign in to comment.