- Switch freshness and PR update times to typed `DateTime`/`Option` values - Update GitHub and VCS adapters, tests, and sorting to use the new shapes
Showing the changes to apps/server/src/git/githubPullRequests.ts (1 of 9 files). Show all
Unified · Split
| @@ -1,4 +1,4 @@ | ||
| 1 | −import { Cause, Exit, Result, Schema } from "effect"; | |
| 1 | +import { Cause, DateTime, Exit, Option, Result, Schema } from "effect"; | |
| 2 | 2 | import { PositiveInt, TrimmedNonEmptyString } from "@t3tools/contracts"; |
| 3 | 3 | import { decodeJsonResult, formatSchemaError } from "@t3tools/shared/schemaJson"; |
| 4 | 4 | |
| @@ -9,7 +9,7 @@ export interface NormalizedGitHubPullRequestRecord { · 4 unmodified lines | ||
| 9 | 9 | readonly baseRefName: string; |
| 10 | 10 | readonly headRefName: string; |
| 11 | 11 | readonly state: "open" | "closed" | "merged"; |
| 12 | − readonly updatedAt: string | null; | |
| 12 | + readonly updatedAt: Option.Option<DateTime.Utc>; | |
| 13 | 13 | readonly isCrossRepository?: boolean; |
| 14 | 14 | readonly headRepositoryNameWithOwner?: string | null; |
| 15 | 15 | readonly headRepositoryOwnerLogin?: string | null; |
| @@ -23,7 +23,7 @@ const GitHubPullRequestSchema = Schema.Struct({ · 7 unmodified lines | ||
| 23 | 23 | headRefName: TrimmedNonEmptyString, |
| 24 | 24 | state: Schema.optional(Schema.NullOr(Schema.String)), |
| 25 | 25 | mergedAt: Schema.optional(Schema.NullOr(Schema.String)), |
| 26 | − updatedAt: Schema.optional(Schema.NullOr(Schema.String)), | |
| 26 | + updatedAt: Schema.optional(Schema.OptionFromNullOr(Schema.DateTimeUtcFromString)), | |
| 27 | 27 | isCrossRepository: Schema.optional(Schema.Boolean), |
| 28 | 28 | headRepository: Schema.optional( |
| 29 | 29 | Schema.NullOr( |
| @@ -80,8 +80,7 @@ function normalizeGitHubPullRequestRecord( · 50 unmodified lines | ||
| 80 | 80 | baseRefName: raw.baseRefName, |
| 81 | 81 | headRefName: raw.headRefName, |
| 82 | 82 | state: normalizeGitHubPullRequestState(raw), |
| 83 | − updatedAt: | |
| 84 | − typeof raw.updatedAt === "string" && raw.updatedAt.trim().length > 0 ? raw.updatedAt : null, | |
| 83 | + updatedAt: raw.updatedAt ?? Option.none(), | |
| 85 | 84 | ...(typeof raw.isCrossRepository === "boolean" |
| 86 | 85 | ? { isCrossRepository: raw.isCrossRepository } |
| 87 | 86 | : {}), |