add: economy api
This commit is contained in:
parent
0a3ce3e9fe
commit
3c4ce1fae5
6 changed files with 51 additions and 16 deletions
|
@ -4,7 +4,7 @@ use crate::{auto_method, DataManager};
|
|||
use oiseau::{cache::Cache, execute, get, params, query_rows, PostgresRow};
|
||||
|
||||
impl DataManager {
|
||||
/// Get a [`Letter`] from an SQL row.
|
||||
/// Get a [`CoinTransfer`] from an SQL row.
|
||||
pub(crate) fn get_transfer_from_row(x: &PostgresRow) -> CoinTransfer {
|
||||
CoinTransfer {
|
||||
id: get!(x->0(i64)) as usize,
|
||||
|
@ -51,7 +51,7 @@ impl DataManager {
|
|||
/// Create a new transfer in the database.
|
||||
///
|
||||
/// # Arguments
|
||||
/// * `data` - a mock [`Letter`] object to insert
|
||||
/// * `data` - a mock [`CoinTransfer`] object to insert
|
||||
pub async fn create_transfer(&self, data: CoinTransfer) -> Result<CoinTransfer> {
|
||||
// check values
|
||||
let mut sender = self.get_user_by_id(data.sender).await?;
|
||||
|
|
|
@ -106,6 +106,8 @@ pub enum AppScope {
|
|||
UserCreateProducts,
|
||||
/// Create letters on behalf of the user.
|
||||
UserCreateLetters,
|
||||
/// Send coins on behalf of the user.
|
||||
UserSendCoins,
|
||||
/// Delete posts owned by the user.
|
||||
UserDeletePosts,
|
||||
/// Delete messages owned by the user.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue