Compare commits
4 Commits
2f469c1830
...
9749d5658c
Author | SHA1 | Date | |
---|---|---|---|
9749d5658c | |||
0402b8ac65 | |||
56a6f3cfc4 | |||
98d21724ee |
@ -3,14 +3,36 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
swaggerFiles "github.com/swaggo/files"
|
||||
ginSwagger "github.com/swaggo/gin-swagger"
|
||||
|
||||
_ "github.com/timetracker/backend/docs" // This line is important for swag to work
|
||||
)
|
||||
|
||||
func helloHandler(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintln(w, "Hello from the Time Tracker Backend!")
|
||||
// @title Time Tracker API
|
||||
// @version 1.0
|
||||
// @description This is a simple time tracker API.
|
||||
// @host localhost:8080
|
||||
// @BasePath /
|
||||
|
||||
// @Summary Say hello
|
||||
// @Description Get a hello message
|
||||
// @ID hello
|
||||
// @Produce plain
|
||||
// @Success 200 {string} string "Hello from the Time Tracker Backend!"
|
||||
// @Router / [get]
|
||||
func helloHandler(c *gin.Context) {
|
||||
c.String(http.StatusOK, "Hello from the Time Tracker Backend!")
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/", helloHandler)
|
||||
r := gin.Default()
|
||||
|
||||
r.GET("/", helloHandler)
|
||||
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
||||
|
||||
fmt.Println("Server listening on port 8080")
|
||||
http.ListenAndServe(":8080", nil)
|
||||
r.Run(":8080") // Use Gin's Run method
|
||||
}
|
||||
|
55
backend/docs/docs.go
Normal file
55
backend/docs/docs.go
Normal file
@ -0,0 +1,55 @@
|
||||
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
||||
package docs
|
||||
|
||||
import "github.com/swaggo/swag"
|
||||
|
||||
const docTemplate = `{
|
||||
"schemes": {{ marshal .Schemes }},
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "{{escape .Description}}",
|
||||
"title": "{{.Title}}",
|
||||
"contact": {},
|
||||
"version": "{{.Version}}"
|
||||
},
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"description": "Get a hello message",
|
||||
"produces": [
|
||||
"text/plain"
|
||||
],
|
||||
"summary": "Say hello",
|
||||
"operationId": "hello",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Hello from the Time Tracker Backend!",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = &swag.Spec{
|
||||
Version: "1.0",
|
||||
Host: "localhost:8080",
|
||||
BasePath: "/",
|
||||
Schemes: []string{},
|
||||
Title: "Time Tracker API",
|
||||
Description: "This is a simple time tracker API.",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
LeftDelim: "{{",
|
||||
RightDelim: "}}",
|
||||
}
|
||||
|
||||
func init() {
|
||||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||||
}
|
31
backend/docs/swagger.json
Normal file
31
backend/docs/swagger.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "This is a simple time tracker API.",
|
||||
"title": "Time Tracker API",
|
||||
"contact": {},
|
||||
"version": "1.0"
|
||||
},
|
||||
"host": "localhost:8080",
|
||||
"basePath": "/",
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"description": "Get a hello message",
|
||||
"produces": [
|
||||
"text/plain"
|
||||
],
|
||||
"summary": "Say hello",
|
||||
"operationId": "hello",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Hello from the Time Tracker Backend!",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
21
backend/docs/swagger.yaml
Normal file
21
backend/docs/swagger.yaml
Normal file
@ -0,0 +1,21 @@
|
||||
basePath: /
|
||||
host: localhost:8080
|
||||
info:
|
||||
contact: {}
|
||||
description: This is a simple time tracker API.
|
||||
title: Time Tracker API
|
||||
version: "1.0"
|
||||
paths:
|
||||
/:
|
||||
get:
|
||||
description: Get a hello message
|
||||
operationId: hello
|
||||
produces:
|
||||
- text/plain
|
||||
responses:
|
||||
"200":
|
||||
description: Hello from the Time Tracker Backend!
|
||||
schema:
|
||||
type: string
|
||||
summary: Say hello
|
||||
swagger: "2.0"
|
@ -1,3 +1,47 @@
|
||||
module github.com/timetracker/backend
|
||||
|
||||
go 1.23.6
|
||||
|
||||
require (
|
||||
github.com/gin-gonic/gin v1.10.0
|
||||
github.com/oklog/ulid/v2 v2.1.0
|
||||
github.com/swaggo/files v1.0.1
|
||||
github.com/swaggo/gin-swagger v1.6.0
|
||||
github.com/swaggo/swag v1.16.4
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/KyleBanks/depth v1.2.1 // indirect
|
||||
github.com/bytedance/sonic v1.13.1 // indirect
|
||||
github.com/bytedance/sonic/loader v0.2.4 // indirect
|
||||
github.com/cloudwego/base64x v0.1.5 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
|
||||
github.com/gin-contrib/sse v1.0.0 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.25.0 // indirect
|
||||
github.com/goccy/go-json v0.10.5 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/mailru/easyjson v0.9.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||
golang.org/x/arch v0.15.0 // indirect
|
||||
golang.org/x/crypto v0.36.0 // indirect
|
||||
golang.org/x/net v0.37.0 // indirect
|
||||
golang.org/x/sys v0.31.0 // indirect
|
||||
golang.org/x/text v0.23.0 // indirect
|
||||
golang.org/x/tools v0.31.0 // indirect
|
||||
google.golang.org/protobuf v1.36.5 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
149
backend/go.sum
Normal file
149
backend/go.sum
Normal file
@ -0,0 +1,149 @@
|
||||
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
|
||||
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
|
||||
github.com/bytedance/sonic v1.13.1 h1:Jyd5CIvdFnkOWuKXr+wm4Nyk2h0yAFsr8ucJgEasO3g=
|
||||
github.com/bytedance/sonic v1.13.1/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=
|
||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=
|
||||
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
|
||||
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
|
||||
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
|
||||
github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
|
||||
github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
|
||||
github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk=
|
||||
github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E=
|
||||
github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0=
|
||||
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
||||
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ=
|
||||
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
|
||||
github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ=
|
||||
github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4=
|
||||
github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY=
|
||||
github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk=
|
||||
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
|
||||
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.25.0 h1:5Dh7cjvzR7BRZadnsVOzPhWsrwUr0nmsZJxEAnFLNO8=
|
||||
github.com/go-playground/validator/v10 v10.25.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus=
|
||||
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
||||
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
|
||||
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/oklog/ulid/v2 v2.1.0 h1:+9lhoxAP56we25tyYETBBY1YLA2SaoLvUFgrP2miPJU=
|
||||
github.com/oklog/ulid/v2 v2.1.0/go.mod h1:rcEKHmBBKfef9DhnvX7y1HZBYxjXb0cP5ExxNsTT1QQ=
|
||||
github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o=
|
||||
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
|
||||
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE=
|
||||
github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg=
|
||||
github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M=
|
||||
github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo=
|
||||
github.com/swaggo/swag v1.16.4 h1:clWJtd9LStiG3VeijiCfOVODP6VpHtKdQy9ELFG3s1A=
|
||||
github.com/swaggo/swag v1.16.4/go.mod h1:VBsHJRsDvfYvqoiMKnsdwhNV9LEMHgEDZcyVYX0sxPg=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
golang.org/x/arch v0.15.0 h1:QtOrQd0bTUnhNVNndMpLHNWrDmYzZ2KDqSrEymqInZw=
|
||||
golang.org/x/arch v0.15.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
|
||||
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
|
||||
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
|
||||
golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
|
||||
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
||||
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
||||
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU=
|
||||
golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
|
||||
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
@ -1,7 +1,22 @@
|
||||
package entities
|
||||
|
||||
import (
|
||||
"github.com/oklog/ulid/v2"
|
||||
)
|
||||
|
||||
type Activity struct {
|
||||
ID int
|
||||
ID ulid.ULID
|
||||
Name string
|
||||
BillingRate float64
|
||||
}
|
||||
|
||||
type ActivityUpdate struct {
|
||||
ID ulid.ULID
|
||||
Name *string
|
||||
BillingRate *float64
|
||||
}
|
||||
|
||||
type ActivityCreate struct {
|
||||
Name string
|
||||
BillingRate float64
|
||||
}
|
||||
|
@ -1,6 +1,17 @@
|
||||
package entities
|
||||
|
||||
import "github.com/oklog/ulid/v2"
|
||||
|
||||
type Company struct {
|
||||
ID int
|
||||
ID ulid.ULID
|
||||
Name string
|
||||
}
|
||||
|
||||
type CompanyCreate struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
type CompanyUpdate struct {
|
||||
ID ulid.ULID
|
||||
Name *string
|
||||
}
|
||||
|
@ -1,7 +1,20 @@
|
||||
package entities
|
||||
|
||||
import "github.com/oklog/ulid/v2"
|
||||
|
||||
type Customer struct {
|
||||
ID int
|
||||
ID ulid.ULID
|
||||
Name string
|
||||
CompanyID int
|
||||
}
|
||||
|
||||
type CustomerCreate struct {
|
||||
Name string
|
||||
CompanyID int
|
||||
}
|
||||
|
||||
type CustomerUpdate struct {
|
||||
ID ulid.ULID
|
||||
Name *string
|
||||
CompanyID *int
|
||||
}
|
||||
|
@ -1,7 +1,20 @@
|
||||
package entities
|
||||
|
||||
import "github.com/oklog/ulid/v2"
|
||||
|
||||
type Project struct {
|
||||
ID int
|
||||
ID ulid.ULID
|
||||
Name string
|
||||
CustomerID int
|
||||
}
|
||||
|
||||
type ProjectCreate struct {
|
||||
Name string
|
||||
CustomerID int
|
||||
}
|
||||
|
||||
type ProjectUpdate struct {
|
||||
ID ulid.ULID
|
||||
Name *string
|
||||
CustomerID *int
|
||||
}
|
||||
|
@ -1,9 +1,13 @@
|
||||
package entities
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/oklog/ulid/v2"
|
||||
)
|
||||
|
||||
type TimeEntry struct {
|
||||
ID int
|
||||
ID ulid.ULID
|
||||
UserID int
|
||||
ProjectID int
|
||||
ActivityID int
|
||||
@ -12,3 +16,24 @@ type TimeEntry struct {
|
||||
Description string
|
||||
Billable int // Percentage (0-100)
|
||||
}
|
||||
|
||||
type TimeEntryCreate struct {
|
||||
UserID int
|
||||
ProjectID int
|
||||
ActivityID int
|
||||
Start time.Time
|
||||
End time.Time
|
||||
Description string
|
||||
Billable int // Percentage (0-100)
|
||||
}
|
||||
|
||||
type TimeEntryUpdate struct {
|
||||
ID ulid.ULID
|
||||
UserID *int
|
||||
ProjectID *int
|
||||
ActivityID *int
|
||||
Start *time.Time
|
||||
End *time.Time
|
||||
Description *string
|
||||
Billable *int // Percentage (0-100)
|
||||
}
|
||||
|
@ -1,10 +1,29 @@
|
||||
package entities
|
||||
|
||||
import "github.com/oklog/ulid/v2"
|
||||
|
||||
type User struct {
|
||||
ID int
|
||||
ID ulid.ULID
|
||||
Username string
|
||||
Password string
|
||||
Role string
|
||||
CompanyID int
|
||||
HourlyRate float64
|
||||
}
|
||||
|
||||
type UserCreate struct {
|
||||
Username string
|
||||
Password string
|
||||
Role string
|
||||
CompanyID int
|
||||
HourlyRate float64
|
||||
}
|
||||
|
||||
type UserUpdate struct {
|
||||
ID ulid.ULID
|
||||
Username *string
|
||||
Password *string
|
||||
Role *string
|
||||
CompanyID *int
|
||||
HourlyRate *float64
|
||||
}
|
||||
|
22
backend/internal/interfaces/http/dto/activity_dto.go
Normal file
22
backend/internal/interfaces/http/dto/activity_dto.go
Normal file
@ -0,0 +1,22 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"github.com/oklog/ulid/v2"
|
||||
)
|
||||
|
||||
type ActivityDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
BillingRate float64 `json:"billingRate"`
|
||||
}
|
||||
|
||||
type ActivityCreateDto struct {
|
||||
Name string `json:"name"`
|
||||
BillingRate float64 `json:"billingRate"`
|
||||
}
|
||||
|
||||
type ActivityUpdateDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name *string `json:"name"`
|
||||
BillingRate *float64 `json:"billingRate"`
|
||||
}
|
19
backend/internal/interfaces/http/dto/company_dto.go
Normal file
19
backend/internal/interfaces/http/dto/company_dto.go
Normal file
@ -0,0 +1,19 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"github.com/oklog/ulid/v2"
|
||||
)
|
||||
|
||||
type CompanyDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type CompanyCreateDto struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type CompanyUpdateDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name *string `json:"name"`
|
||||
}
|
22
backend/internal/interfaces/http/dto/customer_dto.go
Normal file
22
backend/internal/interfaces/http/dto/customer_dto.go
Normal file
@ -0,0 +1,22 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"github.com/oklog/ulid/v2"
|
||||
)
|
||||
|
||||
type CustomerDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
CompanyID int `json:"companyId"`
|
||||
}
|
||||
|
||||
type CustomerCreateDto struct {
|
||||
Name string `json:"name"`
|
||||
CompanyID int `json:"companyId"`
|
||||
}
|
||||
|
||||
type CustomerUpdateDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name *string `json:"name"`
|
||||
CompanyID *int `json:"companyId"`
|
||||
}
|
22
backend/internal/interfaces/http/dto/project_dto.go
Normal file
22
backend/internal/interfaces/http/dto/project_dto.go
Normal file
@ -0,0 +1,22 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"github.com/oklog/ulid/v2"
|
||||
)
|
||||
|
||||
type ProjectDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
CustomerID int `json:"customerId"`
|
||||
}
|
||||
|
||||
type ProjectCreateDto struct {
|
||||
Name string `json:"name"`
|
||||
CustomerID int `json:"customerId"`
|
||||
}
|
||||
|
||||
type ProjectUpdateDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name *string `json:"name"`
|
||||
CustomerID *int `json:"customerId"`
|
||||
}
|
39
backend/internal/interfaces/http/dto/timeentry_dto.go
Normal file
39
backend/internal/interfaces/http/dto/timeentry_dto.go
Normal file
@ -0,0 +1,39 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/oklog/ulid/v2"
|
||||
)
|
||||
|
||||
type TimeEntryDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
UserID int `json:"userId"`
|
||||
ProjectID int `json:"projectId"`
|
||||
ActivityID int `json:"activityId"`
|
||||
Start time.Time `json:"start"`
|
||||
End time.Time `json:"end"`
|
||||
Description string `json:"description"`
|
||||
Billable int `json:"billable"` // Percentage (0-100)
|
||||
}
|
||||
|
||||
type TimeEntryCreateDto struct {
|
||||
UserID int `json:"userId"`
|
||||
ProjectID int `json:"projectId"`
|
||||
ActivityID int `json:"activityId"`
|
||||
Start time.Time `json:"start"`
|
||||
End time.Time `json:"end"`
|
||||
Description string `json:"description"`
|
||||
Billable int `json:"billable"` // Percentage (0-100)
|
||||
}
|
||||
|
||||
type TimeEntryUpdateDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
UserID *int `json:"userId"`
|
||||
ProjectID *int `json:"projectId"`
|
||||
ActivityID *int `json:"activityId"`
|
||||
Start *time.Time `json:"start"`
|
||||
End *time.Time `json:"end"`
|
||||
Description *string `json:"description"`
|
||||
Billable *int `json:"billable"` // Percentage (0-100)
|
||||
}
|
31
backend/internal/interfaces/http/dto/user_dto.go
Normal file
31
backend/internal/interfaces/http/dto/user_dto.go
Normal file
@ -0,0 +1,31 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"github.com/oklog/ulid/v2"
|
||||
)
|
||||
|
||||
type UserDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"` // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
|
||||
Role string `json:"role"`
|
||||
CompanyID int `json:"companyId"`
|
||||
HourlyRate float64 `json:"hourlyRate"`
|
||||
}
|
||||
|
||||
type UserCreateDto struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"` // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
|
||||
Role string `json:"role"`
|
||||
CompanyID int `json:"companyId"`
|
||||
HourlyRate float64 `json:"hourlyRate"`
|
||||
}
|
||||
|
||||
type UserUpdateDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Username *string `json:"username"`
|
||||
Password *string `json:"password"` // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
|
||||
Role *string `json:"role"`
|
||||
CompanyID *int `json:"companyId"`
|
||||
HourlyRate *float64 `json:"hourlyRate"`
|
||||
}
|
6
backend/tygo.yml
Normal file
6
backend/tygo.yml
Normal file
@ -0,0 +1,6 @@
|
||||
packages:
|
||||
- path: github.com/timetracker/backend/internal/interfaces/http/dto
|
||||
type_mappings:
|
||||
"time.Time": "string"
|
||||
"ulid.ULID": "string"
|
||||
output_path: ../frontend/src/types/dto.ts
|
19
frontend/src/types/activity.ts
Normal file
19
frontend/src/types/activity.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { ActivityDto, ActivityCreateDto, ActivityUpdateDto } from "./dto";
|
||||
|
||||
export type Activity = ActivityDto;
|
||||
|
||||
export const mapActivityDtoToActivity = (dto: ActivityDto): Activity => ({
|
||||
...dto,
|
||||
});
|
||||
|
||||
export type ActivityCreate = ActivityCreateDto;
|
||||
|
||||
export const mapActivityCreateDtoToActivityCreate = (dto: ActivityCreateDto): ActivityCreate => ({
|
||||
...dto,
|
||||
});
|
||||
|
||||
export type ActivityUpdate = ActivityUpdateDto;
|
||||
|
||||
export const mapActivityUpdateDtoToActivityUpdate = (dto: ActivityUpdateDto): ActivityUpdate => ({
|
||||
...dto,
|
||||
});
|
19
frontend/src/types/company.ts
Normal file
19
frontend/src/types/company.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { CompanyDto, CompanyCreateDto, CompanyUpdateDto } from "./dto";
|
||||
|
||||
export type Company = CompanyDto;
|
||||
|
||||
export const mapCompanyDtoToCompany = (dto: CompanyDto): Company => ({
|
||||
...dto,
|
||||
});
|
||||
|
||||
export type CompanyCreate = CompanyCreateDto;
|
||||
|
||||
export const mapCompanyCreateDtoToCompanyCreate = (dto: CompanyCreateDto): CompanyCreate => ({
|
||||
...dto,
|
||||
});
|
||||
|
||||
export type CompanyUpdate = CompanyUpdateDto;
|
||||
|
||||
export const mapCompanyUpdateDtoToCompanyUpdate = (dto: CompanyUpdateDto): CompanyUpdate => ({
|
||||
...dto,
|
||||
});
|
19
frontend/src/types/customer.ts
Normal file
19
frontend/src/types/customer.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { CustomerDto, CustomerCreateDto, CustomerUpdateDto } from "./dto";
|
||||
|
||||
export type Customer = CustomerDto;
|
||||
|
||||
export const mapCustomerDtoToCustomer = (dto: CustomerDto): Customer => ({
|
||||
...dto,
|
||||
});
|
||||
|
||||
export type CustomerCreate = CustomerCreateDto;
|
||||
|
||||
export const mapCustomerCreateDtoToCustomerCreate = (dto: CustomerCreateDto): CustomerCreate => ({
|
||||
...dto,
|
||||
});
|
||||
|
||||
export type CustomerUpdate = CustomerUpdateDto;
|
||||
|
||||
export const mapCustomerUpdateDtoToCustomerUpdate = (dto: CustomerUpdateDto): CustomerUpdate => ({
|
||||
...dto,
|
||||
});
|
130
frontend/src/types/dto.ts
Normal file
130
frontend/src/types/dto.ts
Normal file
@ -0,0 +1,130 @@
|
||||
// Code generated by tygo. DO NOT EDIT.
|
||||
|
||||
//////////
|
||||
// source: activity_dto.go
|
||||
|
||||
export interface ActivityDto {
|
||||
id: string;
|
||||
name: string;
|
||||
billingRate: number /* float64 */;
|
||||
}
|
||||
export interface ActivityCreateDto {
|
||||
name: string;
|
||||
billingRate: number /* float64 */;
|
||||
}
|
||||
export interface ActivityUpdateDto {
|
||||
id: string;
|
||||
name?: string;
|
||||
billingRate?: number /* float64 */;
|
||||
}
|
||||
|
||||
//////////
|
||||
// source: company_dto.go
|
||||
|
||||
export interface CompanyDto {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
export interface CompanyCreateDto {
|
||||
name: string;
|
||||
}
|
||||
export interface CompanyUpdateDto {
|
||||
id: string;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
//////////
|
||||
// source: customer_dto.go
|
||||
|
||||
export interface CustomerDto {
|
||||
id: string;
|
||||
name: string;
|
||||
companyId: number /* int */;
|
||||
}
|
||||
export interface CustomerCreateDto {
|
||||
name: string;
|
||||
companyId: number /* int */;
|
||||
}
|
||||
export interface CustomerUpdateDto {
|
||||
id: string;
|
||||
name?: string;
|
||||
companyId?: number /* int */;
|
||||
}
|
||||
|
||||
//////////
|
||||
// source: project_dto.go
|
||||
|
||||
export interface ProjectDto {
|
||||
id: string;
|
||||
name: string;
|
||||
customerId: number /* int */;
|
||||
}
|
||||
export interface ProjectCreateDto {
|
||||
name: string;
|
||||
customerId: number /* int */;
|
||||
}
|
||||
export interface ProjectUpdateDto {
|
||||
id: string;
|
||||
name?: string;
|
||||
customerId?: number /* int */;
|
||||
}
|
||||
|
||||
//////////
|
||||
// source: timeentry_dto.go
|
||||
|
||||
export interface TimeEntryDto {
|
||||
id: string;
|
||||
userId: number /* int */;
|
||||
projectId: number /* int */;
|
||||
activityId: number /* int */;
|
||||
start: string;
|
||||
end: string;
|
||||
description: string;
|
||||
billable: number /* int */; // Percentage (0-100)
|
||||
}
|
||||
export interface TimeEntryCreateDto {
|
||||
userId: number /* int */;
|
||||
projectId: number /* int */;
|
||||
activityId: number /* int */;
|
||||
start: string;
|
||||
end: string;
|
||||
description: string;
|
||||
billable: number /* int */; // Percentage (0-100)
|
||||
}
|
||||
export interface TimeEntryUpdateDto {
|
||||
id: string;
|
||||
userId?: number /* int */;
|
||||
projectId?: number /* int */;
|
||||
activityId?: number /* int */;
|
||||
start?: string;
|
||||
end?: string;
|
||||
description?: string;
|
||||
billable?: number /* int */; // Percentage (0-100)
|
||||
}
|
||||
|
||||
//////////
|
||||
// source: user_dto.go
|
||||
|
||||
export interface UserDto {
|
||||
id: string;
|
||||
username: string;
|
||||
password: string; // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
|
||||
role: string;
|
||||
companyId: number /* int */;
|
||||
hourlyRate: number /* float64 */;
|
||||
}
|
||||
export interface UserCreateDto {
|
||||
username: string;
|
||||
password: string; // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
|
||||
role: string;
|
||||
companyId: number /* int */;
|
||||
hourlyRate: number /* float64 */;
|
||||
}
|
||||
export interface UserUpdateDto {
|
||||
id: string;
|
||||
username?: string;
|
||||
password?: string; // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
|
||||
role?: string;
|
||||
companyId?: number /* int */;
|
||||
hourlyRate?: number /* float64 */;
|
||||
}
|
19
frontend/src/types/project.ts
Normal file
19
frontend/src/types/project.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { ProjectDto, ProjectCreateDto, ProjectUpdateDto } from "./dto";
|
||||
|
||||
export type Project = ProjectDto;
|
||||
|
||||
export const mapProjectDtoToProject = (dto: ProjectDto): Project => ({
|
||||
...dto,
|
||||
});
|
||||
|
||||
export type ProjectCreate = ProjectCreateDto;
|
||||
|
||||
export const mapProjectCreateDtoToProjectCreate = (dto: ProjectCreateDto): ProjectCreate => ({
|
||||
...dto,
|
||||
});
|
||||
|
||||
export type ProjectUpdate = ProjectUpdateDto;
|
||||
|
||||
export const mapProjectUpdateDtoToProjectUpdate = (dto: ProjectUpdateDto): ProjectUpdate => ({
|
||||
...dto,
|
||||
});
|
34
frontend/src/types/timeentry.ts
Normal file
34
frontend/src/types/timeentry.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import { TimeEntryDto, TimeEntryCreateDto, TimeEntryUpdateDto } from "./dto";
|
||||
|
||||
export type TimeEntry = Omit<TimeEntryDto, "start" | "end"> & {
|
||||
start: Date;
|
||||
end: Date;
|
||||
};
|
||||
|
||||
export const mapTimeEntryDtoToTimeEntry = (dto: TimeEntryDto): TimeEntry => ({
|
||||
...dto,
|
||||
start: new Date(dto.start),
|
||||
end: new Date(dto.end),
|
||||
});
|
||||
|
||||
export type TimeEntryCreate = Omit<TimeEntryCreateDto, "start" | "end"> & {
|
||||
start: Date;
|
||||
end: Date;
|
||||
};
|
||||
|
||||
export const mapTimeEntryCreateDtoToTimeEntryCreate = (dto: TimeEntryCreateDto): TimeEntryCreate => ({
|
||||
...dto,
|
||||
start: new Date(dto.start),
|
||||
end: new Date(dto.end),
|
||||
});
|
||||
|
||||
export type TimeEntryUpdate = Omit<TimeEntryUpdateDto, "start" | "end"> & {
|
||||
start?: Date;
|
||||
end?: Date;
|
||||
};
|
||||
|
||||
export const mapTimeEntryUpdateDtoToTimeEntryUpdate = (dto: TimeEntryUpdateDto): TimeEntryUpdate => ({
|
||||
...dto,
|
||||
start: dto.start ? new Date(dto.start) : undefined,
|
||||
end: dto.end ? new Date(dto.end) : undefined,
|
||||
});
|
19
frontend/src/types/user.ts
Normal file
19
frontend/src/types/user.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { UserDto, UserCreateDto, UserUpdateDto } from "./dto";
|
||||
|
||||
export type User = Omit<UserDto, never>;
|
||||
|
||||
export const mapUserDtoToUser = (dto: UserDto): User => ({
|
||||
...dto,
|
||||
});
|
||||
|
||||
export type UserCreate = Omit<UserCreateDto, never>;
|
||||
|
||||
export const mapUserCreateDtoToUserCreate = (dto: UserCreateDto): UserCreate => ({
|
||||
...dto,
|
||||
});
|
||||
|
||||
export type UserUpdate = Omit<UserUpdateDto, never>;
|
||||
|
||||
export const mapUserUpdateDtoToUserUpdate = (dto: UserUpdateDto): UserUpdate => ({
|
||||
...dto,
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user