block / block/builder-syndicate

Add post-persistence type safety to Post entity

Open
#33 0 comments 0 reactions 0 assignees View on GitHub
ex machina
Dominant language
Kotlin
Stars
6
Forks
4
PR merge metrics
No merged PRs in 30d

Description

The `Post` entity uses nullable fields (`id: Long?`, `createdAt: Instant?`, `updatedAt: Instant?`) because pre-persistence posts lack these values. After persistence, they are always non-null, but the type system does not reflect this — leading to `!!` assertions scattered across action/response code.

## Options

- Separate `Post` (pre-persistence) from a `PersistedPost` (post-persistence) type
- Make repository return types guarantee non-null fields
- Use a sealed type or value class wrapper

## Acceptance Criteria

- No `!!` on post id/timestamps in action or response code
- All tests pass
- No behavioral change

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.