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