Skip to content

Feat: contact-us messages - #72

Merged
khanzadimahdi merged 1 commit into
mainfrom
feat/contact-us
Aug 4, 2026
Merged

Feat: contact-us messages#72
khanzadimahdi merged 1 commit into
mainfrom
feat/contact-us

Conversation

@khanzadimahdi

Copy link
Copy Markdown
Member

Lets a visitor send a message without having an account, and gives the dashboard a place to read and triage what comes in.

What's here

Domaindomain/contact: Message (subject, body, email, phone, ReadAt, CreatedAt), its repository port, and phone-number validation (digits only, at least four).

Public endpointPOST /api/contact-us, open to anonymous visitors. The sender must leave an email or a phone number; either one is enough, both are accepted, and whichever is filled in still has to be well-formed. That rule is the reason for the two new translation keys.

Dashboard endpoints — each behind its own permission:

Route Permission
GET /api/dashboard/contact-us contactus.index
GET /api/dashboard/contact-us/{uuid} contactus.show
DELETE /api/dashboard/contact-us/{uuid} contactus.delete
PUT /api/dashboard/contact-us/{uuid}/read contactus.markAsRead

Storage — MongoDB repository plus a mock for the use-case tests.

Notes for review

  • Read state is a nullable timestamp rather than a boolean, so the dashboard can show when a message was read, and IsRead() derives from it.
  • Every file in this branch is new except five: permission.go, the permissions collection, en.go/fa.go, and the IOC wiring in blog.go. Those five are the ones that will conflict with the sibling PRs — see below.
  • The OpenAPI docs under resources/docs/ are regenerated (go generate); the diff there is pure addition of the four paths above.

Relationship to the other PRs

This was split out of one working branch alongside notes and block users. All three are cut from main and can be merged in any order, but each touches domain/permission/permission.go, the permissions collection, the translation files, and infrastructure/ioc/providers/blog.go. Expect conflicts in those on the second and third merge — they are additive in every case, so resolution is keeping both sides. Re-run go generate after merging to settle the OpenAPI docs.

Verification

go build ./... and go test ./... both pass on this branch alone.

🤖 Generated with Claude Code

Lets a visitor send a message without an account, and gives the dashboard
a place to read and triage what comes in.

- domain/contact: Message, its repository port, and phone-number validation
- POST /api/contact-us, open to anonymous visitors. The sender must leave
  an email or a phone number (either one, both accepted) so there is a way
  to reply
- Dashboard: list, show, delete, and mark-as-read, each behind its own
  contactus.* permission
- MongoDB repository and a mock for the tests
- Two new validation messages in en/fa

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@khanzadimahdi
khanzadimahdi marked this pull request as ready for review August 4, 2026 10:57
@khanzadimahdi
khanzadimahdi merged commit 99f5a76 into main Aug 4, 2026
6 checks passed
@khanzadimahdi
khanzadimahdi deleted the feat/contact-us branch August 4, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant