This commit is contained in:
che
2026-07-25 19:18:32 +05:00
parent 2032725563
commit 1441a14b90
14 changed files with 257 additions and 88 deletions
+17 -17
View File
@@ -5,9 +5,9 @@ use super::models::{Contract, ContractApplicationFile, ContractCategory, Counter
static CONTRACTAPP_FILTERS: &[Filter] = &[ static CONTRACTAPP_FILTERS: &[Filter] = &[
Filter::exact("id"), Filter::exact("id"),
Filter::exact("name"), Filter::exact("name"),
Filter::contains("name"), Filter::contains("name").remote("name_of_product"),
Filter::exact("number"), Filter::exact("number"),
Filter::contains("number"), Filter::contains("number").remote("number"),
Filter::exact("date"), Filter::exact("date"),
Filter::exact("status"), Filter::exact("status"),
Filter::exact("status_name"), Filter::exact("status_name"),
@@ -16,50 +16,50 @@ static CONTRACTAPP_FILTERS: &[Filter] = &[
Filter::contains("contract_type"), Filter::contains("contract_type"),
Filter::exact("category"), Filter::exact("category"),
Filter::contains("category"), Filter::contains("category"),
Filter::exact("category_id"), Filter::exact("category_id").remote("category"),
Filter::contains("counterparty_name"), Filter::contains("counterparty_name"),
Filter::contains("name_of_product"), Filter::contains("name_of_product").remote("name_of_product"),
Filter::exact("counterparty_id"), Filter::exact("counterparty_id").remote("company"),
Filter::exact("project_id"), Filter::exact("project_id").remote("project"),
Filter::exact("frc_id"), Filter::exact("frc_id").remote("frc"),
Filter::exact("employee_id"), Filter::exact("employee_id").remote("employee"),
]; ];
static CONTRACT_CATEGORY_FILTERS: &[Filter] = &[ static CONTRACT_CATEGORY_FILTERS: &[Filter] = &[
Filter::exact("id"), Filter::exact("id"),
Filter::exact("name"), Filter::exact("name"),
Filter::contains("name"), Filter::contains("name").local_only(),
Filter::exact("name_group"), Filter::exact("name_group"),
Filter::contains("name_group"), Filter::contains("name_group").local_only(),
]; ];
static COUNTERPARTY_FILTERS: &[Filter] = &[ static COUNTERPARTY_FILTERS: &[Filter] = &[
Filter::exact("id"), Filter::exact("id"),
Filter::exact("name"), Filter::exact("name"),
Filter::contains("name"), Filter::contains("name").remote("search"),
]; ];
static CONTRACT_APPLICATION_FILE_FILTERS: &[Filter] = &[ static CONTRACT_APPLICATION_FILE_FILTERS: &[Filter] = &[
Filter::exact("id"), Filter::exact("id"),
Filter::exact("contract_id"), Filter::exact("contract_id").remote("contract"),
Filter::exact("name"), Filter::exact("name"),
Filter::contains("name"), Filter::contains("name").remote("search"),
Filter::exact("file_type"), Filter::exact("file_type"),
Filter::exact("status"), Filter::exact("status"),
]; ];
pub fn contractapp_filterset() -> FilterSet<Contract> { pub fn contractapp_filterset() -> FilterSet<Contract> {
FilterSet::new(CONTRACTAPP_FILTERS) FilterSet::new(CONTRACTAPP_FILTERS).remote_ordering("order_by")
} }
pub fn contract_category_filterset() -> FilterSet<ContractCategory> { pub fn contract_category_filterset() -> FilterSet<ContractCategory> {
FilterSet::new(CONTRACT_CATEGORY_FILTERS) FilterSet::new(CONTRACT_CATEGORY_FILTERS).remote_ordering("order_by")
} }
pub fn counterparty_filterset() -> FilterSet<Counterparty> { pub fn counterparty_filterset() -> FilterSet<Counterparty> {
FilterSet::new(COUNTERPARTY_FILTERS) FilterSet::new(COUNTERPARTY_FILTERS).remote_ordering("order_by")
} }
pub fn contract_application_file_filterset() -> FilterSet<ContractApplicationFile> { pub fn contract_application_file_filterset() -> FilterSet<ContractApplicationFile> {
FilterSet::new(CONTRACT_APPLICATION_FILE_FILTERS) FilterSet::new(CONTRACT_APPLICATION_FILE_FILTERS).remote_ordering("order_by")
} }
+8 -4
View File
@@ -16,23 +16,27 @@ impl AppModule for ContractappModule {
} }
fn init(&self, ctx: &mut ModuleContext) { fn init(&self, ctx: &mut ModuleContext) {
ctx.resource::<models::Contract>( ctx.mapped_remote_resource::<models::Contract>(
"contract", "contract",
"/api/contract/",
serializers::contractapp_serializer(), serializers::contractapp_serializer(),
filters::contractapp_filterset(), filters::contractapp_filterset(),
); );
ctx.resource::<models::ContractCategory>( ctx.mapped_remote_resource::<models::ContractCategory>(
"contract_category", "contract_category",
"/api/cont/category/",
serializers::contract_category_serializer(), serializers::contract_category_serializer(),
filters::contract_category_filterset(), filters::contract_category_filterset(),
); );
ctx.resource::<models::Counterparty>( ctx.mapped_remote_resource::<models::Counterparty>(
"counterparty", "counterparty",
"/api/catalog/company/",
serializers::counterparty_serializer(), serializers::counterparty_serializer(),
filters::counterparty_filterset(), filters::counterparty_filterset(),
); );
ctx.resource::<models::ContractApplicationFile>( ctx.mapped_remote_resource::<models::ContractApplicationFile>(
"contract_application_file", "contract_application_file",
"/api/cont/appfile/",
serializers::contract_application_file_serializer(), serializers::contract_application_file_serializer(),
filters::contract_application_file_filterset(), filters::contract_application_file_filterset(),
); );
+38 -22
View File
@@ -12,19 +12,19 @@ static CONTRACT_FIELDS: &[Field] = &[
Field::new("id").read_only(), Field::new("id").read_only(),
Field::new("name"), Field::new("name"),
Field::new("number"), Field::new("number"),
Field::new("absolute_url"), Field::new("absolute_url").source("get_absolute_url"),
Field::new("contract_type"), Field::new("contract_type").source("get_type"),
Field::new("category"), Field::new("category").source("get_category"),
Field::new("category_id").required(false).nullable(), Field::new("category_id").required(false).nullable(),
Field::new("amount_total_display"), Field::new("amount_total_display").source("get_amount_total"),
Field::new("amount_by_ds"), Field::new("amount_by_ds").source("get_amount_by_ds"),
Field::new("comment"), Field::new("comment"),
Field::new("date"), Field::new("date"),
Field::new("status_name"), Field::new("status_name").source("get_status"),
Field::new("status"), Field::new("status"),
Field::new("nds"), Field::new("nds"),
Field::new("name_of_product"), Field::new("name_of_product"),
Field::new("counterparty_name"), Field::new("counterparty_name").source("counterparty"),
Field::new("amount"), Field::new("amount"),
Field::new("month_pay").required(false).nullable(), Field::new("month_pay").required(false).nullable(),
Field::new("avans_pay"), Field::new("avans_pay"),
@@ -35,15 +35,27 @@ static CONTRACT_FIELDS: &[Field] = &[
Field::new("bill_paid_sum").required(false).nullable(), Field::new("bill_paid_sum").required(false).nullable(),
Field::new("income_total"), Field::new("income_total"),
Field::new("arrears"), Field::new("arrears"),
Field::new("counterparty_id").required(false).nullable(), Field::new("counterparty_id")
Field::new("project_id").required(false).nullable(), .source("company")
Field::new("frc_id").required(false).nullable(), .required(false)
Field::new("employee_id").required(false).nullable(), .nullable(),
Field::new("project_id")
.source("project")
.required(false)
.nullable(),
Field::new("frc_id")
.source("frc")
.required(false)
.nullable(),
Field::new("employee_id")
.source("get_employee")
.required(false)
.nullable(),
Field::related("category_ref", "category_id", &CATEGORY_RELATION), Field::related("category_ref", "category_id", &CATEGORY_RELATION),
Field::related("counterparty", "counterparty_id", &COUNTERPARTY_RELATION), Field::related("counterparty", "company", &COUNTERPARTY_RELATION),
Field::related("project", "project_id", &PROJECT_RELATION), Field::related("project", "project", &PROJECT_RELATION),
Field::related("frc", "frc_id", &FRC_RELATION), Field::related("frc", "frc", &FRC_RELATION),
Field::related("employee", "employee_id", &EMPLOYEE_RELATION), Field::related("employee", "get_employee", &EMPLOYEE_RELATION),
]; ];
static CONTRACT_CATEGORY_FIELDS: &[Field] = &[ static CONTRACT_CATEGORY_FIELDS: &[Field] = &[
@@ -58,16 +70,16 @@ static CONTRACT_CATEGORY_FIELDS: &[Field] = &[
static COUNTERPARTY_FIELDS: &[Field] = &[Field::new("id").read_only(), Field::new("name")]; static COUNTERPARTY_FIELDS: &[Field] = &[Field::new("id").read_only(), Field::new("name")];
static CONTRACT_APPLICATION_FILE_FIELDS: &[Field] = &[ static CONTRACT_APPLICATION_FILE_FIELDS: &[Field] = &[
Field::new("id").read_only(), Field::new("id").read_only(),
Field::new("contract_id"), Field::new("contract_id").source("contract"),
Field::new("name"), Field::new("name"),
Field::new("file_type"), Field::new("file_type"),
Field::new("file_type_display"), Field::new("file_type_display").source("get_file_type_display"),
Field::new("status"), Field::new("status"),
Field::new("status_display"), Field::new("status_display").source("get_status_display"),
Field::new("absolute_url"), Field::new("absolute_url").source("get_absolute_url"),
Field::new("scan_name"), Field::new("scan_name").source("get_scan"),
Field::new("scan_url"), Field::new("scan_url").source("scan"),
Field::new("local_path"), Field::new("local_path").default(empty_string),
Field::new("comment"), Field::new("comment"),
Field::new("bill_total"), Field::new("bill_total"),
Field::new("bill_cost_total"), Field::new("bill_cost_total"),
@@ -83,6 +95,10 @@ static PROJECT_RELATION: RelatedModel<Project> = RelatedModel::new(project_seria
static FRC_RELATION: RelatedModel<Frc> = RelatedModel::new(frc_serializer); static FRC_RELATION: RelatedModel<Frc> = RelatedModel::new(frc_serializer);
static EMPLOYEE_RELATION: RelatedModel<Employee> = RelatedModel::new(employee_serializer); static EMPLOYEE_RELATION: RelatedModel<Employee> = RelatedModel::new(employee_serializer);
fn empty_string() -> serde_json::Value {
serde_json::Value::String(String::new())
}
pub fn contractapp_serializer() -> ModelSerializer<Contract> { pub fn contractapp_serializer() -> ModelSerializer<Contract> {
ModelSerializer::new(CONTRACT_FIELDS) ModelSerializer::new(CONTRACT_FIELDS)
} }
+2 -2
View File
@@ -5,9 +5,9 @@ use super::models::Frc;
static FRC_FILTERS: &[Filter] = &[ static FRC_FILTERS: &[Filter] = &[
Filter::exact("id"), Filter::exact("id"),
Filter::exact("name"), Filter::exact("name"),
Filter::contains("name"), Filter::contains("name").local_only(),
]; ];
pub fn frc_filterset() -> FilterSet<Frc> { pub fn frc_filterset() -> FilterSet<Frc> {
FilterSet::new(FRC_FILTERS) FilterSet::new(FRC_FILTERS).remote_ordering("order_by")
} }
+2 -1
View File
@@ -16,8 +16,9 @@ impl AppModule for FrcModule {
} }
fn init(&self, ctx: &mut ModuleContext) { fn init(&self, ctx: &mut ModuleContext) {
ctx.resource::<models::Frc>( ctx.mapped_remote_resource::<models::Frc>(
"frc", "frc",
"/api/frc/frc/",
serializers::frc_serializer(), serializers::frc_serializer(),
filters::frc_filterset(), filters::frc_filterset(),
); );
+1 -1
View File
@@ -6,7 +6,7 @@ static FRC_FIELDS: &[Field] = &[
Field::new("id").read_only(), Field::new("id").read_only(),
Field::new("name"), Field::new("name"),
Field::new("icon"), Field::new("icon"),
Field::new("balance"), Field::new("balance").source("get_balance"),
]; ];
pub fn frc_serializer() -> ModelSerializer<Frc> { pub fn frc_serializer() -> ModelSerializer<Frc> {
+15 -11
View File
@@ -5,17 +5,21 @@ use super::models::{Employee, Message, Task, TaskTransfer};
static EMPLOYEE_FILTERS: &[Filter] = &[ static EMPLOYEE_FILTERS: &[Filter] = &[
Filter::exact("id"), Filter::exact("id"),
Filter::exact("name"), Filter::exact("name"),
Filter::contains("name"), Filter::contains("name").remote("name"),
Filter::exact("short_name"), Filter::exact("short_name"),
Filter::contains("short_name"), Filter::contains("short_name").remote("name"),
]; ];
static TASK_FILTERS: &[Filter] = &[ static TASK_FILTERS: &[Filter] = &[
Filter::exact("id"), Filter::exact("id"),
Filter::exact("name"), Filter::contains("text"),
Filter::contains("name"), Filter::remote_only("doer"),
Filter::exact("author_id"), Filter::remote_only("author"),
Filter::exact("responsible_id"), Filter::exact("archive"),
Filter::exact("typ"),
Filter::exact("status"),
Filter::remote_only("q"),
Filter::remote_only("incomplete"),
]; ];
static MESSAGE_FILTERS: &[Filter] = &[ static MESSAGE_FILTERS: &[Filter] = &[
@@ -26,18 +30,18 @@ static MESSAGE_FILTERS: &[Filter] = &[
static TASK_TRANSFER_FILTERS: &[Filter] = &[ static TASK_TRANSFER_FILTERS: &[Filter] = &[
Filter::exact("id"), Filter::exact("id"),
Filter::exact("employee_from_id"), Filter::remote_only("employee_from"),
Filter::exact("employee_to_id"), Filter::remote_only("employee_to"),
Filter::exact("status"), Filter::exact("status"),
Filter::exact("typ"), Filter::exact("typ"),
]; ];
pub fn employee_filterset() -> FilterSet<Employee> { pub fn employee_filterset() -> FilterSet<Employee> {
FilterSet::new(EMPLOYEE_FILTERS) FilterSet::new(EMPLOYEE_FILTERS).remote_ordering("order_by")
} }
pub fn task_filterset() -> FilterSet<Task> { pub fn task_filterset() -> FilterSet<Task> {
FilterSet::new(TASK_FILTERS) FilterSet::new(TASK_FILTERS).remote_ordering("order_by")
} }
pub fn message_filterset() -> FilterSet<Message> { pub fn message_filterset() -> FilterSet<Message> {
@@ -45,5 +49,5 @@ pub fn message_filterset() -> FilterSet<Message> {
} }
pub fn task_transfer_filterset() -> FilterSet<TaskTransfer> { pub fn task_transfer_filterset() -> FilterSet<TaskTransfer> {
FilterSet::new(TASK_TRANSFER_FILTERS) FilterSet::new(TASK_TRANSFER_FILTERS).remote_ordering("order_by")
} }
+6 -5
View File
@@ -16,20 +16,21 @@ impl AppModule for TaskModule {
} }
fn init(&self, ctx: &mut ModuleContext) { fn init(&self, ctx: &mut ModuleContext) {
ctx.resource::<models::Employee>( ctx.mapped_remote_resource::<models::Employee>(
"employee", "employee",
"/api/persone/employee/",
serializers::employee_serializer(), serializers::employee_serializer(),
filters::employee_filterset(), filters::employee_filterset(),
); );
ctx.remote_resource::<models::Task>( ctx.mapped_remote_resource::<models::Task>(
"task", "task",
"/api/persone/task", "/api/persone/task/",
serializers::task_serializer(), serializers::task_serializer(),
filters::task_filterset(), filters::task_filterset(),
); );
ctx.remote_resource::<models::TaskTransfer>( ctx.mapped_remote_resource::<models::TaskTransfer>(
"task_transfer", "task_transfer",
"/api/persone/task_transfer", "/api/persone/task_transfer/",
serializers::task_transfer_serializer(), serializers::task_transfer_serializer(),
filters::task_transfer_filterset(), filters::task_transfer_filterset(),
); );
+71 -11
View File
@@ -19,13 +19,73 @@ pub struct Task {
#[field(primary_key)] #[field(primary_key)]
pub id: i64, pub id: i64,
pub name: String, pub project: Option<String>,
pub doer: Option<String>,
#[field(foreign_key = Employee)] pub doer_name: String,
pub author_id: Option<i64>, pub author: Option<String>,
pub memo_full: Option<String>,
#[field(foreign_key = Employee)] pub bill_full: Option<String>,
pub responsible_id: Option<i64>, pub contract_full: Option<String>,
pub contract_application_full: Option<String>,
pub outgoing_letter_full: Option<String>,
pub entry_letter_full: Option<String>,
pub protocolitem_full: Option<String>,
pub decree_full: Option<String>,
pub delivery_full: Option<String>,
pub get_status: String,
pub get_status_class: String,
pub get_scan_url: Option<String>,
pub get_last_day: String,
pub frc_icon: String,
pub uploadfile_set: Option<String>,
pub deadline: String,
pub request_new_deadline: Option<String>,
pub plan_date: Option<String>,
pub date: String,
pub message_set: Option<String>,
pub responsible: Option<String>,
pub counterparty: Option<String>,
pub get_deadline_history: Option<String>,
pub duration: Option<i64>,
pub bid_full: Option<String>,
pub price_agreement_full: Option<String>,
pub transfer: Option<String>,
pub text: String,
pub status: String,
pub result: String,
pub complit_date: Option<String>,
pub comment: String,
pub note: String,
pub approve: bool,
pub archive: bool,
pub approve_date: Option<String>,
pub approve_required: bool,
pub progress_status: String,
pub start_date: Option<String>,
pub end_date: Option<String>,
pub order_number: Option<i64>,
pub priority: Option<i64>,
pub typ: String,
pub stage: Option<String>,
pub contract: Option<String>,
pub questionnair: Option<String>,
pub contract_application: Option<String>,
pub entry_letter: Option<String>,
pub outgoing_letter: Option<String>,
pub protocol: Option<String>,
pub bill: Option<String>,
pub decree: Option<String>,
pub court_case: Option<String>,
pub bill_register: Option<String>,
pub price_agreement: Option<String>,
pub bid: Option<String>,
pub delivery: Option<String>,
pub scheduled_task: Option<String>,
pub report: Option<String>,
pub memo: Option<String>,
pub protocolitem: Option<String>,
pub related_note: Option<String>,
pub task: Option<String>,
} }
#[derive(Debug, Clone, Model)] #[derive(Debug, Clone, Model)]
@@ -49,14 +109,14 @@ pub struct TaskTransfer {
#[field(primary_key)] #[field(primary_key)]
pub id: i64, pub id: i64,
#[field(foreign_key = Employee)] pub employee_from: Option<String>,
pub employee_from_id: Option<i64>,
#[field(foreign_key = Employee)] pub employee_to: Option<String>,
pub employee_to_id: Option<i64>,
pub date_create: String, pub date_create: String,
pub task: Option<String>,
pub status: String, pub status: String,
pub typ: String, pub typ: String,
@@ -11,9 +11,85 @@ static EMPLOYEE_FIELDS: &[Field] = &[
static TASK_FIELDS: &[Field] = &[ static TASK_FIELDS: &[Field] = &[
Field::new("id").read_only(), Field::new("id").read_only(),
Field::new("name"), Field::json("project").required(false).nullable(),
Field::new("author_id").required(false).nullable(), Field::json("doer").required(false).nullable(),
Field::new("responsible_id").required(false).nullable(), Field::new("doer_name"),
Field::json("author").required(false).nullable(),
Field::json("memo_full").required(false).nullable(),
Field::json("bill_full").required(false).nullable(),
Field::json("contract_full").required(false).nullable(),
Field::json("contract_application_full")
.required(false)
.nullable(),
Field::json("outgoing_letter_full")
.required(false)
.nullable(),
Field::json("entry_letter_full").required(false).nullable(),
Field::json("protocolitem_full").required(false).nullable(),
Field::json("decree_full").required(false).nullable(),
Field::json("delivery_full").required(false).nullable(),
Field::new("get_status"),
Field::new("get_status_class"),
Field::new("get_scan_url").required(false).nullable(),
Field::new("get_last_day"),
Field::new("frc_icon"),
Field::json("uploadfile_set").required(false).nullable(),
Field::new("deadline"),
Field::new("request_new_deadline")
.required(false)
.nullable(),
Field::new("plan_date").required(false).nullable(),
Field::new("date"),
Field::json("message_set").required(false).nullable(),
Field::json("responsible").required(false).nullable(),
Field::json("counterparty").required(false).nullable(),
Field::json("get_deadline_history")
.required(false)
.nullable(),
Field::new("duration").required(false).nullable(),
Field::json("bid_full").required(false).nullable(),
Field::json("price_agreement_full")
.required(false)
.nullable(),
Field::json("transfer").required(false).nullable(),
Field::new("text"),
Field::new("status"),
Field::new("result"),
Field::new("complit_date").required(false).nullable(),
Field::new("comment"),
Field::new("note"),
Field::new("approve"),
Field::new("archive"),
Field::new("approve_date").required(false).nullable(),
Field::new("approve_required"),
Field::new("progress_status"),
Field::new("start_date").required(false).nullable(),
Field::new("end_date").required(false).nullable(),
Field::new("order_number").required(false).nullable(),
Field::new("priority").required(false).nullable(),
Field::new("typ"),
Field::json("stage").required(false).nullable(),
Field::json("contract").required(false).nullable(),
Field::json("questionnair").required(false).nullable(),
Field::json("contract_application")
.required(false)
.nullable(),
Field::json("entry_letter").required(false).nullable(),
Field::json("outgoing_letter").required(false).nullable(),
Field::json("protocol").required(false).nullable(),
Field::json("bill").required(false).nullable(),
Field::json("decree").required(false).nullable(),
Field::json("court_case").required(false).nullable(),
Field::json("bill_register").required(false).nullable(),
Field::json("price_agreement").required(false).nullable(),
Field::json("bid").required(false).nullable(),
Field::json("delivery").required(false).nullable(),
Field::json("scheduled_task").required(false).nullable(),
Field::json("report").required(false).nullable(),
Field::json("memo").required(false).nullable(),
Field::json("protocolitem").required(false).nullable(),
Field::json("related_note").required(false).nullable(),
Field::json("task").required(false).nullable(),
]; ];
static MESSAGE_FIELDS: &[Field] = &[ static MESSAGE_FIELDS: &[Field] = &[
@@ -25,12 +101,12 @@ static MESSAGE_FIELDS: &[Field] = &[
static TASK_TRANSFER_FIELDS: &[Field] = &[ static TASK_TRANSFER_FIELDS: &[Field] = &[
Field::new("id").read_only(), Field::new("id").read_only(),
Field::new("employee_from_id").required(false).nullable(), Field::json("employee_from").required(false).nullable(),
Field::new("employee_to_id").required(false).nullable(), Field::json("employee_to").required(false).nullable(),
Field::new("date_create").read_only(), Field::new("date_create").read_only(),
Field::json("task").required(false).nullable(),
Field::new("status"), Field::new("status"),
Field::new("typ"), Field::new("typ"),
Field::new("project_id"),
]; ];
pub fn employee_serializer() -> ModelSerializer<Employee> { pub fn employee_serializer() -> ModelSerializer<Employee> {
+3 -3
View File
@@ -5,11 +5,11 @@ use super::models::Project;
static PROJECT_FILTERS: &[Filter] = &[ static PROJECT_FILTERS: &[Filter] = &[
Filter::exact("id"), Filter::exact("id"),
Filter::exact("name"), Filter::exact("name"),
Filter::contains("name"), Filter::contains("name").remote("search"),
Filter::exact("short_name"), Filter::exact("short_name"),
Filter::contains("short_name"), Filter::contains("short_name").remote("search"),
]; ];
pub fn project_filterset() -> FilterSet<Project> { pub fn project_filterset() -> FilterSet<Project> {
FilterSet::new(PROJECT_FILTERS) FilterSet::new(PROJECT_FILTERS).remote_ordering("order_by")
} }
+2 -1
View File
@@ -16,8 +16,9 @@ impl AppModule for ProjectModule {
} }
fn init(&self, ctx: &mut ModuleContext) { fn init(&self, ctx: &mut ModuleContext) {
ctx.resource::<models::Project>( ctx.mapped_remote_resource::<models::Project>(
"project", "project",
"/api/project/",
serializers::project_serializer(), serializers::project_serializer(),
filters::project_filterset(), filters::project_filterset(),
); );
+9 -3
View File
@@ -6,9 +6,15 @@ static PROJECT_FIELDS: &[Field] = &[
Field::new("id").read_only(), Field::new("id").read_only(),
Field::new("name"), Field::new("name"),
Field::new("full_name"), Field::new("full_name"),
Field::new("short_name"), Field::new("short_name").source("get_short_name"),
Field::new("locality_id").required(false).nullable(), Field::new("locality_id")
Field::new("locality_name").required(false).nullable(), .source("locality")
.required(false)
.nullable(),
Field::new("locality_name")
.source("locality.name")
.required(false)
.nullable(),
]; ];
pub fn project_serializer() -> ModelSerializer<Project> { pub fn project_serializer() -> ModelSerializer<Project> {
+1 -1
View File
@@ -152,7 +152,7 @@ pub fn run() {
url: String::from("sqlite://ewa-mobile.sqlite?mode=rwc"), url: String::from("sqlite://ewa-mobile.sqlite?mode=rwc"),
}, },
remote: Some(RemoteConfig { remote: Some(RemoteConfig {
base_url: String::from("https://ewa-corp.ru/"), base_url: String::from("http://127.0.0.1:8000/"),
auth_path: Some(String::from(" /api-token-auth/")), auth_path: Some(String::from(" /api-token-auth/")),
}), }),
}; };