Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: init a new module for smtp server for paybox #324

Merged
merged 7 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .changeset/spicy-hounds-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@paybox/mail-zeus": patch
"@paybox/mail": patch
---

feat: init a new module for smtp server for paybox
44 changes: 44 additions & 0 deletions backend/hasura-mail/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: "3.8"

services:

postgres:
image: postgres:15.0-alpine
ports:
- 4446:5432
volumes:
- mail_data:/var/lib/postgresql1/data
restart: always
environment:
POSTGRES_DB: reef_dev
POSTGRES_PASSWORD: pass
POSTGRES_USER: user
healthcheck:
test: pg_isready --username=user --dbname=reef_dev --quiet
interval: 15s
timeout: 5s

hasura:
image: hasura/graphql-engine:v2.38.0
ports:
- 8114:8080
depends_on:
- postgres
volumes:
- "./hasura/metadata:/hasura-metadata"
- "./hasura/migrations:/hasura-migrations"
restart: unless-stopped
healthcheck:
test: curl -f http://localhost:8080/healthz || exit 1
interval: 10s
timeout: 10s
retries: 15
environment:
HASURA_GRAPHQL_DATABASE_URL: postgres://user:pass@postgres/reef_dev
PG_DATABASE_URL: postgres://user:pass@postgres/reef_dev
HASURA_GRAPHQL_DEV_MODE: "true"
HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"

volumes:
mail_data:
4 changes: 4 additions & 0 deletions backend/hasura-mail/hasura/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: 3
endpoint: http://localhost:8114
metadata_directory: metadata
admin_secret: myadminsecretkey
Empty file.
6 changes: 6 additions & 0 deletions backend/hasura-mail/hasura/metadata/actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
actions: []
custom_types:
enums: []
input_objects: []
objects: []
scalars: []
1 change: 1 addition & 0 deletions backend/hasura-mail/hasura/metadata/allow_list.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions backend/hasura-mail/hasura/metadata/api_limits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
13 changes: 13 additions & 0 deletions backend/hasura-mail/hasura/metadata/backend_configs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
dataconnector:
athena:
uri: http://localhost:8081/api/v1/athena
mariadb:
uri: http://localhost:8081/api/v1/mariadb
mongodb:
uri: http://localhost:8082
mysql8:
uri: http://localhost:8081/api/v1/mysql
oracle:
uri: http://localhost:8081/api/v1/oracle
snowflake:
uri: http://localhost:8081/api/v1/snowflake
1 change: 1 addition & 0 deletions backend/hasura-mail/hasura/metadata/cron_triggers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
9 changes: 9 additions & 0 deletions backend/hasura-mail/hasura/metadata/databases/databases.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- name: default
kind: postgres
configuration:
connection_info:
database_url:
from_env: PG_DATABASE_URL
isolation_level: read-committed
use_prepared_statements: false
tables: "!include default/tables/tables.yaml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
table:
name: custom_address
schema: public
configuration:
column_config:
created_at:
custom_name: createdAt
updated_at:
custom_name: updatedAt
custom_column_names:
created_at: createdAt
updated_at: updatedAt
custom_root_fields: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
table:
name: mails
schema: public
configuration:
column_config:
created_at:
custom_name: createdAt
from_address:
custom_name: fromAddress
html_content:
custom_name: htmlContent
text_content:
custom_name: textContent
to_address:
custom_name: toAddress
updated_at:
custom_name: updatedAt
custom_column_names:
created_at: createdAt
from_address: fromAddress
html_content: htmlContent
text_content: textContent
to_address: toAddress
updated_at: updatedAt
custom_root_fields: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- "!include public_custom_address.yaml"
- "!include public_mails.yaml"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
disabled_for_roles: []
1 change: 1 addition & 0 deletions backend/hasura-mail/hasura/metadata/inherited_roles.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions backend/hasura-mail/hasura/metadata/metrics_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions backend/hasura-mail/hasura/metadata/network.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions backend/hasura-mail/hasura/metadata/opentelemetry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions backend/hasura-mail/hasura/metadata/query_collections.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions backend/hasura-mail/hasura/metadata/remote_schemas.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions backend/hasura-mail/hasura/metadata/rest_endpoints.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions backend/hasura-mail/hasura/metadata/version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version: 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
SET check_function_bodies = false;
CREATE FUNCTION public.set_current_timestamp_updated_at() RETURNS trigger
LANGUAGE plpgsql
AS $$
DECLARE
_new record;
BEGIN
_new := NEW;
_new."updated_at" = NOW();
RETURN _new;
END;
$$;
CREATE TABLE public.custom_address (
id uuid DEFAULT gen_random_uuid() NOT NULL,
address text NOT NULL,
description text NOT NULL,
key text NOT NULL,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
COMMENT ON TABLE public.custom_address IS 'custom address for paybox';
CREATE TABLE public.mails (
id uuid DEFAULT gen_random_uuid() NOT NULL,
from_address text NOT NULL,
to_address text NOT NULL,
subject text NOT NULL,
text_content text NOT NULL,
html_content text NOT NULL,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
date timestamp with time zone NOT NULL
);
COMMENT ON TABLE public.mails IS 'mails from clients';
ALTER TABLE ONLY public.custom_address
ADD CONSTRAINT custom_address_address_key UNIQUE (address);
ALTER TABLE ONLY public.custom_address
ADD CONSTRAINT custom_address_key_key UNIQUE (key);
ALTER TABLE ONLY public.custom_address
ADD CONSTRAINT custom_address_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.mails
ADD CONSTRAINT mails_pkey PRIMARY KEY (id);
CREATE TRIGGER set_public_custom_address_updated_at BEFORE UPDATE ON public.custom_address FOR EACH ROW EXECUTE FUNCTION public.set_current_timestamp_updated_at();
COMMENT ON TRIGGER set_public_custom_address_updated_at ON public.custom_address IS 'trigger to set value of column "updated_at" to current timestamp on row update';
CREATE TRIGGER set_public_mails_updated_at BEFORE UPDATE ON public.mails FOR EACH ROW EXECUTE FUNCTION public.set_current_timestamp_updated_at();
COMMENT ON TRIGGER set_public_mails_updated_at ON public.mails IS 'trigger to set value of column "updated_at" to current timestamp on row update';
3 changes: 2 additions & 1 deletion backend/hasura/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ services:
timeout: 5s

hasura:
image: hasura/graphql-engine:v2.18.0.cli-migrations-v3
image: hasura/graphql-engine:v2.38.0
ports:
- 8112:8080
depends_on:
Expand All @@ -47,6 +47,7 @@ services:
HASURA_GRAPHQL_DATABASE_URL: postgres://user:pass@postgres/reef_dev
HASURA_GRAPHQL_DEV_MODE: "true"
HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"

volumes:
data:
10 changes: 10 additions & 0 deletions backend/mail-zeus/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
.build
.next
out
.env
dist
.DS_Store
npm-debug.log
yarn-error.log
.turbo
2 changes: 2 additions & 0 deletions backend/mail-zeus/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
HASURA_MAIL_URL=
HASURA_MAIL_ADMIN_SECRET=
34 changes: 34 additions & 0 deletions backend/mail-zeus/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
.pnp
.pnp.js

# testing
coverage

build
/dist

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# turbo
.turbo

# vercel
.vercel
13 changes: 13 additions & 0 deletions backend/mail-zeus/.yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# backend/ws/.yarnrc

# Use Workspaces (if needed, though it's typically inherited)
workspaces-experimental true

"@paybox:registry" "https://registry.yarnpkg.com/"

# Specify private registry for private packages
# "@paybox:registry" "https://your-private-registry-url/"

# Use selective version resolutions if needed
# For example, to specify a different version of a package for this workspace
# "@paybox/ws" "1.0.0"
13 changes: 13 additions & 0 deletions backend/mail-zeus/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# @paybox/zeus

## 0.1.1

### Patch Changes

- 2f0d245: feat: updating scripts and pipeline and adding some actions

## 0.1.0

### Minor Changes

- init package publishing
23 changes: 23 additions & 0 deletions backend/mail-zeus/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "@paybox/mail-zeus",
"version": "0.0.1",
"main": "./src/index.ts",
"types": "./src/index.ts",
"license": "MIT",
"private": "true",
"scripts": {
"zeus": "zeus http://localhost:8114/v1/graphql ./src --header=x-hasura-admin-secret:myadminsecretkey --header=x-hasura-role:admin --subscriptions && prettier src/zeus/*.ts --write",
"build": "esbuild ./src/index.ts --bundle --platform=node --outfile=dist/index.js",
"dev": "yarn build -- --watch",
"codegen": "graphql-codegen generate --config src/codegen.yml"
},
"dependencies": {
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/typescript": "^4.0.1",
"@graphql-codegen/typescript-operations": "^4.0.1",
"graphql": "^16.8.1",
"graphql-zeus": "^5.3.2",
"prettier": "^3.1.0",
"tsc-alias": "^1.7.1"
}
}
9 changes: 9 additions & 0 deletions backend/mail-zeus/src/codegen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
overwrite: true
schema:
- http://localhost:8114/v1/graphql:
headers:
x-hasura-admin-secret: myadminsecretkey
generates:
src/codegen/types.ts:
plugins:
- "typescript"
Loading
Loading