JavaScript is disabled, refresh for a better experience. ambee/giterated

ambee/giterated

Git repository hosting, collaboration, and discovery for the Fediverse.

Unified stack refactor clean up

Clean up obsolete code and some warnings

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨356f714

⁨giterated-models/src/settings/operations.rs⁩ - ⁨987⁩ bytes
Raw
1 use std::fmt::Debug;
2
3 use serde::{Deserialize, Serialize};
4 use serde_json::Value;
5 use thiserror::Error;
6
7 use crate::{object::GiteratedObject, operation::GiteratedOperation};
8
9 use super::AnySetting;
10
11 #[derive(Serialize, Deserialize, Debug, Clone)]
12 pub struct GetSetting {
13 pub setting_name: String,
14 }
15
16 impl<O: GiteratedObject> GiteratedOperation<O> for GetSetting {
17 fn operation_name() -> &'static str {
18 "get_setting"
19 }
20
21 type Success = Value;
22
23 type Failure = GetSettingError;
24 }
25
26 #[derive(Error, Debug, Serialize, Deserialize)]
27 pub enum GetSettingError {}
28 #[derive(Serialize, Deserialize, Debug, Clone)]
29 pub struct SetSetting {
30 pub setting_name: String,
31 pub value: AnySetting,
32 }
33
34 impl<O: GiteratedObject> GiteratedOperation<O> for SetSetting {
35 fn operation_name() -> &'static str {
36 "set_setting"
37 }
38
39 type Success = ();
40
41 type Failure = SetSettingError;
42 }
43
44 #[derive(Error, Debug, Serialize, Deserialize)]
45 pub enum SetSettingError {}
46