All files / src/services/api speakerNominationApi.ts

33.33% Statements 1/3
100% Branches 0/0
0% Functions 0/1
33.33% Lines 1/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37                                                    3x                    
/**
 * Speaker Self-Nomination API Client — Story 7.2 "I Could Speak on That".
 *
 * A logged-in attendee raises their hand with a proposed talk for a specific upcoming event
 * (the event card supplies the eventCode). Flows into the existing speaker pool at IDENTIFIED
 * tagged source=self_nomination — see event-management-service SelfNominationController.
 *
 * CRITICAL: paths are relative to baseURL (which already includes /api/v1).
 */
 
import apiClient from '@/services/api/apiClient';
import type { SpeakerPoolResponse } from '@/types/speakerPool.types';
 
export interface SelfNominateRequest {
  /** The proposed talk title. */
  sessionTitle: string;
  /** The proposed talk abstract (stored raw). */
  abstract: string;
}
 
/**
 * Self-nominate as a speaker for {@code eventCode}. The attendee's name + company are
 * auto-filled server-side from their profile — the body carries only the proposed talk.
 *
 * @throws on 409 if the event's topic is unset/unpublished, or the attendee already nominated.
 */
export const selfNominateSpeaker = async (
  eventCode: string,
  req: SelfNominateRequest
): Promise<SpeakerPoolResponse> => {
  const response = await apiClient.post<SpeakerPoolResponse>(
    `/events/${eventCode}/speakers/self-nominate`,
    req
  );
  return response.data;
};