All files / src/types/service group.ts

0% Statements 0/228
0% Branches 0/1
0% Functions 0/1
0% Lines 0/228

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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
// Group V2 공통 타입
export type GroupV2Status = 'RECRUITING' | 'FULL' | 'CLOSED' | 'CANCELLED' | 'FINISHED';

export type GroupV2JoinPolicy = 'FREE' | 'APPROVAL_REQUIRED';

export type GroupV2ListFilter = 'ACTIVE' | 'ARCHIVED' | 'ALL';

export type GroupUserV2Status = 'ATTEND' | 'LEFT' | 'KICKED' | 'BANNED' | 'PENDING' | 'REJECTED';

export interface GroupV2Membership {
  groupUserId: number;
  role: 'HOST' | 'MANAGER' | 'MEMBER';
  status: GroupUserV2Status;
  joinedAt: string;
  leftAt: string | null;
}

// 모임 목록 조회 응답 (GET /api/v2/groups, GET /api/v2/groups/me)
export interface GroupListItemResponse {
  id: number;
  title: string;
  // v2 추가 필드
  joinPolicy: GroupV2JoinPolicy;
  status: GroupV2Status;

  location: string;
  locationDetail?: string | null;
  startTime: string; // ISO 8601 형식: "2026-12-25T19:00:00"
  endTime?: string | null; // ISO 8601 형식: "2026-12-25T21:00:00"
  images: string[]; // CARD_440_240 URL 배열 (최대 3개)
  tags: string[];
  description: string;
  participantCount: number;
  maxParticipants: number;
  // v2 추가 필드
  remainingSeats: number;
  joinable: boolean;

  createdBy: {
    userId: number;
    nickName: string;
    profileImage: string | null;
    profileMessage?: string | null;
  };
  createdAt: string; // ISO 8601 형식
  updatedAt: string; // ISO 8601 형식

  // /api/v2/groups/me 에서만 내려오는 필드 (목록에서는 선택적)
  myMembership?: GroupV2Membership | null;
}

// 모임 목록 조회 요청 파라미터 (GET /api/v2/groups)
export interface GetGroupsPayload {
  keyword?: string;
  cursor?: number;
  size: number;
  // v2 필터 옵션들 (선택)
  filter?: GroupV2ListFilter;
  includeStatuses?: GroupV2Status[];
  excludeStatuses?: GroupV2Status[];
}

// 모임 목록 조회 응답
export interface GetGroupsResponse {
  items: GroupListItemResponse[];
  nextCursor: number | null;
}

// 내 모임 목록 조회 요청 파라미터 (GET /api/v2/groups/me)
export interface GetMyGroupsPayload {
  type: 'current' | 'myPost' | 'past';
  cursor?: number;
  size: number;
  // v2 필터 옵션들 (선택)
  filter?: GroupV2ListFilter;
  includeStatuses?: GroupV2Status[];
  excludeStatuses?: GroupV2Status[];
  myStatuses?: GroupUserV2Status[];
}

// 내 모임 목록 조회 응답
export interface GetMyGroupsResponse {
  items: GroupListItemResponse[];
  nextCursor: number | null;
}

export interface PreUploadGroupImagePayload {
  images: File[];
}

export interface PreUploadGroupImageResponse {
  images: {
    imageKey: string;
    sortOrder: number;
    imageUrl440x240: string;
    imageUrl100x100: string;
  }[];
}

export interface CreateGroupPayload {
  title: string;
  location: string;
  locationDetail?: string | null;
  startTime: string;
  endTime?: string;
  tags?: string[] | null;
  description: string;
  maxParticipants: number;
  images?: {
    imageKey: string;
    sortOrder: number;
  }[];
  // v2 기준: FREE / APPROVAL_REQUIRED
  joinPolicy: GroupV2JoinPolicy;
}

export interface CreateGroupResponse {
  id: number;
  title: string;
  // v2 상태 타입
  status: GroupV2Status;
  address: {
    location: string;
    locationDetail: string;
  };
  startTime: string;
  endTime: string;
  tags: string[];
  description: string;
  participantCount: number;
  maxParticipants: number;
  createdAt: string;
  updatedAt: string;
  createdBy: {
    userId: number;
    nickName: string;
    profileImage: string | null;
    profileMessage: string | null;
  };
  myMembership?: GroupV2Membership | null;
  images: {
    groupImageId: number;
    imageKey: string;
    sortOrder: number;
    variants: {
      variantId: number;
      type: 'CARD_440_240' | 'THUMBNAIL_100_100';
      width: number;
      height: number;
      format: 'WEBP';
      imageUrl: string;
    }[];
  }[];
}

export interface GetGroupDetailsResponse {
  id: number;
  title: string;
  joinPolicy: GroupV2JoinPolicy;
  status: GroupV2Status;
  address: {
    location: string;
    locationDetail: string;
  };
  startTime: string;
  endTime?: string | null;
  images: {
    groupImageId: number;
    imageKey: string;
    sortOrder: number;
    variants: {
      variantId: number;
      // v2 이미지 타입
      type: 'CARD_440_240' | 'THUMBNAIL_100_100';
      width: number;
      height: number;
      format: 'WEBP';
      imageUrl: string;
    }[];
  }[];
  tags: string[];
  description: string;
  participantCount: number;
  maxParticipants: number;
  createdBy: {
    userId: number;
    nickName: string;
    profileImage: string | null;
    profileMessage: string | null;
  };
  createdAt: string;
  updatedAt: string;
  myMembership?: GroupV2Membership | null;
  joinedMembers: {
    userId: number;
    role: 'HOST' | 'MANAGER' | 'MEMBER';
    status: GroupUserV2Status;
    nickName: string;
    profileImage: string | null;
    joinedAt: string;
    leftAt: string | null;
  }[];
}

export interface GroupIdParams {
  groupId: string;
}

export interface KickGroupMemberParams {
  groupId: GroupIdParams['groupId'];
  targetUserId: string;
}

// 승인 대기자 목록 조회 응답 (GET /api/v2/groups/{groupId}/attendance/pending)
export interface GetPendingMembersResponse {
  groupId: number;
  joinPolicy: GroupV2JoinPolicy;
  pendingMembers: {
    userId: number;
    groupUserId: number;
    nickName: string;
    profileImage: string | null;
    profileMessage: string | null;
    requestMessage: string | null;
    requestedAt: string;
  }[];
  serverTime: string;
}