- 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 | import { PositiveInt, TrimmedNonEmptyString } from "@t3tools/contracts"; | 2 | import { PositiveInt, TrimmedNonEmptyString } from "@t3tools/contracts"; |
| 3 | import { decodeJsonResult, formatSchemaError } from "@t3tools/shared/schemaJson"; | 3 | import { decodeJsonResult, formatSchemaError } from "@t3tools/shared/schemaJson"; |
| 4 | 4 | ||
| @@ -9,7 +9,7 @@ export interface NormalizedGitHubPullRequestRecord { · 4 unmodified lines | |||
| 9 | readonly baseRefName: string; | 9 | readonly baseRefName: string; |
| 10 | readonly headRefName: string; | 10 | readonly headRefName: string; |
| 11 | readonly state: "open" | "closed" | "merged"; | 11 | readonly state: "open" | "closed" | "merged"; |
| 12 | readonly updatedAt: string | null; | 12 | readonly updatedAt: Option.Option<DateTime.Utc>; |
| 13 | readonly isCrossRepository?: boolean; | 13 | readonly isCrossRepository?: boolean; |
| 14 | readonly headRepositoryNameWithOwner?: string | null; | 14 | readonly headRepositoryNameWithOwner?: string | null; |
| 15 | readonly headRepositoryOwnerLogin?: string | null; | 15 | readonly headRepositoryOwnerLogin?: string | null; |
| @@ -23,7 +23,7 @@ const GitHubPullRequestSchema = Schema.Struct({ · 7 unmodified lines | |||
| 23 | headRefName: TrimmedNonEmptyString, | 23 | headRefName: TrimmedNonEmptyString, |
| 24 | state: Schema.optional(Schema.NullOr(Schema.String)), | 24 | state: Schema.optional(Schema.NullOr(Schema.String)), |
| 25 | mergedAt: Schema.optional(Schema.NullOr(Schema.String)), | 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 | isCrossRepository: Schema.optional(Schema.Boolean), | 27 | isCrossRepository: Schema.optional(Schema.Boolean), |
| 28 | headRepository: Schema.optional( | 28 | headRepository: Schema.optional( |
| 29 | Schema.NullOr( | 29 | Schema.NullOr( |
| @@ -80,8 +80,7 @@ function normalizeGitHubPullRequestRecord( · 50 unmodified lines | |||
| 80 | baseRefName: raw.baseRefName, | 80 | baseRefName: raw.baseRefName, |
| 81 | headRefName: raw.headRefName, | 81 | headRefName: raw.headRefName, |
| 82 | state: normalizeGitHubPullRequestState(raw), | 82 | state: normalizeGitHubPullRequestState(raw), |
| 83 | updatedAt: | 83 | updatedAt: raw.updatedAt ?? Option.none(), |
| 84 | typeof raw.updatedAt === "string" && raw.updatedAt.trim().length > 0 ? raw.updatedAt : null, | ||
| 85 | ...(typeof raw.isCrossRepository === "boolean" | 84 | ...(typeof raw.isCrossRepository === "boolean" |
| 86 | ? { isCrossRepository: raw.isCrossRepository } | 85 | ? { isCrossRepository: raw.isCrossRepository } |
| 87 | : {}), | 86 | : {}), |