3 Commits
Author SHA1 Message Date
phoenix 270c4e5675 Adding license (#34)
schedtxt_api Build / Rustfmt (push) Successful in 1m15s
schedtxt_api Build / Clippy (push) Successful in 1m15s
schedtxt_api Build / Check (push) Successful in 3m14s
schedtxt_api Build / Test Suite (push) Successful in 4m24s
schedtxt_api Build / build (push) Successful in 2m37s
Reviewed-on: #34
2026-07-14 15:33:21 -04:00
phoenix 89b347b3f6 Dependency name change (#33)
schedtxt_api Build / Rustfmt (push) Successful in 40s
schedtxt_api Build / Check (push) Successful in 1m21s
schedtxt_api Build / Test Suite (push) Successful in 2m50s
schedtxt_api Build / Clippy (push) Successful in 2m51s
schedtxt_api Build / build (push) Successful in 3m49s
Reviewed-on: #33
2026-07-13 18:06:17 -04:00
phoenix 57709ab87d Update rust (#32)
textsender_api Build / Check (push) Successful in 2m22s
textsender_api Build / Rustfmt (push) Successful in 33s
textsender_api Build / Test Suite (push) Successful in 4m6s
textsender_api Build / Clippy (push) Successful in 1m10s
textsender_api Build / build (push) Successful in 4m6s
Reviewed-on: phoenix/textsender_api#32
2026-07-10 18:21:10 -04:00
25 changed files with 414 additions and 390 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
JWT_SECRET=NULqYIzgt28bTiyziCd7IOO7b6LnWDW! JWT_SECRET=NULqYIzgt28bTiyziCd7IOO7b6LnWDW!
DB_MAIN_NAME=textsender_db DB_MAIN_NAME=schedtxt_db
DB_MAIN_USER=textsender DB_MAIN_USER=schedtxt
DB_MAIN_PASSWORD=password DB_MAIN_PASSWORD=password
DB_MAIN_HOST=main_db DB_MAIN_HOST=main_db
DB_MAIN_PORT=5432 DB_MAIN_PORT=5432
@@ -10,5 +10,5 @@ TWILIO_AUTH_SID=9M438C93R943U4329MCU43C34U
TWILIO_SERVICE_SID=9M4J3X8439U398NUVT3342MC349C348T TWILIO_SERVICE_SID=9M4J3X8439U398NUVT3342MC349C348T
TWILIO_AUTH_TOKEN="MA08HJp9tYtkfs72m8JIIROofRVm74oR0ixEYBHGYpB9" TWILIO_AUTH_TOKEN="MA08HJp9tYtkfs72m8JIIROofRVm74oR0ixEYBHGYpB9"
TWILIO_PHONE_NUMBER=+10123456789 TWILIO_PHONE_NUMBER=+10123456789
ALLOWED_ORIGINS="http://textsender.com,http://localhost:5173,http://localhost:9080,http://localhost:9081" ALLOWED_ORIGINS="http://schedtxt.com,http://localhost:5173,http://localhost:9080,http://localhost:9081"
APP_ENV=production APP_ENV=production
+3 -3
View File
@@ -1,6 +1,6 @@
JWT_SECRET=NULqYIzgt28bTiyziCd7IOO7b6LnWDW! JWT_SECRET=NULqYIzgt28bTiyziCd7IOO7b6LnWDW!
DB_MAIN_NAME=textsender_db DB_MAIN_NAME=schedtxt_db
DB_MAIN_USER=textsender DB_MAIN_USER=schedtxt
DB_MAIN_PASSWORD=password DB_MAIN_PASSWORD=password
DB_MAIN_HOST=localhost DB_MAIN_HOST=localhost
DB_MAIN_PORT=5432 DB_MAIN_PORT=5432
@@ -10,5 +10,5 @@ TWILIO_AUTH_SID=9M438C93R943U4329MCU43C34U
TWILIO_SERVICE_SID=9M4J3X8439U398NUVT3342MC349C348T TWILIO_SERVICE_SID=9M4J3X8439U398NUVT3342MC349C348T
TWILIO_AUTH_TOKEN="MA08HJp9tYtkfs72m8JIIROofRVm74oR0ixEYBHGYpB9" TWILIO_AUTH_TOKEN="MA08HJp9tYtkfs72m8JIIROofRVm74oR0ixEYBHGYpB9"
TWILIO_PHONE_NUMBER=+10123456789 TWILIO_PHONE_NUMBER=+10123456789
ALLOWED_ORIGINS="http://textsender.com,http://localhost:5173,http://localhost:9080,http://localhost:9081" ALLOWED_ORIGINS="http://schedtxt.com,http://localhost:5173,http://localhost:9080,http://localhost:9081"
APP_ENV=production APP_ENV=production
+13 -13
View File
@@ -1,4 +1,4 @@
name: textsender_api PR name: schedtxt_api PR
on: on:
pull_request: pull_request:
@@ -17,16 +17,16 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.96.1 toolchain: 1.97
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: | - run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/schedtxt-models_deploy_key
chmod 600 ~/.ssh/textsender-models_deploy_key chmod 600 ~/.ssh/schedtxt-models_deploy_key
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s) eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender-models_deploy_key ssh-add -v ~/.ssh/schedtxt-models_deploy_key
cargo check cargo check
@@ -37,17 +37,17 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.96.1 toolchain: 1.97
- run: rustup component add rustfmt - run: rustup component add rustfmt
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: | - run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/schedtxt-models_deploy_key
chmod 600 ~/.ssh/textsender-models_deploy_key chmod 600 ~/.ssh/schedtxt-models_deploy_key
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s) eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender-models_deploy_key ssh-add -v ~/.ssh/schedtxt-models_deploy_key
cargo fmt --all -- --check cargo fmt --all -- --check
clippy: clippy:
@@ -57,15 +57,15 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.96.1 toolchain: 1.97
- run: rustup component add clippy - run: rustup component add clippy
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: | - run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/schedtxt-models_deploy_key
chmod 600 ~/.ssh/textsender-models_deploy_key chmod 600 ~/.ssh/schedtxt-models_deploy_key
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s) eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender-models_deploy_key ssh-add -v ~/.ssh/schedtxt-models_deploy_key
cargo clippy -- -D warnings cargo clippy -- -D warnings
+9 -9
View File
@@ -1,4 +1,4 @@
name: Rust Build name: schedtxt_api Test
on: on:
pull_request: pull_request:
@@ -35,7 +35,7 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.96.1 toolchain: 1.97
# --- Add this step for explicit verification --- # --- Add this step for explicit verification ---
- name: Verify Docker Environment - name: Verify Docker Environment
run: | run: |
@@ -61,12 +61,12 @@ jobs:
ENABLE_REGISTRATION: 'TRUE' ENABLE_REGISTRATION: 'TRUE'
run: | run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/schedtxt-models_deploy_key
chmod 600 ~/.ssh/textsender-models_deploy_key chmod 600 ~/.ssh/schedtxt-models_deploy_key
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s) eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender-models_deploy_key ssh-add -v ~/.ssh/schedtxt-models_deploy_key
cargo test cargo test
@@ -77,15 +77,15 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.96.1 toolchain: 1.97
- run: rustup component add rustfmt - run: rustup component add rustfmt
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: | - run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/schedtxt-models_deploy_key
chmod 600 ~/.ssh/textsender-models_deploy_key chmod 600 ~/.ssh/schedtxt-models_deploy_key
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s) eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender-models_deploy_key ssh-add -v ~/.ssh/schedtxt-models_deploy_key
cargo fmt --all -- --check cargo fmt --all -- --check
+21 -21
View File
@@ -1,4 +1,4 @@
name: Rust Build name: schedtxt_api Build
on: on:
push: push:
@@ -18,16 +18,16 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.96.1 toolchain: 1.97
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: | - run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/schedtxt-models_deploy_key
chmod 600 ~/.ssh/textsender-models_deploy_key chmod 600 ~/.ssh/schedtxt-models_deploy_key
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s) eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender-models_deploy_key ssh-add -v ~/.ssh/schedtxt-models_deploy_key
cargo check cargo check
@@ -55,7 +55,7 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.96.1 toolchain: 1.97
# --- Add this step for explicit verification --- # --- Add this step for explicit verification ---
- name: Verify Docker Environment - name: Verify Docker Environment
run: | run: |
@@ -81,12 +81,12 @@ jobs:
ENABLE_REGISTRATION: 'TRUE' ENABLE_REGISTRATION: 'TRUE'
run: | run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/schedtxt-models_deploy_key
chmod 600 ~/.ssh/textsender-models_deploy_key chmod 600 ~/.ssh/schedtxt-models_deploy_key
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s) eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender-models_deploy_key ssh-add -v ~/.ssh/schedtxt-models_deploy_key
cargo test cargo test
@@ -97,17 +97,17 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.96.1 toolchain: 1.97
- run: rustup component add rustfmt - run: rustup component add rustfmt
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: | - run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/schedtxt-models_deploy_key
chmod 600 ~/.ssh/textsender-models_deploy_key chmod 600 ~/.ssh/schedtxt-models_deploy_key
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s) eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender-models_deploy_key ssh-add -v ~/.ssh/schedtxt-models_deploy_key
cargo fmt --all -- --check cargo fmt --all -- --check
clippy: clippy:
@@ -117,17 +117,17 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.96.1 toolchain: 1.97
- run: rustup component add clippy - run: rustup component add clippy
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: | - run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/schedtxt-models_deploy_key
chmod 600 ~/.ssh/textsender-models_deploy_key chmod 600 ~/.ssh/schedtxt-models_deploy_key
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s) eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender-models_deploy_key ssh-add -v ~/.ssh/schedtxt-models_deploy_key
cargo clippy -- -D warnings cargo clippy -- -D warnings
build: build:
@@ -137,14 +137,14 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.96.1 toolchain: 1.97
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: | - run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/schedtxt-models_deploy_key
chmod 600 ~/.ssh/textsender-models_deploy_key chmod 600 ~/.ssh/schedtxt-models_deploy_key
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s) eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender-models_deploy_key ssh-add -v ~/.ssh/schedtxt-models_deploy_key
cargo build --release cargo build --release
Generated
+105 -98
View File
@@ -171,9 +171,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]] [[package]]
name = "base64-ng" name = "base64-ng"
version = "1.3.5" version = "1.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b87dbd7e45c4885ad3432a2d125ddb155c5ee87046ab23bad043dfe84fedfa2" checksum = "78dbdaa3c8250efc13282f483f2ae92733e407c9cf6ffc2fe7918ce1ee420724"
[[package]] [[package]]
name = "base64ct" name = "base64ct"
@@ -222,15 +222,15 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]] [[package]]
name = "bytes" name = "bytes"
version = "1.12.0" version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ae3f5d315924270530207e2a68396c3cc547f6dca3fbdca317cfb1a51edb593" checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.66" version = "1.2.67"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5d6cac793997bd970000024b2934968efe83b382de4fdcf4fcb46b6ee4ad996" checksum = "e17dd265a7d0f31ef544e1b20e03add05d3b45b491b633b10d67145d2acc1a38"
dependencies = [ dependencies = [
"find-msvc-tools", "find-msvc-tools",
"jobserver", "jobserver",
@@ -301,6 +301,12 @@ version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
[[package]]
name = "const-oid"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c"
[[package]] [[package]]
name = "const_format" name = "const_format"
version = "0.2.36" version = "0.2.36"
@@ -489,7 +495,7 @@ version = "0.7.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"
dependencies = [ dependencies = [
"const-oid", "const-oid 0.9.6",
"pem-rfc7468", "pem-rfc7468",
"zeroize", "zeroize",
] ]
@@ -521,7 +527,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [ dependencies = [
"block-buffer 0.10.4", "block-buffer 0.10.4",
"const-oid", "const-oid 0.9.6",
"crypto-common 0.1.6", "crypto-common 0.1.6",
"subtle", "subtle",
] ]
@@ -533,6 +539,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
dependencies = [ dependencies = [
"block-buffer 0.12.1", "block-buffer 0.12.1",
"const-oid 0.10.2",
"crypto-common 0.2.2", "crypto-common 0.2.2",
"ctutils", "ctutils",
] ]
@@ -1013,9 +1020,9 @@ dependencies = [
[[package]] [[package]]
name = "http-body" name = "http-body"
version = "1.0.1" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c"
dependencies = [ dependencies = [
"bytes", "bytes",
"http", "http",
@@ -1023,9 +1030,9 @@ dependencies = [
[[package]] [[package]]
name = "http-body-util" name = "http-body-util"
version = "0.1.3" version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" checksum = "e9f41fd6a08e4d4ec69df65976da761afd5ad5e58a9d4acb46bd1c953a9e3ff2"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-core", "futures-core",
@@ -1345,7 +1352,7 @@ dependencies = [
"p256", "p256",
"p384", "p384",
"pem", "pem",
"rand 0.8.6", "rand 0.8.7",
"rsa", "rsa",
"serde", "serde",
"serde_json", "serde_json",
@@ -1452,9 +1459,9 @@ dependencies = [
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.8.2" version = "2.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4" checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
[[package]] [[package]]
name = "mime" name = "mime"
@@ -1484,9 +1491,9 @@ dependencies = [
[[package]] [[package]]
name = "mio" name = "mio"
version = "1.2.1" version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda" checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427"
dependencies = [ dependencies = [
"libc", "libc",
"wasi", "wasi",
@@ -1557,7 +1564,7 @@ dependencies = [
"num-integer", "num-integer",
"num-iter", "num-iter",
"num-traits", "num-traits",
"rand 0.8.6", "rand 0.8.7",
"smallvec", "smallvec",
"zeroize", "zeroize",
] ]
@@ -1579,11 +1586,10 @@ dependencies = [
[[package]] [[package]]
name = "num-iter" name = "num-iter"
version = "0.1.45" version = "0.1.46"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b"
dependencies = [ dependencies = [
"autocfg",
"num-integer", "num-integer",
"num-traits", "num-traits",
] ]
@@ -1874,9 +1880,9 @@ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
[[package]] [[package]]
name = "rand" name = "rand"
version = "0.8.6" version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a" checksum = "22f6172bdec972074665ed81ed53b71da00bfc44b65a753cfde883ec4c702a1a"
dependencies = [ dependencies = [
"libc", "libc",
"rand_chacha", "rand_chacha",
@@ -1939,9 +1945,9 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.12.4" version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba" checksum = "2a0e75113e14dc5acb068cd0786884f214f1312650a3d36d269f5c4f3cdee8a2"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@@ -1951,9 +1957,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-automata" name = "regex-automata"
version = "0.4.14" version = "0.4.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" checksum = "1f388202e4b80542a0921078cc23b6333bcf1409c1e3f86404cae4766a6131db"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@@ -2042,7 +2048,7 @@ version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d"
dependencies = [ dependencies = [
"const-oid", "const-oid 0.9.6",
"digest 0.10.7", "digest 0.10.7",
"num-bigint-dig", "num-bigint-dig",
"num-integer", "num-integer",
@@ -2058,9 +2064,9 @@ dependencies = [
[[package]] [[package]]
name = "rust-embed" name = "rust-embed"
version = "8.11.0" version = "8.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04113cb9355a377d83f06ef1f0a45b8ab8cd7d8b1288160717d66df5c7988d27" checksum = "e9e7760e252aaba7b09f4be00e36476cf585bdb68a53552ac954cdf504ab4bc9"
dependencies = [ dependencies = [
"rust-embed-impl", "rust-embed-impl",
"rust-embed-utils", "rust-embed-utils",
@@ -2069,10 +2075,11 @@ dependencies = [
[[package]] [[package]]
name = "rust-embed-impl" name = "rust-embed-impl"
version = "8.11.0" version = "8.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da0902e4c7c8e997159ab384e6d0fc91c221375f6894346ae107f47dd0f3ccaa" checksum = "3bcfc4d6f53af43755f7a723e4b6b8794fcce052a178dd8c6c1dadc5f5343097"
dependencies = [ dependencies = [
"mime_guess",
"proc-macro2", "proc-macro2",
"quote", "quote",
"rust-embed-utils", "rust-embed-utils",
@@ -2082,11 +2089,11 @@ dependencies = [
[[package]] [[package]]
name = "rust-embed-utils" name = "rust-embed-utils"
version = "8.11.0" version = "8.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bcdef0be6fe7f6fa333b1073c949729274b05f123a0ad7efcb8efd878e5c3b1" checksum = "42ffa149f6aa81b58a5b3011d01a857c4ed12c7a732d2c51947a4c7c692185f0"
dependencies = [ dependencies = [
"sha2 0.10.9", "sha2 0.11.0",
"walkdir", "walkdir",
] ]
@@ -2120,9 +2127,9 @@ dependencies = [
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.23.41" version = "0.23.42"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b92b125634d9b795e7beca796cc790df15a7fb38323bf3196fda83292d06b1f" checksum = "3c54fcab019b409d04215d3a17cb438fd7fbf192ee61461f20f4fe18704bc138"
dependencies = [ dependencies = [
"aws-lc-rs", "aws-lc-rs",
"once_cell", "once_cell",
@@ -2223,6 +2230,46 @@ dependencies = [
"windows-sys 0.61.2", "windows-sys 0.61.2",
] ]
[[package]]
name = "schedtxt_api"
version = "0.2.4"
dependencies = [
"axum",
"axum-extra",
"josekit",
"jsonwebtoken",
"schedtxt_models",
"serde",
"serde_json",
"sqlx",
"swoosh",
"time",
"tokio",
"tower",
"tower-http 0.7.0",
"tracing-subscriber",
"url",
"utoipa",
"utoipa-swagger-ui",
"uuid",
]
[[package]]
name = "schedtxt_models"
version = "0.5.3"
source = "git+ssh://git@git.kundeng.us/phoenix/schedtxt_models.git?tag=v0.5.3#597af4e84c082bb437cc94817bb19592614681a5"
dependencies = [
"const_format",
"dotenvy",
"josekit",
"serde",
"serde_json",
"sqlx",
"time",
"utoipa",
"uuid",
]
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "1.2.0" version = "1.2.0"
@@ -2458,9 +2505,9 @@ dependencies = [
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.6.4" version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51" checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
dependencies = [ dependencies = [
"libc", "libc",
"windows-sys 0.61.2", "windows-sys 0.61.2",
@@ -2468,9 +2515,9 @@ dependencies = [
[[package]] [[package]]
name = "spin" name = "spin"
version = "0.9.8" version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e"
dependencies = [ dependencies = [
"lock_api", "lock_api",
] ]
@@ -2690,14 +2737,14 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]] [[package]]
name = "swoosh" name = "swoosh"
version = "0.5.2" version = "0.5.4"
source = "git+ssh://git@git.kundeng.us/phoenix/swoosh.git?tag=v0.5.2#50e4b209f521d8985d73a33b4a8f1db69334100a" source = "git+ssh://git@git.kundeng.us/phoenix/swoosh.git?tag=v0.5.4#84ba4c21ec721662d76bb21ef67062d51f31f719"
dependencies = [ dependencies = [
"base64-ng", "base64-ng",
"reqwest", "reqwest",
"schedtxt_models",
"serde", "serde",
"serde_json", "serde_json",
"textsender_models",
"time", "time",
] ]
@@ -2766,46 +2813,6 @@ dependencies = [
"windows-sys 0.61.2", "windows-sys 0.61.2",
] ]
[[package]]
name = "textsender_api"
version = "0.2.3"
dependencies = [
"axum",
"axum-extra",
"josekit",
"jsonwebtoken",
"serde",
"serde_json",
"sqlx",
"swoosh",
"textsender_models",
"time",
"tokio",
"tower",
"tower-http 0.7.0",
"tracing-subscriber",
"url",
"utoipa",
"utoipa-swagger-ui",
"uuid",
]
[[package]]
name = "textsender_models"
version = "0.5.1"
source = "git+ssh://git@git.kundeng.us/phoenix/textsender_models.git?tag=v0.5.1#151eeaacf64e255bde56a48df03f4c46ec77c235"
dependencies = [
"const_format",
"dotenvy",
"josekit",
"serde",
"serde_json",
"sqlx",
"time",
"utoipa",
"uuid",
]
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "2.0.18" version = "2.0.18"
@@ -2828,9 +2835,9 @@ dependencies = [
[[package]] [[package]]
name = "thread_local" name = "thread_local"
version = "1.1.9" version = "1.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
] ]
@@ -2877,9 +2884,9 @@ dependencies = [
[[package]] [[package]]
name = "tinyvec" name = "tinyvec"
version = "1.11.0" version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f"
dependencies = [ dependencies = [
"tinyvec_macros", "tinyvec_macros",
] ]
@@ -3197,9 +3204,9 @@ dependencies = [
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.23.4" version = "1.23.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf80a72845275afea99e7f2b434723d3bc7e38470fcd1c7ed39a599c73319a53" checksum = "ea5fab0d6c3c01ae70085a09cb03d4c7a1d6314e2b3e075392783396d724ca0a"
dependencies = [ dependencies = [
"getrandom 0.4.3", "getrandom 0.4.3",
"js-sys", "js-sys",
@@ -3510,18 +3517,18 @@ dependencies = [
[[package]] [[package]]
name = "zerocopy" name = "zerocopy"
version = "0.8.53" version = "0.8.54"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75726053136156d419e285b9b7eddaaea9e3fea6ce32eed44a89901f0bd98de1" checksum = "b7cbbc0a705a0fd05cc3676525980d2bf5a9bc4adac6d6475209a7887cf59d19"
dependencies = [ dependencies = [
"zerocopy-derive", "zerocopy-derive",
] ]
[[package]] [[package]]
name = "zerocopy-derive" name = "zerocopy-derive"
version = "0.8.53" version = "0.8.54"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4714fd92cf900833d49538023a9b3915155210801d1c1169eba513b2addefd71" checksum = "e2e817b7b52d0c7358d3246da9d69935ebb18116b2b102b4230dac079b4862f5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -3618,15 +3625,15 @@ dependencies = [
[[package]] [[package]]
name = "zlib-rs" name = "zlib-rs"
version = "0.6.5" version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5431d5661c32445236631278f27946e444ddafe4684cac70b185272d4f9c52d5" checksum = "b142a20ec14a91d5bc708c1dc21b080c550113d8aa77afa29635673a65dd02c5"
[[package]] [[package]]
name = "zmij" name = "zmij"
version = "1.0.21" version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
[[package]] [[package]]
name = "zopfli" name = "zopfli"
+8 -6
View File
@@ -1,8 +1,10 @@
[package] [package]
name = "textsender_api" name = "schedtxt_api"
version = "0.2.3" version = "0.2.4"
edition = "2024" edition = "2024"
rust-version = "1.96.1" license = "MIT"
description = "Core API for sending text messages"
rust-version = "1.97"
[dependencies] [dependencies]
axum = { version = "0.8.9", features = ["multipart"] } axum = { version = "0.8.9", features = ["multipart"] }
@@ -12,14 +14,14 @@ serde_json = { version = "1.0.150" }
tokio = { version = "1.52.3", features = ["full"] } tokio = { version = "1.52.3", features = ["full"] }
tower-http = { version = "0.7.0", features = ["cors", "timeout"] } tower-http = { version = "0.7.0", features = ["cors", "timeout"] }
tracing-subscriber = "0.3.23" tracing-subscriber = "0.3.23"
uuid = { version = "1.23.3", features = ["v4", "serde"] } uuid = { version = "1.23.5", features = ["v4", "serde"] }
sqlx = { version = "0.9.0", features = ["runtime-tokio", "tls-native-tls", "postgres", "time", "uuid"] } sqlx = { version = "0.9.0", features = ["runtime-tokio", "tls-native-tls", "postgres", "time", "uuid"] }
time = { version = "0.3.53", features = ["formatting", "macros", "parsing", "serde"] } time = { version = "0.3.53", features = ["formatting", "macros", "parsing", "serde"] }
jsonwebtoken = { version = "10.4.0", features = ["rust_crypto"] } jsonwebtoken = { version = "10.4.0", features = ["rust_crypto"] }
utoipa = { version = "5.5.0", features = ["axum_extras"] } utoipa = { version = "5.5.0", features = ["axum_extras"] }
utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] } utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] }
textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender_models.git", tag = "v0.5.1" } schedtxt_models = { git = "ssh://git@git.kundeng.us/phoenix/schedtxt_models.git", tag = "v0.5.3" }
swoosh = { git = "ssh://git@git.kundeng.us/phoenix/swoosh.git", tag = "v0.5.2" } swoosh = { git = "ssh://git@git.kundeng.us/phoenix/swoosh.git", tag = "v0.5.4" }
[dev-dependencies] [dev-dependencies]
tower = { version = "0.5.3", features = ["full"] } tower = { version = "0.5.3", features = ["full"] }
+4 -24
View File
@@ -1,50 +1,36 @@
# Stage 1: Build the application FROM rust:1.97 as builder
FROM rust:1.96.1 as builder
# Set the working directory inside the container # Set the working directory inside the container
WORKDIR /usr/src/app WORKDIR /usr/src/app
# Install build dependencies if needed (e.g., git for cloning)
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config libssl3 \ pkg-config libssl3 \
ca-certificates \ ca-certificates \
openssh-client git \ openssh-client git \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Create .ssh/ directory for internal dependencies
RUN mkdir -p -m 0700 ~/.ssh && \ RUN mkdir -p -m 0700 ~/.ssh && \
echo "Host git.kundeng.us" >> ~/.ssh/config && \ echo "Host git.kundeng.us" >> ~/.ssh/config && \
echo " User git" >> ~/.ssh/config && \ echo " User git" >> ~/.ssh/config && \
chmod 600 ~/.ssh/config chmod 600 ~/.ssh/config
# << --- ADD HOST KEY HERE --- >>
RUN ssh-keyscan git.kundeng.us >> ~/.ssh/known_hosts RUN ssh-keyscan git.kundeng.us >> ~/.ssh/known_hosts
# Copy Cargo manifests
COPY Cargo.toml Cargo.lock ./ COPY Cargo.toml Cargo.lock ./
# Build *only* dependencies to leverage Docker cache
# This dummy build caches dependencies as a separate layer
RUN --mount=type=ssh mkdir src && \ RUN --mount=type=ssh mkdir src && \
echo "fn main() {println!(\"if you see this, the build broke\")}" > src/main.rs && \ echo "fn main() {println!(\"if you see this, the build broke\")}" > src/main.rs && \
cargo build --release --quiet && \ cargo build --release --quiet && \
rm -rf src target/release/deps/textsender_api* # Clean up dummy build artifacts (replace textsender_api) rm -rf src target/release/deps/schedtxt_api*
# Copy the actual source code # Copy the actual source code
COPY src ./src COPY src ./src
# If you have other directories like `templates` or `static`, copy them too
COPY .env ./.env COPY .env ./.env
COPY migrations ./migrations COPY migrations ./migrations
# << --- SSH MOUNT ADDED HERE --- >>
# Build *only* dependencies to leverage Docker cache
# This dummy build caches dependencies as a separate layer
# Mount the SSH agent socket for this command
RUN --mount=type=ssh \ RUN --mount=type=ssh \
cargo build --release --quiet cargo build --release --quiet
# Stage 2: Create the final, smaller runtime image
# Use a minimal base image like debian-slim or even distroless for security/size
FROM debian:trixie-slim FROM debian:trixie-slim
# Install runtime dependencies if needed (e.g., SSL certificates) # Install runtime dependencies if needed (e.g., SSL certificates)
@@ -53,18 +39,12 @@ RUN apt-get update && apt-get install -y ca-certificates libssl-dev libssl3 && r
# Set the working directory # Set the working directory
WORKDIR /usr/local/bin WORKDIR /usr/local/bin
# Copy the compiled binary from the builder stage COPY --from=builder /usr/src/app/target/release/schedtxt_api .
# Replace 'textsender_api' with the actual name of your binary (usually the crate name)
COPY --from=builder /usr/src/app/target/release/textsender_api .
# Copy other necessary files like .env (if used for runtime config) or static assets
# It's generally better to configure via environment variables in Docker though
COPY --from=builder /usr/src/app/.env . COPY --from=builder /usr/src/app/.env .
COPY --from=builder /usr/src/app/migrations ./migrations COPY --from=builder /usr/src/app/migrations ./migrations
# Expose the port your Axum app listens on (e.g., 3000 or 8000)
EXPOSE 9081 EXPOSE 9081
# Set the command to run your application # Set the command to run your application
# Ensure this matches the binary name copied above CMD ["./schedtxt_api"]
CMD ["./textsender_api"]
+22
View File
@@ -0,0 +1,22 @@
Copyright (c) 2026 Kun Deng.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
+46
View File
@@ -0,0 +1,46 @@
# schedtxt_api
Core API to send text messages
## Getting started
Fastest way to get started is with docker. Make sure that is installed before moving forward.
This application requires `schedtxt_auth` and `catapult` repositories to be located in the
parent directory.
```
.
..
- schedtxt_auth/
- schedtxt_api/
- catapult/
```
Make sure the othe repositories are configured as it is required to operate successfully.
Copy over the `.env.docker.sample` to `.env` to get started.
### Token service
The `JWT_SECRET` environment variable should be the same variable as `SECRET_MAIN_KEY` in
`schedtxt_auth`.
### Messaging configuration
schedtxt uses `twilio` as the service to send the messages. You will need to sign up with
them and be provided an account SID, service SID, auth token, and phone number. Update the
corresponding `TWILIO_*` variables.
### Database configuration
Make sure to provide values for the `DB_MAIN_*` variables. For the sake of development, it
can be left as it is.
Build the container
```
docker build
```
Run the container
```
docker compose up
```
+27 -41
View File
@@ -3,12 +3,11 @@ version: '3.8' # Use a recent version
services: services:
# --- Web API --- # --- Web API ---
api: api:
build: # Tells docker-compose to build the Dockerfile in the current directory build:
context: . context: .
ssh: ["default"] # Uses host's SSH agent ssh: ["default"]
container_name: textsender_api # Optional: Give the container a specific name container_name: schedtxt_api
ports: ports:
# Map host port 8000 to container port 3000 (adjust as needed)
- "9081:9081" - "9081:9081"
env_file: env_file:
- .env - .env
@@ -16,33 +15,26 @@ services:
main_db: main_db:
condition: service_healthy condition: service_healthy
networks: networks:
- textsender_api-network - schedtxt_api-network
restart: unless-stopped # Optional: Restart policy restart: unless-stopped
# --- Auth API --- # --- Auth API ---
auth_api: auth_api:
build: build:
# Might want to change the naming convention at some point for the repo names. textsender-models, textsender_auth, textesender-api, etc context: ../schedtxt_auth
context: ../textsender_auth # IMPORTANT: Relative path to the local checkout of your web API repo (containing the Dockerfile) ssh: ["default"]
ssh: ["default"] # Uses host's SSH agent dockerfile: Dockerfile
dockerfile: Dockerfile # Optional: Specify if your Dockerfile has a non-standard name
container_name: auth_api container_name: auth_api
restart: unless-stopped restart: unless-stopped
ports: ports:
- "9080:9080" - "9080:9080"
# environment:
# Environment variables your API needs, e.g., database connection
# Add other necessary environment variables
env_file: env_file:
- ../textsender_auth/.env - ../schedtxt_auth/.env
depends_on: depends_on:
auth_db: auth_db:
condition: service_healthy condition: service_healthy
networks: networks:
- textsender_api-network - schedtxt_api-network
# Optional: Mount local code for development (live reload)
# volumes:
# - ./path/to/your/web-api-repo:/app
# --- catapult service --- # --- catapult service ---
catapult: catapult:
@@ -60,24 +52,21 @@ services:
- auth_api - auth_api
- auth_db - auth_db
networks: networks:
- textsender_api-network - schedtxt_api-network
# PostgreSQL Database Service # PostgreSQL Database Service
# --- textsender_api web api db ---
main_db: main_db:
image: postgres:18.4-alpine # Use an official Postgres image (Alpine variant is smaller) image: postgres:18.4-alpine
container_name: textsender_api_db # Optional: Give the container a specific name container_name: schedtxt_api_db
environment: environment:
# These MUST match the user, password, and database name in the DATABASE_URL above # These MUST match the user, password, and database name in the DATABASE_URL above
POSTGRES_USER: ${DB_MAIN_USER:-textsender_api} POSTGRES_USER: ${DB_MAIN_USER:-schedtxt_api}
POSTGRES_PASSWORD: ${DB_MAIN_PASSWORD:-password} POSTGRES_PASSWORD: ${DB_MAIN_PASSWORD:-password}
POSTGRES_DB: ${DB_MAIN_NAME:-textsender_api_db} POSTGRES_DB: ${DB_MAIN_NAME:-schedtxt_api_db}
volumes: volumes:
# Persist database data using a named volume
- postgres_data:/var/lib/postgresql - postgres_data:/var/lib/postgresql
ports: ports:
# Optional: Expose port 5432 ONLY if you need to connect directly from your host machine (e.g., for debugging)
- "5432:5432" - "5432:5432"
healthcheck: healthcheck:
# Checks if Postgres is ready to accept connections # Checks if Postgres is ready to accept connections
@@ -86,24 +75,23 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
start_period: 10s start_period: 10s
restart: always # Optional: Restart policy restart: always
networks: networks:
- textsender_api-network - schedtxt_api-network
# --- textsender_api web auth api db --- # --- schedtxt_api web auth api db ---
auth_db: auth_db:
image: postgres:18.4-alpine # Use an official Postgres image (Alpine variant is smaller) image: postgres:18.4-alpine
container_name: textsender_api_auth_db # Optional: Give the container a specific name container_name: schedtxt_api_auth_db
environment: environment:
# These MUST match the user, password, and database name in the DATABASE_URL above # These MUST match the user, password, and database name in the DATABASE_URL above
POSTGRES_USER: ${DB_AUTH_USER:-textsender_auth} POSTGRES_USER: ${DB_AUTH_USER:-schedtxt_auth}
POSTGRES_PASSWORD: ${DB_AUTH_PASSWORD:-password} POSTGRES_PASSWORD: ${DB_AUTH_PASSWORD:-password}
POSTGRES_DB: ${DB_AUTH_NAME:-textsender_auth_db} POSTGRES_DB: ${DB_AUTH_NAME:-schedtxt_auth_db}
volumes: volumes:
# Persist database data using a named volume # Persist database data using a named volume
- postgres_data_auth:/var/lib/postgresql - postgres_data_auth:/var/lib/postgresql
ports: ports:
# Optional: Expose port 5432 ONLY if you need to connect directly from your host machine (e.g., for debugging)
- "5433:5432" - "5433:5432"
healthcheck: healthcheck:
# Checks if Postgres is ready to accept connections # Checks if Postgres is ready to accept connections
@@ -112,18 +100,16 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
start_period: 10s start_period: 10s
restart: always # Optional: Restart policy restart: always
networks: networks:
- textsender_api-network - schedtxt_api-network
# Define the named volume for data persistence
volumes: volumes:
postgres_data: postgres_data:
driver: local # Use the default local driver driver: local
postgres_data_auth: postgres_data_auth:
driver: local # Use the default local driver driver: local
# Define the network (optional, but good practice)
networks: networks:
textsender_api-network: schedtxt_api-network:
driver: bridge driver: bridge
+3 -3
View File
@@ -36,11 +36,11 @@ pub async fn auth<B>(
(StatusCode::UNAUTHORIZED, Json(json_error)) (StatusCode::UNAUTHORIZED, Json(json_error))
})?; })?;
let secret_key = textsender_models::envy::environment::get_secret_main_key().value; let secret_key = schedtxt_models::envy::environment::get_secret_main_key().value;
let mut validation = Validation::new(jsonwebtoken::Algorithm::HS256); let mut validation = Validation::new(jsonwebtoken::Algorithm::HS256);
validation.set_audience(&["textsender"]); // Must match exactly what's in the token validation.set_audience(&["schedtxt"]); // Must match exactly what's in the token
let _claims = decode::<textsender_models::token::Claims>( let _claims = decode::<schedtxt_models::token::Claims>(
&token, &token,
&DecodingKey::from_secret(secret_key.as_ref()), &DecodingKey::from_secret(secret_key.as_ref()),
&validation, &validation,
+2 -12
View File
@@ -49,7 +49,7 @@ pub mod response {
#[derive(Debug, Default, Deserialize, Serialize, ToSchema)] #[derive(Debug, Default, Deserialize, Serialize, ToSchema)]
pub struct AddContactResponse { pub struct AddContactResponse {
pub message: String, pub message: String,
pub data: Vec<textsender_models::contact::Contact>, pub data: Vec<schedtxt_models::contact::Contact>,
} }
pub use AddContactResponse as GetContactResponse; pub use AddContactResponse as GetContactResponse;
@@ -69,19 +69,9 @@ pub mod response {
pub new_lastname: Option<String>, pub new_lastname: Option<String>,
pub new_nickname: Option<String>, pub new_nickname: Option<String>,
} }
/*
#[derive(Debug, Default, Deserialize, Serialize, ToSchema)]
pub struct GetContactResponse {
pub message: String,
pub data: Vec<textsender_models::contact::Contact>,
}
*/
} }
pub mod endpoint { pub mod endpoint {
// use axum::{Json, response::IntoResponse};
use crate::repo::contact as contact_repo; use crate::repo::contact as contact_repo;
/// Endpoint to create Contact /// Endpoint to create Contact
@@ -126,7 +116,7 @@ pub mod endpoint {
sqlx::Error::RowNotFound => { sqlx::Error::RowNotFound => {
println!("Good to create"); println!("Good to create");
// Put code here // Put code here
let mut contact = textsender_models::contact::Contact { let mut contact = schedtxt_models::contact::Contact {
firstname: payload.firstname, firstname: payload.firstname,
lastname: payload.lastname, lastname: payload.lastname,
phone_number: payload.phone_number, phone_number: payload.phone_number,
+6 -6
View File
@@ -23,7 +23,7 @@ pub mod response {
#[derive(Debug, Default, Deserialize, Serialize, ToSchema)] #[derive(Debug, Default, Deserialize, Serialize, ToSchema)]
pub struct InstantMessageResponse { pub struct InstantMessageResponse {
pub message: String, pub message: String,
pub data: Vec<textsender_models::message::event::MessageEventResponse>, pub data: Vec<schedtxt_models::message::event::MessageEventResponse>,
} }
} }
@@ -57,7 +57,7 @@ pub mod endpoint {
let mut response = super::response::InstantMessageResponse::default(); let mut response = super::response::InstantMessageResponse::default();
if payload.is_valid() { if payload.is_valid() {
let mut contacts: Vec<textsender_models::contact::Contact> = Vec::new(); let mut contacts: Vec<schedtxt_models::contact::Contact> = Vec::new();
for contact_id in &payload.contact_ids { for contact_id in &payload.contact_ids {
match contact_repo::get(&pool, contact_id).await { match contact_repo::get(&pool, contact_id).await {
@@ -81,7 +81,7 @@ pub mod endpoint {
match message_repo::get(&pool, &payload.message_id).await { match message_repo::get(&pool, &payload.message_id).await {
Ok(message) => { Ok(message) => {
println!("Valid message"); println!("Valid message");
let t_config = match textsender_models::config::auxiliary::load_config() { let t_config = match schedtxt_models::config::auxiliary::load_config() {
Ok(config) => config, Ok(config) => config,
Err(err) => { Err(err) => {
eprintln!("Error: {err:?}"); eprintln!("Error: {err:?}");
@@ -93,7 +93,7 @@ pub mod endpoint {
} }
}; };
let mut results: Vec< let mut results: Vec<
textsender_models::message::event::MessageEventResponse, schedtxt_models::message::event::MessageEventResponse,
> = Vec::new(); > = Vec::new();
let pp = swoosh::twilio::types::Parameters { let pp = swoosh::twilio::types::Parameters {
schedule: false, schedule: false,
@@ -114,11 +114,11 @@ pub mod endpoint {
match sendmsg.send_message(&pp).await { match sendmsg.send_message(&pp).await {
Ok(result) => { Ok(result) => {
let val = swoosh::twilio::api::response_to_json(result).await; let val = swoosh::twilio::api::response_to_json(result).await;
let mer = textsender_models::message::event::MessageEventResponse { let mer = schedtxt_models::message::event::MessageEventResponse {
user_id: payload.user_id, user_id: payload.user_id,
// TODO: Make this more accurate // TODO: Make this more accurate
sent: Some(time::OffsetDateTime::now_utc()), sent: Some(time::OffsetDateTime::now_utc()),
status: String::from(textsender_models::message::event::MESSAGE_EVENT_RESPONSE_STATUS_INSTANT), status: String::from(schedtxt_models::message::event::MESSAGE_EVENT_RESPONSE_STATUS_INSTANT),
contact_id: contact.id.unwrap(), contact_id: contact.id.unwrap(),
message_id: message.id.unwrap(), message_id: message.id.unwrap(),
response: val, response: val,
+2 -2
View File
@@ -40,7 +40,7 @@ pub mod response {
#[derive(Debug, Default, Deserialize, Serialize, ToSchema)] #[derive(Debug, Default, Deserialize, Serialize, ToSchema)]
pub struct RecordMessageEventResponse { pub struct RecordMessageEventResponse {
pub message: String, pub message: String,
pub data: Vec<textsender_models::message::event::MessageEventResponse>, pub data: Vec<schedtxt_models::message::event::MessageEventResponse>,
} }
pub use RecordMessageEventResponse as GetMERResponse; pub use RecordMessageEventResponse as GetMERResponse;
@@ -74,7 +74,7 @@ pub mod endpoint {
let mut response = super::response::RecordMessageEventResponse::default(); let mut response = super::response::RecordMessageEventResponse::default();
if payload.is_valid() { if payload.is_valid() {
let mut mer = textsender_models::message::event::MessageEventResponse { let mut mer = schedtxt_models::message::event::MessageEventResponse {
scheduled_message_event_id: Some(payload.scheduled_message_event_id), scheduled_message_event_id: Some(payload.scheduled_message_event_id),
user_id: payload.user_id, user_id: payload.user_id,
sent: payload.sent, sent: payload.sent,
+2 -2
View File
@@ -31,7 +31,7 @@ pub mod response {
#[derive(Debug, Default, Deserialize, Serialize, ToSchema)] #[derive(Debug, Default, Deserialize, Serialize, ToSchema)]
pub struct AddMessageResponse { pub struct AddMessageResponse {
pub message: String, pub message: String,
pub data: Vec<textsender_models::message::Message>, pub data: Vec<schedtxt_models::message::Message>,
} }
pub use AddMessageResponse as GetMessageResponse; pub use AddMessageResponse as GetMessageResponse;
@@ -65,7 +65,7 @@ pub mod endpoint {
let mut response = super::response::AddMessageResponse::default(); let mut response = super::response::AddMessageResponse::default();
if payload.is_valid() { if payload.is_valid() {
let mut msg = textsender_models::message::Message { let mut msg = schedtxt_models::message::Message {
content: payload.content, content: payload.content,
user_id: Some(payload.user_id), user_id: Some(payload.user_id),
..Default::default() ..Default::default()
+10 -10
View File
@@ -52,10 +52,10 @@ pub mod request {
impl UpdateScheduledMessageStatusRequest { impl UpdateScheduledMessageStatusRequest {
pub fn is_valid(&self) -> bool { pub fn is_valid(&self) -> bool {
if !self.status.is_empty() || !self.scheduled_message_id.is_nil() { if !self.status.is_empty() || !self.scheduled_message_id.is_nil() {
self.status == textsender_models::message::scheduling::PENDING self.status == schedtxt_models::message::scheduling::PENDING
|| self.status == textsender_models::message::scheduling::READY || self.status == schedtxt_models::message::scheduling::READY
|| self.status == textsender_models::message::scheduling::PROCESSING || self.status == schedtxt_models::message::scheduling::PROCESSING
|| self.status == textsender_models::message::scheduling::DONE || self.status == schedtxt_models::message::scheduling::DONE
} else { } else {
false false
} }
@@ -70,19 +70,19 @@ pub mod response {
#[derive(Debug, Default, Deserialize, Serialize, ToSchema)] #[derive(Debug, Default, Deserialize, Serialize, ToSchema)]
pub struct ScheduleMessageResponse { pub struct ScheduleMessageResponse {
pub message: String, pub message: String,
pub data: Vec<textsender_models::message::scheduling::ScheduledMessage>, pub data: Vec<schedtxt_models::message::scheduling::ScheduledMessage>,
} }
#[derive(Debug, Default, Deserialize, Serialize, ToSchema)] #[derive(Debug, Default, Deserialize, Serialize, ToSchema)]
pub struct GetScheduledMessageResponse { pub struct GetScheduledMessageResponse {
pub message: String, pub message: String,
pub data: Vec<textsender_models::message::scheduling::ScheduledMessage>, pub data: Vec<schedtxt_models::message::scheduling::ScheduledMessage>,
} }
#[derive(Debug, Default, Deserialize, Serialize, ToSchema)] #[derive(Debug, Default, Deserialize, Serialize, ToSchema)]
pub struct CreateScheduleMessageEventResponse { pub struct CreateScheduleMessageEventResponse {
pub message: String, pub message: String,
pub data: Vec<textsender_models::message::scheduling::ScheduledMessageEvent>, pub data: Vec<schedtxt_models::message::scheduling::ScheduledMessageEvent>,
} }
pub use CreateScheduleMessageEventResponse as GetScheduledMessageEventResponse; pub use CreateScheduleMessageEventResponse as GetScheduledMessageEventResponse;
@@ -133,13 +133,13 @@ pub mod endpoint {
let mut response = super::response::ScheduleMessageResponse::default(); let mut response = super::response::ScheduleMessageResponse::default();
if payload.is_valid() { if payload.is_valid() {
if payload.status != textsender_models::message::scheduling::PENDING { if payload.status != schedtxt_models::message::scheduling::PENDING {
response.message = String::from("scheduled message must be pending"); response.message = String::from("scheduled message must be pending");
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response)) (axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
} else { } else {
if can_schedule(&payload.scheduled) { if can_schedule(&payload.scheduled) {
let mut scheduled_message = let mut scheduled_message =
textsender_models::message::scheduling::ScheduledMessage { schedtxt_models::message::scheduling::ScheduledMessage {
scheduled: payload.scheduled, scheduled: payload.scheduled,
status: payload.status, status: payload.status,
..Default::default() ..Default::default()
@@ -402,7 +402,7 @@ pub mod endpoint {
} }
} }
let mut scme = textsender_models::message::scheduling::ScheduledMessageEvent { let mut scme = schedtxt_models::message::scheduling::ScheduledMessageEvent {
contact_id: payload.contact_id, contact_id: payload.contact_id,
message_id: payload.message_id, message_id: payload.message_id,
scheduled_message_id: payload.scheduled_message_id, scheduled_message_id: payload.scheduled_message_id,
+4 -4
View File
@@ -46,12 +46,12 @@ pub mod init {
.max_age(std::time::Duration::from_secs(3600)); // Cache the preflight response for 1 hour:cite[2] .max_age(std::time::Duration::from_secs(3600)); // Cache the preflight response for 1 hour:cite[2]
// Dynamically set the allowed origin based on the environment // Dynamically set the allowed origin based on the environment
match std::env::var(textsender_models::envy::keys::APP_ENV).as_deref() { match std::env::var(schedtxt_models::envy::keys::APP_ENV).as_deref() {
Ok("production") => { Ok("production") => {
// In production, allow only your specific, trusted origins // In production, allow only your specific, trusted origins
let allowed_origins_env = let allowed_origins_env =
textsender_models::envy::environment::get_allowed_origins(); schedtxt_models::envy::environment::get_allowed_origins();
match textsender_models::envy::utility::delimitize(&allowed_origins_env) { match schedtxt_models::envy::utility::delimitize(&allowed_origins_env) {
Ok(alwd) => { Ok(alwd) => {
let allowed_origins: Vec<axum::http::HeaderValue> = alwd let allowed_origins: Vec<axum::http::HeaderValue> = alwd
.into_iter() .into_iter()
@@ -93,7 +93,7 @@ pub mod init {
event_responses::RecordMessageEventResponse event_responses::RecordMessageEventResponse
)), )),
tags( tags(
(name = "textsender API", description = "Web API to manage texting") (name = "schedtxt API", description = "Web API to manage texting")
) )
)] )]
struct ApiDoc; struct ApiDoc;
+1 -1
View File
@@ -5,7 +5,7 @@ pub mod connection_settings {
} }
pub async fn create_pool() -> Result<sqlx::PgPool, sqlx::Error> { pub async fn create_pool() -> Result<sqlx::PgPool, sqlx::Error> {
let database_url = textsender_models::envy::environment::get_db_url().value; let database_url = schedtxt_models::envy::environment::get_db_url().value;
println!("Database url: {database_url}"); println!("Database url: {database_url}");
PgPoolOptions::new() PgPoolOptions::new()
+2 -2
View File
@@ -3,10 +3,10 @@ async fn main() {
// initialize tracing // initialize tracing
tracing_subscriber::fmt::init(); tracing_subscriber::fmt::init();
match tokio::net::TcpListener::bind(textsender_api::config::host::get_full()).await { match tokio::net::TcpListener::bind(schedtxt_api::config::host::get_full()).await {
Ok(listener) => { Ok(listener) => {
// build our application with routes // build our application with routes
let app = textsender_api::config::init::app().await; let app = schedtxt_api::config::init::app().await;
axum::serve(listener, app).await.unwrap(); axum::serve(listener, app).await.unwrap();
} }
Err(err) => { Err(err) => {
+8 -8
View File
@@ -2,7 +2,7 @@ use sqlx::Row;
pub async fn insert( pub async fn insert(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
contact: &textsender_models::contact::Contact, contact: &schedtxt_models::contact::Contact,
) -> Result<uuid::Uuid, sqlx::Error> { ) -> Result<uuid::Uuid, sqlx::Error> {
match sqlx::query( match sqlx::query(
r#" r#"
@@ -29,7 +29,7 @@ pub async fn insert(
pub async fn get( pub async fn get(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
id: &uuid::Uuid, id: &uuid::Uuid,
) -> Result<textsender_models::contact::Contact, sqlx::Error> { ) -> Result<schedtxt_models::contact::Contact, sqlx::Error> {
match sqlx::query( match sqlx::query(
r#" r#"
SELECT id, firstname, lastname, nickname, phone_number, user_id FROM "contacts" SELECT id, firstname, lastname, nickname, phone_number, user_id FROM "contacts"
@@ -46,7 +46,7 @@ pub async fn get(
let phone_number: String = row.try_get("phone_number")?; let phone_number: String = row.try_get("phone_number")?;
let user_id: uuid::Uuid = row.try_get("user_id")?; let user_id: uuid::Uuid = row.try_get("user_id")?;
Ok(textsender_models::contact::Contact { Ok(schedtxt_models::contact::Contact {
id: Some(id), id: Some(id),
firstname: match row.try_get("firstname") { firstname: match row.try_get("firstname") {
Ok(val) => val, Ok(val) => val,
@@ -81,7 +81,7 @@ pub async fn get_with_user_id_and_phone(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
user_id: &uuid::Uuid, user_id: &uuid::Uuid,
phone_number: &str, phone_number: &str,
) -> Result<textsender_models::contact::Contact, sqlx::Error> { ) -> Result<schedtxt_models::contact::Contact, sqlx::Error> {
match sqlx::query( match sqlx::query(
r#" r#"
SELECT id, firstname, lastname, nickname, phone_number, user_id FROM "contacts" SELECT id, firstname, lastname, nickname, phone_number, user_id FROM "contacts"
@@ -103,7 +103,7 @@ pub async fn get_with_user_id_and_phone(
let phone_number: String = row.try_get("phone_number")?; let phone_number: String = row.try_get("phone_number")?;
let user_id: uuid::Uuid = row.try_get("user_id")?; let user_id: uuid::Uuid = row.try_get("user_id")?;
println!("Found"); println!("Found");
Ok(textsender_models::contact::Contact { Ok(schedtxt_models::contact::Contact {
id: Some(id), id: Some(id),
firstname: Some(firstname), firstname: Some(firstname),
lastname: Some(lastname), lastname: Some(lastname),
@@ -122,7 +122,7 @@ pub async fn get_with_user_id_and_phone(
pub async fn get_with_user_id( pub async fn get_with_user_id(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
user_id: &uuid::Uuid, user_id: &uuid::Uuid,
) -> Result<Vec<textsender_models::contact::Contact>, sqlx::Error> { ) -> Result<Vec<schedtxt_models::contact::Contact>, sqlx::Error> {
match sqlx::query( match sqlx::query(
r#" r#"
SELECT id, firstname, lastname, nickname, phone_number, user_id FROM "contacts" SELECT id, firstname, lastname, nickname, phone_number, user_id FROM "contacts"
@@ -135,13 +135,13 @@ pub async fn get_with_user_id(
.await .await
{ {
Ok(rows) => { Ok(rows) => {
let mut contacts: Vec<textsender_models::contact::Contact> = Vec::new(); let mut contacts: Vec<schedtxt_models::contact::Contact> = Vec::new();
for row in rows { for row in rows {
let id: uuid::Uuid = row.try_get("id")?; let id: uuid::Uuid = row.try_get("id")?;
let phone_number: String = row.try_get("phone_number")?; let phone_number: String = row.try_get("phone_number")?;
let user_id: uuid::Uuid = row.try_get("user_id")?; let user_id: uuid::Uuid = row.try_get("user_id")?;
let contact = textsender_models::contact::Contact { let contact = schedtxt_models::contact::Contact {
id: Some(id), id: Some(id),
firstname: match row.try_get("firstname") { firstname: match row.try_get("firstname") {
Ok(val) => val, Ok(val) => val,
+6 -6
View File
@@ -2,7 +2,7 @@ use sqlx::Row;
pub async fn insert( pub async fn insert(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
event: &textsender_models::message::event::MessageEventResponse, event: &schedtxt_models::message::event::MessageEventResponse,
) -> Result<uuid::Uuid, sqlx::Error> { ) -> Result<uuid::Uuid, sqlx::Error> {
match sqlx::query( match sqlx::query(
r#" r#"
@@ -31,7 +31,7 @@ pub async fn insert(
pub async fn get( pub async fn get(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
id: &uuid::Uuid, id: &uuid::Uuid,
) -> Result<textsender_models::message::event::MessageEventResponse, sqlx::Error> { ) -> Result<schedtxt_models::message::event::MessageEventResponse, sqlx::Error> {
match sqlx::query( match sqlx::query(
r#" r#"
SELECT id, scheduled_message_event_id, response, user_id, sent, contact_id, message_id, status FROM "message_event_responses" SELECT id, scheduled_message_event_id, response, user_id, sent, contact_id, message_id, status FROM "message_event_responses"
@@ -54,7 +54,7 @@ pub async fn get(
pub async fn get_with_user_id( pub async fn get_with_user_id(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
user_id: &uuid::Uuid, user_id: &uuid::Uuid,
) -> Result<Vec<textsender_models::message::event::MessageEventResponse>, sqlx::Error> { ) -> Result<Vec<schedtxt_models::message::event::MessageEventResponse>, sqlx::Error> {
match sqlx::query( match sqlx::query(
r#" r#"
SELECT id, scheduled_message_event_id, response, user_id, sent, contact_id, message_id, status FROM "message_event_responses" SELECT id, scheduled_message_event_id, response, user_id, sent, contact_id, message_id, status FROM "message_event_responses"
@@ -67,7 +67,7 @@ pub async fn get_with_user_id(
.await .await
{ {
Ok(rows) => { Ok(rows) => {
let mut events: Vec<textsender_models::message::event::MessageEventResponse> = let mut events: Vec<schedtxt_models::message::event::MessageEventResponse> =
Vec::new(); Vec::new();
for row in rows { for row in rows {
match parse_row(&row).await { match parse_row(&row).await {
@@ -88,7 +88,7 @@ pub async fn get_with_user_id(
async fn parse_row( async fn parse_row(
row: &sqlx::postgres::PgRow, row: &sqlx::postgres::PgRow,
) -> Result<textsender_models::message::event::MessageEventResponse, sqlx::Error> { ) -> Result<schedtxt_models::message::event::MessageEventResponse, sqlx::Error> {
println!("Parsing MER"); println!("Parsing MER");
let id: uuid::Uuid = row.try_get("id")?; let id: uuid::Uuid = row.try_get("id")?;
let response: serde_json::Value = row.try_get("response")?; let response: serde_json::Value = row.try_get("response")?;
@@ -101,7 +101,7 @@ async fn parse_row(
.unwrap_or_default(); .unwrap_or_default();
let user_id: uuid::Uuid = row.try_get("user_id")?; let user_id: uuid::Uuid = row.try_get("user_id")?;
Ok(textsender_models::message::event::MessageEventResponse { Ok(schedtxt_models::message::event::MessageEventResponse {
id, id,
response, response,
contact_id, contact_id,
+6 -6
View File
@@ -5,7 +5,7 @@ use sqlx::Row;
pub async fn insert( pub async fn insert(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
message: &textsender_models::message::Message, message: &schedtxt_models::message::Message,
user_id: &uuid::Uuid, user_id: &uuid::Uuid,
) -> Result<uuid::Uuid, sqlx::Error> { ) -> Result<uuid::Uuid, sqlx::Error> {
match sqlx::query( match sqlx::query(
@@ -30,7 +30,7 @@ pub async fn insert(
pub async fn get( pub async fn get(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
id: &uuid::Uuid, id: &uuid::Uuid,
) -> Result<textsender_models::message::Message, sqlx::Error> { ) -> Result<schedtxt_models::message::Message, sqlx::Error> {
match sqlx::query( match sqlx::query(
r#" r#"
SELECT id, content, user_id FROM "messages" SELECT id, content, user_id FROM "messages"
@@ -47,7 +47,7 @@ pub async fn get(
let content: String = row.try_get("content")?; let content: String = row.try_get("content")?;
let user_id: uuid::Uuid = row.try_get("user_id")?; let user_id: uuid::Uuid = row.try_get("user_id")?;
Ok(textsender_models::message::Message { Ok(schedtxt_models::message::Message {
id: Some(id), id: Some(id),
content, content,
user_id: Some(user_id), user_id: Some(user_id),
@@ -60,7 +60,7 @@ pub async fn get(
pub async fn get_with_user_id( pub async fn get_with_user_id(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
user_id: &uuid::Uuid, user_id: &uuid::Uuid,
) -> Result<Vec<textsender_models::message::Message>, sqlx::Error> { ) -> Result<Vec<schedtxt_models::message::Message>, sqlx::Error> {
match sqlx::query( match sqlx::query(
r#" r#"
SELECT id, content, user_id FROM "messages" SELECT id, content, user_id FROM "messages"
@@ -73,13 +73,13 @@ pub async fn get_with_user_id(
.await .await
{ {
Ok(rows) => { Ok(rows) => {
let mut messages: Vec<textsender_models::message::Message> = Vec::new(); let mut messages: Vec<schedtxt_models::message::Message> = Vec::new();
for row in rows { for row in rows {
let id: uuid::Uuid = row.try_get("id")?; let id: uuid::Uuid = row.try_get("id")?;
let content: String = row.try_get("content")?; let content: String = row.try_get("content")?;
let user_id: uuid::Uuid = row.try_get("user_id")?; let user_id: uuid::Uuid = row.try_get("user_id")?;
let message = textsender_models::message::Message { let message = schedtxt_models::message::Message {
id: Some(id), id: Some(id),
content, content,
user_id: Some(user_id), user_id: Some(user_id),
+16 -17
View File
@@ -2,7 +2,7 @@ use sqlx::Row;
pub async fn insert( pub async fn insert(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
scheduled_message: &textsender_models::message::scheduling::ScheduledMessage, scheduled_message: &schedtxt_models::message::scheduling::ScheduledMessage,
user_id: &uuid::Uuid, user_id: &uuid::Uuid,
) -> Result<(uuid::Uuid, time::OffsetDateTime), sqlx::Error> { ) -> Result<(uuid::Uuid, time::OffsetDateTime), sqlx::Error> {
match sqlx::query( match sqlx::query(
@@ -29,7 +29,7 @@ pub async fn insert(
pub async fn get( pub async fn get(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
id: &uuid::Uuid, id: &uuid::Uuid,
) -> Result<textsender_models::message::scheduling::ScheduledMessage, sqlx::Error> { ) -> Result<schedtxt_models::message::scheduling::ScheduledMessage, sqlx::Error> {
match sqlx::query( match sqlx::query(
r#" r#"
SELECT id, scheduled, created, status, user_id FROM "scheduled_messages" SELECT id, scheduled, created, status, user_id FROM "scheduled_messages"
@@ -52,7 +52,7 @@ pub async fn get(
pub async fn get_with_user_id( pub async fn get_with_user_id(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
user_id: &uuid::Uuid, user_id: &uuid::Uuid,
) -> Result<Vec<textsender_models::message::scheduling::ScheduledMessage>, sqlx::Error> { ) -> Result<Vec<schedtxt_models::message::scheduling::ScheduledMessage>, sqlx::Error> {
match sqlx::query( match sqlx::query(
r#" r#"
SELECT id, scheduled, created, status, user_id FROM "scheduled_messages" SELECT id, scheduled, created, status, user_id FROM "scheduled_messages"
@@ -65,7 +65,7 @@ pub async fn get_with_user_id(
.await .await
{ {
Ok(rows) => { Ok(rows) => {
let mut messages: Vec<textsender_models::message::scheduling::ScheduledMessage> = let mut messages: Vec<schedtxt_models::message::scheduling::ScheduledMessage> =
Vec::new(); Vec::new();
for row in rows { for row in rows {
match parse_row(&row).await { match parse_row(&row).await {
@@ -86,7 +86,7 @@ pub async fn get_with_user_id(
pub async fn fetch( pub async fn fetch(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
) -> Result<textsender_models::message::scheduling::ScheduledMessage, sqlx::Error> { ) -> Result<schedtxt_models::message::scheduling::ScheduledMessage, sqlx::Error> {
match sqlx::query( match sqlx::query(
r#" r#"
UPDATE "scheduled_messages" UPDATE "scheduled_messages"
@@ -101,8 +101,8 @@ pub async fn fetch(
RETURNING id, scheduled, created, status, user_id RETURNING id, scheduled, created, status, user_id
"#, "#,
) )
.bind(textsender_models::message::scheduling::PROCESSING) .bind(schedtxt_models::message::scheduling::PROCESSING)
.bind(textsender_models::message::scheduling::READY) .bind(schedtxt_models::message::scheduling::READY)
.fetch_one(pool) .fetch_one(pool)
.await .await
{ {
@@ -136,14 +136,14 @@ pub async fn update_status(
async fn parse_row( async fn parse_row(
row: &sqlx::postgres::PgRow, row: &sqlx::postgres::PgRow,
) -> Result<textsender_models::message::scheduling::ScheduledMessage, sqlx::Error> { ) -> Result<schedtxt_models::message::scheduling::ScheduledMessage, sqlx::Error> {
let id: uuid::Uuid = row.try_get("id")?; let id: uuid::Uuid = row.try_get("id")?;
let scheduled: time::OffsetDateTime = row.try_get("scheduled")?; let scheduled: time::OffsetDateTime = row.try_get("scheduled")?;
let status: String = row.try_get("status")?; let status: String = row.try_get("status")?;
let created: time::OffsetDateTime = row.try_get("created")?; let created: time::OffsetDateTime = row.try_get("created")?;
let user_id: uuid::Uuid = row.try_get("user_id")?; let user_id: uuid::Uuid = row.try_get("user_id")?;
Ok(textsender_models::message::scheduling::ScheduledMessage { Ok(schedtxt_models::message::scheduling::ScheduledMessage {
id, id,
scheduled: Some(scheduled), scheduled: Some(scheduled),
created: Some(created), created: Some(created),
@@ -157,7 +157,7 @@ pub mod sched_msg_event {
pub async fn insert( pub async fn insert(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
scheduled_message_event: &textsender_models::message::scheduling::ScheduledMessageEvent, scheduled_message_event: &schedtxt_models::message::scheduling::ScheduledMessageEvent,
) -> Result<(uuid::Uuid, time::OffsetDateTime), sqlx::Error> { ) -> Result<(uuid::Uuid, time::OffsetDateTime), sqlx::Error> {
match sqlx::query( match sqlx::query(
r#" r#"
@@ -183,7 +183,7 @@ pub mod sched_msg_event {
pub async fn get( pub async fn get(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
id: &uuid::Uuid, id: &uuid::Uuid,
) -> Result<textsender_models::message::scheduling::ScheduledMessageEvent, sqlx::Error> { ) -> Result<schedtxt_models::message::scheduling::ScheduledMessageEvent, sqlx::Error> {
match sqlx::query( match sqlx::query(
r#" r#"
SELECT id, contact_id, message_id, scheduled_message_id, created FROM "scheduled_message_events" SELECT id, contact_id, message_id, scheduled_message_id, created FROM "scheduled_message_events"
@@ -206,8 +206,7 @@ pub mod sched_msg_event {
pub async fn get_with_scheduled_message_id( pub async fn get_with_scheduled_message_id(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
scheduled_message_id: &uuid::Uuid, scheduled_message_id: &uuid::Uuid,
) -> Result<Vec<textsender_models::message::scheduling::ScheduledMessageEvent>, sqlx::Error> ) -> Result<Vec<schedtxt_models::message::scheduling::ScheduledMessageEvent>, sqlx::Error> {
{
match sqlx::query( match sqlx::query(
r#" r#"
SELECT id, contact_id, message_id, scheduled_message_id, created FROM "scheduled_message_events" SELECT id, contact_id, message_id, scheduled_message_id, created FROM "scheduled_message_events"
@@ -220,7 +219,7 @@ pub mod sched_msg_event {
.await .await
{ {
Ok(rows) => { Ok(rows) => {
let mut scheduled_message_events: Vec<textsender_models::message::scheduling::ScheduledMessageEvent> = let mut scheduled_message_events: Vec<schedtxt_models::message::scheduling::ScheduledMessageEvent> =
Vec::new(); Vec::new();
for row in rows { for row in rows {
match parse_row(&row).await { match parse_row(&row).await {
@@ -241,7 +240,7 @@ pub mod sched_msg_event {
pub async fn delete( pub async fn delete(
pool: &sqlx::PgPool, pool: &sqlx::PgPool,
scheduled_message_event: &textsender_models::message::scheduling::ScheduledMessageEvent, scheduled_message_event: &schedtxt_models::message::scheduling::ScheduledMessageEvent,
) -> Result<(), sqlx::Error> { ) -> Result<(), sqlx::Error> {
match sqlx::query( match sqlx::query(
r#" r#"
@@ -260,7 +259,7 @@ pub mod sched_msg_event {
async fn parse_row( async fn parse_row(
row: &sqlx::postgres::PgRow, row: &sqlx::postgres::PgRow,
) -> Result<textsender_models::message::scheduling::ScheduledMessageEvent, sqlx::Error> { ) -> Result<schedtxt_models::message::scheduling::ScheduledMessageEvent, sqlx::Error> {
let id: uuid::Uuid = row.try_get("id")?; let id: uuid::Uuid = row.try_get("id")?;
let contact_id: uuid::Uuid = row.try_get("contact_id")?; let contact_id: uuid::Uuid = row.try_get("contact_id")?;
let message_id: uuid::Uuid = row.try_get("message_id")?; let message_id: uuid::Uuid = row.try_get("message_id")?;
@@ -268,7 +267,7 @@ pub mod sched_msg_event {
let created: time::OffsetDateTime = row.try_get("created")?; let created: time::OffsetDateTime = row.try_get("created")?;
Ok( Ok(
textsender_models::message::scheduling::ScheduledMessageEvent { schedtxt_models::message::scheduling::ScheduledMessageEvent {
id, id,
contact_id, contact_id,
message_id, message_id,
+85 -93
View File
@@ -1,4 +1,4 @@
use textsender_api::db; use schedtxt_api::db;
mod db_mgr { mod db_mgr {
use std::str::FromStr; use std::str::FromStr;
@@ -6,7 +6,7 @@ mod db_mgr {
pub const LIMIT: usize = 6; pub const LIMIT: usize = 6;
pub async fn get_pool() -> Result<sqlx::PgPool, sqlx::Error> { pub async fn get_pool() -> Result<sqlx::PgPool, sqlx::Error> {
let tm_db_url = textsender_models::envy::environment::get_db_url().value; let tm_db_url = schedtxt_models::envy::environment::get_db_url().value;
let tm_options = sqlx::postgres::PgConnectOptions::from_str(&tm_db_url).unwrap(); let tm_options = sqlx::postgres::PgConnectOptions::from_str(&tm_db_url).unwrap();
sqlx::PgPool::connect_with(tm_options).await sqlx::PgPool::connect_with(tm_options).await
} }
@@ -18,7 +18,7 @@ mod db_mgr {
} }
pub async fn connect_to_db(db_name: &str) -> Result<sqlx::PgPool, sqlx::Error> { pub async fn connect_to_db(db_name: &str) -> Result<sqlx::PgPool, sqlx::Error> {
let db_url = textsender_models::envy::environment::get_db_url().value; let db_url = schedtxt_models::envy::environment::get_db_url().value;
let options = sqlx::postgres::PgConnectOptions::from_str(&db_url)?.database(db_name); let options = sqlx::postgres::PgConnectOptions::from_str(&db_url)?.database(db_name);
sqlx::PgPool::connect_with(options).await sqlx::PgPool::connect_with(options).await
} }
@@ -77,7 +77,7 @@ mod db_mgr {
} }
pub async fn get_database_name() -> Result<String, Box<dyn std::error::Error>> { pub async fn get_database_name() -> Result<String, Box<dyn std::error::Error>> {
let database_url = textsender_models::envy::environment::get_db_url().value; let database_url = schedtxt_models::envy::environment::get_db_url().value;
let parsed_url = url::Url::parse(&database_url)?; let parsed_url = url::Url::parse(&database_url)?;
if parsed_url.scheme() == "postgres" || parsed_url.scheme() == "postgresql" { if parsed_url.scheme() == "postgres" || parsed_url.scheme() == "postgresql" {
@@ -101,7 +101,7 @@ mod db_mgr {
mod init { mod init {
pub async fn app(pool: sqlx::PgPool) -> axum::Router { pub async fn app(pool: sqlx::PgPool) -> axum::Router {
textsender_api::config::init::routes() schedtxt_api::config::init::routes()
.await .await
.layer(axum::Extension(pool)) .layer(axum::Extension(pool))
.layer(axum::extract::DefaultBodyLimit::max(1024 * 1024 * 1024)) .layer(axum::extract::DefaultBodyLimit::max(1024 * 1024 * 1024))
@@ -136,8 +136,8 @@ mod util {
pub fn token_fields() -> (String, String, String) { pub fn token_fields() -> (String, String, String) {
( (
String::from("What a twist!"), String::from("What a twist!"),
String::from("textsender_test"), String::from("schedtxt_test"),
String::from("textsender"), String::from("schedtxt"),
) )
} }
@@ -185,17 +185,17 @@ pub fn test_mer_response() -> serde_json::Value {
} }
pub async fn test_token() -> Result<String, josekit::JoseError> { pub async fn test_token() -> Result<String, josekit::JoseError> {
let key: String = textsender_models::envy::environment::get_secret_main_key().value; let key: String = schedtxt_models::envy::environment::get_secret_main_key().value;
let (message, issuer, audience) = token_fields(); let (message, issuer, audience) = token_fields();
let token_resource = textsender_models::token::TokenResource { let token_resource = schedtxt_models::token::TokenResource {
message: message, message: message,
issuer: issuer, issuer: issuer,
audiences: vec![audience], audiences: vec![audience],
user_id: TEST_USER_ID, user_id: TEST_USER_ID,
}; };
match textsender_models::token::create_token(&key, token_resource, time::Duration::hours(1)) { match schedtxt_models::token::create_token(&key, token_resource, time::Duration::hours(1)) {
Ok(access_token) => Ok(access_token.access_token), Ok(access_token) => Ok(access_token.access_token),
Err(err) => Err(err), Err(err) => Err(err),
} }
@@ -239,7 +239,7 @@ mod request {
match run_post( match run_post(
Some(&payload), Some(&payload),
textsender_api::caller::endpoints::ADD_CONTACT, schedtxt_api::caller::endpoints::ADD_CONTACT,
axum::http::Method::POST, axum::http::Method::POST,
true, true,
) )
@@ -257,11 +257,7 @@ mod request {
app: &axum::Router, app: &axum::Router,
id: &uuid::Uuid, id: &uuid::Uuid,
) -> Result<axum::response::Response, axum::http::Error> { ) -> Result<axum::response::Response, axum::http::Error> {
let uri = format!( let uri = format!("{}?id={}", schedtxt_api::caller::endpoints::GET_CONTACT, id);
"{}?id={}",
textsender_api::caller::endpoints::GET_CONTACT,
id
);
match run_post(None, &uri, axum::http::Method::GET, false).await { match run_post(None, &uri, axum::http::Method::GET, false).await {
Ok(req) => match app.clone().oneshot(req).await { Ok(req) => match app.clone().oneshot(req).await {
@@ -289,7 +285,7 @@ mod request {
match run_post( match run_post(
Some(&payload), Some(&payload),
textsender_api::caller::endpoints::UPDATE_CONTACT_NAME, schedtxt_api::caller::endpoints::UPDATE_CONTACT_NAME,
axum::http::Method::PATCH, axum::http::Method::PATCH,
true, true,
) )
@@ -316,7 +312,7 @@ mod request {
match super::run_post( match super::run_post(
Some(&payload), Some(&payload),
textsender_api::caller::endpoints::ADD_MESSAGE, schedtxt_api::caller::endpoints::ADD_MESSAGE,
axum::http::Method::POST, axum::http::Method::POST,
true, true,
) )
@@ -334,11 +330,7 @@ mod request {
app: &axum::Router, app: &axum::Router,
id: &uuid::Uuid, id: &uuid::Uuid,
) -> Result<axum::response::Response, axum::http::Error> { ) -> Result<axum::response::Response, axum::http::Error> {
let uri = format!( let uri = format!("{}?id={}", schedtxt_api::caller::endpoints::GET_MESSAGE, id);
"{}?id={}",
textsender_api::caller::endpoints::GET_MESSAGE,
id
);
match super::run_post(None, &uri, axum::http::Method::GET, false).await { match super::run_post(None, &uri, axum::http::Method::GET, false).await {
Ok(req) => match app.clone().oneshot(req).await { Ok(req) => match app.clone().oneshot(req).await {
@@ -372,14 +364,14 @@ mod request {
"response": super::super::super::test_mer_response(), "response": super::super::super::test_mer_response(),
"user_id": user_id, "user_id": user_id,
"sent": sent, "sent": sent,
"status": textsender_models::message::event::MESSAGE_EVENT_RESPONSE_STATUS_SCHEDULED, "status": schedtxt_models::message::event::MESSAGE_EVENT_RESPONSE_STATUS_SCHEDULED,
"contact_id": contact_id, "contact_id": contact_id,
"message_id": message_id "message_id": message_id
}); });
match super::super::run_post( match super::super::run_post(
Some(&payload), Some(&payload),
textsender_api::caller::endpoints::RECORD_MESSAGE_EVENT_RESPONSE, schedtxt_api::caller::endpoints::RECORD_MESSAGE_EVENT_RESPONSE,
axum::http::Method::POST, axum::http::Method::POST,
true, true,
) )
@@ -399,7 +391,7 @@ mod request {
) -> Result<axum::response::Response, axum::http::Error> { ) -> Result<axum::response::Response, axum::http::Error> {
let uri = format!( let uri = format!(
"{}?id={}", "{}?id={}",
textsender_api::caller::endpoints::GET_MESSAGE_EVENT_RESPONSE, schedtxt_api::caller::endpoints::GET_MESSAGE_EVENT_RESPONSE,
id id
); );
@@ -430,13 +422,13 @@ mod request {
let payload = serde_json::json!({ let payload = serde_json::json!({
"scheduled": scheduled, "scheduled": scheduled,
"status": textsender_models::message::scheduling::PENDING, "status": schedtxt_models::message::scheduling::PENDING,
"user_id": super::super::super::TEST_USER_ID, "user_id": super::super::super::TEST_USER_ID,
}); });
match super::super::run_post( match super::super::run_post(
Some(&payload), Some(&payload),
textsender_api::caller::endpoints::SCHEDULE_MESSAGE, schedtxt_api::caller::endpoints::SCHEDULE_MESSAGE,
axum::http::Method::POST, axum::http::Method::POST,
true, true,
) )
@@ -456,7 +448,7 @@ mod request {
) -> Result<axum::response::Response, axum::http::Error> { ) -> Result<axum::response::Response, axum::http::Error> {
let uri = format!( let uri = format!(
"{}?id={}", "{}?id={}",
textsender_api::caller::endpoints::GET_SCHEDULE_MESSAGE, schedtxt_api::caller::endpoints::GET_SCHEDULE_MESSAGE,
id id
); );
@@ -474,7 +466,7 @@ mod request {
) -> Result<axum::response::Response, axum::http::Error> { ) -> Result<axum::response::Response, axum::http::Error> {
match super::super::run_post( match super::super::run_post(
None, None,
textsender_api::caller::endpoints::FETCH_SCHEDULED_MESSAGE, schedtxt_api::caller::endpoints::FETCH_SCHEDULED_MESSAGE,
axum::http::Method::GET, axum::http::Method::GET,
false, false,
) )
@@ -493,7 +485,7 @@ mod request {
id: &uuid::Uuid, id: &uuid::Uuid,
updated_status: &str, updated_status: &str,
) -> Result<axum::response::Response, axum::http::Error> { ) -> Result<axum::response::Response, axum::http::Error> {
let uri = textsender_api::caller::endpoints::UPDATE_SCHEDULED_MESSAGE_STATUS; let uri = schedtxt_api::caller::endpoints::UPDATE_SCHEDULED_MESSAGE_STATUS;
let payload = serde_json::json!({ let payload = serde_json::json!({
"scheduled_message_id": id, "scheduled_message_id": id,
"status": updated_status "status": updated_status
@@ -526,7 +518,7 @@ mod request {
match super::super::run_post( match super::super::run_post(
Some(&payload), Some(&payload),
textsender_api::caller::endpoints::CREATE_SCHEDULED_MESSAGE_EVENT, schedtxt_api::caller::endpoints::CREATE_SCHEDULED_MESSAGE_EVENT,
axum::http::Method::POST, axum::http::Method::POST,
true, true,
) )
@@ -546,7 +538,7 @@ mod request {
) -> Result<axum::response::Response, axum::http::Error> { ) -> Result<axum::response::Response, axum::http::Error> {
let uri = format!( let uri = format!(
"{}?scheduled_message_id={}", "{}?scheduled_message_id={}",
textsender_api::caller::endpoints::GET_SCHEDULED_MESSAGE_EVENT, schedtxt_api::caller::endpoints::GET_SCHEDULED_MESSAGE_EVENT,
scheduled_message_id scheduled_message_id
); );
@@ -564,7 +556,7 @@ mod request {
scheduled_message_event_id: &uuid::Uuid, scheduled_message_event_id: &uuid::Uuid,
) -> Result<axum::response::Response, axum::http::Error> { ) -> Result<axum::response::Response, axum::http::Error> {
let uri = super::super::super::util::format_url_with_value( let uri = super::super::super::util::format_url_with_value(
textsender_api::caller::endpoints::DELETE_SCHEDULED_MESSAGE_EVENT, schedtxt_api::caller::endpoints::DELETE_SCHEDULED_MESSAGE_EVENT,
scheduled_message_event_id, scheduled_message_event_id,
) )
.await; .await;
@@ -624,7 +616,7 @@ async fn test_create_contact() {
match request::create_contact(&app).await { match request::create_contact(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::contact::response::AddContactResponse, schedtxt_api::caller::contact::response::AddContactResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -646,7 +638,7 @@ async fn test_get_contact() {
match request::create_contact(&app).await { match request::create_contact(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::contact::response::AddContactResponse, schedtxt_api::caller::contact::response::AddContactResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -656,7 +648,7 @@ async fn test_get_contact() {
match request::get_contact(&app, &id).await { match request::get_contact(&app, &id).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::contact::response::GetContactResponse, schedtxt_api::caller::contact::response::GetContactResponse,
>(response) >(response)
.await; .await;
assert_eq!( assert_eq!(
@@ -683,13 +675,13 @@ async fn test_update_contact_names() {
let (tm_pool, db_name, pool) = db_mgr::get_database_ready().await; let (tm_pool, db_name, pool) = db_mgr::get_database_ready().await;
let app = init::app(pool).await; let app = init::app(pool).await;
let mut opt_contact: Option<textsender_models::contact::Contact> = None; let mut opt_contact: Option<schedtxt_models::contact::Contact> = None;
// Send request // Send request
match request::create_contact(&app).await { match request::create_contact(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::contact::response::AddContactResponse, schedtxt_api::caller::contact::response::AddContactResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -699,7 +691,7 @@ async fn test_update_contact_names() {
match request::get_contact(&app, &id).await { match request::get_contact(&app, &id).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::contact::response::GetContactResponse, schedtxt_api::caller::contact::response::GetContactResponse,
>(response) >(response)
.await; .await;
assert_eq!( assert_eq!(
@@ -737,7 +729,7 @@ async fn test_update_contact_names() {
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::contact::response::UpdateContactNamesResponse, schedtxt_api::caller::contact::response::UpdateContactNamesResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Error updating Contact names"); assert_eq!(false, resp.data.is_empty(), "Error updating Contact names");
@@ -764,7 +756,7 @@ async fn test_create_message() {
match request::message::create_message(&app).await { match request::message::create_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::response::AddMessageResponse, schedtxt_api::caller::message::response::AddMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -786,13 +778,13 @@ async fn test_create_message() {
async fn test_get_message() { async fn test_get_message() {
let (tm_pool, db_name, pool) = db_mgr::get_database_ready().await; let (tm_pool, db_name, pool) = db_mgr::get_database_ready().await;
let app = init::app(pool).await; let app = init::app(pool).await;
let mut message_result: Option<textsender_models::message::Message> = None; let mut message_result: Option<schedtxt_models::message::Message> = None;
// Send request // Send request
match request::message::create_message(&app).await { match request::message::create_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::response::AddMessageResponse, schedtxt_api::caller::message::response::AddMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -815,7 +807,7 @@ async fn test_get_message() {
match request::message::get_message(&app, &message_id).await { match request::message::get_message(&app, &message_id).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::response::GetMessageResponse, schedtxt_api::caller::message::response::GetMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -836,7 +828,7 @@ async fn test_schedule_message() {
match request::message::scheduling::create_scheduled_message(&app).await { match request::message::scheduling::create_scheduled_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::ScheduleMessageResponse, schedtxt_api::caller::message::scheduling::response::ScheduleMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -859,7 +851,7 @@ async fn test_get_scheduled_message() {
match request::message::scheduling::create_scheduled_message(&app).await { match request::message::scheduling::create_scheduled_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::ScheduleMessageResponse, schedtxt_api::caller::message::scheduling::response::ScheduleMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -875,7 +867,7 @@ async fn test_get_scheduled_message() {
match request::message::scheduling::get_scheduled_messages(&app, &parsed_id).await { match request::message::scheduling::get_scheduled_messages(&app, &parsed_id).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::GetScheduledMessageResponse, schedtxt_api::caller::message::scheduling::response::GetScheduledMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -903,7 +895,7 @@ async fn test_create_scheduled_message_event() {
match request::create_contact(&app).await { match request::create_contact(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::contact::response::AddContactResponse, schedtxt_api::caller::contact::response::AddContactResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -917,7 +909,7 @@ async fn test_create_scheduled_message_event() {
match request::message::create_message(&app).await { match request::message::create_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::response::AddMessageResponse, schedtxt_api::caller::message::response::AddMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -932,7 +924,7 @@ async fn test_create_scheduled_message_event() {
match request::message::scheduling::create_scheduled_message(&app).await { match request::message::scheduling::create_scheduled_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::ScheduleMessageResponse, schedtxt_api::caller::message::scheduling::response::ScheduleMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -953,7 +945,7 @@ async fn test_create_scheduled_message_event() {
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::CreateScheduleMessageEventResponse, schedtxt_api::caller::message::scheduling::response::CreateScheduleMessageEventResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -978,7 +970,7 @@ async fn test_get_scheduled_message_event() {
match request::create_contact(&app).await { match request::create_contact(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::contact::response::AddContactResponse, schedtxt_api::caller::contact::response::AddContactResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -992,7 +984,7 @@ async fn test_get_scheduled_message_event() {
match request::message::create_message(&app).await { match request::message::create_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::response::AddMessageResponse, schedtxt_api::caller::message::response::AddMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1007,7 +999,7 @@ async fn test_get_scheduled_message_event() {
match request::message::scheduling::create_scheduled_message(&app).await { match request::message::scheduling::create_scheduled_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::ScheduleMessageResponse, schedtxt_api::caller::message::scheduling::response::ScheduleMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1028,7 +1020,7 @@ async fn test_get_scheduled_message_event() {
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::CreateScheduleMessageEventResponse, schedtxt_api::caller::message::scheduling::response::CreateScheduleMessageEventResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1043,7 +1035,7 @@ async fn test_get_scheduled_message_event() {
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::GetScheduledMessageEventResponse, schedtxt_api::caller::message::scheduling::response::GetScheduledMessageEventResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1068,7 +1060,7 @@ async fn test_delete_scheduled_message_event() {
match request::create_contact(&app).await { match request::create_contact(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::contact::response::AddContactResponse, schedtxt_api::caller::contact::response::AddContactResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1082,7 +1074,7 @@ async fn test_delete_scheduled_message_event() {
match request::message::create_message(&app).await { match request::message::create_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::response::AddMessageResponse, schedtxt_api::caller::message::response::AddMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1097,7 +1089,7 @@ async fn test_delete_scheduled_message_event() {
match request::message::scheduling::create_scheduled_message(&app).await { match request::message::scheduling::create_scheduled_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::ScheduleMessageResponse, schedtxt_api::caller::message::scheduling::response::ScheduleMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1118,7 +1110,7 @@ async fn test_delete_scheduled_message_event() {
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::CreateScheduleMessageEventResponse, schedtxt_api::caller::message::scheduling::response::CreateScheduleMessageEventResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1133,7 +1125,7 @@ async fn test_delete_scheduled_message_event() {
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::GetScheduledMessageEventResponse, schedtxt_api::caller::message::scheduling::response::GetScheduledMessageEventResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1146,7 +1138,7 @@ async fn test_delete_scheduled_message_event() {
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::DeleteScheduledMessageEventResponse, schedtxt_api::caller::message::scheduling::response::DeleteScheduledMessageEventResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1176,7 +1168,7 @@ async fn test_update_scheduled_message_status() {
match request::create_contact(&app).await { match request::create_contact(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::contact::response::AddContactResponse, schedtxt_api::caller::contact::response::AddContactResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1190,7 +1182,7 @@ async fn test_update_scheduled_message_status() {
match request::message::create_message(&app).await { match request::message::create_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::response::AddMessageResponse, schedtxt_api::caller::message::response::AddMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1205,7 +1197,7 @@ async fn test_update_scheduled_message_status() {
match request::message::scheduling::create_scheduled_message(&app).await { match request::message::scheduling::create_scheduled_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::ScheduleMessageResponse, schedtxt_api::caller::message::scheduling::response::ScheduleMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1226,7 +1218,7 @@ async fn test_update_scheduled_message_status() {
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::CreateScheduleMessageEventResponse, schedtxt_api::caller::message::scheduling::response::CreateScheduleMessageEventResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1239,13 +1231,13 @@ async fn test_update_scheduled_message_status() {
match request::message::scheduling::update_scheduled_message_status( match request::message::scheduling::update_scheduled_message_status(
&app, &app,
&scheduled_message_id, &scheduled_message_id,
textsender_models::message::scheduling::READY, schedtxt_models::message::scheduling::READY,
) )
.await .await
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::UpdateScheduledMessageStatusResponse, schedtxt_api::caller::message::scheduling::response::UpdateScheduledMessageStatusResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1270,7 +1262,7 @@ async fn test_fetch_scheduled_message() {
match request::create_contact(&app).await { match request::create_contact(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::contact::response::AddContactResponse, schedtxt_api::caller::contact::response::AddContactResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1284,7 +1276,7 @@ async fn test_fetch_scheduled_message() {
match request::message::create_message(&app).await { match request::message::create_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::response::AddMessageResponse, schedtxt_api::caller::message::response::AddMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1299,7 +1291,7 @@ async fn test_fetch_scheduled_message() {
match request::message::scheduling::create_scheduled_message(&app).await { match request::message::scheduling::create_scheduled_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::ScheduleMessageResponse, schedtxt_api::caller::message::scheduling::response::ScheduleMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1320,7 +1312,7 @@ async fn test_fetch_scheduled_message() {
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::CreateScheduleMessageEventResponse, schedtxt_api::caller::message::scheduling::response::CreateScheduleMessageEventResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1333,13 +1325,13 @@ async fn test_fetch_scheduled_message() {
match request::message::scheduling::update_scheduled_message_status( match request::message::scheduling::update_scheduled_message_status(
&app, &app,
&scheduled_message_id, &scheduled_message_id,
textsender_models::message::scheduling::READY, schedtxt_models::message::scheduling::READY,
) )
.await .await
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::UpdateScheduledMessageStatusResponse, schedtxt_api::caller::message::scheduling::response::UpdateScheduledMessageStatusResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1352,7 +1344,7 @@ async fn test_fetch_scheduled_message() {
match request::message::scheduling::fetch_scheduled_message(&app).await { match request::message::scheduling::fetch_scheduled_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::FetchScheduledMessageResponse, schedtxt_api::caller::message::scheduling::response::FetchScheduledMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1378,7 +1370,7 @@ async fn test_record_message_event_response() {
match request::create_contact(&app).await { match request::create_contact(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::contact::response::AddContactResponse, schedtxt_api::caller::contact::response::AddContactResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1392,7 +1384,7 @@ async fn test_record_message_event_response() {
match request::message::create_message(&app).await { match request::message::create_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::response::AddMessageResponse, schedtxt_api::caller::message::response::AddMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1407,7 +1399,7 @@ async fn test_record_message_event_response() {
match request::message::scheduling::create_scheduled_message(&app).await { match request::message::scheduling::create_scheduled_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::ScheduleMessageResponse, schedtxt_api::caller::message::scheduling::response::ScheduleMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1428,7 +1420,7 @@ async fn test_record_message_event_response() {
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::CreateScheduleMessageEventResponse, schedtxt_api::caller::message::scheduling::response::CreateScheduleMessageEventResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1443,13 +1435,13 @@ async fn test_record_message_event_response() {
match request::message::scheduling::update_scheduled_message_status( match request::message::scheduling::update_scheduled_message_status(
&app, &app,
&scheduled_message_id, &scheduled_message_id,
textsender_models::message::scheduling::READY, schedtxt_models::message::scheduling::READY,
) )
.await .await
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::UpdateScheduledMessageStatusResponse, schedtxt_api::caller::message::scheduling::response::UpdateScheduledMessageStatusResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1462,7 +1454,7 @@ async fn test_record_message_event_response() {
match request::message::scheduling::fetch_scheduled_message(&app).await { match request::message::scheduling::fetch_scheduled_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::FetchScheduledMessageResponse, schedtxt_api::caller::message::scheduling::response::FetchScheduledMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1489,7 +1481,7 @@ async fn test_record_message_event_response() {
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::event::response::RecordMessageEventResponse, schedtxt_api::caller::message::event::response::RecordMessageEventResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1515,7 +1507,7 @@ async fn test_get_message_event_response() {
match request::create_contact(&app).await { match request::create_contact(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::contact::response::AddContactResponse, schedtxt_api::caller::contact::response::AddContactResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1529,7 +1521,7 @@ async fn test_get_message_event_response() {
match request::message::create_message(&app).await { match request::message::create_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::response::AddMessageResponse, schedtxt_api::caller::message::response::AddMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1544,7 +1536,7 @@ async fn test_get_message_event_response() {
match request::message::scheduling::create_scheduled_message(&app).await { match request::message::scheduling::create_scheduled_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::ScheduleMessageResponse, schedtxt_api::caller::message::scheduling::response::ScheduleMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1565,7 +1557,7 @@ async fn test_get_message_event_response() {
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::CreateScheduleMessageEventResponse, schedtxt_api::caller::message::scheduling::response::CreateScheduleMessageEventResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1580,13 +1572,13 @@ async fn test_get_message_event_response() {
match request::message::scheduling::update_scheduled_message_status( match request::message::scheduling::update_scheduled_message_status(
&app, &app,
&scheduled_message_id, &scheduled_message_id,
textsender_models::message::scheduling::READY, schedtxt_models::message::scheduling::READY,
) )
.await .await
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::UpdateScheduledMessageStatusResponse, schedtxt_api::caller::message::scheduling::response::UpdateScheduledMessageStatusResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1599,7 +1591,7 @@ async fn test_get_message_event_response() {
match request::message::scheduling::fetch_scheduled_message(&app).await { match request::message::scheduling::fetch_scheduled_message(&app).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::scheduling::response::FetchScheduledMessageResponse, schedtxt_api::caller::message::scheduling::response::FetchScheduledMessageResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1626,7 +1618,7 @@ async fn test_get_message_event_response() {
{ {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::event::response::RecordMessageEventResponse, schedtxt_api::caller::message::event::response::RecordMessageEventResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");
@@ -1634,7 +1626,7 @@ async fn test_get_message_event_response() {
match request::message::event::get_message_event_response(&app, &mer.id).await { match request::message::event::get_message_event_response(&app, &mer.id).await {
Ok(response) => { Ok(response) => {
let resp = util::get_resp_data::< let resp = util::get_resp_data::<
textsender_api::caller::message::event::response::GetMERResponse, schedtxt_api::caller::message::event::response::GetMERResponse,
>(response) >(response)
.await; .await;
assert_eq!(false, resp.data.is_empty(), "Should not be empty"); assert_eq!(false, resp.data.is_empty(), "Should not be empty");