-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
199 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use holaplex_hub_nfts_solana_entity::compression_leafs::{ActiveModel, Column, Entity, Model}; | ||
use sea_orm::prelude::*; | ||
|
||
use crate::db::Connection; | ||
|
||
pub struct CompressionLeaf; | ||
|
||
impl CompressionLeaf { | ||
pub async fn create(db: &Connection, model: Model) -> Result<Model, DbErr> { | ||
let conn = db.get(); | ||
|
||
let active_model: ActiveModel = model.into(); | ||
|
||
active_model.insert(conn).await | ||
} | ||
|
||
pub async fn find_by_id(db: &Connection, id: Uuid) -> Result<Option<Model>, DbErr> { | ||
let conn = db.get(); | ||
|
||
Entity::find().filter(Column::Id.eq(id)).one(conn).await | ||
} | ||
|
||
pub async fn update(db: &Connection, model: ActiveModel) -> Result<Model, DbErr> { | ||
let conn = db.get(); | ||
|
||
model.update(conn).await | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.5 | ||
|
||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, Default, PartialEq, DeriveEntityModel, Eq)] | ||
#[sea_orm(table_name = "compression_leafs")] | ||
pub struct Model { | ||
#[sea_orm(primary_key, auto_increment = false)] | ||
pub id: Uuid, | ||
pub collection_id: Uuid, | ||
#[sea_orm(column_type = "Text")] | ||
pub merkle_tree: String, | ||
#[sea_orm(column_type = "Text")] | ||
pub tree_authority: String, | ||
#[sea_orm(column_type = "Text")] | ||
pub tree_delegate: String, | ||
#[sea_orm(column_type = "Text")] | ||
pub leaf_owner: String, | ||
#[sea_orm(column_type = "Text", nullable)] | ||
pub asset_id: Option<String>, | ||
pub created_at: DateTime, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation {} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod collection_mints; | ||
pub mod collections; | ||
pub mod compression_leafs; | ||
|
||
pub mod prelude; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.5 | ||
|
||
pub use super::{collection_mints::Entity as CollectionMints, collections::Entity as Collections}; | ||
pub use super::{ | ||
collection_mints::Entity as CollectionMints, collections::Entity as Collections, | ||
compression_leafs::Entity as CompressionLeafs, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.