-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create re_fsc_multipliers table Create models for multipliers table Add table to migrations manifest
- Loading branch information
1 parent
6a7bd45
commit f6c2102
Showing
5 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
migrations/app/schema/20241115214553_create_re_fsc_multipliers_table.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CREATE TABLE IF NOT EXISTS re_fsc_multipliers ( | ||
id uuid NOT NULL, | ||
low_weight int NOT NULL, | ||
high_weight int NOT NULL, | ||
multiplier decimal NOT NULL, | ||
created_at timestamp NOT NULL DEFAULT NOW(), | ||
updated_at timestamp NOT NULL DEFAULT NOW(), | ||
); | ||
|
||
COMMENT ON TABLE re_fsc_multipliers IS 'Stores data needed to needed to calculate FSC'; | ||
COMMENT ON COLUMN re_fsc_multipliers.low_weight IS 'The lowest weight permitted for a shipment'; | ||
COMMENT ON COLUMN re_fsc_multipliers.high_weight IS 'The highest weight permitted for a shipment'; | ||
COMMENT ON COLUMN re_fsc_multipliers.multiplier IS 'The decimal multiplier used to calculate the FSC'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package models | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/gofrs/uuid" | ||
"google.golang.org/genproto/googleapis/type/decimal" | ||
) | ||
|
||
type FscMultiplier struct { | ||
ID uuid.UUID `json:"id" db:"id" rw:"r"` | ||
LowWeight int `json:"low_weight" rw:"r"` | ||
HighWeight int `json:"high_weight" rw:"r"` | ||
Multiplier *decimal.Decimal `json:"multiplier"` | ||
CreatedAt time.Time `json:"created_at" db:"created_at" rw:"r"` | ||
UpdatedAt time.Time `json:"updated_at" db:"updated_at" rw:"r"` | ||
} | ||
|
||
func (f FscMultiplier) TableName() string { | ||
return "re_fsc_multipliers" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters