mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 12:57:34 +00:00
chore: move the go code into a subfolder
This commit is contained in:
40
apps/api/internal/repository/deviceauth/constraints.go
Normal file
40
apps/api/internal/repository/deviceauth/constraints.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package deviceauth
|
||||
|
||||
import (
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
)
|
||||
|
||||
const (
|
||||
UniqueUserCode = "user_code"
|
||||
UniqueDeviceCode = "device_code"
|
||||
DuplicateUserCode = "Errors.DeviceUserCode.AlreadyExists"
|
||||
DuplicateDeviceCode = "Errors.DeviceCode.AlreadyExists"
|
||||
)
|
||||
|
||||
func NewAddUniqueConstraints(deviceCode, userCode string) []*eventstore.UniqueConstraint {
|
||||
return []*eventstore.UniqueConstraint{
|
||||
eventstore.NewAddEventUniqueConstraint(
|
||||
UniqueDeviceCode,
|
||||
deviceCode,
|
||||
DuplicateDeviceCode,
|
||||
),
|
||||
eventstore.NewAddEventUniqueConstraint(
|
||||
UniqueUserCode,
|
||||
userCode,
|
||||
DuplicateUserCode,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func NewRemoveUniqueConstraints(deviceCode, userCode string) []*eventstore.UniqueConstraint {
|
||||
return []*eventstore.UniqueConstraint{
|
||||
eventstore.NewRemoveUniqueConstraint(
|
||||
UniqueDeviceCode,
|
||||
deviceCode,
|
||||
),
|
||||
eventstore.NewRemoveUniqueConstraint(
|
||||
UniqueUserCode,
|
||||
userCode,
|
||||
),
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user