init commit

This commit is contained in:
2025-03-21 15:17:53 +01:00
commit d483a245f8
22 changed files with 275 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
node_modules
dist

29
package-lock.json generated Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "@mtlsz/common",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@mtlsz/common",
"version": "1.0.0",
"license": "ISC",
"devDependencies": {
"typescript": "^5.8.2"
}
},
"node_modules/typescript": {
"version": "5.8.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz",
"integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
}
}
}

20
package.json Normal file
View File

@@ -0,0 +1,20 @@
{
"name": "@mtlsz/common",
"version": "1.0.2",
"description": "MTLSZ frontend packages",
"main": "dist/index.ts",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://git.tothbt.com/tothbt/mtlsz-frontend-packages"
},
"author": "TRWEB",
"license": "ISC",
"devDependencies": {
"typescript": "^5.8.2"
}
}

17
src/index.ts Normal file
View File

@@ -0,0 +1,17 @@
export * from './interfaces/club';
export * from './interfaces/player';
export * from './interfaces/api-pagination';
export * from './interfaces/api-result';
export * from './interfaces/category';
export * from './interfaces/entry';
export * from './interfaces/in-memory-cache';
export * from './interfaces/official';
export * from './interfaces/pagination';
export * from './interfaces/ranking-entry';
export * from './interfaces/ranking';
export * from './interfaces/system-data';
export * from './interfaces/team-administrator';
export * from './interfaces/team-category';
export * from './interfaces/team-entry';
export * from './interfaces/team';
export * from './interfaces/tournament';

View File

@@ -0,0 +1,8 @@
export interface ApiPagination {
'@id': string;
'@type': string;
'hydra:first': string;
'hydra:last': string;
'hydra:next'?: string;
'hydra:previous'?: string;
}

View File

@@ -0,0 +1,10 @@
import { ApiPagination } from "./api-pagination";
export interface ApiResult {
'@context': string;
'@id': string;
type: string;
'hydra:member': Array<any>;
'hydra:totalItems': number;
'hydra:view': ApiPagination
}

View File

@@ -0,0 +1,12 @@
export interface Category {
id?: number;
name: string;
singles: boolean;
doubles: boolean;
mixed: boolean;
shortName: string;
gender: string;
class: number;
age?: string;
priority: number;
}

12
src/interfaces/club.ts Normal file
View File

@@ -0,0 +1,12 @@
export interface Club {
id?: number;
name: string;
shortName: string;
players?: Array<any>;
city?: string;
contactName?: string;
email?: string;
address?: string;
phone?: string;
active: boolean;
}

18
src/interfaces/entry.ts Normal file
View File

@@ -0,0 +1,18 @@
import { Category } from "./category";
import { Club } from "./club";
import { Player } from "./player";
import { Tournament } from "./tournament";
export interface Entry {
id?: number;
player1: Player;
player2?: Player;
sentBy: Club;
status: number;
category: Category;
tournament: Tournament;
createdAt: string;
updatedAt?: string;
sameEntry?: Entry;
missingEntryFromOtherClub?: boolean;
}

View File

@@ -0,0 +1,8 @@
/**
* This is just a simple interface for clearCache method
* which removes the data from the memory. E.g set
* your list to empty array, null or whatever.
*/
export declare interface InMemoryCache {
clearCache(): void;
}

View File

@@ -0,0 +1,10 @@
export interface Official {
id?: number;
name: string;
email: string;
phone?: string;
/** @deprecated Use referee and umpire booleans instead */
type?: number;
referee: boolean;
umpire: boolean;
}

View File

@@ -0,0 +1,4 @@
export declare interface Pagination {
forward(): void;
back(): void;
}

14
src/interfaces/player.ts Normal file
View File

@@ -0,0 +1,14 @@
import { Club } from "./club";
export interface Player {
id?: number;
firstName: string;
lastName: string;
gender: string;
birthDate: string;
officialId?: number;
club: Club;
email?: string;
keycloakUserId?: string;
active?: boolean;
}

View File

@@ -0,0 +1,12 @@
import { Player } from "./player";
import { Ranking } from "./ranking";
export interface RankingEntry {
id?: number;
ranking: Ranking;
player: Player;
place: number;
tournamentCount: number;
points: number;
validFrom: Date;
}

View File

@@ -0,0 +1,8 @@
export interface Ranking {
id?: number;
gender: string;
age: string | null;
singles: boolean;
doubles: boolean;
mixed: boolean;
}

View File

@@ -0,0 +1,4 @@
export interface SystemData {
type: string;
value: string;
}

View File

@@ -0,0 +1,11 @@
import { Club } from "./club";
export interface TeamAdministrator {
id?: number;
keycloakId?: string;
lastName: string;
firstName: string;
email: string;
active?: boolean;
club: Club;
}

View File

@@ -0,0 +1,10 @@
import { Category } from "./category";
export interface TeamCategory {
id?: number;
name: string;
class: number;
gender: string;
age?: string;
categories?: Category[];
}

View File

@@ -0,0 +1,15 @@
import { Club } from "./club";
import { Team } from "./team";
import { TeamCategory } from "./team-category";
import { Tournament } from "./tournament";
export interface TeamEntry {
id?: number;
sentBy: Club;
status: number;
category: TeamCategory;
tournament: Tournament;
createdAt: string;
updatedAt?: string;
team: Team;
}

7
src/interfaces/team.ts Normal file
View File

@@ -0,0 +1,7 @@
import { Club } from "./club";
export interface Team {
id?: number;
name: string;
club: Club;
}

View File

@@ -0,0 +1,31 @@
import { Category } from "./category";
import { Club } from "./club";
import { Official } from "./official";
import { TeamCategory } from "./team-category";
export interface Tournament {
id?: number;
name: string;
dateFrom: string;
dateTo?: string;
entryDeadline?: string;
entryOpenFrom?: string;
categories: Array<Category>;
teamCategories?: Array<TeamCategory>;
/**
* @deprecated use organizerName instead
*/
organizer?: Club;
organizerName?: string;
active: boolean;
city?: string;
onlyWithLicence: boolean;
teamChampionship: boolean;
allowedWithoutPartner: boolean;
allowedSimilarEntries: boolean;
entriesChecked?: boolean;
referee: Official | null;
deputyReferee: Official | null;
drawUrl: string | null;
notificationsSentAt?: Date | null;
}

13
tsconfig.json Normal file
View File

@@ -0,0 +1,13 @@
{
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": false,
"outDir": "dist",
"module": "commonjs",
"target": "ES6",
"strict": true
},
"include": [
"src"
]
}