postmasterapi::logic::letter_logic

Struct LetterLogic

pub struct LetterLogic {}

Implementations§

§

impl LetterLogic

pub fn create( conn: &PgConnection, letter1: Json<LetterRequest>, jwt_token: JwtToken, ) -> Result<LetterResponse, StatusMessage>

pub fn update( conn: &PgConnection, updated_letter1: Json<LetterRequest>, ) -> Result<LetterResponse, StatusMessage>

pub fn delete(conn: &PgConnection, id: Uuid) -> Result<usize, StatusMessage>

pub fn find( conn: &PgConnection, id: Uuid, ) -> Result<LetterResponse, StatusMessage>

pub fn get_credentials() -> Credentials

pub fn get_from_email() -> String

pub fn get_mail_server() -> String

pub fn make_letter( letter_dto: LetterCreateDto, pool: &PgConnection, org_id: Option<Uuid>, user_id: Uuid, name: Option<String>, ) -> Letter

pub fn render_send_save_letter<T>( subject: Option<String>, name: Option<String>, email: Option<String>, pool: &PgConnection, user_id: Uuid, org_id: Option<Uuid>, template: Template, data_for_template: T, footer_dto: FooterDto, header_dto: HeaderDto, from_u: Option<Uuid>, creds: Option<LetterCreds>, attachment: Option<SinglePart>, template_name: Option<Templates>, ) -> Result<Response, StatusMessage>
where T: Serialize,

pub fn send_singlepart( subject: Option<String>, name: Option<String>, email: Option<String>, text: String, credentials: Option<LetterCreds>, attachment: Option<SinglePart>, ) -> Result<Response, Error>

pub fn send_singlepart_save_letter( subject: Option<String>, name: Option<String>, email: Option<String>, text: String, letter: Option<Letter>, pool: Option<&PgConnection>, user_id: Uuid, credentials: Option<LetterCreds>, attachment: Option<SinglePart>, ) -> Result<Response, StatusMessage>

pub fn init_data_for_template<T>(entity: &T) -> BTreeMap<String, String>
where T: Serialize,

pub fn send_generic_dto_letter<T>( pool: &PgConnection, dto: T, org_id: Uuid, user_id: Uuid, template_name: Option<Templates>, ) -> Result<Response, StatusMessage>

pub fn get_template_from_resources( template: &Templates, locale: Option<String>, ) -> Option<Template>

pub fn get_template_and_header( pool: &PgConnection, template: Templates, locale: Option<String>, org_id: Option<Uuid>, ) -> Result<(Template, HeaderDto), StatusMessage>

pub fn send_registrations( pool: &PgConnection, send_registrations: SendRegistrationRequest, org_id: Option<Uuid>, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn notification_user( noti: NotificationUserRequest, ) -> Result<Response, StatusMessage>

pub fn notification_user_bulk( noti: Vec<NotificationUserRequest>, ) -> Result<(), StatusMessage>

pub fn send_password_to_user( pool: &PgConnection, send_password: SendPasswordToUserRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn send_enroll( pool: &PgConnection, enroll: EnrollRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, accept: bool, ) -> Result<Response, StatusMessage>

pub fn send_access_request( pool: &PgConnection, access_request: AccessRequestRequest, ) -> Result<Response, StatusMessage>

pub fn send_access_request_approve( pool: &PgConnection, access_request: AccessRequestApproveRequest, ) -> Result<Response, StatusMessage>

pub fn send_meeting_invitation( pool: &PgConnection, meeting_request: MeetingRequest, jwt_token: JwtToken, ) -> Result<Response, StatusMessage>

pub fn send_form_request( pool: &PgConnection, form_request: FormRequestRequest, jwt_token: JwtToken, headers: HeaderMap, loc: String, revoke: bool, ) -> Result<Response, StatusMessage>

pub fn redirect_enroll( pool: &PgConnection, redirect_enroll: RedirectEnrollRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn send_invitation( pool: &PgConnection, invitation: SendVerificationAndRecoveryRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, public_bytes: &Vec<u8>, ) -> Result<Response, StatusMessage>

pub fn send_support( request: SendSupportRequest, ) -> Result<Response, StatusMessage>

pub fn send_school_invitation( pool: &PgConnection, invitation: SendVerificationAndRecoveryRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn send_guest_request( pool: &PgConnection, guest_request: SendGuestRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn send_guest_feedback( pool: &PgConnection, guest_feedback: SendGuestFeedbackRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn send_verification( pool: &PgConnection, send_verification: SendVerificationAndRecoveryRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn send_approve_ur( pool: &PgConnection, send_approve_ur: SendApproveURRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn send_recovery( pool: &PgConnection, send_recovery: SendVerificationAndRecoveryRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn do_feedback( pool: &PgConnection, do_feedback: DoFeedbackRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn generate_calendar(cal_obj: Calendar) -> SinglePart

pub fn mailing_letters( pool: &PgConnection, mailing_letters: Vec<MailingLettersRequest>, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn resend_failed( conn: &PgConnection, resend_request: ResendFailedRequest, ) -> Result<Response, StatusMessage>

pub fn send_auth_code( app_data: Data<AppData>, jwt_token: JwtToken, _: HeaderMap, code: String, email: String, ) -> Result<StatusMessage, StatusMessage>

pub fn begin_events( pool: &PgConnection, begin_events: BeginEventRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn send_invitation_user_create( pool: &PgConnection, send_invitation_user_create: SendInvitationUserCreateRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn invite_registration_for_event( pool: &PgConnection, invite_reg_for_event: InviteRegistrationForEvent, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn notify_application_for_event( pool: &PgConnection, notify_app_for_event: NotifyApplicationForEventRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn notify_cancel( pool: &PgConnection, notify_cancel: NotifyCancelRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn notify_approve( pool: &PgConnection, notify_approve: NotifyApproveRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

pub fn notify_transmission( pool: &PgConnection, notify_transmission: NotifyTransmissionRequest, org_id: Uuid, user_id: Uuid, _user_role_id: Uuid, ) -> Result<Response, StatusMessage>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src
where Scheme: ApproxScheme,

Source§

type Err = NoError

The error type produced by a failed conversion.
Source§

fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>

Convert the given value into an approximately equivalent representation.
Source§

impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src
where Dst: ApproxFrom<Src, Scheme>, Scheme: ApproxScheme,

Source§

type Err = <Dst as ApproxFrom<Src, Scheme>>::Err

The error type produced by a failed conversion.
Source§

fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>

Convert the subject into an approximately equivalent representation.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, Dst> ConvAsUtil<Dst> for T

Source§

fn approx(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject with the default scheme.
Source§

fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject with a specific scheme.
Source§

impl<T> ConvUtil for T

Source§

fn approx_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject to a given type with the default scheme.
Source§

fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject to a given type with a specific scheme.
Source§

fn into_as<Dst>(self) -> Dst
where Self: Sized + Into<Dst>,

Convert the subject to a given type.
Source§

fn try_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + TryInto<Dst>,

Attempt to convert the subject to a given type.
Source§

fn value_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ValueInto<Dst>,

Attempt a value conversion of the subject to a given type.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoSql for T

Source§

fn into_sql<T>(self) -> Self::Expression
where Self: Sized + AsExpression<T>,

Convert self to an expression for Diesel’s query builder. Read more
Source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>,

Convert &self to an expression for Diesel’s query builder. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<Src> TryFrom<Src> for Src

Source§

type Err = NoError

The error type produced by a failed conversion.
Source§

fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>

Convert the given value into the subject type.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<Src, Dst> TryInto<Dst> for Src
where Dst: TryFrom<Src>,

Source§

type Err = <Dst as TryFrom<Src>>::Err

The error type produced by a failed conversion.
Source§

fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>

Convert the subject into the destination type.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<Src> ValueFrom<Src> for Src

Source§

type Err = NoError

The error type produced by a failed conversion.
Source§

fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>

Convert the given value into an exactly equivalent representation.
Source§

impl<Src, Dst> ValueInto<Dst> for Src
where Dst: ValueFrom<Src>,

Source§

type Err = <Dst as ValueFrom<Src>>::Err

The error type produced by a failed conversion.
Source§

fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>

Convert the subject into an exactly equivalent representation.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T