Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/reference/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13462,6 +13462,8 @@ paths:
application/json:
schema:
type: object
required:
- items
properties:
items:
type: array
Expand All @@ -13471,6 +13473,13 @@ paths:
x-stoplight:
id: srl106ylr6cpm
type: object
required:
- cost_id
- type
- supplier
- description
- attachments
- cost
properties:
cost_id:
type: number
Expand All @@ -13480,6 +13489,9 @@ paths:
type: object
x-stoplight:
id: itchthltx575n
required:
- name
- id
properties:
name:
type: string
Expand All @@ -13493,6 +13505,9 @@ paths:
type: object
x-stoplight:
id: pewi2gjqq2j1h
required:
- name
- id
properties:
name:
type: string
Expand All @@ -13514,6 +13529,10 @@ paths:
x-stoplight:
id: w31uej26rl532
type: object
required:
- id
- url
- mimetype
properties:
id:
type: number
Expand All @@ -13527,6 +13546,10 @@ paths:
type: string
x-stoplight:
id: 6tqj2cg96280v
cost:
type: number
x-stoplight:
id: 4zut3xli3ht5f
examples:
Example 1:
value:
Expand All @@ -13543,6 +13566,7 @@ paths:
url: string
mimetype: string
cost_id: 0
cost: 10.2
'403':
description: Forbidden
'404':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ describe("GET /campaigns/campaignId/finance/otherCosts", () => {
items: expect.arrayContaining([
expect.objectContaining({
cost_id: 1,
cost: 100.5,
type: {
name: "Type 1",
id: 1,
Expand All @@ -185,6 +186,7 @@ describe("GET /campaigns/campaignId/finance/otherCosts", () => {
}),
expect.objectContaining({
cost_id: 2,
cost: 200.75,
type: {
name: "Type 2",
id: 2,
Expand Down Expand Up @@ -218,6 +220,7 @@ describe("GET /campaigns/campaignId/finance/otherCosts", () => {
items: expect.arrayContaining([
expect.objectContaining({
cost_id: 1,
cost: 100.5,
type: {
name: "Type 1",
id: 1,
Expand All @@ -230,6 +233,7 @@ describe("GET /campaigns/campaignId/finance/otherCosts", () => {
}),
expect.objectContaining({
cost_id: 2,
cost: 200.75,
type: {
name: "Type 2",
id: 2,
Expand Down Expand Up @@ -300,6 +304,7 @@ describe("GET /campaigns/campaignId/finance/otherCosts", () => {
(item: any) => item.cost_id === 10
);
expect(costWithoutAttachments).toBeDefined();
expect(costWithoutAttachments.cost).toBe(50);
expect(costWithoutAttachments.attachments).toEqual([]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import OpenapiError from "@src/features/OpenapiError";

type OtherCost = {
cost_id: number;
cost: number;
type: {
name: string;
id: number;
Expand Down Expand Up @@ -52,7 +53,8 @@ export default class OtherCostsRoute extends CampaignRoute<{
.as("cost_id"),
"description",
"type_id",
"supplier_id"
"supplier_id",
"cost"
)
.where("campaign_id", this.cp_id);

Expand Down Expand Up @@ -84,6 +86,7 @@ export default class OtherCostsRoute extends CampaignRoute<{

return {
cost_id: cost.cost_id,
cost: cost.cost,
type: {
name: type?.name || "",
id: type?.id || 0,
Expand Down
27 changes: 14 additions & 13 deletions src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5638,22 +5638,23 @@ export interface operations {
200: {
content: {
"application/json": {
items?: {
cost_id?: number;
type?: {
name?: string;
id?: number;
items: {
cost_id: number;
type: {
name: string;
id: number;
};
supplier?: {
name?: string;
id?: number;
supplier: {
name: string;
id: number;
};
description?: string;
attachments?: {
id?: number;
url?: string;
mimetype?: string;
description: string;
attachments: {
id: number;
url: string;
mimetype: string;
}[];
cost: number;
}[];
};
};
Expand Down
Loading