Add first login route

This commit is contained in:
Achim Rohn
2025-09-17 16:30:18 +02:00
parent 2a3506d21b
commit 8bc7b1e27b
9 changed files with 104 additions and 21 deletions
+7 -7
View File
@@ -7,8 +7,8 @@ import (
"errors"
"ersteller-lib/starter/ent/googleauth"
"ersteller-lib/starter/ent/predicate"
"ersteller-lib/starter/ent/schema"
"ersteller-lib/starter/ent/user"
"ersteller-lib/starter/google"
"fmt"
"sync"
"time"
@@ -38,7 +38,7 @@ type GoogleAuthMutation struct {
id *int
created_at *time.Time
updated_at *time.Time
credentials *google.Credentials
credentials *schema.Credentials
clearedFields map[string]struct{}
user *int
cleareduser bool
@@ -218,12 +218,12 @@ func (m *GoogleAuthMutation) ResetUpdatedAt() {
}
// SetCredentials sets the "credentials" field.
func (m *GoogleAuthMutation) SetCredentials(_go google.Credentials) {
m.credentials = &_go
func (m *GoogleAuthMutation) SetCredentials(s schema.Credentials) {
m.credentials = &s
}
// Credentials returns the value of the "credentials" field in the mutation.
func (m *GoogleAuthMutation) Credentials() (r google.Credentials, exists bool) {
func (m *GoogleAuthMutation) Credentials() (r schema.Credentials, exists bool) {
v := m.credentials
if v == nil {
return
@@ -234,7 +234,7 @@ func (m *GoogleAuthMutation) Credentials() (r google.Credentials, exists bool) {
// OldCredentials returns the old "credentials" field's value of the GoogleAuth entity.
// If the GoogleAuth object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GoogleAuthMutation) OldCredentials(ctx context.Context) (v google.Credentials, err error) {
func (m *GoogleAuthMutation) OldCredentials(ctx context.Context) (v schema.Credentials, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCredentials is only allowed on UpdateOne operations")
}
@@ -389,7 +389,7 @@ func (m *GoogleAuthMutation) SetField(name string, value ent.Value) error {
m.SetUpdatedAt(v)
return nil
case googleauth.FieldCredentials:
v, ok := value.(google.Credentials)
v, ok := value.(schema.Credentials)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}