@@ -264,24 +264,6 @@ pub async fn get_events(
264264 Ok ( events)
265265}
266266
267- #[ allow( dead_code) ]
268- pub async fn get_event ( db : & D1Database , id : & str ) -> Result < Option < CalendarEvent > > {
269- let stmt = db. prepare (
270- "SELECT id, calendar_id, title, description, start_time, end_time,
271- all_day, recurrence_rule, created_at, updated_at
272- FROM events WHERE id = ?" ,
273- ) ;
274-
275- let results = stmt. bind ( & [ id. into ( ) ] ) ?. all ( ) . await ?;
276- let rows = results. results :: < serde_json:: Value > ( ) ?;
277-
278- if let Some ( row) = rows. into_iter ( ) . next ( ) {
279- Ok ( serde_json:: from_value ( row) . ok ( ) )
280- } else {
281- Ok ( None )
282- }
283- }
284-
285267pub async fn save_event ( db : & D1Database , event : & CalendarEvent ) -> Result < ( ) > {
286268 let stmt = db. prepare (
287269 "INSERT OR REPLACE INTO events
@@ -421,25 +403,6 @@ pub async fn get_booking(db: &D1Database, id: &str) -> Result<Option<Booking>> {
421403 }
422404}
423405
424- #[ allow( dead_code) ]
425- pub async fn get_booking_by_token ( db : & D1Database , token : & str ) -> Result < Option < Booking > > {
426- let stmt = db. prepare (
427- "SELECT id, calendar_id, booking_link_id, slot_date, slot_time, duration,
428- name, email, phone, notes, fields_data, status, confirmation_token,
429- created_at, updated_at
430- FROM bookings WHERE confirmation_token = ?" ,
431- ) ;
432-
433- let results = stmt. bind ( & [ token. into ( ) ] ) ?. all ( ) . await ?;
434- let rows = results. results :: < serde_json:: Value > ( ) ?;
435-
436- if let Some ( row) = rows. into_iter ( ) . next ( ) {
437- Ok ( serde_json:: from_value ( row) . ok ( ) )
438- } else {
439- Ok ( None )
440- }
441- }
442-
443406pub async fn save_booking ( db : & D1Database , booking : & Booking ) -> Result < ( ) > {
444407 let status_str = match booking. status {
445408 BookingStatus :: Pending => "pending" ,
@@ -605,70 +568,6 @@ pub async fn save_instagram_post(db: &D1Database, post: &ProcessedPost) -> Resul
605568// D1 Operations (Event Sources)
606569// ============================================================================
607570
608- #[ allow( dead_code) ]
609- pub async fn get_event_source_by_event_id (
610- db : & D1Database ,
611- event_id : & str ,
612- ) -> Result < Option < EventSource > > {
613- let stmt = db. prepare (
614- "SELECT id, event_id, contact_id, source_type, source_id, external_id, created_at
615- FROM event_sources WHERE event_id = ?" ,
616- ) ;
617-
618- let results = stmt. bind ( & [ event_id. into ( ) ] ) ?. all ( ) . await ?;
619- let rows = results. results :: < serde_json:: Value > ( ) ?;
620-
621- if let Some ( row) = rows. into_iter ( ) . next ( ) {
622- Ok ( serde_json:: from_value ( row) . ok ( ) )
623- } else {
624- Ok ( None )
625- }
626- }
627-
628- #[ allow( dead_code) ]
629- pub async fn get_event_source_by_contact_id (
630- db : & D1Database ,
631- contact_id : i64 ,
632- ) -> Result < Option < EventSource > > {
633- let stmt = db. prepare (
634- "SELECT id, event_id, contact_id, source_type, source_id, external_id, created_at
635- FROM event_sources WHERE contact_id = ?" ,
636- ) ;
637-
638- let results = stmt. bind ( & [ contact_id. into ( ) ] ) ?. all ( ) . await ?;
639- let rows = results. results :: < serde_json:: Value > ( ) ?;
640-
641- if let Some ( row) = rows. into_iter ( ) . next ( ) {
642- Ok ( serde_json:: from_value ( row) . ok ( ) )
643- } else {
644- Ok ( None )
645- }
646- }
647-
648- #[ allow( dead_code) ]
649- pub async fn get_event_source_by_external_id (
650- db : & D1Database ,
651- source_type : & str ,
652- external_id : & str ,
653- ) -> Result < Option < EventSource > > {
654- let stmt = db. prepare (
655- "SELECT id, event_id, contact_id, source_type, source_id, external_id, created_at
656- FROM event_sources WHERE source_type = ? AND external_id = ?" ,
657- ) ;
658-
659- let results = stmt
660- . bind ( & [ source_type. into ( ) , external_id. into ( ) ] ) ?
661- . all ( )
662- . await ?;
663- let rows = results. results :: < serde_json:: Value > ( ) ?;
664-
665- if let Some ( row) = rows. into_iter ( ) . next ( ) {
666- Ok ( serde_json:: from_value ( row) . ok ( ) )
667- } else {
668- Ok ( None )
669- }
670- }
671-
672571pub async fn save_event_source ( db : & D1Database , source : & EventSource ) -> Result < ( ) > {
673572 let stmt = db. prepare (
674573 "INSERT OR REPLACE INTO event_sources
0 commit comments