# Data Model: View Event Landing Page (007)

**Date**: 2026-03-06

## Entities

### Event (modified — adds `timezone` field)

| Field           | Type             | Required | Constraints              | Notes                            |
|-----------------|------------------|----------|--------------------------|----------------------------------|
| id              | Long             | yes      | BIGSERIAL, PK            | Internal only, never exposed     |
| eventToken      | UUID             | yes      | UNIQUE, NOT NULL         | Public identifier in URLs        |
| organizerToken  | UUID             | yes      | UNIQUE, NOT NULL         | Secret, never in public API      |
| title           | String           | yes      | 1–200 chars              |                                  |
| description     | String           | no       | max 2000 chars           |                                  |
| dateTime        | OffsetDateTime   | yes      |                          | Organizer's original offset      |
| timezone        | String           | yes      | IANA zone ID, max 64     | **NEW** — e.g. "Europe/Berlin"   |
| location        | String           | no       | max 500 chars            |                                  |
| expiryDate      | LocalDate        | yes      | Must be future at create | Auto-deletion trigger            |
| createdAt       | OffsetDateTime   | yes      | Server-generated         |                                  |

**Validation rules**:
- `timezone` must be a valid IANA zone ID (`ZoneId.getAvailableZoneIds()`).
- `expiryDate` must be in the future at creation time (existing rule).

**State transitions**:
- Active → Expired: when `expiryDate < today` (computed, not stored).
- Active → Cancelled: future (US-18), adds `cancelledAt` + `cancellationMessage`.

### RSVP (future — not created in this feature)

Documented here for context only. Created when the RSVP feature (US-8+) is implemented.

| Field      | Type    | Required | Constraints                  |
|------------|---------|----------|------------------------------|
| id         | Long    | yes      | BIGSERIAL, PK                |
| eventId    | Long    | yes      | FK → events.id               |
| guestName  | String  | yes      | 1–100 chars                  |
| attending  | Boolean | yes      | true = attending             |
| createdAt  | OffsetDateTime | yes | Server-generated           |

## Relationships

```
Event 1 ←── * RSVP (future)
```

## Type Mapping (full stack)

| Concept      | Java              | PostgreSQL    | OpenAPI             | TypeScript |
|--------------|-------------------|---------------|---------------------|------------|
| Event time   | `OffsetDateTime`  | `timestamptz` | `string` `date-time`| `string`   |
| Timezone     | `String`          | `varchar(64)` | `string`            | `string`   |
| Expiry date  | `LocalDate`       | `date`        | `string` `date`     | `string`   |
| Token        | `UUID`            | `uuid`        | `string` `uuid`     | `string`   |
| Count        | `int`             | `integer`     | `integer`           | `number`   |
