Commit graph

78 commits

Author SHA1 Message Date
62afd2f9d6
add cors middleware 2026-05-09 23:15:11 +03:00
23ec371386
add cors 2026-05-09 23:13:17 +03:00
30738b163d
add user:promote artisan command
Marks the user with the given email as an admin. Used by the
cypress harness to bootstrap an admin without a public promote
endpoint and is also useful for ops.
2026-05-06 23:23:00 +03:00
eb59f4ca2d
route dev mail through mailpit
Switch from MAIL_MAILER=log to smtp pointing at mailpit on
:1025. From-address mirrors LaravelEmailFactory's confirmation
email format. phpunit.xml keeps MAIL_MAILER=array so unit and
feature tests do not touch mailpit.
2026-05-06 23:21:48 +03:00
beb4ddd1e9
split seeders by domain entity
Replaces the laravel-default scaffold seeder with one file per
domain (AdminUser, User, Post, Comment) plus a config/seed.php
to source admin credentials from env. DatabaseSeeder is now a
pure orchestrator that calls the sub-seeders in dependency
order.
2026-05-06 22:38:14 +03:00
a3f90d1e85
implement user search and admin promote endpoints
GET /users?q=... is public; POST /admin/users/promote is auth
required and admin-checked inside the use case.
2026-05-06 22:36:15 +03:00
56136f8bcf
test user search and admin promote endpoints 2026-05-06 22:36:10 +03:00
ac7295faf3
implement PromoteUserToAdmin use case 2026-05-06 22:34:53 +03:00
8cbc84b051
test PromoteUserToAdmin use case 2026-05-06 22:34:29 +03:00
d917e76f1b
implement SearchUsers use case 2026-05-06 22:34:08 +03:00
31a807f0ae
test SearchUsers use case 2026-05-06 22:33:22 +03:00
8ac5a5b18a
implement featured post admin endpoints
Adds POST /admin/posts/feature, POST /admin/posts/unfeature
(both auth-required, admin-checked inside controller via the
use case's ForbiddenException), and public GET /posts/featured.
Post serialization now includes featureSlot.
2026-05-06 22:32:46 +03:00
8983b69fa1
test featured posts admin endpoints 2026-05-06 22:32:36 +03:00
e4791de81a
implement ListFeaturedPosts use case 2026-05-06 22:30:49 +03:00
e61492f864
test ListFeaturedPosts use case 2026-05-06 22:30:32 +03:00
a8f59afc30
implement ClearFeaturedPost use case 2026-05-06 22:30:17 +03:00
7bd3ff78b4
test ClearFeaturedPost use case 2026-05-06 22:29:54 +03:00
ee95bcafc9
implement SetFeaturedPost use case 2026-05-06 22:29:34 +03:00
13ca655f9b
test SetFeaturedPost use case 2026-05-06 22:29:09 +03:00
f73e5a1af5
extend Post entity with feature slot
Adds nullable feature_slot column (unique) plus repo
findByFeatureSlot/findFeatured/update methods so admins can
pin a post into one of two slots.
2026-05-06 22:28:45 +03:00
64a334c63e
test Post entity feature slot 2026-05-06 22:27:18 +03:00
59d4ed88c4
implement post and comment controllers
Wires PostController (recent, show, create, delete, listByUser)
and CommentController (listForPost, create, delete) to the
existing use cases. Posts and comments expose author display
names alongside user IDs. CommentRepository binding added to
RepositoryServiceProvider.
2026-05-06 22:26:35 +03:00
8614858558
test post and comment controllers
Adds AuthenticatesUsers feature trait that runs the full
signup -> confirm -> login flow and exposes the resulting auth
cookie. Bumps phpunit defaultTimeLimit to 30 seconds so the
multi-bcrypt-per-test feature flow finishes inside the limit.
2026-05-06 22:26:10 +03:00
d24bde3761
implement DeleteComment use case 2026-05-06 22:16:34 +03:00
5bbef871db
test DeleteComment use case 2026-05-06 22:16:10 +03:00
a59fc4890f
implement ListCommentsForPost use case
Renames seed() helper to seedComment() to avoid clashing with
Illuminate\Foundation\Testing\TestCase::seed().
2026-05-06 22:15:49 +03:00
f9e2529994
test ListCommentsForPost use case 2026-05-06 22:15:10 +03:00
e8d2ff3fdf
implement CreateComment use case 2026-05-06 22:14:55 +03:00
2557c9b6a9
test CreateComment use case 2026-05-06 22:14:31 +03:00
93da08756c
add Comment persistence: model, migration, eloquent + fake repo 2026-05-06 22:14:11 +03:00
0d589340d9
add Comment entity, dto, repository interface 2026-05-06 22:13:37 +03:00
9049f1581b
implement auth controller and routes
Wires AuthController (signup, confirmEmail, login, me, logout)
to the existing auth use cases. Routes mounted under /api with
AuthMiddleware on logout/me. RepositoryServiceProvider gains
EmailConfirmationToken and Post bindings; AppServiceProvider
binds the Emailer/EmailFactory and constructs SignupUser with
the configured from-address.
2026-05-06 22:12:51 +03:00
0ffc4b546c
test auth controller signup, confirm-email, login, me, logout 2026-05-06 22:12:27 +03:00
f3c6e2e000
implement SignupUser two-step confirm flow
Signup now collects only email + displayName, creates an
unconfirmed user with empty password hash, mints an
EmailConfirmationToken, and dispatches a confirmation email.
Password is set during ConfirmUserEmail.
2026-05-06 22:08:54 +03:00
11f2823a30
test SignupUser two-step confirm flow 2026-05-06 22:08:25 +03:00
6823bdeb50
implement ConfirmUserEmail use case 2026-05-06 22:07:30 +03:00
60308988f7
test ConfirmUserEmail use case 2026-05-06 22:07:08 +03:00
2890781a56
add Emailer and EmailFactory interfaces with laravel + fake impls 2026-05-06 22:06:30 +03:00
e16cb45387
add EmailConfirmationToken persistence: model, migration, eloquent + fake repo 2026-05-06 22:05:52 +03:00
9747d07c31
test EmailConfirmationToken entity 2026-05-06 22:04:57 +03:00
4b1689d17e
implement SignupUser displayname requirement 2026-05-06 22:03:49 +03:00
4829a02aac
test SignupUser displayname requirement
Adds displayname to existing assertions and new tests covering:
null/short/invalid-charset displayname, duplicate displayname,
findability by displayname. AuthenticateUser tests pick up the
seedUser displayname argument.
2026-05-06 22:03:40 +03:00
298b8634ec
extend User entity with displayname and email confirmation
Add display_name (unique) and email_confirmed_at columns plus
matching getters, DTO fields, repo methods (findByDisplayName,
update), and migration. Existing auth tests updated to construct
User with the new params.
2026-05-06 22:03:19 +03:00
d547ec2c61
test User entity displayname and email confirmation 2026-05-06 22:00:22 +03:00
e9ac16377f
implement DeletePost use case 2026-05-06 21:58:25 +03:00
yisroel
fd91da6bab
test DeletePost use case
7 cases: zero postId or requesterId -> BadRequest; unknown post
is idempotent no-op; author can delete own post; admin can
delete anyone's post; non-author non-admin -> ForbiddenException;
forbidden attempts leave post intact.
2026-05-06 15:26:28 +03:00
yisroel
7fda18dde3
implement GetPost use case
validates id > 0, delegates to PostRepository->find. 58 tests
pass.
2026-05-06 15:25:56 +03:00
yisroel
eb0ebc6f63
test GetPost use case
4 cases: zero/negative id -> BadRequest; unknown id -> null
(controller maps to 404); existing id returns the Post.
GetPost takes int id directly (no Request object - the value is
trivial and controllers pull it from a route param).
2026-05-06 15:25:36 +03:00
yisroel
32cbf4229c
implement ListUserPosts use case
validates userId > 0, delegates to PostRepository->findByUserId.
54 tests pass.
2026-05-06 15:25:07 +03:00
yisroel
e97ca28237
test ListUserPosts use case
5 cases: zero/negative userId -> BadRequest; user with no posts
-> []; returns only requested user's posts (filters out other
authors); ordered newest-first by createdAt. fails red.
2026-05-06 15:24:41 +03:00