App+API: ogloszenia — strona szczegolow z autorem (GET /me/feed/announcements/:id oznacza przeczytane), skracanie list do 3 lini i menu kontekstowe Aktualnosci w topbarze (wyszukiwarka, filtr typu, filtr okresu z kalendarzowym selektorem miesiaca, akcja Oznacz wszystkie; wspoldzielony FilterDropdown; swagger + testy unit/integracyjne/e2e)
This commit is contained in:
@@ -3,6 +3,7 @@ import { api } from './client';
|
||||
import type {
|
||||
ActiveSession,
|
||||
ActivePresence,
|
||||
AnnouncementDetail,
|
||||
Availability,
|
||||
CalendarDay,
|
||||
Conversation,
|
||||
@@ -1055,6 +1056,18 @@ export function markFeedAllRead() {
|
||||
return api('/me/feed/read-all', { method: 'POST' });
|
||||
}
|
||||
|
||||
/**
|
||||
* Szczegóły ogłoszenia (strona /announcements/:id). GET oznacza przeczytane
|
||||
* po stronie API — strona unieważnia feed po wczytaniu, żeby zgasł badge.
|
||||
*/
|
||||
export function useAnnouncementDetail(id: string | undefined) {
|
||||
return useQuery({
|
||||
queryKey: ['announcement', id],
|
||||
queryFn: () => api<{ announcement: AnnouncementDetail }>(`/me/feed/announcements/${id}`),
|
||||
enabled: !!id,
|
||||
});
|
||||
}
|
||||
|
||||
// ---------- ogłoszenia siłowni (właściciel) ----------
|
||||
export function useGymAnnouncements(gymId: string | undefined, enabled = true) {
|
||||
return useQuery({
|
||||
|
||||
@@ -695,7 +695,17 @@ export interface FeedNotificationItem {
|
||||
|
||||
export type AnnouncementKind = 'MANUAL' | 'HOURS_CHANGE' | 'EXCEPTION';
|
||||
|
||||
export interface FeedAnnouncementItem {
|
||||
/** Rola autora ogłoszenia: admin platformy albo OWNER/TRENER siłowni; null = systemowe. */
|
||||
export type AnnouncementAuthorRole = 'ADMIN' | 'OWNER' | 'TRAINER';
|
||||
|
||||
/** Atrybucja „od kogo" w kontraktach list i szczegółów ogłoszeń. */
|
||||
export interface AnnouncementAuthorInfo {
|
||||
authorId: string | null;
|
||||
authorName: string | null;
|
||||
authorRole: AnnouncementAuthorRole | null;
|
||||
}
|
||||
|
||||
export interface FeedAnnouncementItem extends AnnouncementAuthorInfo {
|
||||
source: 'announcement';
|
||||
id: string;
|
||||
kind: AnnouncementKind;
|
||||
@@ -709,11 +719,20 @@ export interface FeedAnnouncementItem {
|
||||
|
||||
export type FeedItem = FeedNotificationItem | FeedAnnouncementItem;
|
||||
|
||||
/** Ogłoszenie siłowni w widoku zarządzania (właściciel) i listy członków. */
|
||||
export interface GymAnnouncement {
|
||||
/** Szczegóły pojedynczego ogłoszenia (GET /me/feed/announcements/:id, oznacza przeczytane). */
|
||||
export interface AnnouncementDetail extends AnnouncementAuthorInfo {
|
||||
id: string;
|
||||
kind: AnnouncementKind;
|
||||
title: string;
|
||||
body: string;
|
||||
gymId: string | null;
|
||||
authorId: string | null;
|
||||
gymName: string | null;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
/** Ogłoszenie siłowni w widoku zarządzania (właściciel) i listy członków. */
|
||||
export interface GymAnnouncement extends AnnouncementAuthorInfo {
|
||||
id: string;
|
||||
kind: AnnouncementKind;
|
||||
title: string;
|
||||
body: string;
|
||||
|
||||
Reference in New Issue
Block a user