From 37c60dc0bd897e1ad8e7412bf86a678e1a5f9311 Mon Sep 17 00:00:00 2001 From: Emanuel <Emanuel.Petrinovic@Student.Reutlingen-University.DE> Date: Mon, 14 Apr 2025 13:40:03 +0200 Subject: [PATCH] add json mapping to modells --- src/myaktion/model/account.go | 6 +++--- src/myaktion/model/campaign.go | 16 ++++++++-------- src/myaktion/model/donation.go | 10 +++++----- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/myaktion/model/account.go b/src/myaktion/model/account.go index d2e74b4..794af4d 100644 --- a/src/myaktion/model/account.go +++ b/src/myaktion/model/account.go @@ -1,7 +1,7 @@ package model type Account struct { - Name string - BankName string - Number string + Name string `json:name` + BankName string `json:bankname` + Number string `json:number` } diff --git a/src/myaktion/model/campaign.go b/src/myaktion/model/campaign.go index 8b44909..7ea5e44 100644 --- a/src/myaktion/model/campaign.go +++ b/src/myaktion/model/campaign.go @@ -1,12 +1,12 @@ package model type Campaign struct { - ID uint - Name string - OrganizerName string - TargetAmmount float64 - DonationMinimum float64 - AmmountDonatedSoFar float64 - Donations []Donation - Account + ID uint `json:id` + Name string `json:name` + OrganizerName string `json:organizername` + TargetAmmount float64 `json:targetammount` + DonationMinimum float64 `json:donationminimum` + AmmountDonatedSoFar float64 `json: ammountdonatedsofar` + Donations []Donation `json: donations` + Account Account `account` } diff --git a/src/myaktion/model/donation.go b/src/myaktion/model/donation.go index 1df1dd3..bee8212 100644 --- a/src/myaktion/model/donation.go +++ b/src/myaktion/model/donation.go @@ -1,11 +1,11 @@ package model type Donation struct { - Ammount float64 - DonorName string - ReceiptRequested bool - Status - Account + Ammount float64 `json:ammount` + DonorName string `json:donorname` + ReceiptRequested bool `json:receiptrequested` + Status Status `json:status` + Account Account `json:account` } type Status string -- GitLab