Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
270c4e5675 | ||
|
|
89b347b3f6 | ||
|
|
57709ab87d | ||
|
|
79f9fc3972 | ||
|
|
23f9a1430a | ||
|
|
ba485261da | ||
|
|
71da521a53 |
+4
-3
@@ -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,4 +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"
|
ALLOWED_ORIGINS="http://schedtxt.com,http://localhost:5173,http://localhost:9080,http://localhost:9081"
|
||||||
|
APP_ENV=production
|
||||||
|
|||||||
+4
-3
@@ -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,4 +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"
|
ALLOWED_ORIGINS="http://schedtxt.com,http://localhost:5173,http://localhost:9080,http://localhost:9081"
|
||||||
|
APP_ENV=production
|
||||||
|
|||||||
+20
-16
@@ -1,28 +1,32 @@
|
|||||||
name: textsender_api PR
|
name: schedtxt_api PR
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
name: Check
|
name: Check
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- 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
|
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
|
||||||
|
|
||||||
@@ -30,38 +34,38 @@ jobs:
|
|||||||
name: Rustfmt
|
name: Rustfmt
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- 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
|
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:
|
||||||
name: Clippy
|
name: Clippy
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- 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
|
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
|
||||||
|
|||||||
+11
-11
@@ -1,4 +1,4 @@
|
|||||||
name: Rust Build
|
name: schedtxt_api Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -32,10 +32,10 @@ jobs:
|
|||||||
--health-retries 5
|
--health-retries 5
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- 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
|
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
|
||||||
|
|
||||||
@@ -74,18 +74,18 @@ jobs:
|
|||||||
name: Rustfmt
|
name: Rustfmt
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- 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
|
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
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Rust Build
|
name: schedtxt_api Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -15,19 +15,19 @@ jobs:
|
|||||||
name: Check
|
name: Check
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- 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
|
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
|
||||||
|
|
||||||
@@ -52,10 +52,10 @@ jobs:
|
|||||||
--health-retries 5
|
--health-retries 5
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- 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
|
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
|
||||||
|
|
||||||
@@ -94,57 +94,57 @@ jobs:
|
|||||||
name: Rustfmt
|
name: Rustfmt
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- 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
|
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:
|
||||||
name: Clippy
|
name: Clippy
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- 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
|
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:
|
||||||
name: build
|
name: build
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- 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
|
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
+204
-716
File diff suppressed because it is too large
Load Diff
+12
-13
@@ -1,8 +1,10 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "textsender_api"
|
name = "schedtxt_api"
|
||||||
version = "0.2.0"
|
version = "0.2.4"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.96"
|
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"] }
|
||||||
@@ -10,21 +12,18 @@ axum-extra = { version = "0.12.6", features = ["cookie"] }
|
|||||||
serde = { version = "1.0.228", features = ["derive"] }
|
serde = { version = "1.0.228", features = ["derive"] }
|
||||||
serde_json = { version = "1.0.150" }
|
serde_json = { version = "1.0.150" }
|
||||||
tokio = { version = "1.52.3", features = ["full"] }
|
tokio = { version = "1.52.3", features = ["full"] }
|
||||||
tokio-util = { version = "0.7.18", features = ["io"] }
|
tower-http = { version = "0.7.0", features = ["cors", "timeout"] }
|
||||||
tower = { version = "0.5.3", features = ["full"] }
|
|
||||||
tower-http = { version = "0.6.11", features = ["cors", "timeout"] }
|
|
||||||
tracing-subscriber = "0.3.23"
|
tracing-subscriber = "0.3.23"
|
||||||
futures = { version = "0.3.32" }
|
uuid = { version = "1.23.5", features = ["v4", "serde"] }
|
||||||
uuid = { version = "1.23.3", 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.49", 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"] }
|
||||||
josekit = { version = "0.10.3" }
|
|
||||||
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.4.10" }
|
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.4.2.0" }
|
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"] }
|
||||||
|
josekit = { version = "0.10.3" }
|
||||||
url = { version = "2.5.8" }
|
url = { version = "2.5.8" }
|
||||||
tempfile = { version = "3.27.0" }
|
|
||||||
|
|||||||
+4
-24
@@ -1,50 +1,36 @@
|
|||||||
# Stage 1: Build the application
|
FROM rust:1.97 as builder
|
||||||
FROM rust:1.96 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
@@ -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.
|
||||||
@@ -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
@@ -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
-5
@@ -36,13 +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()
|
let secret_key = schedtxt_models::envy::environment::get_secret_main_key().value;
|
||||||
.await
|
|
||||||
.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
@@ -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,
|
||||||
|
|||||||
+27
-22
@@ -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,39 +81,44 @@ 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 =
|
let t_config = match schedtxt_models::config::auxiliary::load_config() {
|
||||||
match textsender_models::config::auxiliary::load_config().await {
|
Ok(config) => config,
|
||||||
Ok(config) => config,
|
Err(err) => {
|
||||||
Err(err) => {
|
eprintln!("Error: {err:?}");
|
||||||
eprintln!("Error: {err:?}");
|
response.message = String::from("Error getting config");
|
||||||
response.message = String::from("Error getting config");
|
return (
|
||||||
return (
|
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
axum::Json(response),
|
||||||
axum::Json(response),
|
);
|
||||||
);
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
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,
|
||||||
schedule_at: None,
|
schedule_at: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let mut sendmsg = swoosh::SendMsg::default();
|
||||||
|
sendmsg.load_config(
|
||||||
|
&t_config.auth_token,
|
||||||
|
&t_config.phone_number,
|
||||||
|
&t_config.service_sid,
|
||||||
|
&t_config.account_sid,
|
||||||
|
);
|
||||||
|
|
||||||
for contact in &contacts {
|
for contact in &contacts {
|
||||||
match swoosh::twilio::api::send_message(
|
sendmsg.load_message(&message.content);
|
||||||
&message, contact, &pp, &t_config,
|
sendmsg.load_recipient(&contact.phone_number);
|
||||||
)
|
match sendmsg.send_message(&pp).await {
|
||||||
.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,
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
+5
-4
@@ -33,6 +33,7 @@ pub mod init {
|
|||||||
let cors = tower_http::cors::CorsLayer::new()
|
let cors = tower_http::cors::CorsLayer::new()
|
||||||
.allow_methods([
|
.allow_methods([
|
||||||
axum::http::Method::GET,
|
axum::http::Method::GET,
|
||||||
|
axum::http::Method::PATCH,
|
||||||
axum::http::Method::POST,
|
axum::http::Method::POST,
|
||||||
axum::http::Method::PUT,
|
axum::http::Method::PUT,
|
||||||
axum::http::Method::DELETE,
|
axum::http::Method::DELETE,
|
||||||
@@ -45,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().await;
|
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()
|
||||||
@@ -92,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
-3
@@ -5,9 +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()
|
let database_url = schedtxt_models::envy::environment::get_db_url().value;
|
||||||
.await
|
|
||||||
.value;
|
|
||||||
println!("Database url: {database_url}");
|
println!("Database url: {database_url}");
|
||||||
|
|
||||||
PgPoolOptions::new()
|
PgPoolOptions::new()
|
||||||
|
|||||||
+2
-2
@@ -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
@@ -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,
|
||||||
|
|||||||
@@ -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")?;
|
||||||
@@ -96,17 +96,19 @@ async fn parse_row(
|
|||||||
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")?;
|
||||||
let sent: time::OffsetDateTime = row.try_get("sent")?;
|
let sent: time::OffsetDateTime = row.try_get("sent")?;
|
||||||
let scheduled_message_event_id: uuid::Uuid = row.try_get("scheduled_message_event_id")?;
|
let scheduled_message_event_id: Option<uuid::Uuid> = row
|
||||||
|
.try_get("scheduled_message_event_id")
|
||||||
|
.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,
|
||||||
message_id,
|
message_id,
|
||||||
status,
|
status,
|
||||||
sent: Some(sent),
|
sent: Some(sent),
|
||||||
scheduled_message_event_id: Some(scheduled_message_event_id),
|
scheduled_message_event_id,
|
||||||
user_id,
|
user_id,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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),
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
+86
-102
@@ -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,9 +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()
|
let tm_db_url = schedtxt_models::envy::environment::get_db_url().value;
|
||||||
.await
|
|
||||||
.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
|
||||||
}
|
}
|
||||||
@@ -20,9 +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()
|
let db_url = schedtxt_models::envy::environment::get_db_url().value;
|
||||||
.await
|
|
||||||
.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
|
||||||
}
|
}
|
||||||
@@ -81,9 +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()
|
let database_url = schedtxt_models::envy::environment::get_db_url().value;
|
||||||
.await
|
|
||||||
.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" {
|
||||||
@@ -107,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))
|
||||||
@@ -142,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"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,20 +185,18 @@ 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()
|
let key: String = schedtxt_models::envy::environment::get_secret_main_key().value;
|
||||||
.await
|
|
||||||
.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, _some_time)) => Ok(access_token),
|
Ok(access_token) => Ok(access_token.access_token),
|
||||||
Err(err) => Err(err),
|
Err(err) => Err(err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -247,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,
|
||||||
)
|
)
|
||||||
@@ -265,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 {
|
||||||
@@ -297,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,
|
||||||
)
|
)
|
||||||
@@ -324,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,
|
||||||
)
|
)
|
||||||
@@ -342,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 {
|
||||||
@@ -380,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,
|
||||||
)
|
)
|
||||||
@@ -407,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
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -438,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,
|
||||||
)
|
)
|
||||||
@@ -464,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
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -482,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,
|
||||||
)
|
)
|
||||||
@@ -501,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
|
||||||
@@ -534,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,
|
||||||
)
|
)
|
||||||
@@ -554,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
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -572,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;
|
||||||
@@ -632,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");
|
||||||
@@ -654,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");
|
||||||
@@ -664,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!(
|
||||||
@@ -691,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");
|
||||||
@@ -707,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!(
|
||||||
@@ -745,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");
|
||||||
@@ -772,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");
|
||||||
@@ -794,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");
|
||||||
@@ -823,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");
|
||||||
@@ -844,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");
|
||||||
@@ -867,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");
|
||||||
@@ -883,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");
|
||||||
@@ -911,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");
|
||||||
@@ -925,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");
|
||||||
@@ -940,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");
|
||||||
@@ -961,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");
|
||||||
@@ -986,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");
|
||||||
@@ -1000,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");
|
||||||
@@ -1015,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");
|
||||||
@@ -1036,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");
|
||||||
@@ -1051,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");
|
||||||
@@ -1076,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");
|
||||||
@@ -1090,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");
|
||||||
@@ -1105,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");
|
||||||
@@ -1126,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");
|
||||||
@@ -1141,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");
|
||||||
@@ -1154,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");
|
||||||
@@ -1184,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");
|
||||||
@@ -1198,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");
|
||||||
@@ -1213,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");
|
||||||
@@ -1234,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");
|
||||||
@@ -1247,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");
|
||||||
@@ -1278,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");
|
||||||
@@ -1292,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");
|
||||||
@@ -1307,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");
|
||||||
@@ -1328,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");
|
||||||
@@ -1341,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");
|
||||||
@@ -1360,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");
|
||||||
@@ -1386,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");
|
||||||
@@ -1400,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");
|
||||||
@@ -1415,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");
|
||||||
@@ -1436,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");
|
||||||
@@ -1451,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");
|
||||||
@@ -1470,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");
|
||||||
@@ -1497,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");
|
||||||
@@ -1523,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");
|
||||||
@@ -1537,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");
|
||||||
@@ -1552,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");
|
||||||
@@ -1573,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");
|
||||||
@@ -1588,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");
|
||||||
@@ -1607,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");
|
||||||
@@ -1634,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");
|
||||||
@@ -1642,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");
|
||||||
|
|||||||
Reference in New Issue
Block a user