Skip to content

Commit c4241b6

Browse files
committed
clean up dead code
1 parent 10f30e5 commit c4241b6

File tree

4 files changed

+1
-128
lines changed

4 files changed

+1
-128
lines changed

src/ai.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use serde::{Deserialize, Serialize};
1+
use serde::Serialize;
22
use worker::*;
33

44
use crate::types::ExtractedEvent;
@@ -17,12 +17,6 @@ struct Message {
1717
content: String,
1818
}
1919

20-
#[derive(Deserialize)]
21-
#[allow(dead_code)]
22-
struct AiResponse {
23-
response: Option<String>,
24-
}
25-
2620
// ============================================================================
2721
// Responder AI Generation
2822
// ============================================================================

src/helpers.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -310,21 +310,6 @@ pub fn day_name(day: u32) -> &'static str {
310310
}
311311
}
312312

313-
/// Get short day name
314-
#[allow(dead_code)]
315-
pub fn day_name_short(day: u32) -> &'static str {
316-
match day {
317-
0 => "Sun",
318-
1 => "Mon",
319-
2 => "Tue",
320-
3 => "Wed",
321-
4 => "Thu",
322-
5 => "Fri",
323-
6 => "Sat",
324-
_ => "?",
325-
}
326-
}
327-
328313
/// Add CORS headers to a response
329314
pub fn add_cors_headers(
330315
mut response: Response,

src/storage.rs

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
285267
pub 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-
443406
pub 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-
672571
pub async fn save_event_source(db: &D1Database, source: &EventSource) -> Result<()> {
673572
let stmt = db.prepare(
674573
"INSERT OR REPLACE INTO event_sources

src/types.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -551,15 +551,13 @@ pub struct InstagramMedia {
551551
// WhatsApp Types
552552
// ============================================================================
553553

554-
#[allow(dead_code)]
555554
#[derive(Debug, Deserialize)]
556555
pub struct WhatsAppWebhook {
557556
pub object: String,
558557
#[serde(default)]
559558
pub entry: Vec<WebhookEntry>,
560559
}
561560

562-
#[allow(dead_code)]
563561
#[derive(Debug, Deserialize)]
564562
pub struct WebhookEntry {
565563
pub id: String,
@@ -573,7 +571,6 @@ pub struct WebhookChange {
573571
pub value: WebhookValue,
574572
}
575573

576-
#[allow(dead_code)]
577574
#[derive(Debug, Deserialize)]
578575
pub struct WebhookValue {
579576
pub messaging_product: String,
@@ -584,7 +581,6 @@ pub struct WebhookValue {
584581
pub messages: Vec<WhatsAppMessage>,
585582
}
586583

587-
#[allow(dead_code)]
588584
#[derive(Debug, Deserialize)]
589585
pub struct WebhookMetadata {
590586
pub display_phone_number: String,
@@ -618,7 +614,6 @@ pub struct TextMessage {
618614
pub body: String,
619615
}
620616

621-
#[allow(dead_code)]
622617
#[derive(Debug, Clone)]
623618
pub struct IncomingMessage {
624619
pub from: String,

0 commit comments

Comments
 (0)