Compare commits

..

4 Commits

Author SHA1 Message Date
c46ab8397c style: fix some clippy errors
Some checks failed
Publish Docker Images / build-and-publish (push) Has been cancelled
2025-11-20 10:51:48 +01:00
daa92328c5 docs(README): open links in new tabs 2025-11-20 10:51:48 +01:00
2f0ebc8144 chore: add Sonar analysis 2025-11-16 02:12:21 +01:00
797ab461ab feat: send confirmation email to sender
When users submit a contact form, they now receive a confirmation
email acknowlledging receipt of their message. The backend also
continues to send a notification email to the configured recipient.

If the backend fails to send the acknowledgement email to the sender,
it will assume the email is not valid and will therefore not transmit
the contact request to the configured recipient.

Changes:
- Refactor `send_email()` to `send_emails()` that sends two emails:
  - Confirmation email from the submitter
  - Notification email to the configured recipient
- Add `From<T>` implementations of various errors for new error type
  `ContactError`.
- Errors now return a translation identifier for the frontend.
2025-11-16 02:12:21 +01:00
4 changed files with 12 additions and 8 deletions

View File

@@ -84,7 +84,7 @@ Cachix is a Nix binary cache that dramatically speeds up builds by caching build
Configure these in the workflow's `env` section or as repository variables: Configure these in the workflow's `env` section or as repository variables:
| Variable | Description | Default Value | Example | | Variable | Description | Default Value | Example |
|--------------------+------------------------------------------------+---------------+--------------------| |--------------------|------------------------------------------------|---------------|--------------------|
| `CACHIX_NAME` | Name of the Cachix cache to use | `devenv` | `phundrak-dot-com` | | `CACHIX_NAME` | Name of the Cachix cache to use | `devenv` | `phundrak-dot-com` |
| `CACHIX_SKIP_PUSH` | Whether to skip pushing artifacts to the cache | `true` | `false` | | `CACHIX_SKIP_PUSH` | Whether to skip pushing artifacts to the cache | `true` | `false` |

View File

@@ -3,7 +3,13 @@ include_toc: true
gitea: none gitea: none
--- ---
# phundrak.com Backend <h1 align="center">Bakit</h1>
<div align="center">
<strong>
A backend for my personal website
</strong>
</div>
<br/>
<div align="center"> <div align="center">
<a href="https://sonar.phundrak.com/dashboard?id=phundrak-backend" target="_blank"> <a href="https://sonar.phundrak.com/dashboard?id=phundrak-backend" target="_blank">
@@ -20,8 +26,6 @@ gitea: none
</a> </a>
</div> </div>
The backend for [phundrak.com](https://phundrak.com), built with Rust and the [Poem](https://github.com/poem-web/poem) web framework.
## Features ## Features
- **RESTful API** with automatic OpenAPI/Swagger documentation - **RESTful API** with automatic OpenAPI/Swagger documentation

View File

@@ -268,7 +268,7 @@ mod tests {
#[test] #[test]
fn from_validation_errors_with_name_error() { fn from_validation_errors_with_name_error() {
use validator::{Validate, ValidationError}; use validator::Validate;
#[derive(Validate)] #[derive(Validate)]
struct TestStruct { struct TestStruct {

View File

@@ -933,7 +933,7 @@ mod tests {
assert!(result.is_err()); assert!(result.is_err());
match result.unwrap_err() { match result.unwrap_err() {
ContactError::CouldNotParseSettingsEmail(_) => (), ContactError::CouldNotParseSettingsEmail(_) => (),
e => panic!("Expected CouldNotParseSettingsEmail, got {:?}", e), e => panic!("Expected CouldNotParseSettingsEmail, got {e:?}"),
} }
} }
@@ -964,7 +964,7 @@ mod tests {
assert!(result.is_err()); assert!(result.is_err());
match result.unwrap_err() { match result.unwrap_err() {
ContactError::CouldNotParseRequestEmailAddress(_) => (), ContactError::CouldNotParseRequestEmailAddress(_) => (),
e => panic!("Expected CouldNotParseRequestEmailAddress, got {:?}", e), e => panic!("Expected CouldNotParseRequestEmailAddress, got {e:?}"),
} }
} }
@@ -996,7 +996,7 @@ mod tests {
assert!(result.is_err()); assert!(result.is_err());
match result.unwrap_err() { match result.unwrap_err() {
ContactError::CouldNotSendEmail(_) => (), ContactError::CouldNotSendEmail(_) => (),
e => panic!("Expected CouldNotSendEmail, got {:?}", e), e => panic!("Expected CouldNotSendEmail, got {e:?}"),
} }
} }
} }