Skip to content

Commit 7d4b763

Browse files
authored
Merge branch 'master' into i18n
2 parents ee964a6 + 0035897 commit 7d4b763

File tree

11 files changed

+41603
-13763
lines changed

11 files changed

+41603
-13763
lines changed

.github/workflows/hub.yml

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: ci
1+
name: Build docker image
22

33
on:
4-
push:
5-
branches: master
4+
release:
5+
types: [published]
66

77
jobs:
88
multi:
@@ -26,6 +26,9 @@ jobs:
2626
key: ${{ runner.os }}-buildx-${{ github.sha }}
2727
restore-keys: |
2828
${{ runner.os }}-buildx-
29+
- name: Parse the git tag
30+
id: get_tag
31+
run: echo ::set-output name=TAG::$(echo $GITHUB_REF | cut -d / -f 3)
2932
- name: Login to DockerHub
3033
uses: docker/login-action@v1
3134
with:
@@ -50,6 +53,6 @@ jobs:
5053
# cache-to: type=local,dest=/tmp/.buildx-cache
5154
tags: |
5255
akhilrex/hammond:latest
53-
akhilrex/hammond:1.0.0
56+
akhilrex/hammond:${{ steps.get_tag.outputs.TAG }}
5457
ghcr.io/akhilrex/hammond:latest
55-
ghcr.io/akhilrex/hammond:1.0.0
58+
ghcr.io/akhilrex/hammond:${{ steps.get_tag.outputs.TAG }}

.github/workflows/test-go.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
on: [push, pull_request]
2+
name: Test server
3+
jobs:
4+
test:
5+
strategy:
6+
matrix:
7+
go-version: [1.17.x, 1.18.x]
8+
os: [ubuntu-latest]
9+
runs-on: ${{ matrix.os }}
10+
steps:
11+
- uses: actions/setup-go@v3
12+
with:
13+
go-version: ${{ matrix.go-version }}
14+
- uses: actions/checkout@v3
15+
- run: go test ./...
16+
working-directory: server

server/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
*.out
1313
*.db
1414

15+
# MS VSCode
16+
.vscode
17+
__debug_bin
18+
1519
# Dependency directories (remove the comment below to include it)
1620
# vendor/
1721
assets/*

server/db/dbModels.go

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type Vehicle struct {
6060
Base
6161
Nickname string `json:"nickname"`
6262
Registration string `json:"registration"`
63+
VIN string `json:"vin"`
6364
Make string `json:"make"`
6465
Model string `json:"model"`
6566
YearOfManufacture int `json:"yearOfManufacture"`

server/db/migrations.go

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ var migrations = []localMigration{
2121
{
2222
Name: "2021_02_07_00_09_LowerCaseEmails",
2323
Query: "update users set email=lower(email)",
24+
25+
},
26+
{
27+
Name: "2022_03_08_13_16_AddVIN",
28+
Query: "ALTER TABLE vehicles ADD COLUMN vin text",
2429
},
2530
}
2631

server/models/vehicle.go

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type SubItemQuery struct {
1717
type CreateVehicleRequest struct {
1818
Nickname string `form:"nickname" json:"nickname" binding:"required"`
1919
Registration string `form:"registration" json:"registration" binding:"required"`
20+
VIN string `form:"vin" json:"vin"`
2021
Make string `form:"make" json:"make" binding:"required"`
2122
Model string `form:"model" json:"model" binding:"required"`
2223
YearOfManufacture int `form:"yearOfManufacture" json:"yearOfManufacture"`

server/service/vehicleService.go

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ func CreateVehicle(model models.CreateVehicleRequest, userId string) (*db.Vehicl
1414
Nickname: model.Nickname,
1515
Registration: model.Registration,
1616
Model: model.Model,
17+
VIN: model.VIN,
1718
Make: model.Make,
1819
YearOfManufacture: model.YearOfManufacture,
1920
EngineSize: model.EngineSize,
@@ -100,6 +101,7 @@ func UpdateVehicle(vehicleID string, model models.UpdateVehicleRequest) error {
100101
//return db.DB.Model(&toUpdate).Updates(db.Vehicle{
101102
toUpdate.Nickname = model.Nickname
102103
toUpdate.Registration = model.Registration
104+
toUpdate.VIN = model.VIN
103105
toUpdate.Model = model.Model
104106
toUpdate.Make = model.Make
105107
toUpdate.YearOfManufacture = model.YearOfManufacture

0 commit comments

Comments
 (0)