- GET /api/v1/posts/{id} returns a single post (owner-only for unpublished);
/detail/{id} stays as an alias; user posts live at /api/v1/users/{userId}/posts
- POST /api/v1/posts Location points to /api/v1/posts/{id}
- PostResponse.userEmail removed (use userLogin); unused DialogResponse removed
- GET /api/v1/posts/search?city= removed (same filter: GET /api/v1/posts?city=)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- GET /api/v1/users/{userId}/posts returns Page<PostResponse> (owner sees unpublished)
- POST /api/v1/posts returns 201 with the created PostResponse and Location
- PostResponse.userLogin; userEmail kept with the same value as deprecated
- GET /api/v1/posts/{userId} and /search?city= marked deprecated; search is paged
- CORS exposes Retry-After and Location to the frontend
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OrphanFileCleanupService (03:30, ShedLock) lists the bucket and deletes objects
older than 24 hours that no images.url or users.avatar_url points to (full
URLs in legacy rows are normalised to keys), at most 5000 per run. Such files
appear when an upload via POST /api/v1/files is never attached or a request
fails between upload and save. Deleted files stay recoverable for 30 days as
noncurrent versions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- PostService.create/update geocode and upload photos before opening the DB
transaction (TransactionTemplate); uploaded files are removed if the
transaction fails, so a DB connection is no longer held while waiting for
Nominatim or MinIO.
- GeocodingService: configurable URL and User-Agent (geocoding.*), results
cached in Redis for 30 days by coordinates rounded to ~11 m, and a
cluster-wide 1 request/s slot (geo:throttle) as the public Nominatim policy
requires; city/district are cut to the column sizes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Interlocutors, posts, last messages (one subquery by max id) and unread counts
(one GROUP BY) are loaded per list. The last message is now picked by id:
createdAt is written in the sender's time zone and is not monotonic between
users in different zones.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follows the usual ad-server flow (serve -> impression -> click):
- GET /api/ads/next returns an impressionToken: HMAC-signed (ads.tracking.secret,
defaults to jwt.secret) ad id, campaign id, subject and nonce, valid 1 hour.
/impression and /click accept it, verify the signature, count each nonce once
(Redis SET NX) and take the user/session from the token, so impressions
cannot be forged or replayed. Requests without a token keep working until
ads.tracking.require-token is switched on after the frontend update.
- The frequency cap is per campaign and calendar day (ads.timezone) and grows
on real impressions, not on serving: ad:cap:<subject>:<campaign>:<yyyyMMdd>.
- Selection reads a 30-second in-memory snapshot of eligible ads (projection,
invalidated locally on admin changes), filters capped campaigns with one
MGET, picks by weight and then sets the cooldown atomically. The weighted
sort drew random numbers inside the comparator, breaking its contract.
- Campaigns past endDate are finished every 10 minutes (ShedLock).
- GET /api/v1/admin/campaigns/{id}/stats: impressions, clicks and CTR per ad
for a date range; composite indexes on impression/click (changelog 021).
- Removed unused cascade collections on Campaign/Advertising, the unused
FullscreenAdActivateRequestDto and the /api/ads/impression/beacon rule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- GET /api/v1/users/{id} returns email and phone only to the user themself
and to admins.
- When a user changes their own login, the PUT response carries a new token
pair (login is the JWT subject, so the old tokens stop matching); old
refresh tokens fail on their own because the stored login differs.
- The old avatar is deleted only after the profile is saved; login length is
checked against the column size.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- RateLimitFilter: fixed-window counters in Redis (Lua INCR+PEXPIRE) per
client IP for login, registration, refresh, check-login, post creation,
uploads, chat start and public ad endpoints; 429 with Retry-After; fails
open when Redis is down. Rules live in rate-limit.* in application.yaml.
- Login is blocked for an account after 10 failed attempts in 15 minutes,
independent of the client IP.
- Registration requires a password of at least 8 characters.
- server.forward-headers-strategy=native so the client IP survives a reverse
proxy; graceful shutdown.
- /actuator/health with liveness/readiness probes is public (no details).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Scheduled jobs (nightly cleanup, moderation, search dictionary rebuild) take
a ShedLock lock in Redis, so only one instance runs each; the moderation run
stops before its lock can expire.
- STOMP events (chat messages, unread counters, transcoding status) are
published to the Redis channel ws:broadcast and every instance hands them to
its local simple broker, so subscribers on other instances receive them.
Falls back to local delivery if Redis is down; app.websocket.cluster-broadcast
switches it off.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ReFoundApplicationTests runs on PostgreSQL via Testcontainers with a test
profile holding test-only JWT/Redis/MinIO values; it previously failed
without JWT_SECRET. The test also checks Liquibase + ddl validate.
- Unit tests: JWT access/refresh separation, refresh rotation, admin
authority, exception mapping, image signature checks, ad media Range
responses, post deletion after commit, moderation races, campaign status,
ad selection without HttpSession and with Redis down, target URL rules.
- resolveRange rejects ranges that start past the end of the file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- PostService.delete did not remove favorites (FK without cascade -> 500 once a
post was favorited) or chat links; owner, admin and nightly cleanup now share
PostDeletionService, which deletes MinIO files only after commit. The nightly
job also removes the images of expired posts.
- Moderation reads a snapshot in a short transaction, calls AI outside of it and
applies the verdict only if the post is still in MODERATION and unchanged, so
an edit made during a check can no longer go live unmoderated. Storage/AI
outages keep the post in MODERATION instead of rejecting it.
- Posts without a category broke PostMapper with an NPE; title/phone/reward and
address are checked against column sizes; a long address no longer overflows
posts.city; Nominatim outages fall back to the address instead of 503.
- Favorites list hides posts that are back in moderation or rejected.
- Statistics counters use atomic UPDATEs instead of read-modify-write.
- Removed MapCacheService: its version key was bumped but never read.
- hibernate.default_batch_fetch_size=50 removes N+1 on images/users; show-sql
is off by default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Photos from iPhone (3-10 MB, 12-24 MP) were stored and served as-is, so the
feed loaded slowly on first open. Images are now downscaled to 1600px,
rotated by EXIF and re-encoded as progressive JPEG on upload. The
/api/v1/files proxy now sends Cache-Control instead of Spring Security's
no-store, so images are not re-downloaded on every app open.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- GET /api/v1/chats/with/{otherUserId}?postId= finds an existing chat
(404 if there is none) and never creates one
- POST /api/v1/chats/with/{otherUserId}/messages?postId= with {content}
finds or creates the chat and saves the first message in one
transaction; same participant/post checks as before, WebSocket events
still sent after commit
- the old POST /with/{otherUserId} that created empty chats is removed
- chat list hides chats without messages (existing empty rows stay in DB)
- empty messages are rejected with 400
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>