Skip to content

Commit

Permalink
fix: schema mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
jofmi committed Apr 8, 2024
1 parent 53e3afc commit 118e3f4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ schema.fields = [
choices: [{ text: "$t:Normal membership", value: "normal" }],
},
translations: [
{ language: "de-DE", translation: "Typ" },
{ language: "en-US", translation: "Art" },
{ language: "de-DE", translation: "Art" },
{ language: "en-US", translation: "Type" },
],
},

Expand Down
31 changes: 8 additions & 23 deletions collectivo/extensions/payments/server/examples/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,9 @@ export default async function examples() {

// Clean up old data
await directus.request(deleteItems("payments_invoices_out", { limit: 1000 }));
await directus.request(deleteItems("payments_items", { limit: 1000 }));

const item_names = ["Test item 1", "Test item 2"];
const item_ids = [];
const invoice_ids = [];

for (const name of item_names) {
const res = await directus.request(
createItem("payments_items", {
payments_name: name,
}),
);

item_ids.push(res.id);
}

const users = await directus.request(
readUsers({ filter: { first_name: "Alice" } }),
);
Expand All @@ -40,15 +27,13 @@ export default async function examples() {
}

for (const invoice_id of invoice_ids) {
for (const item_id of item_ids) {
await directus.request(
createItem("payments_invoices_entries", {
payments_invoice: invoice_id,
payments_item: item_id,
payments_quantity: 1,
payments_price: 100,
}),
);
}
await directus.request(
createItem("payments_invoices_entries", {
payments_invoice: invoice_id,
payments_description: "Test item",
payments_quantity: 1,
payments_price: 100,
}),
);
}
}
8 changes: 4 additions & 4 deletions collectivo/extensions/payments/server/schemas/payments_01.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ schema.fields = [
options: {
enableSelect: false,
template:
"{{payments_item.payments_name}}:{{payments_quantity}}*{{payments_price}}",
"{{payments_description}}:{{payments_quantity}}*{{payments_price}}",
},
display: "related-values",
display_options: {
template:
"{{payments_item.payments_name}}: {{payments_quantity}}*{{payments_price}}",
"{{payments_description}}: {{payments_quantity}}*{{payments_price}}",
},
translations: [
{ language: "de-DE", translation: "Posten" },
Expand Down Expand Up @@ -223,8 +223,8 @@ schema.fields = [
meta: { interface: "select-dropdown-m2o", hidden: true },
},
{
field: "payments_invoices_entries",
collection: "payments_description",
collection: "payments_invoices_entries",
field: "payments_description",
type: "string",
meta: {
sort: 3,
Expand Down

0 comments on commit 118e3f4

Please sign in to comment.