This commit is contained in:
2025-12-04 23:31:55 +01:00
parent 9fa21a488a
commit fb509607c1
96 changed files with 5839 additions and 1609 deletions

View File

@@ -0,0 +1 @@
export * from './media/DemoImageServiceAdapter';

View File

@@ -0,0 +1,31 @@
import type { ImageServicePort } from '@gridpilot/media';
export class DemoImageServiceAdapter implements ImageServicePort {
getDriverAvatar(driverId: string): string {
const seed = stableHash(driverId);
return `https://picsum.photos/seed/driver-${seed}/128/128`;
}
getTeamLogo(teamId: string): string {
const seed = stableHash(teamId);
return `https://picsum.photos/seed/team-${seed}/256/256`;
}
getLeagueCover(leagueId: string): string {
const seed = stableHash(leagueId);
return `https://picsum.photos/seed/league-cover-${seed}/1200/280?blur=2`;
}
getLeagueLogo(leagueId: string): string {
const seed = stableHash(leagueId);
return `https://picsum.photos/seed/league-logo-${seed}/160/160`;
}
}
function stableHash(value: string): number {
let hash = 0;
for (let i = 0; i < value.length; i++) {
hash = (hash * 31 + value.charCodeAt(i)) | 0;
}
return Math.abs(hash);
}

View File

@@ -0,0 +1,15 @@
{
"name": "@gridpilot/demo-infrastructure",
"version": "0.1.0",
"type": "module",
"main": "./index.ts",
"types": "./index.ts",
"dependencies": {
"@gridpilot/media": "file:../media",
"@faker-js/faker": "^9.0.0"
},
"exports": {
".": "./index.ts",
"./media/*": "./media/*"
}
}

View File

@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "../..",
"outDir": "dist",
"declaration": true,
"declarationMap": false
},
"include": [
"../../packages/demo-infrastructure/**/*.ts",
"../../packages/media/**/*.ts"
]
}