From 831c5d71f0376db9a3b920e378f545c514c4bf79 Mon Sep 17 00:00:00 2001 From: tom Date: Thu, 20 Feb 2025 14:35:45 +0100 Subject: [PATCH] CHANGE: added env file, checking docker postgres initdb --- .gitignore | 4 ++ Backend/static/css/styles.css | 73 +++++------------------ Backend/templates/timeComponents.templ | 8 ++- Backend/templates/timeComponents_templ.go | 34 +++++------ Docker/docker-compose.yml | 3 +- Docker/{.env => example.env} | 3 +- 6 files changed, 44 insertions(+), 81 deletions(-) rename Docker/{.env => example.env} (63%) diff --git a/.gitignore b/.gitignore index 97ce011..2501731 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,7 @@ go.work.sum **__debug* *_templ.txt +DB/pg_data + +.env +.env.* diff --git a/Backend/static/css/styles.css b/Backend/static/css/styles.css index 04deaa6..285c98d 100644 --- a/Backend/static/css/styles.css +++ b/Backend/static/css/styles.css @@ -556,24 +556,12 @@ .col-span-3 { grid-column: span 3 / span 3; } - .col-span-5 { - grid-column: span 5 / span 5; - } .col-span-full { grid-column: 1 / -1; } - .row-span-3 { - grid-row: span 3 / span 3; - } - .row-span-full { - grid-row: 1 / -1; - } .-my-1 { margin-block: calc(var(--spacing) * -1); } - .my-2 { - margin-block: calc(var(--spacing) * 2); - } .mt-1 { margin-top: calc(var(--spacing) * 1); } @@ -627,9 +615,6 @@ .w-full { width: 100%; } - .max-w-\[70\%\] { - max-width: 70%; - } .flex-grow { flex-grow: 1; } @@ -648,9 +633,6 @@ .resize { resize: both; } - .grid-cols-4 { - grid-template-columns: repeat(4, minmax(0, 1fr)); - } .grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } @@ -695,11 +677,6 @@ border-bottom-width: calc(1px * calc(1 - var(--tw-divide-y-reverse))); } } - .divide-neutral-300 { - :where(& > :not(:last-child)) { - border-color: var(--color-neutral-300); - } - } .divide-neutral-400 { :where(& > :not(:last-child)) { border-color: var(--color-neutral-400); @@ -718,24 +695,13 @@ border-style: var(--tw-border-style); border-width: 1px; } - .border-0 { - border-style: var(--tw-border-style); - border-width: 0px; - } .border-r-0 { border-right-style: var(--tw-border-style); border-right-width: 0px; } - .border-b-0 { - border-bottom-style: var(--tw-border-style); - border-bottom-width: 0px; - } .border-neutral-200 { border-color: var(--color-neutral-200); } - .border-neutral-400 { - border-color: var(--color-neutral-400); - } .border-neutral-900 { border-color: var(--color-neutral-900); } @@ -786,9 +752,6 @@ .text-accent { color: var(--color-accent); } - .text-black { - color: var(--color-black); - } .text-neutral-500 { color: var(--color-neutral-500); } @@ -832,11 +795,6 @@ --tw-duration: 300ms; transition-duration: 300ms; } - .group-\[\.edit\]\:block { - &:is(:where(.group):is(.edit) *) { - display: block; - } - } .group-\[\.edit\]\:hidden { &:is(:where(.group):is(.edit) *) { display: none; @@ -847,16 +805,6 @@ display: inline; } } - .peer-\[\.edit\]\:block { - &:is(:where(.peer):is(.edit) ~ *) { - display: block; - } - } - .peer-\[\.edit\]\:hidden { - &:is(:where(.peer):is(.edit) ~ *) { - display: none; - } - } .placeholder\:text-neutral-400 { &::placeholder { color: var(--color-neutral-400); @@ -869,6 +817,20 @@ } } } + .hover\:bg-neutral-200 { + &:hover { + @media (hover: hover) { + background-color: var(--color-neutral-200); + } + } + } + .hover\:bg-neutral-300 { + &:hover { + @media (hover: hover) { + background-color: var(--color-neutral-300); + } + } + } .hover\:bg-neutral-700 { &:hover { @media (hover: hover) { @@ -956,13 +918,6 @@ } } } - .md\:group-\[\.edit\]\:block { - @media (width >= 48rem) { - &:is(:where(.group):is(.edit) *) { - display: block; - } - } - } .print\:hidden { @media print { display: none; diff --git a/Backend/templates/timeComponents.templ b/Backend/templates/timeComponents.templ index d4b948b..28ba16a 100644 --- a/Backend/templates/timeComponents.templ +++ b/Backend/templates/timeComponents.templ @@ -13,6 +13,7 @@ templ inputForm(){ urlParams := ctx.Value("urlParams").(url.Values) user := ctx.Value("user").(models.User) }} +

{user.Vorname + " " + user.Name}

Überstunden

@@ -22,7 +23,7 @@ templ inputForm(){ // @lineComponent()
- +
@@ -34,10 +35,11 @@ templ inputForm(){
+
} templ dayComponent(workDay models.WorkDay){ -
+
@timeGaugeComponent(workDay.GetWorkDayProgress(), workDay.Day.Equal(time.Now().Truncate(24 * time.Hour)), workDay.RequiresAction())
@@ -96,7 +98,7 @@ templ timeGaugeComponent(progress uint8, today bool, warning bool){ } }} if today { -
+
}else { diff --git a/Backend/templates/timeComponents_templ.go b/Backend/templates/timeComponents_templ.go index 014b0c1..f1b67db 100644 --- a/Backend/templates/timeComponents_templ.go +++ b/Backend/templates/timeComponents_templ.go @@ -40,14 +40,14 @@ func inputForm() templ.Component { urlParams := ctx.Value("urlParams").(url.Values) user := ctx.Value("user").(models.User) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(user.Vorname + " " + user.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 17, Col: 64} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 18, Col: 64} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -68,26 +68,26 @@ func inputForm() templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(urlParams.Get("time_from")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 25, Col: 55} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 26, Col: 55} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "\" name=\"time_from\" class=\"w-full bg-neutral-100 placeholder:text-neutral-400 text-neutral-700 text-sm border border-neutral-200 rounded-md px-3 py-2 transition duration-300 ease focus:outline-none focus:border-neutral-400 hover:border-neutral-300\" placeholder=\"Zeitraum von...\">

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "\" name=\"time_to\" class=\"w-full bg-neutral-100 placeholder:text-neutral-400 text-neutral-700 text-sm border border-neutral-0 rounded-md px-3 py-2 transition duration-300 ease focus:outline-none focus:border-neutral-400 hover:border-neutral-300\" placeholder=\"Zeitraum bis...\">
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -116,7 +116,7 @@ func dayComponent(workDay models.WorkDay) templ.Component { templ_7745c5c3_Var5 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -131,7 +131,7 @@ func dayComponent(workDay models.WorkDay) templ.Component { var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(workDay.Day.Format("Mon")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 44, Col: 77} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 46, Col: 77} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -144,7 +144,7 @@ func dayComponent(workDay models.WorkDay) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(workDay.Day.Format("02.01.2006")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 44, Col: 120} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 46, Col: 120} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -167,7 +167,7 @@ func dayComponent(workDay models.WorkDay) templ.Component { var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(workDay.GetWorkTimeString()) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 49, Col: 56} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 51, Col: 56} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { @@ -193,7 +193,7 @@ func dayComponent(workDay models.WorkDay) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs("time-" + workDay.Day.Format("2006-01-02")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 55, Col: 54} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 57, Col: 54} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -308,7 +308,7 @@ func timeGaugeComponent(progress uint8, today bool, warning bool) templ.Componen break } if today { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -337,7 +337,7 @@ func timeGaugeComponent(progress uint8, today bool, warning bool) templ.Componen var templ_7745c5c3_Var15 string templ_7745c5c3_Var15, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues(fmt.Sprintf("height: %d%%", int(progress))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 100, Col: 146} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 102, Col: 146} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) if templ_7745c5c3_Err != nil { @@ -432,7 +432,7 @@ func bookingComponent(booking models.Booking) templ.Component { var templ_7745c5c3_Var20 string templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(booking.Timestamp.Local().Format("15:04")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 123, Col: 103} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 125, Col: 103} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) if templ_7745c5c3_Err != nil { @@ -445,7 +445,7 @@ func bookingComponent(booking models.Booking) templ.Component { var templ_7745c5c3_Var21 string templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs("booking_" + strconv.Itoa(booking.CounterId)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 124, Col: 59} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 126, Col: 59} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) if templ_7745c5c3_Err != nil { @@ -458,7 +458,7 @@ func bookingComponent(booking models.Booking) templ.Component { var templ_7745c5c3_Var22 string templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(booking.Timestamp.Local().Format("15:04")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 124, Col: 342} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 126, Col: 342} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) if templ_7745c5c3_Err != nil { @@ -471,7 +471,7 @@ func bookingComponent(booking models.Booking) templ.Component { var templ_7745c5c3_Var23 string templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(booking.GetBookingType()) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 125, Col: 27} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/timeComponents.templ`, Line: 127, Col: 27} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) if templ_7745c5c3_Err != nil { diff --git a/Docker/docker-compose.yml b/Docker/docker-compose.yml index 612ea13..60da485 100644 --- a/Docker/docker-compose.yml +++ b/Docker/docker-compose.yml @@ -6,12 +6,13 @@ services: env_file: - .env environment: - POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_USER: ${POSTGRES_ADMIN} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_DB: ${POSTGRES_DB} PGDATA: /var/lib/postgresql/data/pg_data volumes: - ${POSTGRES_PATH}:/var/lib/postgresql/data + - ${POSTGRES_PATH}/initdb:/docker-entrypoint-initdb.d backend: image: git.letsstein.de/tom/arbeitszeit-backend diff --git a/Docker/.env b/Docker/example.env similarity index 63% rename from Docker/.env rename to Docker/example.env index fdf9775..942ebf5 100644 --- a/Docker/.env +++ b/Docker/example.env @@ -1,5 +1,6 @@ +POSTGRES_ADMIN=root POSTGRES_USER=arbeit_zeit -POSTGRES_PASSWORD=password +POSTGRES_PASSWORD=secure_password POSTGRES_PATH=../DB POSTGRES_DB=arbeitszeitmessung EXPOSED_PORT=8000