Move postman and web inside src

This commit is contained in:
jude
2024-03-24 20:23:16 +00:00
parent 075fde71df
commit 4a80d42f86
152 changed files with 833 additions and 779 deletions

View File

@ -1,6 +1,6 @@
use std::collections::HashSet;
use chrono::{Duration, NaiveDateTime, Utc};
use chrono::{DateTime, NaiveDateTime, TimeDelta, Utc};
use chrono_tz::Tz;
use poise::serenity_prelude::{
model::id::{ChannelId, GuildId, UserId},
@ -73,7 +73,7 @@ impl ReminderBuilder {
match queried_time.utc_time {
Some(utc_time) => {
if utc_time < (Utc::now() - Duration::seconds(60)).naive_local() {
if utc_time < (Utc::now() - TimeDelta::try_minutes(1).unwrap()).naive_local() {
Err(ReminderError::PastTime)
} else {
sqlx::query!(
@ -165,7 +165,7 @@ impl<'a> MultiReminderBuilder<'a> {
}
pub fn time<T: Into<i64>>(mut self, time: T) -> Self {
if let Some(utc_time) = NaiveDateTime::from_timestamp_opt(time.into(), 0) {
if let Some(utc_time) = DateTime::from_timestamp(time.into(), 0).map(|d| d.naive_utc()) {
self.utc_time = utc_time;
}
@ -173,7 +173,8 @@ impl<'a> MultiReminderBuilder<'a> {
}
pub fn expires<T: Into<i64>>(mut self, time: Option<T>) -> Self {
self.expires = time.map(|t| NaiveDateTime::from_timestamp_opt(t.into(), 0)).flatten();
self.expires =
time.map(|t| DateTime::from_timestamp(t.into(), 0)).flatten().map(|d| d.naive_utc());
self
}

View File

@ -38,6 +38,7 @@ use crate::{
};
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct Reminder {
pub id: u32,
pub uid: String,

View File

@ -4,6 +4,7 @@ use sqlx::MySqlPool;
pub struct Timer {
pub name: String,
pub start_time: DateTime<Utc>,
#[allow(dead_code)]
pub owner: u64,
}

View File

@ -7,6 +7,7 @@ use crate::consts::LOCAL_TIMEZONE;
pub struct UserData {
pub id: u32,
#[allow(dead_code)]
pub user: u64,
pub dm_channel: u32,
pub timezone: String,
@ -22,7 +23,7 @@ impl UserData {
match sqlx::query!(
"
SELECT IFNULL(timezone, 'UTC') AS timezone FROM users WHERE user = ?
SELECT IFNULL(timezone, 'UTC') AS timezone FROM users WHERE user = ?
",
user_id
)