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: i32name: 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]

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]

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]

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

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

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

impl<'de> Deserialize<'de> for Identification[src]

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]

type Table = table

The table this type is associated with.

impl<'ident> Identifiable for &'ident Identification[src]

type Id = &'ident i32

The type of this struct’s identifier. Read more

impl PartialEq<Identification> for NewIdentification<'_>[src]

impl PartialEq<NewIdentification<'_>> for Identification[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]

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

impl Serialize for Identification[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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]

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

impl<'a, Parent, Child> BelongingToDsl<&'a Vec<Parent, Global>> for Child where
    Child: BelongingToDsl<&'a [Parent]>, 
[src]

type Output = <Child as BelongingToDsl<&'a [Parent]>>::Output

The query returned by belonging_to

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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]

impl<T, U> IntoPy<U> for T where
    U: FromPy<T>, 
[src]

impl<T> IntoSql for T[src]

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]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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