Move kind to string

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-03-11 10:18:59 +01:00
parent 764f61bfa7
commit e393411333
19 changed files with 52 additions and 238 deletions

View File

@@ -38,7 +38,7 @@ type (
Source ProfileSource `db:"source"`
State ProfileState `db:"state"`
FullName string `db:"full_name"`
Kind *MembershipProfileKind `db:"kind"`
Kind *string `db:"kind"`
AdditionalEmailAddresses mail.Addrs `db:"additional_email_addresses"`
Position *string `db:"position"`
ContractStartDate *time.Time `db:"contract_start_date"`

View File

@@ -1,67 +0,0 @@
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package coredata
import (
"database/sql/driver"
"fmt"
)
type (
MembershipProfileKind string
)
const (
MembershipProfileKindEmployee MembershipProfileKind = "EMPLOYEE"
MembershipProfileKindContractor MembershipProfileKind = "CONTRACTOR"
MembershipProfileKindServiceAccount MembershipProfileKind = "SERVICE_ACCOUNT"
)
func MembershipProfileKinds() []MembershipProfileKind {
return []MembershipProfileKind{
MembershipProfileKindEmployee,
MembershipProfileKindContractor,
MembershipProfileKindServiceAccount,
}
}
func (mpk MembershipProfileKind) MarshalText() ([]byte, error) {
return []byte(mpk), nil
}
func (mpk *MembershipProfileKind) UnmarshalText(data []byte) error {
*mpk = MembershipProfileKind(data)
return nil
}
func (mpk MembershipProfileKind) String() string {
return string(mpk)
}
func (mpk *MembershipProfileKind) Scan(value any) error {
switch v := value.(type) {
case string:
*mpk = MembershipProfileKind(v)
case []byte:
*mpk = MembershipProfileKind(v)
default:
return fmt.Errorf("unsupported type for MembershipProfileKind: %T", value)
}
return nil
}
func (mpk MembershipProfileKind) Value() (driver.Value, error) {
return string(mpk), nil
}