You've already forked AstralRinth
forked from didirus/AstralRinth
Switch to Trolley for Modrinth Payments (#727)
* most of trolley * Switch to trolley for payments * run prepare * fix clippy * fix more * Fix most tests + bitflags * Update src/auth/flows.rs Co-authored-by: Jackson Kruger <jak.kruger@gmail.com> * Finish trolley * run prep for merge * Update src/queue/payouts.rs Co-authored-by: Jackson Kruger <jak.kruger@gmail.com> --------- Co-authored-by: Jackson Kruger <jak.kruger@gmail.com>
This commit is contained in:
18
src/util/bitflag.rs
Normal file
18
src/util/bitflag.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
#[macro_export]
|
||||
macro_rules! bitflags_serde_impl {
|
||||
($type:ident, $int_type:ident) => {
|
||||
impl serde::Serialize for $type {
|
||||
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
serializer.serialize_i64(self.bits() as i64)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> serde::Deserialize<'de> for $type {
|
||||
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||
let v: i64 = Deserialize::deserialize(deserializer)?;
|
||||
|
||||
Ok($type::from_bits_truncate(v as $int_type))
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
9
src/util/date.rs
Normal file
9
src/util/date.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
use chrono::Utc;
|
||||
|
||||
// this converts timestamps to the timestamp format clickhouse requires/uses
|
||||
pub fn get_current_tenths_of_ms() -> i64 {
|
||||
Utc::now()
|
||||
.timestamp_nanos_opt()
|
||||
.expect("value can not be represented in a timestamp with nanosecond precision.")
|
||||
/ 100_000
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
pub mod bitflag;
|
||||
pub mod captcha;
|
||||
pub mod cors;
|
||||
pub mod date;
|
||||
pub mod env;
|
||||
pub mod ext;
|
||||
pub mod guards;
|
||||
|
||||
Reference in New Issue
Block a user