From ddb0d481fbe88e9604f96dbb7cfd7bb06de5f3d5 Mon Sep 17 00:00:00 2001 From: Anton Tranelis Date: Sun, 9 Feb 2025 20:34:08 +0000 Subject: [PATCH] reorganized types --- types/AssetsApi.d.ts | 4 ---- types/FormState.d.ts | 20 ---------------- types/Item.d.ts | 44 ---------------------------------- types/ItemFormPopupProps.d.ts | 11 --------- types/ItemType.d.ts | 5 ---- types/ItemsApi.d.ts | 8 ------- types/LayerProps.d.ts | 42 -------------------------------- types/Permission.d.ts | 13 ---------- types/PermissionAction.d.ts | 1 - types/PermissionCondition.d.ts | 8 ------- types/Profile.d.ts | 10 -------- types/Relation.d.ts | 5 ---- types/Tag.d.ts | 6 ----- types/UserApi.d.ts | 12 ---------- types/UserItem.d.ts | 13 ---------- types/UtopiaMapProps.d.ts | 16 ------------- types/index.d.ts | 16 ------------- 17 files changed, 234 deletions(-) delete mode 100644 types/AssetsApi.d.ts delete mode 100644 types/FormState.d.ts delete mode 100644 types/Item.d.ts delete mode 100644 types/ItemFormPopupProps.d.ts delete mode 100644 types/ItemType.d.ts delete mode 100644 types/ItemsApi.d.ts delete mode 100644 types/LayerProps.d.ts delete mode 100644 types/Permission.d.ts delete mode 100644 types/PermissionAction.d.ts delete mode 100644 types/PermissionCondition.d.ts delete mode 100644 types/Profile.d.ts delete mode 100644 types/Relation.d.ts delete mode 100644 types/Tag.d.ts delete mode 100644 types/UserApi.d.ts delete mode 100644 types/UserItem.d.ts delete mode 100644 types/UtopiaMapProps.d.ts delete mode 100644 types/index.d.ts diff --git a/types/AssetsApi.d.ts b/types/AssetsApi.d.ts deleted file mode 100644 index f2005016..00000000 --- a/types/AssetsApi.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface AssetsApi { - upload(file: Blob, title: string): Promise<{ id: string }> - url: string -} diff --git a/types/FormState.d.ts b/types/FormState.d.ts deleted file mode 100644 index 20589afd..00000000 --- a/types/FormState.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { Item } from './Item' -import type { Tag } from './Tag' - -export interface FormState { - color: string - id: string - group_type: string - status: string - name: string - subname: string - text: string - contact: string - telephone: string - next_appointment: string - image: string - marker_icon: string - offers: Tag[] - needs: Tag[] - relations: Item[] -} diff --git a/types/Item.d.ts b/types/Item.d.ts deleted file mode 100644 index 47560e66..00000000 --- a/types/Item.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -import type { ItemsApi } from './ItemsApi' -import type { LayerProps } from './LayerProps' -import type { Relation } from './Relation' -import type { UserItem } from './UserItem' -import type { Point } from 'geojson' - -export interface Item { - id: string - name: string - text: string - position?: Point - date_created?: string - date_updated?: string | null - start?: string - end?: string - // eslint-disable-next-line @typescript-eslint/no-explicit-any - api?: ItemsApi - tags?: string[] - layer?: LayerProps - relations?: Relation[] - parent?: string - subname?: string - public_edit?: boolean - slug?: string - user_created?: UserItem - image?: string - // eslint-disable-next-line @typescript-eslint/no-explicit-any - [key: string]: any - /* constructor( - id: string, - name: string, - text: string, - position: Geometry, - layer?: LayerProps, - api?: ItemsApi, - ) { - this.id = id - this.name = name - this.text = text - this.position = position - this.layer = layer - this.api = api - } */ -} diff --git a/types/ItemFormPopupProps.d.ts b/types/ItemFormPopupProps.d.ts deleted file mode 100644 index 64e880bb..00000000 --- a/types/ItemFormPopupProps.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { Item } from './Item' -import type { LayerProps } from './LayerProps' -import type { LatLng } from 'leaflet' - -export interface ItemFormPopupProps { - position: LatLng - layer: LayerProps - item?: Item - children?: React.ReactNode - setItemFormPopup?: React.Dispatch> -} diff --git a/types/ItemType.d.ts b/types/ItemType.d.ts deleted file mode 100644 index 1f125cc7..00000000 --- a/types/ItemType.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface ItemType { - name: string - // eslint-disable-next-line @typescript-eslint/no-explicit-any - [key: string]: any -} diff --git a/types/ItemsApi.d.ts b/types/ItemsApi.d.ts deleted file mode 100644 index 147fa462..00000000 --- a/types/ItemsApi.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export interface ItemsApi { - getItems(): Promise - getItem?(id: string): Promise - createItem?(item: T): Promise - updateItem?(item: T): Promise - deleteItem?(id: string): Promise - collectionName?: string -} diff --git a/types/LayerProps.d.ts b/types/LayerProps.d.ts deleted file mode 100644 index 7d742d5e..00000000 --- a/types/LayerProps.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import type { Item } from './Item' -import type { ItemFormPopupProps } from './ItemFormPopupProps' -import type { ItemsApi } from './ItemsApi' -import type { ItemType } from './ItemType' - -export interface LayerProps { - id?: string - data?: Item[] - children?: React.ReactNode - name: string - menuIcon: string - menuColor: string - menuText: string - markerIcon: string - markerShape: string - markerDefaultColor: string - markerDefaultColor2?: string - // eslint-disable-next-line @typescript-eslint/no-explicit-any - api?: ItemsApi - itemType: ItemType - itemNameField?: string - itemSubnameField?: string - itemTextField?: string - itemAvatarField?: string - itemColorField?: string - itemOwnerField?: string - itemTagsField?: string - itemLatitudeField?: string - itemLongitudeField?: string - itemOffersField?: string - itemNeedsField?: string - onlyOnePerOwner?: boolean - customEditLink?: string - customEditParameter?: string - public_edit_items?: boolean - listed?: boolean - item_presets?: Record - setItemFormPopup?: React.Dispatch> - itemFormPopup?: ItemFormPopupProps | null - // eslint-disable-next-line @typescript-eslint/no-explicit-any - clusterRef?: any -} diff --git a/types/Permission.d.ts b/types/Permission.d.ts deleted file mode 100644 index 57067fee..00000000 --- a/types/Permission.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { PermissionAction } from './PermissionAction' -import type { PermissionCondition } from './PermissionCondition' - -export interface Permission { - id?: string - policy?: { name: string } - collection: string - action: PermissionAction - permissions?: { - // Optional, für spezifische Bedingungen wie `user_created` - _and: PermissionCondition[] - } -} diff --git a/types/PermissionAction.d.ts b/types/PermissionAction.d.ts deleted file mode 100644 index 7278a069..00000000 --- a/types/PermissionAction.d.ts +++ /dev/null @@ -1 +0,0 @@ -export type PermissionAction = 'create' | 'read' | 'update' | 'delete' diff --git a/types/PermissionCondition.d.ts b/types/PermissionCondition.d.ts deleted file mode 100644 index e946bdb1..00000000 --- a/types/PermissionCondition.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export interface PermissionCondition { - user_created?: { - _eq: string // Erwartet den speziellen Wert "$CURRENT_USER" oder eine spezifische UUID - } - public_edit?: { - _eq: boolean // Erwartet den speziellen Wert "$CURRENT_USER" oder eine spezifische UUID - } -} diff --git a/types/Profile.d.ts b/types/Profile.d.ts deleted file mode 100644 index 4bfb8980..00000000 --- a/types/Profile.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { Geometry } from 'geojson' - -export interface Profile { - id?: string - avatar?: string - color?: string - name: string - text: string - geoposition?: Geometry -} diff --git a/types/Relation.d.ts b/types/Relation.d.ts deleted file mode 100644 index 0b038022..00000000 --- a/types/Relation.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface Relation { - related_items_id: string - // eslint-disable-next-line @typescript-eslint/no-explicit-any - [key: string]: any -} diff --git a/types/Tag.d.ts b/types/Tag.d.ts deleted file mode 100644 index 1dc7c5a9..00000000 --- a/types/Tag.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export interface Tag { - color: string - id: string - name: string - offer_or_need?: boolean -} diff --git a/types/UserApi.d.ts b/types/UserApi.d.ts deleted file mode 100644 index 6c36cd4e..00000000 --- a/types/UserApi.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { UserItem } from './UserItem' - -export interface UserApi { - register(email: string, password: string, userName: string): Promise - login(email: string, password: string): Promise - logout(): Promise - getUser(): Promise - getToken(): Promise - updateUser(user: UserItem): Promise - requestPasswordReset(email: string, reset_url?: string) - passwordReset(token: string, new_password: string) -} diff --git a/types/UserItem.d.ts b/types/UserItem.d.ts deleted file mode 100644 index 1d28817e..00000000 --- a/types/UserItem.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Profile } from './Profile' - -export interface UserItem { - id?: string - // eslint-disable-next-line @typescript-eslint/no-explicit-any - role?: any - email?: string - password?: string - profile?: Profile - first_name?: string - // eslint-disable-next-line @typescript-eslint/no-explicit-any - [key: string]: any -} diff --git a/types/UtopiaMapProps.d.ts b/types/UtopiaMapProps.d.ts deleted file mode 100644 index 99389e81..00000000 --- a/types/UtopiaMapProps.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { Tag } from './Tag' -import type { GeoJsonObject } from 'geojson' - -export interface UtopiaMapProps { - height?: string - width?: string - center?: [number, number] - zoom?: number - tags?: Tag[] - children?: React.ReactNode - geo?: GeoJsonObject - showFilterControl?: boolean - showLayerControl?: boolean - showGratitudeControl?: boolean - infoText?: string -} diff --git a/types/index.d.ts b/types/index.d.ts deleted file mode 100644 index 473c3bea..00000000 --- a/types/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -export * from './AssetsApi' -export * from './FormState' -export * from './Item' -export * from './ItemFormPopupProps' -export * from './ItemsApi' -export * from './ItemType' -export * from './LayerProps' -export * from './Permission' -export * from './PermissionAction' -export * from './PermissionCondition' -export * from './Profile' -export * from './Relation' -export * from './Tag' -export * from './UserApi' -export * from './UserItem' -export * from './UtopiaMapProps'