11use crate :: config:: { ArchetypeHandle , PlantArchetype } ;
22use crate :: * ;
33use serde:: Serialize ;
4- use std :: time:: SystemTime ;
5- use tokio_postgres :: Client as PgClient ;
6- use tokio_postgres :: error :: Error as SqlError ;
4+ use time:: PrimitiveDateTime ;
5+ use sqlx :: types :: Type ;
6+ use sqlx :: FromRow ;
77
88
9- #[ derive( Clone , Debug , Serialize ) ]
9+ #[ derive( Clone , Debug , Serialize , FromRow ) ]
1010pub struct Hacksteader {
1111 pub user_id : String ,
1212 pub profile : Profile ,
@@ -15,53 +15,42 @@ pub struct Hacksteader {
1515 pub gotchis : Vec < Possessed < possess:: Gotchi > > ,
1616}
1717
18- #[ derive( Debug , Clone , Serialize ) ]
18+ #[ derive( Debug , Clone , Serialize , Type ) ]
1919pub struct Tile {
20- pub acquired : SystemTime ,
20+ pub acquired : PrimitiveDateTime ,
2121 pub plant : Option < Plant > ,
2222 pub id : uuid:: Uuid ,
2323 pub steader : String ,
2424}
2525
26- #[ derive( Clone , Debug , Serialize ) ]
26+ #[ derive( Clone , Debug , Serialize , Type ) ]
2727pub struct Profile {
2828 /// Indicates when this Hacksteader first joined the elite community.
29- pub joined : SystemTime ,
30- pub last_active : SystemTime ,
31- pub last_farm : SystemTime ,
29+ pub joined : PrimitiveDateTime ,
30+ pub last_active : PrimitiveDateTime ,
31+ pub last_farm : PrimitiveDateTime ,
3232 /// This is not an uuid::Uuid because it's actually the steader id of the person who owns this Profile
3333 pub id : String ,
34- pub xp : u64 ,
34+ pub xp : u32 ,
3535}
3636
37- #[ derive( Debug , Clone , Serialize ) ]
37+ #[ derive( Debug , Clone , Serialize , Type ) ]
3838pub struct Plant {
39- pub xp : u64 ,
39+ pub xp : u32 ,
4040 pub until_yield : f32 ,
4141 pub craft : Option < Craft > ,
4242 pub pedigree : Vec < possess:: seed:: SeedGrower > ,
4343 pub archetype_handle : ArchetypeHandle ,
4444}
4545
46- #[ derive( Debug , Clone , Serialize ) ]
46+ #[ derive( Debug , Clone , Serialize , Type ) ]
4747pub struct Craft {
4848 pub until_finish : f32 ,
4949 pub total_cycles : f32 ,
5050 pub destroys_plant : bool ,
5151 pub makes : ArchetypeHandle ,
5252}
5353
54- impl Hacksteader {
55- pub async fn insert_to_sql ( & self , client : & PgClient ) -> Result < ( ) , SqlError > {
56-
57- Ok ( ( ) )
58- }
59-
60- pub async fn update_in_sql ( & self , client : & PgClient ) -> Result < ( ) , SqlError > {
61- Ok ( ( ) )
62- }
63- }
64-
6554impl std:: ops:: Deref for Plant {
6655 type Target = PlantArchetype ;
6756
0 commit comments