Skip to content

Commit

Permalink
feat: add timeclock range check for 6 months
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Trost <[email protected]>
  • Loading branch information
galexrt committed Jan 31, 2025
1 parent bdaab84 commit a71f5f0
Show file tree
Hide file tree
Showing 12 changed files with 3,333 additions and 3,239 deletions.
1 change: 1 addition & 0 deletions app/components/rector/JobProps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ async function setJobProps(values: Schema): Promise<void> {
if (values.logoUrl && values.logoUrl[0]) {
jobProps.value.logoUrl = { data: new Uint8Array(await values.logoUrl[0].arrayBuffer()) };
}
// TODO past absence days option
try {
const { response } = await getGRPCRectorClient().setJobProps({
Expand Down
27 changes: 6 additions & 21 deletions gen/go/proto/resources/users/job_props.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ func (x *JobProps) Default(job string) {
if x.DiscordSyncSettings.QualificationsRoleFormat == "" {
x.DiscordSyncSettings.QualificationsRoleFormat = DefaultQualificationsRoleFormat
}

// Job Settings
if x.Settings == nil {
x.Settings = &JobSettings{}
}
x.Settings.Default()
}

// Scan implements driver.Valuer for protobuf QuickButtons.
Expand Down Expand Up @@ -174,27 +180,6 @@ func (x *CitizenLabel) Equal(a *CitizenLabel) bool {
return x.Name == a.Name
}

// Scan implements driver.Valuer for protobuf JobSettings.
func (x *JobSettings) Scan(value any) error {
switch t := value.(type) {
case string:
return protojson.Unmarshal([]byte(t), x)
case []byte:
return protojson.Unmarshal(t, x)
}
return nil
}

// Value marshals the value into driver.Valuer.
func (x *JobSettings) Value() (driver.Value, error) {
if x == nil {
return nil, nil
}

out, err := protoutils.Marshal(x)
return string(out), err
}

// Scan implements driver.Valuer for protobuf DiscordSyncChanges.
func (x *DiscordSyncChanges) Scan(value any) error {
switch t := value.(type) {
Expand Down
39 changes: 39 additions & 0 deletions gen/go/proto/resources/users/job_settings.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package users

import (
"database/sql/driver"

"github.com/fivenet-app/fivenet/pkg/utils/protoutils"
"google.golang.org/protobuf/encoding/protojson"
)

const (
DefaultJobAbsencePastDays = 7
)

func (x *JobSettings) Default() {
if x.AbsencePastDays <= 0 {
x.AbsencePastDays = DefaultJobAbsencePastDays
}
}

// Scan implements driver.Valuer for protobuf JobSettings.
func (x *JobSettings) Scan(value any) error {
switch t := value.(type) {
case string:
return protojson.Unmarshal([]byte(t), x)
case []byte:
return protojson.Unmarshal(t, x)
}
return nil
}

// Value marshals the value into driver.Valuer.
func (x *JobSettings) Value() (driver.Value, error) {
if x == nil {
return nil, nil
}

out, err := protoutils.Marshal(x)
return string(out), err
}
51 changes: 31 additions & 20 deletions gen/go/proto/resources/users/job_settings.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions gen/go/proto/resources/users/job_settings.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a71f5f0

Please sign in to comment.