Compare commits
3 Commits
2a1f13a5f0
...
a2c3f16dc7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2c3f16dc7 | ||
|
|
44e6b2a6dc | ||
|
|
42508af610 |
@@ -1,11 +1,10 @@
|
|||||||
import uuid
|
|
||||||
|
|
||||||
from pydantic import BaseModel, EmailStr, ConfigDict
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Optional, Any, Dict
|
from typing import Optional, Any, Dict
|
||||||
from app.models.guest import GuestStatus
|
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
|
from pydantic import BaseModel, EmailStr, ConfigDict
|
||||||
|
|
||||||
|
from app.models.guest import GuestStatus
|
||||||
from app.schemas.rsvp import RSVPSchema, RSVPStatus
|
from app.schemas.rsvp import RSVPSchema, RSVPStatus
|
||||||
|
|
||||||
|
|
||||||
@@ -50,6 +49,8 @@ class GuestRead(GuestBase):
|
|||||||
is_blocked: bool
|
is_blocked: bool
|
||||||
model_config = ConfigDict(from_attributes=True)
|
model_config = ConfigDict(from_attributes=True)
|
||||||
invitation_code: str
|
invitation_code: str
|
||||||
|
rsvp: Optional[RSVPSchema] = None
|
||||||
|
|
||||||
|
|
||||||
class GuestWithRSVPResponse(BaseModel):
|
class GuestWithRSVPResponse(BaseModel):
|
||||||
"""
|
"""
|
||||||
@@ -62,6 +63,7 @@ class GuestWithRSVPResponse(BaseModel):
|
|||||||
class Config:
|
class Config:
|
||||||
from_attributes = True
|
from_attributes = True
|
||||||
|
|
||||||
|
|
||||||
def map_rsvp_status_to_guest_status(rsvp_status: RSVPStatus) -> GuestStatus:
|
def map_rsvp_status_to_guest_status(rsvp_status: RSVPStatus) -> GuestStatus:
|
||||||
if rsvp_status == RSVPStatus.ATTENDING:
|
if rsvp_status == RSVPStatus.ATTENDING:
|
||||||
return GuestStatus.CONFIRMED
|
return GuestStatus.CONFIRMED
|
||||||
@@ -70,4 +72,4 @@ def map_rsvp_status_to_guest_status(rsvp_status: RSVPStatus) -> GuestStatus:
|
|||||||
elif rsvp_status == RSVPStatus.MAYBE:
|
elif rsvp_status == RSVPStatus.MAYBE:
|
||||||
return GuestStatus.PENDING
|
return GuestStatus.PENDING
|
||||||
else:
|
else:
|
||||||
return GuestStatus.INVITED
|
return GuestStatus.INVITED
|
||||||
|
|||||||
@@ -2427,6 +2427,16 @@ export const GuestReadSchema = {
|
|||||||
type: "string",
|
type: "string",
|
||||||
title: "Invitation Code",
|
title: "Invitation Code",
|
||||||
},
|
},
|
||||||
|
rsvp: {
|
||||||
|
anyOf: [
|
||||||
|
{
|
||||||
|
$ref: "#/components/schemas/RSVPSchema",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "null",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
type: "object",
|
type: "object",
|
||||||
required: [
|
required: [
|
||||||
|
|||||||
@@ -370,6 +370,7 @@ export type GuestRead = {
|
|||||||
actual_additional_guests: number;
|
actual_additional_guests: number;
|
||||||
is_blocked: boolean;
|
is_blocked: boolean;
|
||||||
invitation_code: string;
|
invitation_code: string;
|
||||||
|
rsvp?: RsvpSchema | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type GuestStatus =
|
export type GuestStatus =
|
||||||
|
|||||||
@@ -578,8 +578,8 @@ const GuestListTable = ({ event }: GuestListTableProps) => {
|
|||||||
|
|
||||||
{/* Dietary Restrictions Column */}
|
{/* Dietary Restrictions Column */}
|
||||||
<TableCell>
|
<TableCell>
|
||||||
{guest.dietary_restrictions &&
|
{guest.rsvp?.dietary_requirements &&
|
||||||
guest.dietary_restrictions.length > 0 ? (
|
guest.rsvp.dietary_requirements.length > 0 ? (
|
||||||
<Popover>
|
<Popover>
|
||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
@@ -592,7 +592,7 @@ const GuestListTable = ({ event }: GuestListTableProps) => {
|
|||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent className="max-w-xs">
|
<PopoverContent className="max-w-xs">
|
||||||
<p className="text-sm">
|
<p className="text-sm">
|
||||||
{guest.dietary_restrictions}
|
{guest.rsvp.dietary_requirements}
|
||||||
</p>
|
</p>
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
@@ -603,7 +603,8 @@ const GuestListTable = ({ event }: GuestListTableProps) => {
|
|||||||
|
|
||||||
{/* Notes Column */}
|
{/* Notes Column */}
|
||||||
<TableCell>
|
<TableCell>
|
||||||
{guest.notes && guest.notes.length > 0 ? (
|
{guest.rsvp?.response_message &&
|
||||||
|
guest.rsvp.response_message.length > 0 ? (
|
||||||
<Popover>
|
<Popover>
|
||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
@@ -615,7 +616,9 @@ const GuestListTable = ({ event }: GuestListTableProps) => {
|
|||||||
</Button>
|
</Button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent className="max-w-xs">
|
<PopoverContent className="max-w-xs">
|
||||||
<p className="text-sm">{guest.notes}</p>
|
<p className="text-sm">
|
||||||
|
{guest.rsvp.response_message}
|
||||||
|
</p>
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
Reference in New Issue
Block a user