Struct got_ya_id::apps::ids::models::Identification [−][src]
pub struct Identification { pub id: i32, pub name: String, pub course: String, pub valid_from: Option<NaiveDate>, pub valid_till: Option<NaiveDate>, pub institution: String, pub campus: String, pub location_name: String, pub picture: Option<String>, pub location_latitude: Option<f64>, pub location_longitude: Option<f64>, // some fields omitted }
Represents the Queryable IDentification data model
matching the database identification
schema
Fields
id: i32
name: String
Full name on Identification
course: String
Major undertaken by holder or the Department
valid_from: Option<NaiveDate>
Holder’s starting Date(y-m-d)
valid_till: Option<NaiveDate>
Validity end year Date (y-m-d)
institution: String
The name of the institution the Identification belongs to. It ought to be its title only without inclusion of its location
campus: String
Location/Subtitle defining the exact location
of the institution
e.g Main, B
location_name: String
Location from which the ID should be picked
picture: Option<String>
location_latitude: Option<f64>
Latitude representation of the id location point
To be used together with location_longitude
location_longitude: Option<f64>
Longitude representation of the id location point
Implementations
impl Identification
[src]
pub fn find_by_id(key: i32) -> Result<Identification, ResError>
[src]
Finds an Identification by its primary key
pub fn retrieve_all(status: &str) -> Result<Vec<Identification>, ResError>
[src]
Retrieves all existing Identifications
Arguments
status: &str
found - Retrieve found Idts missing - Retrieve non-found Idts all - Retrieve all idts
The default is missing, for a status argument that does not match any of the three options.
Returns
An empty vec if none is present
pub fn mark_found(pk: i32) -> Result<Identification, ResError>
[src]
Marks the identification matching the given key as found
pub async fn remove_found_claims(key: i32) -> Result<(), ResError>
[src]
Removes Identification claim matches of the Identification id given. key
.
This is meant to be called once an Identification has been found, and a claim is no longer needed.
pub fn is_lost(pk: i32) -> Result<Identification, ResError>
[src]
Marks the identification matching the given key as NOT found
pub fn update(
&self,
auth_tk: &HttpRequest,
data: &UpdatableIdentification<'_>
) -> Result<Identification, ResError>
[src]
&self,
auth_tk: &HttpRequest,
data: &UpdatableIdentification<'_>
) -> Result<Identification, ResError>
Updates the Idt with the given data
pub fn show_posted_by_me(usr: &User) -> Result<Vec<Identification>, ResError>
[src]
Retrieves the idenfications that have been posted by the passed user instance.
These are idts whose posted_by
matches the user’s id
pub fn show_mine(usr: &User) -> Result<Vec<Identification>, ResError>
[src]
Retrieves the idenfications that belong to the passed user instance.
These are idts whose owner
matches the user’s id
pub fn is_now_mine(&self, _usr: &User) -> Result<(), ResError>
[src]
Mark an Idt’s owner
as the given user
The User’s details should match those of the Identification, to some (probably to be agreed) extent.
pub fn search_matching_claim(
data: &MatchedIdtJson,
usr: &User
) -> Result<Identification, ResError>
[src]
data: &MatchedIdtJson,
usr: &User
) -> Result<Identification, ResError>
Checks if the Identification and Claim IDs given in the MatchedIdtJson request match each other.
pub async fn match_claims(
&self
) -> Result<(bool, Vec<ClaimableIdentification>), ResError>
[src]
&self
) -> Result<(bool, Vec<ClaimableIdentification>), ResError>
Finds Claims that match an Identification.
This method should be analogous to NewClaim.match_idt
Returns
true: If a claim match is found for the Identification.
Trait Implementations
impl<'update> AsChangeset for &'update Identification
[src]
type Target = table
The table which Self::Changeset
will be updating
type Changeset = <(Eq<name, &'update String>, Eq<course, &'update String>, Option<Eq<valid_from, &'update NaiveDate>>, Option<Eq<valid_till, &'update NaiveDate>>, Eq<institution, &'update String>, Eq<campus, &'update String>, Eq<location_name, &'update String>, Option<Eq<picture, &'update String>>, Option<Eq<posted_by, &'update i32>>, Eq<is_found, &'update bool>, Eq<created_at, &'update NaiveDateTime>, Eq<updated_at, &'update NaiveDateTime>, Option<Eq<about, &'update String>>, Option<Eq<owner, &'update i32>>, Option<Eq<location_latitude, &'update f64>>, Option<Eq<location_longitude, &'update f64>>) as AsChangeset>::Changeset
The update statement this type represents
fn as_changeset(self) -> Self::Changeset
[src]
impl<'update> AsChangeset for Identification
[src]
type Target = table
The table which Self::Changeset
will be updating
type Changeset = <(Eq<name, String>, Eq<course, String>, Option<Eq<valid_from, NaiveDate>>, Option<Eq<valid_till, NaiveDate>>, Eq<institution, String>, Eq<campus, String>, Eq<location_name, String>, Option<Eq<picture, String>>, Option<Eq<posted_by, i32>>, Eq<is_found, bool>, Eq<created_at, NaiveDateTime>, Eq<updated_at, NaiveDateTime>, Option<Eq<about, String>>, Option<Eq<owner, i32>>, Option<Eq<location_latitude, f64>>, Option<Eq<location_longitude, f64>>) as AsChangeset>::Changeset
The update statement this type represents
fn as_changeset(self) -> Self::Changeset
[src]
impl BelongsTo<User> for Identification
[src]
type ForeignKey = i32
The foreign key of this struct
type ForeignKeyColumn = posted_by
The database column representing the foreign key of the table this struct represents Read more
fn foreign_key(&self) -> Option<&Self::ForeignKey>
[src]
fn foreign_key_column() -> Self::ForeignKeyColumn
[src]
impl<'de> Deserialize<'de> for Identification
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl From<&'_ NewIdentification<'_>> for Identification
[src]
fn from(new_idt: &NewIdentification<'_>) -> Self
[src]
Desired fields are those used in comparison between Identifications ans ClaimableIdentifications.
Usable fields are only: name, course, campus, valid_from, valid_till, institution
impl HasTable for Identification
[src]
impl<'ident> Identifiable for &'ident Identification
[src]
impl PartialEq<Identification> for NewIdentification<'_>
[src]
fn eq(&self, idt: &Identification) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<NewIdentification<'_>> for Identification
[src]
fn eq(&self, idt: &NewIdentification<'_>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<__DB: Backend, __ST> Queryable<__ST, __DB> for Identification where
(i32, String, String, Option<NaiveDate>, Option<NaiveDate>, String, String, String, Option<String>, Option<i32>, bool, NaiveDateTime, NaiveDateTime, Option<String>, Option<i32>, Option<f64>, Option<f64>): Queryable<__ST, __DB>,
[src]
(i32, String, String, Option<NaiveDate>, Option<NaiveDate>, String, String, String, Option<String>, Option<i32>, bool, NaiveDateTime, NaiveDateTime, Option<String>, Option<i32>, Option<f64>, Option<f64>): Queryable<__ST, __DB>,
type Row = <(i32, String, String, Option<NaiveDate>, Option<NaiveDate>, String, String, String, Option<String>, Option<i32>, bool, NaiveDateTime, NaiveDateTime, Option<String>, Option<i32>, Option<f64>, Option<f64>) as Queryable<__ST, __DB>>::Row
The Rust type you’d like to map from. Read more
fn build(row: Self::Row) -> Self
[src]
impl Serialize for Identification
[src]
Auto Trait Implementations
impl RefUnwindSafe for Identification
impl Send for Identification
impl Sync for Identification
impl Unpin for Identification
impl UnwindSafe for Identification
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<'a, Parent, Child> BelongingToDsl<&'a [Parent]> for Child where
Child: HasTable + BelongsTo<Parent>,
&'a Parent: Identifiable,
Vec<<&'a Parent as Identifiable>::Id, Global>: AsInExpression<<<Child as BelongsTo<Parent>>::ForeignKeyColumn as Expression>::SqlType>,
<Child as HasTable>::Table: FilterDsl<In<<Child as BelongsTo<Parent>>::ForeignKeyColumn, <Vec<<&'a Parent as Identifiable>::Id, Global> as AsInExpression<<<Child as BelongsTo<Parent>>::ForeignKeyColumn as Expression>::SqlType>>::InExpression>>,
<Child as BelongsTo<Parent>>::ForeignKeyColumn: ExpressionMethods,
[src]
Child: HasTable + BelongsTo<Parent>,
&'a Parent: Identifiable,
Vec<<&'a Parent as Identifiable>::Id, Global>: AsInExpression<<<Child as BelongsTo<Parent>>::ForeignKeyColumn as Expression>::SqlType>,
<Child as HasTable>::Table: FilterDsl<In<<Child as BelongsTo<Parent>>::ForeignKeyColumn, <Vec<<&'a Parent as Identifiable>::Id, Global> as AsInExpression<<<Child as BelongsTo<Parent>>::ForeignKeyColumn as Expression>::SqlType>>::InExpression>>,
<Child as BelongsTo<Parent>>::ForeignKeyColumn: ExpressionMethods,
type Output = <<Child as HasTable>::Table as FilterDsl<In<<Child as BelongsTo<Parent>>::ForeignKeyColumn, <Vec<<&'a Parent as Identifiable>::Id, Global> as AsInExpression<<<Child as BelongsTo<Parent>>::ForeignKeyColumn as Expression>::SqlType>>::InExpression>>>::Output
The query returned by belonging_to
pub fn belonging_to(
parents: &'a [Parent]
) -> <Child as BelongingToDsl<&'a [Parent]>>::Output
[src]
parents: &'a [Parent]
) -> <Child as BelongingToDsl<&'a [Parent]>>::Output
impl<'a, Parent, Child> BelongingToDsl<&'a Vec<Parent, Global>> for Child where
Child: BelongingToDsl<&'a [Parent]>,
[src]
Child: BelongingToDsl<&'a [Parent]>,
type Output = <Child as BelongingToDsl<&'a [Parent]>>::Output
The query returned by belonging_to
pub fn belonging_to(
parents: &'a Vec<Parent, Global>
) -> <Child as BelongingToDsl<&'a Vec<Parent, Global>>>::Output
[src]
parents: &'a Vec<Parent, Global>
) -> <Child as BelongingToDsl<&'a Vec<Parent, Global>>>::Output
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T> FromPy<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> IntoPy<U> for T where
U: FromPy<T>,
[src]
U: FromPy<T>,
impl<T> IntoSql for T
[src]
pub fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
[src]
Self: AsExpression<T>,
pub fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
[src]
&'a Self: AsExpression<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,