Skip to content

Commit

Permalink
add webhook to create an account
Browse files Browse the repository at this point in the history
  • Loading branch information
firminochangani committed Jun 8, 2024
1 parent f06a9c9 commit 059af6a
Show file tree
Hide file tree
Showing 23 changed files with 672 additions and 1,554 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ WORKER_REGION=europe

PRODUCTION_MODE=false

ENDPOINT_CHECK_TIMEOUT_IN_SECONDS=30
ENDPOINT_CHECK_TIMEOUT_IN_SECONDS=30
# NGROK_URL=<your-ngrok-static-url>
11 changes: 10 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version: 3
dotenv:
- ./.env.local
- ./.env
- ./.env.secrets

tasks:
service:
Expand All @@ -22,6 +23,10 @@ tasks:
- |
reflex -r '\.go' -s -- sh -c '{{.CLI_ARGS}}'
webhook:
cmds:
- ngrok http --domain=$NGROK_URL 8080

mig:up:
cmds:
- goose -s -dir ./misc/sql/migrations up
Expand All @@ -30,6 +35,10 @@ tasks:
cmds:
- goose -s -dir ./misc/sql/migrations down

mig:reset:
cmds:
- goose -s -dir ./misc/sql/migrations reset

mig:create:
cmds:
- goose -s -dir ./misc/sql/migrations create {{.CLI_ARGS}} sql
Expand All @@ -48,7 +57,7 @@ tasks:

orm:
cmds:
- task mig:down
- task mig:reset
- task mig:up
- sqlboiler psql --wipe --no-tests -o ./internal/adapters/models

Expand Down
233 changes: 130 additions & 103 deletions api/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,43 +235,7 @@ paths:
$ref: '#/components/schemas/GetIncidentByByIdPayload'
default:
$ref: '#/components/responses/DefaultError'
/accounts/profile:
get:
tags:
- Accounts
operationId: getProfileDetails
summary: Get details about the user currently logged in
security:
- BearerAuth: [ ]
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/GetProfileDetailsPayload'
default:
$ref: '#/components/responses/DefaultError'
/accounts/members/invite:
post:
tags:
- Members
operationId: bulkInviteMembersByEmail
summary: Bulk invite members by email
security:
- BearerAuth: [ ]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BulkInviteMembersByEmail'
responses:
'200':
description: OK
default:
$ref: '#/components/responses/DefaultError'
/auth/accounts:
/webhooks/create-account:
post:
tags:
- Auth
Expand All @@ -288,44 +252,6 @@ paths:
description: CREATED
default:
$ref: '#/components/responses/DefaultError'
/auth/accounts/confirm-invitation:
post:
tags:
- Auth
operationId: confirmInvitation
summary: Creates a user in a team
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ConfirmInvitationRequest'
responses:
'201':
description: CREATED
default:
$ref: '#/components/responses/DefaultError'
/auth/login:
post:
tags:
- Auth
operationId: login
summary: Log in
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/LogInRequest'
responses:
'200':
description: SIGNED UP
content:
application/json:
schema:
$ref: '#/components/schemas/LogInPayload'
default:
$ref: '#/components/responses/DefaultError'
components:
schemas:
BulkInviteMembersByEmail:
Expand Down Expand Up @@ -460,36 +386,137 @@ components:
type: string
response_status:
type: integer
LogInPayload:
required: [ token ]
properties:
token:
type: string
LogInRequest:
required: [ email, password ]
properties:
email:
type: string
password:
type: string
CreateAccountRequest:
required: [ account_name, email, password ]
properties:
account_name:
type: string
email:
type: string
password:
type: string
ConfirmInvitationRequest:
required: [ invitation_token, email, password ]
type: object
properties:
invitation_token:
type: string
email:
type: string
password:
type: string
data:
type: object
required: [id, password_enabled, two_factor_enabled]
properties:
birthday:
type: string
description: User's birthday (empty string if not set)
created_at:
type: integer
description: Timestamp (epoch milliseconds) representing user creation time
email_addresses:
type: array
items:
type: object
properties:
email_address:
type: string
description: User's email address
id:
type: string
description: Unique identifier for the email address
linked_to:
type: array
description: (Array is empty for this event)
items:
type: object
# Add properties for linked objects if needed
object:
type: string
description: Object type (always "email_address" for this event)
verification:
type: object
properties:
status:
type: string
description: Verification status (e.g., "verified", "unverified")
strategy:
type: string
description: Verification strategy (e.g., "ticket", "link")
external_accounts:
type: array
description: (Array is empty for this event)
items:
type: object
# Add properties for external accounts if needed
external_id:
type: string
nullable: true
description: User's external identifier
first_name:
type: string
nullable: true
description: User's first name
gender:
type: string
description: User's gender (empty string if not set)
id:
type: string
description: Unique identifier for the user
image_url:
type: string
description: User's image URL (may be redacted)
last_name:
type: string
nullable: true
description: User's last name
last_sign_in_at:
type: integer
nullable: true
description: Timestamp (epoch milliseconds) representing last sign-in time
object:
type: string
description: Object type (always "user" for this event)
password_enabled:
type: boolean
description: Whether the user has password authentication enabled
phone_numbers:
type: array
description: (Array is empty for this event)
items:
type: object
# Add properties for phone numbers if needed
primary_email_address_id:
type: string
nullable: true
description: Unique identifier for the primary email address
primary_phone_number_id:
type: string
nullable: true
description: Unique identifier for the primary phone number (null if not set)
primary_web3_wallet_id:
type: string
nullable: true
description: Unique identifier for the primary web3 wallet (null if not set)
private_metadata:
type: object
description: User's private metadata (empty object for this event)
profile_image_url:
type: string
description: User's profile image URL (may be redacted)
public_metadata:
type: object
description: User's public metadata (empty object for this event)
two_factor_enabled:
type: boolean
description: Whether two-factor authentication is enabled
unsafe_metadata:
type: object
description: User's unsafe metadata (empty object for this event)
updated_at:
type: integer
description: Timestamp (epoch milliseconds) representing user update time
username:
type: string
nullable: true
description: Username (null if not set)
web3_wallets:
type: array
description: (Array is empty for this event)
items:
type: object
# Add properties for web3 wallets if needed
object:
type: string
description: Event type (always "user.created" for this event)
type:
type: string
description: Event type (always "user.created" for this event)
CreateMonitorRequest:
required: [endpoint_url, check_interval_in_seconds]
properties:
Expand Down
1 change: 0 additions & 1 deletion cmd/service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ func main() {
Commands: app.Commands{
// Auth
CreateAccount: observability.NewCommandDecorator[command.CreateAccount](command.NewCreateAccountHandler(txProvider), logger),
LogIn: observability.NewCommandWithResultDecorator[command.LogIn, string](command.NewLoginHandler(userRepository, tokenSigner), logger),

// Monitor
DeleteMonitor: observability.NewCommandDecorator[command.DeleteMonitor](command.NewDeleteMonitorHandler(txProvider), logger),
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.9'

services:
rabbitmq:
image: heidiks/rabbitmq-delayed-message-exchange:3.9.13-management
Expand Down
4 changes: 2 additions & 2 deletions internal/adapters/models/monitors.go

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

Loading

0 comments on commit 059af6a

Please sign in to comment.