Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
488 changes: 488 additions & 0 deletions packages/core/migrations/0000_chunky_pet_avengers.sql

Large diffs are not rendered by default.

3,752 changes: 3,752 additions & 0 deletions packages/core/migrations/meta/0000_snapshot.json

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions packages/core/migrations/meta/_journal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "7",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "7",
"when": 1769156754401,
"tag": "0000_chunky_pet_avengers",
"breakpoints": true
}
]
}
84 changes: 84 additions & 0 deletions packages/core/src/pro-league/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Pro League Domain - Professional lacrosse league data (PLL, NLL, MLL, MSL, WLA)

// SQL Tables
export {
proLeagueTable,
proSeasonTable,
proTeamTable,
proPlayerTable,
proPlayerSeasonTable,
proGameTable,
proStandingsTable,
proDataIngestionTable,
type ProLeague,
type ProLeagueInsert,
type ProSeason,
type ProSeasonInsert,
type ProTeam,
type ProTeamInsert,
type ProPlayer,
type ProPlayerInsert,
type ProPlayerSeason,
type ProPlayerSeasonInsert,
type ProGame,
type ProGameInsert,
type ProStandings,
type ProStandingsInsert,
type ProDataIngestion,
type ProDataIngestionInsert,
} from "./pro-league.sql";

// JSONB Types
export type {
PlayerStats,
GoalieStats,
TeamStats,
PlayByPlayAction,
GamePlayByPlay,
} from "./pro-league.types";

export { isPLLStats, isNLLStats, hasGoalieStats } from "./pro-league.types";

// Effect Schemas
export {
LeagueCode,
GameStatus,
IngestionStatus,
EntityType,
SourceType,
CreateLeagueInput,
LeagueOutput,
UpsertSeasonInput,
SeasonOutput,
UpsertTeamInput,
TeamOutput,
UpsertPlayerInput,
PlayerOutput,
UpsertPlayerSeasonInput,
UpsertGameInput,
GameOutput,
UpsertStandingsInput,
CreateIngestionInput,
UpdateIngestionInput,
GetByLeagueInput,
GetBySeasonInput,
GetByLeagueAndYearInput,
GetStandingsInput,
} from "./pro-league.schema";

// Errors
export {
ProLeagueNotFoundError,
ProSeasonNotFoundError,
ProTeamNotFoundError,
ProPlayerNotFoundError,
ProGameNotFoundError,
ProIngestionError,
ProUpsertError,
} from "./pro-league.error";

// Repository
export { ProLeagueRepo } from "./pro-league.repo";

// Service
export { ProLeagueService } from "./pro-league.service";
71 changes: 71 additions & 0 deletions packages/core/src/pro-league/pro-league.error.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { Schema } from "effect";

// =============================================================================
// PRO LEAGUE DOMAIN ERRORS
// =============================================================================

export class ProLeagueNotFoundError extends Schema.TaggedError<ProLeagueNotFoundError>()(
"ProLeagueNotFoundError",
{
message: Schema.String,
code: Schema.optional(Schema.String),
id: Schema.optional(Schema.Number),
},
) {}

export class ProSeasonNotFoundError extends Schema.TaggedError<ProSeasonNotFoundError>()(
"ProSeasonNotFoundError",
{
message: Schema.String,
leagueId: Schema.optional(Schema.Number),
externalId: Schema.optional(Schema.String),
year: Schema.optional(Schema.Number),
},
) {}

export class ProTeamNotFoundError extends Schema.TaggedError<ProTeamNotFoundError>()(
"ProTeamNotFoundError",
{
message: Schema.String,
leagueId: Schema.optional(Schema.Number),
externalId: Schema.optional(Schema.String),
},
) {}

export class ProPlayerNotFoundError extends Schema.TaggedError<ProPlayerNotFoundError>()(
"ProPlayerNotFoundError",
{
message: Schema.String,
leagueId: Schema.optional(Schema.Number),
externalId: Schema.optional(Schema.String),
},
) {}

export class ProGameNotFoundError extends Schema.TaggedError<ProGameNotFoundError>()(
"ProGameNotFoundError",
{
message: Schema.String,
seasonId: Schema.optional(Schema.Number),
externalId: Schema.optional(Schema.String),
},
) {}

export class ProIngestionError extends Schema.TaggedError<ProIngestionError>()(
"ProIngestionError",
{
message: Schema.String,
leagueCode: Schema.optional(Schema.String),
entityType: Schema.optional(Schema.String),
cause: Schema.optional(Schema.Unknown),
},
) {}

export class ProUpsertError extends Schema.TaggedError<ProUpsertError>()(
"ProUpsertError",
{
message: Schema.String,
entity: Schema.String,
externalId: Schema.optional(Schema.String),
cause: Schema.optional(Schema.Unknown),
},
) {}
Loading
Loading