Add original packaging attribute to items
This commit is contained in:
parent
bbb57efdd2
commit
5a80201850
|
@ -32,6 +32,11 @@
|
||||||
"ordinal": 5,
|
"ordinal": 5,
|
||||||
"name": "short_id",
|
"name": "short_id",
|
||||||
"type_info": "Int4"
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ordinal": 6,
|
||||||
|
"name": "original_packaging",
|
||||||
|
"type_info": "Uuid"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
|
@ -45,7 +50,8 @@
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false
|
false,
|
||||||
|
true
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"hash": "1e9045f52c002a19b815351fee1c7ee7520478ff4f5886b4523fb0dc4df0e204"
|
"hash": "1e9045f52c002a19b815351fee1c7ee7520478ff4f5886b4523fb0dc4df0e204"
|
||||||
|
|
|
@ -32,6 +32,11 @@
|
||||||
"ordinal": 5,
|
"ordinal": 5,
|
||||||
"name": "short_id",
|
"name": "short_id",
|
||||||
"type_info": "Int4"
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ordinal": 6,
|
||||||
|
"name": "original_packaging",
|
||||||
|
"type_info": "Uuid"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
|
@ -45,7 +50,8 @@
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false
|
false,
|
||||||
|
true
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"hash": "2e9619ce6db1047e2f5447c4925f28fd05f18706f70220b6ebb7354d2a0a9e3b"
|
"hash": "2e9619ce6db1047e2f5447c4925f28fd05f18706f70220b6ebb7354d2a0a9e3b"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"db_name": "PostgreSQL",
|
"db_name": "PostgreSQL",
|
||||||
"query": "UPDATE items SET name = $2, parent = $3, class = $4 WHERE id = $1 RETURNING *",
|
"query": "INSERT INTO items (name, parent, class, original_packaging) VALUES ($1, $2, $3, $4) RETURNING *",
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
|
@ -32,13 +32,18 @@
|
||||||
"ordinal": 5,
|
"ordinal": 5,
|
||||||
"name": "short_id",
|
"name": "short_id",
|
||||||
"type_info": "Int4"
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ordinal": 6,
|
||||||
|
"name": "original_packaging",
|
||||||
|
"type_info": "Uuid"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"Left": [
|
"Left": [
|
||||||
"Uuid",
|
|
||||||
"Varchar",
|
"Varchar",
|
||||||
"Uuid",
|
"Uuid",
|
||||||
|
"Uuid",
|
||||||
"Uuid"
|
"Uuid"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -48,8 +53,9 @@
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false
|
false,
|
||||||
|
true
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"hash": "85528d16361a6e736773e8f8aba4c85cfc7db545724d94c1a467b2c0c74b6b6e"
|
"hash": "30a7f461d0a20179d08436d9d2c69b33ea9d0775ef1e2b37a1d7fd0109f98b27"
|
||||||
}
|
}
|
|
@ -32,6 +32,11 @@
|
||||||
"ordinal": 5,
|
"ordinal": 5,
|
||||||
"name": "short_id",
|
"name": "short_id",
|
||||||
"type_info": "Int4"
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ordinal": 6,
|
||||||
|
"name": "original_packaging",
|
||||||
|
"type_info": "Uuid"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
|
@ -43,7 +48,8 @@
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false
|
false,
|
||||||
|
true
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"hash": "58969747bdccae4a2d3ad8d8117aa92283151d67f52fbb22e5d976b1c6a5c367"
|
"hash": "58969747bdccae4a2d3ad8d8117aa92283151d67f52fbb22e5d976b1c6a5c367"
|
||||||
|
|
|
@ -32,6 +32,11 @@
|
||||||
"ordinal": 5,
|
"ordinal": 5,
|
||||||
"name": "short_id",
|
"name": "short_id",
|
||||||
"type_info": "Int4"
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ordinal": 6,
|
||||||
|
"name": "original_packaging",
|
||||||
|
"type_info": "Uuid"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
|
@ -45,7 +50,8 @@
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false
|
false,
|
||||||
|
true
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"hash": "79d8bfe2ed76ee550cdc31f282f598749d931af69a80d24f4575a4bc2c740f3b"
|
"hash": "79d8bfe2ed76ee550cdc31f282f598749d931af69a80d24f4575a4bc2c740f3b"
|
||||||
|
|
|
@ -32,6 +32,11 @@
|
||||||
"ordinal": 5,
|
"ordinal": 5,
|
||||||
"name": "short_id",
|
"name": "short_id",
|
||||||
"type_info": "Int4"
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ordinal": 6,
|
||||||
|
"name": "original_packaging",
|
||||||
|
"type_info": "Uuid"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
|
@ -45,7 +50,8 @@
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false
|
false,
|
||||||
|
true
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"hash": "7eeb752c8b00ac4000104f0254186f1f9fdb076e8f8b98f10fc1b981cfe8038c"
|
"hash": "7eeb752c8b00ac4000104f0254186f1f9fdb076e8f8b98f10fc1b981cfe8038c"
|
||||||
|
|
|
@ -32,6 +32,11 @@
|
||||||
"ordinal": 5,
|
"ordinal": 5,
|
||||||
"name": "short_id",
|
"name": "short_id",
|
||||||
"type_info": "Int4"
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ordinal": 6,
|
||||||
|
"name": "original_packaging",
|
||||||
|
"type_info": "Uuid"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
|
@ -45,7 +50,8 @@
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false
|
false,
|
||||||
|
true
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"hash": "94958a3a57c3178e6b0de5723b1fbc5433e972b5522b367098afe6cb90a30bf2"
|
"hash": "94958a3a57c3178e6b0de5723b1fbc5433e972b5522b367098afe6cb90a30bf2"
|
||||||
|
|
|
@ -32,6 +32,11 @@
|
||||||
"ordinal": 5,
|
"ordinal": 5,
|
||||||
"name": "short_id",
|
"name": "short_id",
|
||||||
"type_info": "Int4"
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ordinal": 6,
|
||||||
|
"name": "original_packaging",
|
||||||
|
"type_info": "Uuid"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
|
@ -45,7 +50,8 @@
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false
|
false,
|
||||||
|
true
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"hash": "e45160a73a18d870f592989349057d6852d2d3f63dc055442125a6a92950729d"
|
"hash": "e45160a73a18d870f592989349057d6852d2d3f63dc055442125a6a92950729d"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"db_name": "PostgreSQL",
|
"db_name": "PostgreSQL",
|
||||||
"query": "INSERT INTO items (name, parent, class) VALUES ($1, $2, $3) RETURNING *",
|
"query": "SELECT * FROM items WHERE original_packaging = $1",
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
|
@ -32,12 +32,15 @@
|
||||||
"ordinal": 5,
|
"ordinal": 5,
|
||||||
"name": "short_id",
|
"name": "short_id",
|
||||||
"type_info": "Int4"
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ordinal": 6,
|
||||||
|
"name": "original_packaging",
|
||||||
|
"type_info": "Uuid"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"Left": [
|
"Left": [
|
||||||
"Varchar",
|
|
||||||
"Uuid",
|
|
||||||
"Uuid"
|
"Uuid"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -47,8 +50,9 @@
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false
|
false,
|
||||||
|
true
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"hash": "05452db872d5ae8574a979b07d19c2b0791f3f2c4c0ae4777b2a2c309410d0ec"
|
"hash": "efe2258db42b60f732d562d106842b19308d9a558703b02e758f60e7d8644d00"
|
||||||
}
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
{
|
||||||
|
"db_name": "PostgreSQL",
|
||||||
|
"query": "UPDATE items SET name = $2, parent = $3, class = $4, original_packaging = $5 WHERE id = $1 RETURNING *",
|
||||||
|
"describe": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"ordinal": 0,
|
||||||
|
"name": "id",
|
||||||
|
"type_info": "Uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ordinal": 1,
|
||||||
|
"name": "name",
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ordinal": 2,
|
||||||
|
"name": "parent",
|
||||||
|
"type_info": "Uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ordinal": 3,
|
||||||
|
"name": "class",
|
||||||
|
"type_info": "Uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ordinal": 4,
|
||||||
|
"name": "created_at",
|
||||||
|
"type_info": "Timestamptz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ordinal": 5,
|
||||||
|
"name": "short_id",
|
||||||
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ordinal": 6,
|
||||||
|
"name": "original_packaging",
|
||||||
|
"type_info": "Uuid"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Uuid",
|
||||||
|
"Varchar",
|
||||||
|
"Uuid",
|
||||||
|
"Uuid",
|
||||||
|
"Uuid"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nullable": [
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"hash": "fa9770ac99749cc4255da6172e5082b29931e992a08534b315a2935978e827e8"
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
-- SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
|
||||||
|
--
|
||||||
|
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
ALTER TABLE items
|
||||||
|
DROP original_packaging;
|
|
@ -0,0 +1,6 @@
|
||||||
|
-- SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
|
||||||
|
--
|
||||||
|
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
ALTER TABLE items
|
||||||
|
ADD original_packaging UUID REFERENCES items(id) CHECK (original_packaging <> id);
|
|
@ -10,7 +10,7 @@ use maud::html;
|
||||||
use sqlx::PgPool;
|
use sqlx::PgPool;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use super::templates::helpers::{Colour, PageAction, PageActionMethod};
|
use super::templates::helpers::{Colour, ItemName, PageAction, PageActionMethod};
|
||||||
use super::templates::{self, datalist, forms, TemplateConfig};
|
use super::templates::{self, datalist, forms, TemplateConfig};
|
||||||
use crate::manage;
|
use crate::manage;
|
||||||
use crate::models::*;
|
use crate::models::*;
|
||||||
|
@ -49,9 +49,22 @@ async fn show(
|
||||||
.await
|
.await
|
||||||
.map_err(error::ErrorInternalServerError)?;
|
.map_err(error::ErrorInternalServerError)?;
|
||||||
|
|
||||||
|
let original_packaging = match item.original_packaging {
|
||||||
|
Some(id) => Some(
|
||||||
|
manage::item::get(&pool, id)
|
||||||
|
.await
|
||||||
|
.map_err(error::ErrorInternalServerError)?,
|
||||||
|
),
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
|
||||||
|
let original_packaging_of = manage::item::original_packaging_contents(&pool, id)
|
||||||
|
.await
|
||||||
|
.map_err(error::ErrorInternalServerError)?;
|
||||||
|
|
||||||
let item_class = item_classes.get(&item.class).unwrap();
|
let item_class = item_classes.get(&item.class).unwrap();
|
||||||
|
|
||||||
let item_name = templates::helpers::ItemName::new(&item, item_class);
|
let item_name = ItemName::new(&item, item_class);
|
||||||
let mut title = item_name.to_string();
|
let mut title = item_name.to_string();
|
||||||
title.push_str(" – Item Details");
|
title.push_str(" – Item Details");
|
||||||
|
|
||||||
|
@ -105,6 +118,18 @@ async fn show(
|
||||||
th { "Parents" }
|
th { "Parents" }
|
||||||
td { (templates::helpers::parents_breadcrumb(&item, &item_class, &parents, &item_classes, true)) }
|
td { (templates::helpers::parents_breadcrumb(&item, &item_class, &parents, &item_classes, true)) }
|
||||||
}
|
}
|
||||||
|
tr {
|
||||||
|
th { "Original Packaging" }
|
||||||
|
td {
|
||||||
|
@if let Some(original_packaging) = original_packaging {
|
||||||
|
a
|
||||||
|
href={ "/item/" (original_packaging.id) }
|
||||||
|
{ (ItemName::new(&original_packaging, &item_classes.get(&original_packaging.class).unwrap())) }
|
||||||
|
} @else {
|
||||||
|
"-"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@if !children.is_empty() {
|
@if !children.is_empty() {
|
||||||
|
@ -113,7 +138,19 @@ async fn show(
|
||||||
ul {
|
ul {
|
||||||
@for child in children {
|
@for child in children {
|
||||||
li {
|
li {
|
||||||
a href={ "/item/" (child.id) } { (templates::helpers::ItemName::new(&child, &item_classes.get(&child.class).unwrap())) }
|
a href={ "/item/" (child.id) } { (ItemName::new(&child, &item_classes.get(&child.class).unwrap())) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@if !original_packaging_of.is_empty() {
|
||||||
|
h3 .mt-4 { "Original Packaging of" }
|
||||||
|
|
||||||
|
ul {
|
||||||
|
@for item in original_packaging_of {
|
||||||
|
li {
|
||||||
|
a href={ "/item/" (item.id) } { (ItemName::new(&item, &item_classes.get(&item.class).unwrap())) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +222,7 @@ async fn list(pool: web::Data<PgPool>, user: Identity) -> actix_web::Result<impl
|
||||||
tr {
|
tr {
|
||||||
td {
|
td {
|
||||||
a href={ "/item/" (item.id) } {
|
a href={ "/item/" (item.id) } {
|
||||||
(templates::helpers::ItemName::new(&item, class).terse())
|
(ItemName::new(&item, class).terse())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
td { a href={ "/item-class/" (class.id) } { (class.name) } }
|
td { a href={ "/item-class/" (class.id) } { (class.name) } }
|
||||||
|
@ -247,6 +284,15 @@ async fn add_form(
|
||||||
datalist: Some(&datalist_items),
|
datalist: Some(&datalist_items),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
|
(forms::InputGroup {
|
||||||
|
r#type: forms::InputType::Text,
|
||||||
|
name: "original_packaging",
|
||||||
|
title: "Original Packaging",
|
||||||
|
disabled: true,
|
||||||
|
value: form.original_packaging.map(|id| id.to_string()),
|
||||||
|
datalist: Some(&datalist_items),
|
||||||
|
..Default::default()
|
||||||
|
})
|
||||||
|
|
||||||
button .btn.btn-primary type="submit" { "Add" }
|
button .btn.btn-primary type="submit" { "Add" }
|
||||||
}
|
}
|
||||||
|
@ -290,7 +336,7 @@ async fn edit_form(
|
||||||
.await
|
.await
|
||||||
.map_err(error::ErrorInternalServerError)?;
|
.map_err(error::ErrorInternalServerError)?;
|
||||||
|
|
||||||
let item_name = templates::helpers::ItemName::new(&item, &item_class);
|
let item_name = ItemName::new(&item, &item_class);
|
||||||
let mut title = item_name.to_string();
|
let mut title = item_name.to_string();
|
||||||
title.push_str(" – Edit Item");
|
title.push_str(" – Edit Item");
|
||||||
|
|
||||||
|
@ -340,6 +386,15 @@ async fn edit_form(
|
||||||
datalist: Some(&datalist_items),
|
datalist: Some(&datalist_items),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
|
(forms::InputGroup {
|
||||||
|
r#type: forms::InputType::Text,
|
||||||
|
name: "original_packaging",
|
||||||
|
title: "Original Packaging",
|
||||||
|
value: item.original_packaging.map(|id| id.to_string()),
|
||||||
|
disabled: item.original_packaging.is_none(),
|
||||||
|
datalist: Some(&datalist_items),
|
||||||
|
..Default::default()
|
||||||
|
})
|
||||||
|
|
||||||
button .btn.btn-primary type="submit" { "Edit" }
|
button .btn.btn-primary type="submit" { "Edit" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,11 @@ use crate::models::{Item, NewItem};
|
||||||
pub async fn add(pool: &PgPool, new_item: NewItem) -> Result<Item, sqlx::Error> {
|
pub async fn add(pool: &PgPool, new_item: NewItem) -> Result<Item, sqlx::Error> {
|
||||||
query_as!(
|
query_as!(
|
||||||
Item,
|
Item,
|
||||||
"INSERT INTO items (name, parent, class) VALUES ($1, $2, $3) RETURNING *",
|
"INSERT INTO items (name, parent, class, original_packaging) VALUES ($1, $2, $3, $4) RETURNING *",
|
||||||
new_item.name,
|
new_item.name,
|
||||||
new_item.parent,
|
new_item.parent,
|
||||||
new_item.class
|
new_item.class,
|
||||||
|
new_item.original_packaging
|
||||||
)
|
)
|
||||||
.fetch_one(pool)
|
.fetch_one(pool)
|
||||||
.await
|
.await
|
||||||
|
@ -56,11 +57,12 @@ pub async fn get_all_as_map(pool: &PgPool) -> Result<HashMap<Uuid, Item>, sqlx::
|
||||||
pub async fn update(pool: &PgPool, id: Uuid, modified_item: NewItem) -> Result<Item, sqlx::Error> {
|
pub async fn update(pool: &PgPool, id: Uuid, modified_item: NewItem) -> Result<Item, sqlx::Error> {
|
||||||
query_as!(
|
query_as!(
|
||||||
Item,
|
Item,
|
||||||
"UPDATE items SET name = $2, parent = $3, class = $4 WHERE id = $1 RETURNING *",
|
"UPDATE items SET name = $2, parent = $3, class = $4, original_packaging = $5 WHERE id = $1 RETURNING *",
|
||||||
id,
|
id,
|
||||||
modified_item.name,
|
modified_item.name,
|
||||||
modified_item.parent,
|
modified_item.parent,
|
||||||
modified_item.class
|
modified_item.class,
|
||||||
|
modified_item.original_packaging
|
||||||
)
|
)
|
||||||
.fetch_one(pool)
|
.fetch_one(pool)
|
||||||
.await
|
.await
|
||||||
|
@ -110,3 +112,16 @@ pub async fn get_children(pool: &PgPool, id: Uuid) -> Result<Vec<Item>, sqlx::Er
|
||||||
.fetch_all(pool)
|
.fetch_all(pool)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn original_packaging_contents(
|
||||||
|
pool: &PgPool,
|
||||||
|
id: Uuid,
|
||||||
|
) -> Result<Vec<Item>, sqlx::Error> {
|
||||||
|
query_as!(
|
||||||
|
Item,
|
||||||
|
"SELECT * FROM items WHERE original_packaging = $1",
|
||||||
|
id
|
||||||
|
)
|
||||||
|
.fetch_all(pool)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ pub struct Item {
|
||||||
#[serde(with = "time::serde::iso8601")]
|
#[serde(with = "time::serde::iso8601")]
|
||||||
pub created_at: OffsetDateTime,
|
pub created_at: OffsetDateTime,
|
||||||
pub short_id: i32,
|
pub short_id: i32,
|
||||||
|
pub original_packaging: Option<Uuid>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
|
@ -30,6 +31,7 @@ pub struct NewItem {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub parent: Option<Uuid>,
|
pub parent: Option<Uuid>,
|
||||||
pub class: Uuid,
|
pub class: Uuid,
|
||||||
|
pub original_packaging: Option<Uuid>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Its structure is not how it could ideally be
|
// Its structure is not how it could ideally be
|
||||||
|
@ -43,6 +45,7 @@ pub struct NewItemForm {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub parent: Option<Uuid>,
|
pub parent: Option<Uuid>,
|
||||||
pub class: Option<Uuid>,
|
pub class: Option<Uuid>,
|
||||||
|
pub original_packaging: Option<Uuid>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize)]
|
#[derive(Clone, Debug, Serialize)]
|
||||||
|
|
Loading…
Reference in a new issue