Skip to main content

Employee

Struct Employee 

Source
pub struct Employee {
Show 31 fields pub employee_id: String, pub user_id: String, pub display_name: String, pub first_name: String, pub last_name: String, pub email: String, pub persona: UserPersona, pub job_level: JobLevel, pub job_title: String, pub department_id: Option<String>, pub cost_center: Option<String>, pub manager_id: Option<String>, pub direct_reports: Vec<String>, pub status: EmployeeStatus, pub company_code: String, pub working_hours: WorkingHoursPattern, pub authorized_company_codes: Vec<String>, pub authorized_cost_centers: Vec<String>, pub approval_limit: Decimal, pub can_approve_pr: bool, pub can_approve_po: bool, pub can_approve_invoice: bool, pub can_approve_je: bool, pub can_release_payment: bool, pub system_roles: Vec<SystemRole>, pub transaction_codes: Vec<TransactionCodeAuth>, pub hire_date: Option<NaiveDate>, pub termination_date: Option<NaiveDate>, pub location: Option<String>, pub is_shared_services: bool, pub phone: Option<String>,
}
Expand description

Employee master data with organizational hierarchy.

Fields§

§employee_id: String

Employee ID (e.g., “E-001234”)

§user_id: String

User ID (login name, links to User)

§display_name: String

Display name

§first_name: String

First name

§last_name: String

Last name

§email: String

Email address

§persona: UserPersona

Persona classification

§job_level: JobLevel

Job level

§job_title: String

Job title

§department_id: Option<String>

Department ID

§cost_center: Option<String>

Cost center

§manager_id: Option<String>

Manager’s employee ID (for hierarchy)

§direct_reports: Vec<String>

Direct reports (employee IDs)

§status: EmployeeStatus

Employment status

§company_code: String

Company code

§working_hours: WorkingHoursPattern

Working hours pattern

§authorized_company_codes: Vec<String>

Authorized company codes

§authorized_cost_centers: Vec<String>

Authorized cost centers

§approval_limit: Decimal

Approval limit (monetary threshold)

§can_approve_pr: bool

Can approve purchase requisitions

§can_approve_po: bool

Can approve purchase orders

§can_approve_invoice: bool

Can approve invoices

§can_approve_je: bool

Can approve journal entries

§can_release_payment: bool

Can release payments

§system_roles: Vec<SystemRole>

System roles

§transaction_codes: Vec<TransactionCodeAuth>

Authorized transaction codes

§hire_date: Option<NaiveDate>

Hire date

§termination_date: Option<NaiveDate>

Termination date (if applicable)

§location: Option<String>

Location / plant

§is_shared_services: bool

Is this an intercompany employee (works for multiple entities)?

§phone: Option<String>

Phone number

Implementations§

Source§

impl Employee

Source

pub fn new( employee_id: impl Into<String>, user_id: impl Into<String>, first_name: impl Into<String>, last_name: impl Into<String>, company_code: impl Into<String>, ) -> Self

Create a new employee.

Source

pub fn with_persona(self, persona: UserPersona) -> Self

Set persona and adjust defaults accordingly.

Source

pub fn with_job_level(self, level: JobLevel) -> Self

Set job level.

Source

pub fn with_job_title(self, title: impl Into<String>) -> Self

Set job title.

Source

pub fn with_manager(self, manager_id: impl Into<String>) -> Self

Set manager.

Source

pub fn with_department(self, department_id: impl Into<String>) -> Self

Set department.

Source

pub fn with_cost_center(self, cost_center: impl Into<String>) -> Self

Set cost center.

Source

pub fn with_approval_limit(self, limit: Decimal) -> Self

Set approval limit.

Source

pub fn with_authorized_company(self, company_code: impl Into<String>) -> Self

Add authorized company code.

Source

pub fn with_role(self, role: SystemRole) -> Self

Add system role.

Source

pub fn with_hire_date(self, date: NaiveDate) -> Self

Set hire date.

Source

pub fn add_direct_report(&mut self, employee_id: String)

Add a direct report.

Source

pub fn can_approve_amount(&self, amount: Decimal) -> bool

Check if employee can approve an amount.

Source

pub fn can_approve_in_company(&self, company_code: &str) -> bool

Check if employee can approve in a company code.

Source

pub fn has_role(&self, role: &SystemRole) -> bool

Check if employee has a specific role.

Source

pub fn hierarchy_depth(&self) -> u8

Get the depth in the org hierarchy (0 = top).

Source

pub fn to_user(&self) -> User

Convert to a User (for backward compatibility).

Trait Implementations§

Source§

impl Clone for Employee

Source§

fn clone(&self) -> Employee

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Employee

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Employee

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Employee

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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<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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,