diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
new file mode 100644
index 00000000..d8781c44
--- /dev/null
+++ b/.github/pull_request_template.md
@@ -0,0 +1,27 @@
+## チケットへのリンク
+
+- https://github.com/orgs/GreenTeaProgrammers/projects/hogehoge-fugafugaaa
+
+## やったこと
+
+- このプルリクで何をしたのか?
+
+## やらないこと
+
+- このプルリクでやらないことは何か?(あれば。無いなら「無し」で OK)(やらない場合は、いつやるのかを明記する。)
+
+## できるようになること(ユーザ目線)
+
+- 何ができるようになるのか?(あれば。無いなら「無し」で OK)
+
+## できなくなること(ユーザ目線)
+
+- 何ができなくなるのか?(あれば。無いなら「無し」で OK)
+
+## 動作確認
+
+- [] どのような動作確認を行ったのか? 結果はどうか?
+
+## その他
+
+- レビュワーへの参考情報(実装上の懸念点や注意点などあれば記載)
diff --git a/.github/workflows/deploy-to-gcloud.yml b/.github/workflows/deploy-to-gcloud.yml
new file mode 100644
index 00000000..84894ed1
--- /dev/null
+++ b/.github/workflows/deploy-to-gcloud.yml
@@ -0,0 +1,68 @@
+name: Deploy to Google Cloud Run
+permissions:
+ id-token: write
+ contents: read
+
+on:
+ push:
+ branches:
+ - develop
+ paths:
+ - "backend/**"
+
+jobs:
+ setup-build-deploy:
+ name: Setup, Build, and Deploy
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Decrypt secrets
+ run: openssl aes-256-cbc -d -in backend/secrets/gcp-credentials.json.enc -out backend/secrets/gcp-credentials.json -k ${{ secrets.DECRYPTION_KEY }}
+
+ - name: Use decrypted secrets
+ run: |
+ echo "Secrets are decrypted and ready to use"
+
+ - name: Setup gcloud CLI
+ uses: google-github-actions/setup-gcloud@v2
+ with:
+ project_id: ${{ secrets.GCP_PROJECT_ID }}
+ skip_install: false
+ version: ">= 363.0.0"
+
+ - name: Auth
+ uses: google-github-actions/auth@v2
+ with:
+ workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
+ service_account: ${{ secrets.SERVICE_ACCOUNT }}
+ access_token_lifetime: 1200s
+
+ - name: Build Docker Image
+ run: |
+ docker build --tag=gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_DOCKER_IMAGE_NAME }}:latest \
+ --file=./backend/Dockerfile \
+ --platform linux/amd64 ./backend \
+ --build-arg DSN="${{ secrets.DSN }}" \
+ --build-arg DB_USER_NAME="${{ secrets.DB_USER_NAME }}" \
+ --build-arg DB_PASSWORD="${{ secrets.DB_PASSWORD }}" \
+ --build-arg DB_ADDR="${{ secrets.DB_ADDR }}" \
+ --build-arg DB_NAME="${{ secrets.DB_NAME }}" \
+ --build-arg PORT="${{ secrets.PORT }}" \
+ --build-arg MODE_DEV="${{ secrets.MODE_DEV }}" \
+ --build-arg GOOGLE_APPLICATION_CREDENTIALS="${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}" \
+ --build-arg STORAGE_BUCKET_NAME="${{ secrets.STORAGE_BUCKET_NAME }}" \
+ --build-arg PASSWORD_PEPPER="${{ secrets.PASSWORD_PEPPER }}" \
+ --build-arg ML_ADDR="${{ secrets.ML_ADDR }}"
+
+ - name: Configure Docker to use the gcloud command-line tool as a credential helper for the us region
+ run: gcloud auth configure-docker --quiet
+
+ - name: Push Docker Image to Google Container Registry
+ run: |
+ docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_DOCKER_IMAGE_NAME }}:latest
+
+ - name: Deploy to Cloud Run
+ run: |
+ gcloud run deploy ${{ secrets.GCP_CLOUD_RUN_NAME }} --image=gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_DOCKER_IMAGE_NAME }}:latest --platform=managed --project=${{ secrets.GCP_PROJECT_ID }} --region=${{ secrets.REGION }}
diff --git a/.github/workflows/deploy_cloudrun_machine_learning.yml b/.github/workflows/deploy_cloudrun_machine_learning.yml
new file mode 100644
index 00000000..fdeed16b
--- /dev/null
+++ b/.github/workflows/deploy_cloudrun_machine_learning.yml
@@ -0,0 +1,61 @@
+name: Deployment of machine learning gRPC server to CloudRun
+
+on:
+ push:
+ branches:
+ - develop
+ - feature/machine-learning/cicd
+ paths:
+ - ".github/workflows/deploy_cloudrun_machine_learning.yml"
+ - "machine_learning/**"
+
+permissions:
+ contents: read
+ pages: write
+ id-token: write
+
+jobs:
+ deploy:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Setup gcloud CLI
+ uses: google-github-actions/setup-gcloud@v2
+ with:
+ project_id: ${{ secrets.GCP_PROJECT_ID }}
+ skip_install: false
+ version: latest
+
+ # gcloud CLIを認証するステップを追加
+ - name: Google Cloud Platform Service Account Authentication
+ uses: google-github-actions/auth@v0.4.0
+ with:
+ workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
+ service_account: ${{ secrets.SERVICE_ACCOUNT }}
+ access_token_lifetime: 1200s
+
+ - name: Build Docker image
+ run: |
+ docker build \
+ --build-arg GCP_PROJECT_ID=${{ secrets.GCP_PROJECT_ID }} \
+ --build-arg BUCKET_NAME_FOR_ML=${{ secrets.BUCKET_NAME_FOR_ML }} \
+ --build-arg BUCKET_NAME_FOR_FACE=${{ secrets.BUCKET_NAME_FOR_FACE }} \
+ --tag=gcr.io/${{ secrets.GCP_PROJECT_NAME_FOR_ML }}/${{ secrets.GCP_IMAGE_NAME_FOR_ML }}:latest \
+ --file=./machine_learning/Dockerfile \
+ --platform linux/amd64 ./machine_learning
+
+ - name: Authenticate Docker to GCP
+ run: gcloud auth configure-docker --quiet
+
+ - name: Push Docker image to Artifact Registry
+ run: |
+ docker push gcr.io/${{ secrets.GCP_PROJECT_NAME_FOR_ML }}/${{ secrets.GCP_IMAGE_NAME_FOR_ML }}:latest
+
+ - name: Deploy to Cloud Run
+ run: |
+ gcloud run deploy ${{ secrets.GCP_SERVICE_NAME_FOR_ML }} \
+ --image gcr.io/${{ secrets.GCP_PROJECT_NAME_FOR_ML }}/${{ secrets.GCP_IMAGE_NAME_FOR_ML }}:latest \
+ --region ${{ secrets.REGION }} \
+ --platform managed
diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml
new file mode 100644
index 00000000..de7659a0
--- /dev/null
+++ b/.github/workflows/golangci-lint.yml
@@ -0,0 +1,37 @@
+name: golangci-lint
+
+on:
+ push:
+ branches:
+ - main # Changed from 'master' to 'main'
+ - develop # Added 'develop' branch
+ pull_request:
+ branches:
+ - main # Specify branches for pull request as well
+ - develop
+
+permissions:
+ contents: read
+
+jobs:
+ golangci:
+ name: lint
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-go@v5
+ with:
+ go-version: '1.21.5'
+ - name: golangci-lint
+ uses: golangci/golangci-lint-action@v4
+ with:
+ version: v1.54
+ working-directory: backend # Set this to the directory where your Go code is located
+
+ # You can uncomment and adjust the following lines if needed:
+ # args: --timeout=30m --config=/backend/.golangci.yml --issues-exit-code=0
+ # only-new-issues: true
+ # skip-cache: true
+ # skip-pkg-cache: true
+ # skip-build-cache: true
+ # install-mode: "goinstall"
diff --git a/backend/.env.example b/backend/.env.example
new file mode 100644
index 00000000..f9882f57
--- /dev/null
+++ b/backend/.env.example
@@ -0,0 +1,11 @@
+DSN=
+DB_USER_NAME=
+DB_PASSWORD=
+DB_ADDR=
+DB_NAME=
+PORT=
+MODE_DEV=
+GOOGLE_APPLICATION_CREDENTIALS=
+STORAGE_BUCKET_NAME=
+PASSWORD_PEPPER=
+ML_ADDR=
\ No newline at end of file
diff --git a/backend/.gitignore b/backend/.gitignore
new file mode 100644
index 00000000..b7d859d4
--- /dev/null
+++ b/backend/.gitignore
@@ -0,0 +1,33 @@
+# Created by https://www.toptal.com/developers/gitignore/api/go
+# Edit at https://www.toptal.com/developers/gitignore?templates=go
+
+### Go ###
+# If you prefer the allow list template instead of the deny list, see community template:
+# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
+#
+# Binaries for programs and plugins
+*.exe
+*.exe~
+*.dll
+*.so
+*.dylib
+
+# Test binary, built with `go test -c`
+*.test
+
+# Output of the go coverage tool, specifically when used with LiteIDE
+*.out
+
+# Dependency directories (remove the comment below to include it)
+# vendor/
+
+# Go workspace file
+go.work
+
+# End of https://www.toptal.com/developers/gitignore/api/go
+
+# envfile
+.env
+
+# secrets
+secrets-raw/*
\ No newline at end of file
diff --git a/backend/Dockerfile b/backend/Dockerfile
new file mode 100644
index 00000000..bdaa0bcc
--- /dev/null
+++ b/backend/Dockerfile
@@ -0,0 +1,66 @@
+# First stage: build environment
+FROM golang:1.21.5 AS builder
+
+WORKDIR /srv/grpc
+COPY . .
+
+# ARGでビルド時の引数を定義
+ARG DSN
+ARG DB_USER_NAME
+ARG DB_PASSWORD
+ARG DB_ADDR
+ARG DB_NAME
+ARG PORT
+ARG MODE_DEV
+ARG GOOGLE_APPLICATION_CREDENTIALS
+ARG STORAGE_BUCKET_NAME
+ARG PASSWORD_PEPPER
+ARG ML_ADDR
+
+ARG INSIDE_OF_CREDENTIALS
+
+# .env ファイルを生成
+RUN echo "DSN=$DSN" > .env \
+ && echo "DB_USER_NAME=$DB_USER_NAME" >> .env \
+ && echo "DB_PASSWORD=$DB_PASSWORD" >> .env \
+ && echo "DB_ADDR=$DB_ADDR" >> .env \
+ && echo "DB_NAME=$DB_NAME" >> .env \
+ && echo "PORT=$PORT" >> .env \
+ && echo "MODE_DEV=$MODE_DEV" >> .env \
+ && echo "GOOGLE_APPLICATION_CREDENTIALS=$GOOGLE_APPLICATION_CREDENTIALS" >> .env \
+ && echo "STORAGE_BUCKET_NAME=$STORAGE_BUCKET_NAME" >> .env \
+ && echo "PASSWORD_PEPPER=$PASSWORD_PEPPER" >> .env \
+ && echo "ML_ADDR=$ML_ADDR" >> .env
+
+RUN go mod download
+
+ARG VERS="3.11.4"
+ARG ARCH="linux-x86_64"
+
+RUN CGO_ENABLED=0 GOOS=linux \
+ go build -a -installsuffix cgo \
+ -o /go/bin/server \
+ github.com/GreenTeaProgrammers/WhereChildBus/backend/cmd/server
+
+# Final stage: runtime environment
+# CA証明書が必要なので、alpineをベースにする
+# Final stage: runtime environment
+FROM alpine:latest
+
+# 必要なパッケージをインストール
+RUN apk --no-cache add ca-certificates
+
+# アプリケーション実行用のディレクトリを設定
+WORKDIR /app
+
+# ビルドステージからバイナリファイルをコピー
+COPY --from=builder /go/bin/server /app/server
+
+# .envファイルを/appディレクトリにコピー
+COPY --from=builder /srv/grpc/.env /app/.env
+
+# secretsディレクトリを/appディレクトリにコピー
+COPY --from=builder /srv/grpc/secrets /app/secrets
+
+# アプリケーションの起動
+ENTRYPOINT ["/app/server"]
diff --git a/backend/DockerfileLocal b/backend/DockerfileLocal
new file mode 100644
index 00000000..6bf3038e
--- /dev/null
+++ b/backend/DockerfileLocal
@@ -0,0 +1,29 @@
+# First stage: build environment
+FROM golang:1.21.5 AS builder
+
+WORKDIR /srv/grpc
+COPY . .
+RUN go mod download
+
+ARG VERS="3.11.4"
+ARG ARCH="linux-x86_64"
+
+RUN CGO_ENABLED=0 GOOS=linux \
+ go build -a -installsuffix cgo \
+ -o /go/bin/server \
+ github.com/GreenTeaProgrammers/WhereChildBus/backend/cmd/server
+
+# Final stage: runtime environment
+# CA証明書が必要なので、alpineをベースにする
+FROM alpine:latest
+
+# 必要なパッケージをインストール
+RUN apk --no-cache add ca-certificates
+
+# ビルドステージからバイナリと.envファイルをコピー
+COPY --from=builder /go/bin/server /server
+COPY --from=builder /srv/grpc/.env /
+COPY --from=builder /srv/grpc/secrets /secrets
+
+# アプリケーションの起動
+ENTRYPOINT ["/server"]
\ No newline at end of file
diff --git a/backend/Makefile b/backend/Makefile
new file mode 100644
index 00000000..3f3889c3
--- /dev/null
+++ b/backend/Makefile
@@ -0,0 +1,3 @@
+.PHONY: ent/generate
+ent/generate:
+ @GOFLAGS="-mod=mod" go generate ./domain/repository/ent
\ No newline at end of file
diff --git a/backend/cmd/client/main.go b/backend/cmd/client/main.go
new file mode 100644
index 00000000..94a0d091
--- /dev/null
+++ b/backend/cmd/client/main.go
@@ -0,0 +1,112 @@
+package main
+
+import (
+ "context"
+ "crypto/tls"
+ "flag"
+ "fmt"
+ "io"
+ "log"
+
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/config"
+ "google.golang.org/api/idtoken"
+ "google.golang.org/api/option"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/credentials"
+)
+
+var (
+ grpcEndpoint = flag.String("grpc_endpoint", "", "The gRPC Endpoint of the Server")
+ cloudFunctionURL = "https://us-central1-wherechildbus.cloudfunctions.net/CloudFunctionHealthCheck" // Cloud FunctionのURL
+)
+
+func main() {
+ flag.Parse()
+
+ // コンフィグレーションを読み込む
+ cfg, err := config.New()
+ if err != nil {
+ log.Fatalf("Failed to load config: %v", err)
+ }
+
+ // Cloud Functionに対して認証済みGETリクエストを行う
+ if err := makeGetRequest(cfg.GoogleApplicationCredentials, cloudFunctionURL); err != nil {
+ log.Fatalf("Failed to make GET request: %v", err)
+ }
+ if *grpcEndpoint == "" {
+ log.Fatal("[main] unable to start client without gRPC endpoint to server")
+ }
+
+ creds := credentials.NewTLS(&tls.Config{
+ InsecureSkipVerify: true,
+ })
+
+ opts := []grpc.DialOption{
+ grpc.WithTransportCredentials(creds),
+ }
+
+ log.Printf("Connecting to gRPC Service [%s]", *grpcEndpoint)
+ conn, err := grpc.Dial(*grpcEndpoint, opts...)
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer conn.Close()
+
+ client := NewClient(conn)
+ ctx := context.Background()
+
+ rqst := &pb.PingRequest{
+ Name: "Ping",
+ }
+ resp, err := client.Ping(ctx, rqst)
+ if err != nil {
+ log.Fatal(err)
+ }
+ log.Printf("Ping Response: %s", resp.Message)
+}
+
+// Client is a struct that implements the pb.CalculatorClient
+type Client struct {
+ client pb.HealthcheckServiceClient
+}
+
+// NewClient returns a new Client
+func NewClient(conn *grpc.ClientConn) *Client {
+ return &Client{
+ client: pb.NewHealthcheckServiceClient(conn),
+ }
+}
+
+func (c *Client) Ping(ctx context.Context, r *pb.PingRequest) (*pb.PingResponse, error) {
+ return c.client.Ping(ctx, r)
+}
+
+// `makeGetRequest` makes a request to the provided `targetURL`
+// with an authenticated client using audience `audience`.
+func makeGetRequest(credsPath, targetURL string) error {
+ ctx := context.Background()
+
+ // client is a http.Client that automatically adds an "Authorization" header
+ // to any requests made.
+ client, err := idtoken.NewClient(ctx, targetURL, option.WithCredentialsFile(credsPath))
+ if err != nil {
+ return fmt.Errorf("idtoken.NewClient: %w", err)
+ }
+
+ resp, err := client.Get(targetURL)
+ if err != nil {
+ return fmt.Errorf("client.Get: %w", err)
+ }
+ defer resp.Body.Close()
+
+ body, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return fmt.Errorf("ioutil.ReadAll: %w", err)
+ }
+
+ log.Printf("Cloud Function response: %s", string(body))
+
+ return nil
+}
diff --git a/backend/cmd/server/main.go b/backend/cmd/server/main.go
new file mode 100644
index 00000000..80a563a4
--- /dev/null
+++ b/backend/cmd/server/main.go
@@ -0,0 +1,140 @@
+package main
+
+import (
+ "context"
+ "database/sql"
+ "log"
+ "net"
+ "os"
+ "os/signal"
+ "syscall"
+
+ "golang.org/x/exp/slog"
+
+ "cloud.google.com/go/storage"
+ mlv1 "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/machine_learning/v1"
+ "github.com/go-sql-driver/mysql"
+ _ "github.com/go-sql-driver/mysql"
+ "google.golang.org/api/option"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/credentials"
+
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/config"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent"
+ grpc_server "github.com/GreenTeaProgrammers/WhereChildBus/backend/gprc_server"
+)
+
+func main() {
+ // コンフィグを読み込む
+ config, _ := config.New()
+
+ // MySQLへの接続をテスト
+ db, err := sql.Open("mysql", config.DSN)
+ if err != nil {
+ log.Fatal("failed to open db connection", err)
+ }
+
+ // PlanetScaleへの接続をテスト
+ if err := db.Ping(); err != nil {
+ log.Fatalf("Failed to ping PlanetScale: %v", err)
+ }
+
+ // PlanetScaleへの接続を開始
+ log.Println("Connecting to PlanetScale...")
+
+ mysqlConfig := &mysql.Config{
+ User: config.DBUser,
+ Passwd: config.DBPassword,
+ Net: "tcp",
+ Addr: config.DBAddress,
+ DBName: config.DBName,
+ ParseTime: true,
+ TLSConfig: "true", // この行は必要に応じて調整してください。
+ AllowNativePasswords: true,
+ InterpolateParams: true,
+ }
+
+ entClient, err := ent.Open("mysql", mysqlConfig.FormatDSN())
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ log.Println("Successfully connected to PlanetScale!")
+
+ // マイグレーションを実行
+ log.Println("Running migration...")
+ defer entClient.Close()
+ if err := entClient.Schema.Create(context.Background()); err != nil {
+ log.Println("Migration failed!")
+ log.Fatal(err)
+ }
+
+ log.Println("Migration done!")
+
+ // Cloud Storageへの接続を開始
+ log.Println("Connecting to Cloud Storage...")
+ ctx := context.Background()
+ credPath := "./secrets/gcp-credentials.json"
+ storageClient, err := storage.NewClient(ctx, option.WithCredentialsFile(credPath))
+ if err != nil {
+ log.Fatalf("Failed to create Cloud Storage client: %v", err)
+ }
+ defer storageClient.Close()
+
+ log.Println("Connected to Cloud Storage!")
+
+ // 機械学習gRPCサーバーへの接続を開始
+ log.Println("Connecting to Machine Learning gRPC server...")
+ // デフォルトのシステム証明書を使用してTLS接続を設定
+ creds := credentials.NewClientTLSFromCert(nil, "")
+
+ // セキュアなチャネルを通じてサーバーに接続
+ conn, err := grpc.Dial(config.MLAddress, grpc.WithTransportCredentials(creds))
+ if err != nil {
+ log.Fatalf("Failed to connect: %v", err)
+ }
+ defer conn.Close()
+
+ // スタブの作成
+ stub := mlv1.NewHealthcheckServiceClient(conn)
+
+ // 最初のPingリクエスト(nameが設定されていない)
+ request := &mlv1.PingRequest{
+ Name: "ping",
+ }
+ _, err = stub.Ping(context.Background(), request)
+ if err != nil {
+ log.Fatalf("Failed to ping: %v", err)
+ }
+
+ log.Println("Connected to Machine Learning gRPC server!")
+
+ // loggerを作成
+ logger := slog.Default()
+
+ // gRPCサーバーを起動
+ srv := grpc_server.New(
+ grpc_server.WithLogger(logger),
+ grpc_server.WithEntClient(entClient),
+ grpc_server.WithReflection(config.ModeDev),
+ grpc_server.WithStorageClient(storageClient),
+ grpc_server.WithBucketName(config.StorageBucketName),
+ grpc_server.WithMLClient(mlv1.NewMachineLearningServiceClient(conn)),
+ )
+ lsnr, err := net.Listen("tcp", ":"+config.GrpcPort)
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer lsnr.Close()
+ go func() {
+ logger.Info("server launched")
+ if err := srv.Serve(lsnr); err != nil {
+ log.Fatal(err)
+ }
+ }()
+ sigCh := make(chan os.Signal, 1)
+ signal.Notify(sigCh, os.Interrupt, syscall.SIGTERM)
+ <-sigCh
+ logger.Info("server is being stopped")
+ srv.GracefulStop()
+}
diff --git a/backend/config/config.go b/backend/config/config.go
new file mode 100644
index 00000000..a6bf2f24
--- /dev/null
+++ b/backend/config/config.go
@@ -0,0 +1,46 @@
+package config
+
+import (
+ "log"
+
+ "github.com/joho/godotenv"
+ "github.com/kelseyhightower/envconfig"
+)
+
+type Config struct {
+ DSN string `envconfig:"DSN" required:"true"`
+ DBUser string `envconfig:"DB_USER_NAME" required:"true"`
+ DBPassword string `envconfig:"DB_PASSWORD" required:"true"`
+ DBAddress string `envconfig:"DB_ADDR" required:"true"`
+ DBName string `envconfig:"DB_NAME" required:"true"`
+ GrpcPort string `envconfig:"PORT" default:"50051"`
+ ModeDev bool `envconfig:"MODE_DEV" default:"true"`
+ GoogleApplicationCredentials string `envconfig:"GOOGLE_APPLICATION_CREDENTIALS" required:"true"`
+ StorageBucketName string `envconfig:"STORAGE_BUCKET_NAME" required:"true"`
+ PasswordPepper string `envconfig:"PASSWORD_PEPPER" required:"true"`
+ MLAddress string `envconfig:"ML_ADDR" required:"true"`
+}
+
+func New() (*Config, error) {
+ // .env ファイルから環境変数を読み込む
+ if err := godotenv.Load(); err != nil {
+ log.Println("No .env file found or error loading .env file, continuing with environment variables")
+ }
+
+ config := &Config{}
+ if err := envconfig.Process("", config); err != nil {
+ log.Printf("Error processing env variables: %v", err)
+ return nil, err
+ }
+
+ // 開発モードが有効な場合にのみデバッグログを出力
+ if config.ModeDev {
+ log.Println("DSN:", config.DSN)
+ log.Println("DB User:", config.DBUser)
+ log.Println("DB Address:", config.DBAddress)
+ log.Println("DB Name:", config.DBName)
+ log.Println("Port:", config.GrpcPort)
+ }
+
+ return config, nil
+}
diff --git a/backend/domain/repository/ent/boardingrecord.go b/backend/domain/repository/ent/boardingrecord.go
new file mode 100644
index 00000000..21512d00
--- /dev/null
+++ b/backend/domain/repository/ent/boardingrecord.go
@@ -0,0 +1,190 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "fmt"
+ "strings"
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/sql"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/google/uuid"
+)
+
+// BoardingRecord is the model entity for the BoardingRecord schema.
+type BoardingRecord struct {
+ config `json:"-"`
+ // ID of the ent.
+ ID uuid.UUID `json:"id,omitempty"`
+ // 乗降時刻
+ Timestamp time.Time `json:"timestamp,omitempty"`
+ // 乗車時はtrue、降車時はfalse
+ IsBoarding bool `json:"is_boarding,omitempty"`
+ // Edges holds the relations/edges for other nodes in the graph.
+ // The values are being populated by the BoardingRecordQuery when eager-loading is set.
+ Edges BoardingRecordEdges `json:"edges"`
+ bus_boarding_records *uuid.UUID
+ child_boarding_record *uuid.UUID
+ selectValues sql.SelectValues
+}
+
+// BoardingRecordEdges holds the relations/edges for other nodes in the graph.
+type BoardingRecordEdges struct {
+ // Child holds the value of the child edge.
+ Child *Child `json:"child,omitempty"`
+ // Bus holds the value of the bus edge.
+ Bus *Bus `json:"bus,omitempty"`
+ // loadedTypes holds the information for reporting if a
+ // type was loaded (or requested) in eager-loading or not.
+ loadedTypes [2]bool
+}
+
+// ChildOrErr returns the Child value or an error if the edge
+// was not loaded in eager-loading, or loaded but was not found.
+func (e BoardingRecordEdges) ChildOrErr() (*Child, error) {
+ if e.loadedTypes[0] {
+ if e.Child == nil {
+ // Edge was loaded but was not found.
+ return nil, &NotFoundError{label: child.Label}
+ }
+ return e.Child, nil
+ }
+ return nil, &NotLoadedError{edge: "child"}
+}
+
+// BusOrErr returns the Bus value or an error if the edge
+// was not loaded in eager-loading, or loaded but was not found.
+func (e BoardingRecordEdges) BusOrErr() (*Bus, error) {
+ if e.loadedTypes[1] {
+ if e.Bus == nil {
+ // Edge was loaded but was not found.
+ return nil, &NotFoundError{label: bus.Label}
+ }
+ return e.Bus, nil
+ }
+ return nil, &NotLoadedError{edge: "bus"}
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*BoardingRecord) scanValues(columns []string) ([]any, error) {
+ values := make([]any, len(columns))
+ for i := range columns {
+ switch columns[i] {
+ case boardingrecord.FieldIsBoarding:
+ values[i] = new(sql.NullBool)
+ case boardingrecord.FieldTimestamp:
+ values[i] = new(sql.NullTime)
+ case boardingrecord.FieldID:
+ values[i] = new(uuid.UUID)
+ case boardingrecord.ForeignKeys[0]: // bus_boarding_records
+ values[i] = &sql.NullScanner{S: new(uuid.UUID)}
+ case boardingrecord.ForeignKeys[1]: // child_boarding_record
+ values[i] = &sql.NullScanner{S: new(uuid.UUID)}
+ default:
+ values[i] = new(sql.UnknownType)
+ }
+ }
+ return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the BoardingRecord fields.
+func (br *BoardingRecord) assignValues(columns []string, values []any) error {
+ if m, n := len(values), len(columns); m < n {
+ return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+ }
+ for i := range columns {
+ switch columns[i] {
+ case boardingrecord.FieldID:
+ if value, ok := values[i].(*uuid.UUID); !ok {
+ return fmt.Errorf("unexpected type %T for field id", values[i])
+ } else if value != nil {
+ br.ID = *value
+ }
+ case boardingrecord.FieldTimestamp:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field timestamp", values[i])
+ } else if value.Valid {
+ br.Timestamp = value.Time
+ }
+ case boardingrecord.FieldIsBoarding:
+ if value, ok := values[i].(*sql.NullBool); !ok {
+ return fmt.Errorf("unexpected type %T for field is_boarding", values[i])
+ } else if value.Valid {
+ br.IsBoarding = value.Bool
+ }
+ case boardingrecord.ForeignKeys[0]:
+ if value, ok := values[i].(*sql.NullScanner); !ok {
+ return fmt.Errorf("unexpected type %T for field bus_boarding_records", values[i])
+ } else if value.Valid {
+ br.bus_boarding_records = new(uuid.UUID)
+ *br.bus_boarding_records = *value.S.(*uuid.UUID)
+ }
+ case boardingrecord.ForeignKeys[1]:
+ if value, ok := values[i].(*sql.NullScanner); !ok {
+ return fmt.Errorf("unexpected type %T for field child_boarding_record", values[i])
+ } else if value.Valid {
+ br.child_boarding_record = new(uuid.UUID)
+ *br.child_boarding_record = *value.S.(*uuid.UUID)
+ }
+ default:
+ br.selectValues.Set(columns[i], values[i])
+ }
+ }
+ return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the BoardingRecord.
+// This includes values selected through modifiers, order, etc.
+func (br *BoardingRecord) Value(name string) (ent.Value, error) {
+ return br.selectValues.Get(name)
+}
+
+// QueryChild queries the "child" edge of the BoardingRecord entity.
+func (br *BoardingRecord) QueryChild() *ChildQuery {
+ return NewBoardingRecordClient(br.config).QueryChild(br)
+}
+
+// QueryBus queries the "bus" edge of the BoardingRecord entity.
+func (br *BoardingRecord) QueryBus() *BusQuery {
+ return NewBoardingRecordClient(br.config).QueryBus(br)
+}
+
+// Update returns a builder for updating this BoardingRecord.
+// Note that you need to call BoardingRecord.Unwrap() before calling this method if this BoardingRecord
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (br *BoardingRecord) Update() *BoardingRecordUpdateOne {
+ return NewBoardingRecordClient(br.config).UpdateOne(br)
+}
+
+// Unwrap unwraps the BoardingRecord entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (br *BoardingRecord) Unwrap() *BoardingRecord {
+ _tx, ok := br.config.driver.(*txDriver)
+ if !ok {
+ panic("ent: BoardingRecord is not a transactional entity")
+ }
+ br.config.driver = _tx.drv
+ return br
+}
+
+// String implements the fmt.Stringer.
+func (br *BoardingRecord) String() string {
+ var builder strings.Builder
+ builder.WriteString("BoardingRecord(")
+ builder.WriteString(fmt.Sprintf("id=%v, ", br.ID))
+ builder.WriteString("timestamp=")
+ builder.WriteString(br.Timestamp.Format(time.ANSIC))
+ builder.WriteString(", ")
+ builder.WriteString("is_boarding=")
+ builder.WriteString(fmt.Sprintf("%v", br.IsBoarding))
+ builder.WriteByte(')')
+ return builder.String()
+}
+
+// BoardingRecords is a parsable slice of BoardingRecord.
+type BoardingRecords []*BoardingRecord
diff --git a/backend/domain/repository/ent/boardingrecord/boardingrecord.go b/backend/domain/repository/ent/boardingrecord/boardingrecord.go
new file mode 100644
index 00000000..aa0d623b
--- /dev/null
+++ b/backend/domain/repository/ent/boardingrecord/boardingrecord.go
@@ -0,0 +1,126 @@
+// Code generated by ent, DO NOT EDIT.
+
+package boardingrecord
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/google/uuid"
+)
+
+const (
+ // Label holds the string label denoting the boardingrecord type in the database.
+ Label = "boarding_record"
+ // FieldID holds the string denoting the id field in the database.
+ FieldID = "id"
+ // FieldTimestamp holds the string denoting the timestamp field in the database.
+ FieldTimestamp = "timestamp"
+ // FieldIsBoarding holds the string denoting the is_boarding field in the database.
+ FieldIsBoarding = "is_boarding"
+ // EdgeChild holds the string denoting the child edge name in mutations.
+ EdgeChild = "child"
+ // EdgeBus holds the string denoting the bus edge name in mutations.
+ EdgeBus = "bus"
+ // Table holds the table name of the boardingrecord in the database.
+ Table = "boarding_records"
+ // ChildTable is the table that holds the child relation/edge.
+ ChildTable = "boarding_records"
+ // ChildInverseTable is the table name for the Child entity.
+ // It exists in this package in order to avoid circular dependency with the "child" package.
+ ChildInverseTable = "childs"
+ // ChildColumn is the table column denoting the child relation/edge.
+ ChildColumn = "child_boarding_record"
+ // BusTable is the table that holds the bus relation/edge.
+ BusTable = "boarding_records"
+ // BusInverseTable is the table name for the Bus entity.
+ // It exists in this package in order to avoid circular dependency with the "bus" package.
+ BusInverseTable = "bus"
+ // BusColumn is the table column denoting the bus relation/edge.
+ BusColumn = "bus_boarding_records"
+)
+
+// Columns holds all SQL columns for boardingrecord fields.
+var Columns = []string{
+ FieldID,
+ FieldTimestamp,
+ FieldIsBoarding,
+}
+
+// ForeignKeys holds the SQL foreign-keys that are owned by the "boarding_records"
+// table and are not defined as standalone fields in the schema.
+var ForeignKeys = []string{
+ "bus_boarding_records",
+ "child_boarding_record",
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+ for i := range Columns {
+ if column == Columns[i] {
+ return true
+ }
+ }
+ for i := range ForeignKeys {
+ if column == ForeignKeys[i] {
+ return true
+ }
+ }
+ return false
+}
+
+var (
+ // DefaultTimestamp holds the default value on creation for the "timestamp" field.
+ DefaultTimestamp func() time.Time
+ // DefaultIsBoarding holds the default value on creation for the "is_boarding" field.
+ DefaultIsBoarding bool
+ // DefaultID holds the default value on creation for the "id" field.
+ DefaultID func() uuid.UUID
+)
+
+// OrderOption defines the ordering options for the BoardingRecord queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByTimestamp orders the results by the timestamp field.
+func ByTimestamp(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldTimestamp, opts...).ToFunc()
+}
+
+// ByIsBoarding orders the results by the is_boarding field.
+func ByIsBoarding(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldIsBoarding, opts...).ToFunc()
+}
+
+// ByChildField orders the results by child field.
+func ByChildField(field string, opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newChildStep(), sql.OrderByField(field, opts...))
+ }
+}
+
+// ByBusField orders the results by bus field.
+func ByBusField(field string, opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newBusStep(), sql.OrderByField(field, opts...))
+ }
+}
+func newChildStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(ChildInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, ChildTable, ChildColumn),
+ )
+}
+func newBusStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(BusInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, BusTable, BusColumn),
+ )
+}
diff --git a/backend/domain/repository/ent/boardingrecord/where.go b/backend/domain/repository/ent/boardingrecord/where.go
new file mode 100644
index 00000000..72f2bc0f
--- /dev/null
+++ b/backend/domain/repository/ent/boardingrecord/where.go
@@ -0,0 +1,178 @@
+// Code generated by ent, DO NOT EDIT.
+
+package boardingrecord
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id uuid.UUID) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id uuid.UUID) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id uuid.UUID) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...uuid.UUID) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...uuid.UUID) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id uuid.UUID) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id uuid.UUID) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id uuid.UUID) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id uuid.UUID) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldLTE(FieldID, id))
+}
+
+// Timestamp applies equality check predicate on the "timestamp" field. It's identical to TimestampEQ.
+func Timestamp(v time.Time) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldEQ(FieldTimestamp, v))
+}
+
+// IsBoarding applies equality check predicate on the "is_boarding" field. It's identical to IsBoardingEQ.
+func IsBoarding(v bool) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldEQ(FieldIsBoarding, v))
+}
+
+// TimestampEQ applies the EQ predicate on the "timestamp" field.
+func TimestampEQ(v time.Time) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldEQ(FieldTimestamp, v))
+}
+
+// TimestampNEQ applies the NEQ predicate on the "timestamp" field.
+func TimestampNEQ(v time.Time) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldNEQ(FieldTimestamp, v))
+}
+
+// TimestampIn applies the In predicate on the "timestamp" field.
+func TimestampIn(vs ...time.Time) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldIn(FieldTimestamp, vs...))
+}
+
+// TimestampNotIn applies the NotIn predicate on the "timestamp" field.
+func TimestampNotIn(vs ...time.Time) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldNotIn(FieldTimestamp, vs...))
+}
+
+// TimestampGT applies the GT predicate on the "timestamp" field.
+func TimestampGT(v time.Time) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldGT(FieldTimestamp, v))
+}
+
+// TimestampGTE applies the GTE predicate on the "timestamp" field.
+func TimestampGTE(v time.Time) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldGTE(FieldTimestamp, v))
+}
+
+// TimestampLT applies the LT predicate on the "timestamp" field.
+func TimestampLT(v time.Time) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldLT(FieldTimestamp, v))
+}
+
+// TimestampLTE applies the LTE predicate on the "timestamp" field.
+func TimestampLTE(v time.Time) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldLTE(FieldTimestamp, v))
+}
+
+// IsBoardingEQ applies the EQ predicate on the "is_boarding" field.
+func IsBoardingEQ(v bool) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldEQ(FieldIsBoarding, v))
+}
+
+// IsBoardingNEQ applies the NEQ predicate on the "is_boarding" field.
+func IsBoardingNEQ(v bool) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.FieldNEQ(FieldIsBoarding, v))
+}
+
+// HasChild applies the HasEdge predicate on the "child" edge.
+func HasChild() predicate.BoardingRecord {
+ return predicate.BoardingRecord(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, ChildTable, ChildColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasChildWith applies the HasEdge predicate on the "child" edge with a given conditions (other predicates).
+func HasChildWith(preds ...predicate.Child) predicate.BoardingRecord {
+ return predicate.BoardingRecord(func(s *sql.Selector) {
+ step := newChildStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasBus applies the HasEdge predicate on the "bus" edge.
+func HasBus() predicate.BoardingRecord {
+ return predicate.BoardingRecord(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, BusTable, BusColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasBusWith applies the HasEdge predicate on the "bus" edge with a given conditions (other predicates).
+func HasBusWith(preds ...predicate.Bus) predicate.BoardingRecord {
+ return predicate.BoardingRecord(func(s *sql.Selector) {
+ step := newBusStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.BoardingRecord) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.BoardingRecord) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.BoardingRecord) predicate.BoardingRecord {
+ return predicate.BoardingRecord(sql.NotPredicates(p))
+}
diff --git a/backend/domain/repository/ent/boardingrecord_create.go b/backend/domain/repository/ent/boardingrecord_create.go
new file mode 100644
index 00000000..bbb67110
--- /dev/null
+++ b/backend/domain/repository/ent/boardingrecord_create.go
@@ -0,0 +1,325 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/google/uuid"
+)
+
+// BoardingRecordCreate is the builder for creating a BoardingRecord entity.
+type BoardingRecordCreate struct {
+ config
+ mutation *BoardingRecordMutation
+ hooks []Hook
+}
+
+// SetTimestamp sets the "timestamp" field.
+func (brc *BoardingRecordCreate) SetTimestamp(t time.Time) *BoardingRecordCreate {
+ brc.mutation.SetTimestamp(t)
+ return brc
+}
+
+// SetNillableTimestamp sets the "timestamp" field if the given value is not nil.
+func (brc *BoardingRecordCreate) SetNillableTimestamp(t *time.Time) *BoardingRecordCreate {
+ if t != nil {
+ brc.SetTimestamp(*t)
+ }
+ return brc
+}
+
+// SetIsBoarding sets the "is_boarding" field.
+func (brc *BoardingRecordCreate) SetIsBoarding(b bool) *BoardingRecordCreate {
+ brc.mutation.SetIsBoarding(b)
+ return brc
+}
+
+// SetNillableIsBoarding sets the "is_boarding" field if the given value is not nil.
+func (brc *BoardingRecordCreate) SetNillableIsBoarding(b *bool) *BoardingRecordCreate {
+ if b != nil {
+ brc.SetIsBoarding(*b)
+ }
+ return brc
+}
+
+// SetID sets the "id" field.
+func (brc *BoardingRecordCreate) SetID(u uuid.UUID) *BoardingRecordCreate {
+ brc.mutation.SetID(u)
+ return brc
+}
+
+// SetNillableID sets the "id" field if the given value is not nil.
+func (brc *BoardingRecordCreate) SetNillableID(u *uuid.UUID) *BoardingRecordCreate {
+ if u != nil {
+ brc.SetID(*u)
+ }
+ return brc
+}
+
+// SetChildID sets the "child" edge to the Child entity by ID.
+func (brc *BoardingRecordCreate) SetChildID(id uuid.UUID) *BoardingRecordCreate {
+ brc.mutation.SetChildID(id)
+ return brc
+}
+
+// SetNillableChildID sets the "child" edge to the Child entity by ID if the given value is not nil.
+func (brc *BoardingRecordCreate) SetNillableChildID(id *uuid.UUID) *BoardingRecordCreate {
+ if id != nil {
+ brc = brc.SetChildID(*id)
+ }
+ return brc
+}
+
+// SetChild sets the "child" edge to the Child entity.
+func (brc *BoardingRecordCreate) SetChild(c *Child) *BoardingRecordCreate {
+ return brc.SetChildID(c.ID)
+}
+
+// SetBusID sets the "bus" edge to the Bus entity by ID.
+func (brc *BoardingRecordCreate) SetBusID(id uuid.UUID) *BoardingRecordCreate {
+ brc.mutation.SetBusID(id)
+ return brc
+}
+
+// SetNillableBusID sets the "bus" edge to the Bus entity by ID if the given value is not nil.
+func (brc *BoardingRecordCreate) SetNillableBusID(id *uuid.UUID) *BoardingRecordCreate {
+ if id != nil {
+ brc = brc.SetBusID(*id)
+ }
+ return brc
+}
+
+// SetBus sets the "bus" edge to the Bus entity.
+func (brc *BoardingRecordCreate) SetBus(b *Bus) *BoardingRecordCreate {
+ return brc.SetBusID(b.ID)
+}
+
+// Mutation returns the BoardingRecordMutation object of the builder.
+func (brc *BoardingRecordCreate) Mutation() *BoardingRecordMutation {
+ return brc.mutation
+}
+
+// Save creates the BoardingRecord in the database.
+func (brc *BoardingRecordCreate) Save(ctx context.Context) (*BoardingRecord, error) {
+ brc.defaults()
+ return withHooks(ctx, brc.sqlSave, brc.mutation, brc.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (brc *BoardingRecordCreate) SaveX(ctx context.Context) *BoardingRecord {
+ v, err := brc.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (brc *BoardingRecordCreate) Exec(ctx context.Context) error {
+ _, err := brc.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (brc *BoardingRecordCreate) ExecX(ctx context.Context) {
+ if err := brc.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (brc *BoardingRecordCreate) defaults() {
+ if _, ok := brc.mutation.Timestamp(); !ok {
+ v := boardingrecord.DefaultTimestamp()
+ brc.mutation.SetTimestamp(v)
+ }
+ if _, ok := brc.mutation.IsBoarding(); !ok {
+ v := boardingrecord.DefaultIsBoarding
+ brc.mutation.SetIsBoarding(v)
+ }
+ if _, ok := brc.mutation.ID(); !ok {
+ v := boardingrecord.DefaultID()
+ brc.mutation.SetID(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (brc *BoardingRecordCreate) check() error {
+ if _, ok := brc.mutation.Timestamp(); !ok {
+ return &ValidationError{Name: "timestamp", err: errors.New(`ent: missing required field "BoardingRecord.timestamp"`)}
+ }
+ if _, ok := brc.mutation.IsBoarding(); !ok {
+ return &ValidationError{Name: "is_boarding", err: errors.New(`ent: missing required field "BoardingRecord.is_boarding"`)}
+ }
+ return nil
+}
+
+func (brc *BoardingRecordCreate) sqlSave(ctx context.Context) (*BoardingRecord, error) {
+ if err := brc.check(); err != nil {
+ return nil, err
+ }
+ _node, _spec := brc.createSpec()
+ if err := sqlgraph.CreateNode(ctx, brc.driver, _spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ if _spec.ID.Value != nil {
+ if id, ok := _spec.ID.Value.(*uuid.UUID); ok {
+ _node.ID = *id
+ } else if err := _node.ID.Scan(_spec.ID.Value); err != nil {
+ return nil, err
+ }
+ }
+ brc.mutation.id = &_node.ID
+ brc.mutation.done = true
+ return _node, nil
+}
+
+func (brc *BoardingRecordCreate) createSpec() (*BoardingRecord, *sqlgraph.CreateSpec) {
+ var (
+ _node = &BoardingRecord{config: brc.config}
+ _spec = sqlgraph.NewCreateSpec(boardingrecord.Table, sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID))
+ )
+ if id, ok := brc.mutation.ID(); ok {
+ _node.ID = id
+ _spec.ID.Value = &id
+ }
+ if value, ok := brc.mutation.Timestamp(); ok {
+ _spec.SetField(boardingrecord.FieldTimestamp, field.TypeTime, value)
+ _node.Timestamp = value
+ }
+ if value, ok := brc.mutation.IsBoarding(); ok {
+ _spec.SetField(boardingrecord.FieldIsBoarding, field.TypeBool, value)
+ _node.IsBoarding = value
+ }
+ if nodes := brc.mutation.ChildIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: boardingrecord.ChildTable,
+ Columns: []string{boardingrecord.ChildColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _node.child_boarding_record = &nodes[0]
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := brc.mutation.BusIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: boardingrecord.BusTable,
+ Columns: []string{boardingrecord.BusColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _node.bus_boarding_records = &nodes[0]
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ return _node, _spec
+}
+
+// BoardingRecordCreateBulk is the builder for creating many BoardingRecord entities in bulk.
+type BoardingRecordCreateBulk struct {
+ config
+ err error
+ builders []*BoardingRecordCreate
+}
+
+// Save creates the BoardingRecord entities in the database.
+func (brcb *BoardingRecordCreateBulk) Save(ctx context.Context) ([]*BoardingRecord, error) {
+ if brcb.err != nil {
+ return nil, brcb.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(brcb.builders))
+ nodes := make([]*BoardingRecord, len(brcb.builders))
+ mutators := make([]Mutator, len(brcb.builders))
+ for i := range brcb.builders {
+ func(i int, root context.Context) {
+ builder := brcb.builders[i]
+ builder.defaults()
+ var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+ mutation, ok := m.(*BoardingRecordMutation)
+ if !ok {
+ return nil, fmt.Errorf("unexpected mutation type %T", m)
+ }
+ if err := builder.check(); err != nil {
+ return nil, err
+ }
+ builder.mutation = mutation
+ var err error
+ nodes[i], specs[i] = builder.createSpec()
+ if i < len(mutators)-1 {
+ _, err = mutators[i+1].Mutate(root, brcb.builders[i+1].mutation)
+ } else {
+ spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+ // Invoke the actual operation on the latest mutation in the chain.
+ if err = sqlgraph.BatchCreate(ctx, brcb.driver, spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ }
+ }
+ if err != nil {
+ return nil, err
+ }
+ mutation.id = &nodes[i].ID
+ mutation.done = true
+ return nodes[i], nil
+ })
+ for i := len(builder.hooks) - 1; i >= 0; i-- {
+ mut = builder.hooks[i](mut)
+ }
+ mutators[i] = mut
+ }(i, ctx)
+ }
+ if len(mutators) > 0 {
+ if _, err := mutators[0].Mutate(ctx, brcb.builders[0].mutation); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (brcb *BoardingRecordCreateBulk) SaveX(ctx context.Context) []*BoardingRecord {
+ v, err := brcb.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (brcb *BoardingRecordCreateBulk) Exec(ctx context.Context) error {
+ _, err := brcb.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (brcb *BoardingRecordCreateBulk) ExecX(ctx context.Context) {
+ if err := brcb.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/boardingrecord_delete.go b/backend/domain/repository/ent/boardingrecord_delete.go
new file mode 100644
index 00000000..406cd617
--- /dev/null
+++ b/backend/domain/repository/ent/boardingrecord_delete.go
@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+)
+
+// BoardingRecordDelete is the builder for deleting a BoardingRecord entity.
+type BoardingRecordDelete struct {
+ config
+ hooks []Hook
+ mutation *BoardingRecordMutation
+}
+
+// Where appends a list predicates to the BoardingRecordDelete builder.
+func (brd *BoardingRecordDelete) Where(ps ...predicate.BoardingRecord) *BoardingRecordDelete {
+ brd.mutation.Where(ps...)
+ return brd
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (brd *BoardingRecordDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, brd.sqlExec, brd.mutation, brd.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (brd *BoardingRecordDelete) ExecX(ctx context.Context) int {
+ n, err := brd.Exec(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return n
+}
+
+func (brd *BoardingRecordDelete) sqlExec(ctx context.Context) (int, error) {
+ _spec := sqlgraph.NewDeleteSpec(boardingrecord.Table, sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID))
+ if ps := brd.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ affected, err := sqlgraph.DeleteNodes(ctx, brd.driver, _spec)
+ if err != nil && sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ brd.mutation.done = true
+ return affected, err
+}
+
+// BoardingRecordDeleteOne is the builder for deleting a single BoardingRecord entity.
+type BoardingRecordDeleteOne struct {
+ brd *BoardingRecordDelete
+}
+
+// Where appends a list predicates to the BoardingRecordDelete builder.
+func (brdo *BoardingRecordDeleteOne) Where(ps ...predicate.BoardingRecord) *BoardingRecordDeleteOne {
+ brdo.brd.mutation.Where(ps...)
+ return brdo
+}
+
+// Exec executes the deletion query.
+func (brdo *BoardingRecordDeleteOne) Exec(ctx context.Context) error {
+ n, err := brdo.brd.Exec(ctx)
+ switch {
+ case err != nil:
+ return err
+ case n == 0:
+ return &NotFoundError{boardingrecord.Label}
+ default:
+ return nil
+ }
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (brdo *BoardingRecordDeleteOne) ExecX(ctx context.Context) {
+ if err := brdo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/boardingrecord_query.go b/backend/domain/repository/ent/boardingrecord_query.go
new file mode 100644
index 00000000..2522b162
--- /dev/null
+++ b/backend/domain/repository/ent/boardingrecord_query.go
@@ -0,0 +1,689 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "fmt"
+ "math"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// BoardingRecordQuery is the builder for querying BoardingRecord entities.
+type BoardingRecordQuery struct {
+ config
+ ctx *QueryContext
+ order []boardingrecord.OrderOption
+ inters []Interceptor
+ predicates []predicate.BoardingRecord
+ withChild *ChildQuery
+ withBus *BusQuery
+ withFKs bool
+ // intermediate query (i.e. traversal path).
+ sql *sql.Selector
+ path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the BoardingRecordQuery builder.
+func (brq *BoardingRecordQuery) Where(ps ...predicate.BoardingRecord) *BoardingRecordQuery {
+ brq.predicates = append(brq.predicates, ps...)
+ return brq
+}
+
+// Limit the number of records to be returned by this query.
+func (brq *BoardingRecordQuery) Limit(limit int) *BoardingRecordQuery {
+ brq.ctx.Limit = &limit
+ return brq
+}
+
+// Offset to start from.
+func (brq *BoardingRecordQuery) Offset(offset int) *BoardingRecordQuery {
+ brq.ctx.Offset = &offset
+ return brq
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (brq *BoardingRecordQuery) Unique(unique bool) *BoardingRecordQuery {
+ brq.ctx.Unique = &unique
+ return brq
+}
+
+// Order specifies how the records should be ordered.
+func (brq *BoardingRecordQuery) Order(o ...boardingrecord.OrderOption) *BoardingRecordQuery {
+ brq.order = append(brq.order, o...)
+ return brq
+}
+
+// QueryChild chains the current query on the "child" edge.
+func (brq *BoardingRecordQuery) QueryChild() *ChildQuery {
+ query := (&ChildClient{config: brq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := brq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := brq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(boardingrecord.Table, boardingrecord.FieldID, selector),
+ sqlgraph.To(child.Table, child.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, boardingrecord.ChildTable, boardingrecord.ChildColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(brq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryBus chains the current query on the "bus" edge.
+func (brq *BoardingRecordQuery) QueryBus() *BusQuery {
+ query := (&BusClient{config: brq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := brq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := brq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(boardingrecord.Table, boardingrecord.FieldID, selector),
+ sqlgraph.To(bus.Table, bus.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, boardingrecord.BusTable, boardingrecord.BusColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(brq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// First returns the first BoardingRecord entity from the query.
+// Returns a *NotFoundError when no BoardingRecord was found.
+func (brq *BoardingRecordQuery) First(ctx context.Context) (*BoardingRecord, error) {
+ nodes, err := brq.Limit(1).All(setContextOp(ctx, brq.ctx, "First"))
+ if err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nil, &NotFoundError{boardingrecord.Label}
+ }
+ return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (brq *BoardingRecordQuery) FirstX(ctx context.Context) *BoardingRecord {
+ node, err := brq.First(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return node
+}
+
+// FirstID returns the first BoardingRecord ID from the query.
+// Returns a *NotFoundError when no BoardingRecord ID was found.
+func (brq *BoardingRecordQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+ var ids []uuid.UUID
+ if ids, err = brq.Limit(1).IDs(setContextOp(ctx, brq.ctx, "FirstID")); err != nil {
+ return
+ }
+ if len(ids) == 0 {
+ err = &NotFoundError{boardingrecord.Label}
+ return
+ }
+ return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (brq *BoardingRecordQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := brq.FirstID(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return id
+}
+
+// Only returns a single BoardingRecord entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one BoardingRecord entity is found.
+// Returns a *NotFoundError when no BoardingRecord entities are found.
+func (brq *BoardingRecordQuery) Only(ctx context.Context) (*BoardingRecord, error) {
+ nodes, err := brq.Limit(2).All(setContextOp(ctx, brq.ctx, "Only"))
+ if err != nil {
+ return nil, err
+ }
+ switch len(nodes) {
+ case 1:
+ return nodes[0], nil
+ case 0:
+ return nil, &NotFoundError{boardingrecord.Label}
+ default:
+ return nil, &NotSingularError{boardingrecord.Label}
+ }
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (brq *BoardingRecordQuery) OnlyX(ctx context.Context) *BoardingRecord {
+ node, err := brq.Only(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// OnlyID is like Only, but returns the only BoardingRecord ID in the query.
+// Returns a *NotSingularError when more than one BoardingRecord ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (brq *BoardingRecordQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+ var ids []uuid.UUID
+ if ids, err = brq.Limit(2).IDs(setContextOp(ctx, brq.ctx, "OnlyID")); err != nil {
+ return
+ }
+ switch len(ids) {
+ case 1:
+ id = ids[0]
+ case 0:
+ err = &NotFoundError{boardingrecord.Label}
+ default:
+ err = &NotSingularError{boardingrecord.Label}
+ }
+ return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (brq *BoardingRecordQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := brq.OnlyID(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// All executes the query and returns a list of BoardingRecords.
+func (brq *BoardingRecordQuery) All(ctx context.Context) ([]*BoardingRecord, error) {
+ ctx = setContextOp(ctx, brq.ctx, "All")
+ if err := brq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ qr := querierAll[[]*BoardingRecord, *BoardingRecordQuery]()
+ return withInterceptors[[]*BoardingRecord](ctx, brq, qr, brq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (brq *BoardingRecordQuery) AllX(ctx context.Context) []*BoardingRecord {
+ nodes, err := brq.All(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return nodes
+}
+
+// IDs executes the query and returns a list of BoardingRecord IDs.
+func (brq *BoardingRecordQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if brq.ctx.Unique == nil && brq.path != nil {
+ brq.Unique(true)
+ }
+ ctx = setContextOp(ctx, brq.ctx, "IDs")
+ if err = brq.Select(boardingrecord.FieldID).Scan(ctx, &ids); err != nil {
+ return nil, err
+ }
+ return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (brq *BoardingRecordQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := brq.IDs(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return ids
+}
+
+// Count returns the count of the given query.
+func (brq *BoardingRecordQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, brq.ctx, "Count")
+ if err := brq.prepareQuery(ctx); err != nil {
+ return 0, err
+ }
+ return withInterceptors[int](ctx, brq, querierCount[*BoardingRecordQuery](), brq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (brq *BoardingRecordQuery) CountX(ctx context.Context) int {
+ count, err := brq.Count(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (brq *BoardingRecordQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, brq.ctx, "Exist")
+ switch _, err := brq.FirstID(ctx); {
+ case IsNotFound(err):
+ return false, nil
+ case err != nil:
+ return false, fmt.Errorf("ent: check existence: %w", err)
+ default:
+ return true, nil
+ }
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (brq *BoardingRecordQuery) ExistX(ctx context.Context) bool {
+ exist, err := brq.Exist(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return exist
+}
+
+// Clone returns a duplicate of the BoardingRecordQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (brq *BoardingRecordQuery) Clone() *BoardingRecordQuery {
+ if brq == nil {
+ return nil
+ }
+ return &BoardingRecordQuery{
+ config: brq.config,
+ ctx: brq.ctx.Clone(),
+ order: append([]boardingrecord.OrderOption{}, brq.order...),
+ inters: append([]Interceptor{}, brq.inters...),
+ predicates: append([]predicate.BoardingRecord{}, brq.predicates...),
+ withChild: brq.withChild.Clone(),
+ withBus: brq.withBus.Clone(),
+ // clone intermediate query.
+ sql: brq.sql.Clone(),
+ path: brq.path,
+ }
+}
+
+// WithChild tells the query-builder to eager-load the nodes that are connected to
+// the "child" edge. The optional arguments are used to configure the query builder of the edge.
+func (brq *BoardingRecordQuery) WithChild(opts ...func(*ChildQuery)) *BoardingRecordQuery {
+ query := (&ChildClient{config: brq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ brq.withChild = query
+ return brq
+}
+
+// WithBus tells the query-builder to eager-load the nodes that are connected to
+// the "bus" edge. The optional arguments are used to configure the query builder of the edge.
+func (brq *BoardingRecordQuery) WithBus(opts ...func(*BusQuery)) *BoardingRecordQuery {
+ query := (&BusClient{config: brq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ brq.withBus = query
+ return brq
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+// var v []struct {
+// Timestamp time.Time `json:"timestamp,omitempty"`
+// Count int `json:"count,omitempty"`
+// }
+//
+// client.BoardingRecord.Query().
+// GroupBy(boardingrecord.FieldTimestamp).
+// Aggregate(ent.Count()).
+// Scan(ctx, &v)
+func (brq *BoardingRecordQuery) GroupBy(field string, fields ...string) *BoardingRecordGroupBy {
+ brq.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &BoardingRecordGroupBy{build: brq}
+ grbuild.flds = &brq.ctx.Fields
+ grbuild.label = boardingrecord.Label
+ grbuild.scan = grbuild.Scan
+ return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+// var v []struct {
+// Timestamp time.Time `json:"timestamp,omitempty"`
+// }
+//
+// client.BoardingRecord.Query().
+// Select(boardingrecord.FieldTimestamp).
+// Scan(ctx, &v)
+func (brq *BoardingRecordQuery) Select(fields ...string) *BoardingRecordSelect {
+ brq.ctx.Fields = append(brq.ctx.Fields, fields...)
+ sbuild := &BoardingRecordSelect{BoardingRecordQuery: brq}
+ sbuild.label = boardingrecord.Label
+ sbuild.flds, sbuild.scan = &brq.ctx.Fields, sbuild.Scan
+ return sbuild
+}
+
+// Aggregate returns a BoardingRecordSelect configured with the given aggregations.
+func (brq *BoardingRecordQuery) Aggregate(fns ...AggregateFunc) *BoardingRecordSelect {
+ return brq.Select().Aggregate(fns...)
+}
+
+func (brq *BoardingRecordQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range brq.inters {
+ if inter == nil {
+ return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+ }
+ if trv, ok := inter.(Traverser); ok {
+ if err := trv.Traverse(ctx, brq); err != nil {
+ return err
+ }
+ }
+ }
+ for _, f := range brq.ctx.Fields {
+ if !boardingrecord.ValidColumn(f) {
+ return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ }
+ if brq.path != nil {
+ prev, err := brq.path(ctx)
+ if err != nil {
+ return err
+ }
+ brq.sql = prev
+ }
+ return nil
+}
+
+func (brq *BoardingRecordQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*BoardingRecord, error) {
+ var (
+ nodes = []*BoardingRecord{}
+ withFKs = brq.withFKs
+ _spec = brq.querySpec()
+ loadedTypes = [2]bool{
+ brq.withChild != nil,
+ brq.withBus != nil,
+ }
+ )
+ if brq.withChild != nil || brq.withBus != nil {
+ withFKs = true
+ }
+ if withFKs {
+ _spec.Node.Columns = append(_spec.Node.Columns, boardingrecord.ForeignKeys...)
+ }
+ _spec.ScanValues = func(columns []string) ([]any, error) {
+ return (*BoardingRecord).scanValues(nil, columns)
+ }
+ _spec.Assign = func(columns []string, values []any) error {
+ node := &BoardingRecord{config: brq.config}
+ nodes = append(nodes, node)
+ node.Edges.loadedTypes = loadedTypes
+ return node.assignValues(columns, values)
+ }
+ for i := range hooks {
+ hooks[i](ctx, _spec)
+ }
+ if err := sqlgraph.QueryNodes(ctx, brq.driver, _spec); err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nodes, nil
+ }
+ if query := brq.withChild; query != nil {
+ if err := brq.loadChild(ctx, query, nodes, nil,
+ func(n *BoardingRecord, e *Child) { n.Edges.Child = e }); err != nil {
+ return nil, err
+ }
+ }
+ if query := brq.withBus; query != nil {
+ if err := brq.loadBus(ctx, query, nodes, nil,
+ func(n *BoardingRecord, e *Bus) { n.Edges.Bus = e }); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+func (brq *BoardingRecordQuery) loadChild(ctx context.Context, query *ChildQuery, nodes []*BoardingRecord, init func(*BoardingRecord), assign func(*BoardingRecord, *Child)) error {
+ ids := make([]uuid.UUID, 0, len(nodes))
+ nodeids := make(map[uuid.UUID][]*BoardingRecord)
+ for i := range nodes {
+ if nodes[i].child_boarding_record == nil {
+ continue
+ }
+ fk := *nodes[i].child_boarding_record
+ if _, ok := nodeids[fk]; !ok {
+ ids = append(ids, fk)
+ }
+ nodeids[fk] = append(nodeids[fk], nodes[i])
+ }
+ if len(ids) == 0 {
+ return nil
+ }
+ query.Where(child.IDIn(ids...))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ nodes, ok := nodeids[n.ID]
+ if !ok {
+ return fmt.Errorf(`unexpected foreign-key "child_boarding_record" returned %v`, n.ID)
+ }
+ for i := range nodes {
+ assign(nodes[i], n)
+ }
+ }
+ return nil
+}
+func (brq *BoardingRecordQuery) loadBus(ctx context.Context, query *BusQuery, nodes []*BoardingRecord, init func(*BoardingRecord), assign func(*BoardingRecord, *Bus)) error {
+ ids := make([]uuid.UUID, 0, len(nodes))
+ nodeids := make(map[uuid.UUID][]*BoardingRecord)
+ for i := range nodes {
+ if nodes[i].bus_boarding_records == nil {
+ continue
+ }
+ fk := *nodes[i].bus_boarding_records
+ if _, ok := nodeids[fk]; !ok {
+ ids = append(ids, fk)
+ }
+ nodeids[fk] = append(nodeids[fk], nodes[i])
+ }
+ if len(ids) == 0 {
+ return nil
+ }
+ query.Where(bus.IDIn(ids...))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ nodes, ok := nodeids[n.ID]
+ if !ok {
+ return fmt.Errorf(`unexpected foreign-key "bus_boarding_records" returned %v`, n.ID)
+ }
+ for i := range nodes {
+ assign(nodes[i], n)
+ }
+ }
+ return nil
+}
+
+func (brq *BoardingRecordQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := brq.querySpec()
+ _spec.Node.Columns = brq.ctx.Fields
+ if len(brq.ctx.Fields) > 0 {
+ _spec.Unique = brq.ctx.Unique != nil && *brq.ctx.Unique
+ }
+ return sqlgraph.CountNodes(ctx, brq.driver, _spec)
+}
+
+func (brq *BoardingRecordQuery) querySpec() *sqlgraph.QuerySpec {
+ _spec := sqlgraph.NewQuerySpec(boardingrecord.Table, boardingrecord.Columns, sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID))
+ _spec.From = brq.sql
+ if unique := brq.ctx.Unique; unique != nil {
+ _spec.Unique = *unique
+ } else if brq.path != nil {
+ _spec.Unique = true
+ }
+ if fields := brq.ctx.Fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, boardingrecord.FieldID)
+ for i := range fields {
+ if fields[i] != boardingrecord.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+ }
+ }
+ }
+ if ps := brq.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if limit := brq.ctx.Limit; limit != nil {
+ _spec.Limit = *limit
+ }
+ if offset := brq.ctx.Offset; offset != nil {
+ _spec.Offset = *offset
+ }
+ if ps := brq.order; len(ps) > 0 {
+ _spec.Order = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ return _spec
+}
+
+func (brq *BoardingRecordQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(brq.driver.Dialect())
+ t1 := builder.Table(boardingrecord.Table)
+ columns := brq.ctx.Fields
+ if len(columns) == 0 {
+ columns = boardingrecord.Columns
+ }
+ selector := builder.Select(t1.Columns(columns...)...).From(t1)
+ if brq.sql != nil {
+ selector = brq.sql
+ selector.Select(selector.Columns(columns...)...)
+ }
+ if brq.ctx.Unique != nil && *brq.ctx.Unique {
+ selector.Distinct()
+ }
+ for _, p := range brq.predicates {
+ p(selector)
+ }
+ for _, p := range brq.order {
+ p(selector)
+ }
+ if offset := brq.ctx.Offset; offset != nil {
+ // limit is mandatory for offset clause. We start
+ // with default value, and override it below if needed.
+ selector.Offset(*offset).Limit(math.MaxInt32)
+ }
+ if limit := brq.ctx.Limit; limit != nil {
+ selector.Limit(*limit)
+ }
+ return selector
+}
+
+// BoardingRecordGroupBy is the group-by builder for BoardingRecord entities.
+type BoardingRecordGroupBy struct {
+ selector
+ build *BoardingRecordQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (brgb *BoardingRecordGroupBy) Aggregate(fns ...AggregateFunc) *BoardingRecordGroupBy {
+ brgb.fns = append(brgb.fns, fns...)
+ return brgb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (brgb *BoardingRecordGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, brgb.build.ctx, "GroupBy")
+ if err := brgb.build.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*BoardingRecordQuery, *BoardingRecordGroupBy](ctx, brgb.build, brgb, brgb.build.inters, v)
+}
+
+func (brgb *BoardingRecordGroupBy) sqlScan(ctx context.Context, root *BoardingRecordQuery, v any) error {
+ selector := root.sqlQuery(ctx).Select()
+ aggregation := make([]string, 0, len(brgb.fns))
+ for _, fn := range brgb.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ if len(selector.SelectedColumns()) == 0 {
+ columns := make([]string, 0, len(*brgb.flds)+len(brgb.fns))
+ for _, f := range *brgb.flds {
+ columns = append(columns, selector.C(f))
+ }
+ columns = append(columns, aggregation...)
+ selector.Select(columns...)
+ }
+ selector.GroupBy(selector.Columns(*brgb.flds...)...)
+ if err := selector.Err(); err != nil {
+ return err
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := brgb.build.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
+
+// BoardingRecordSelect is the builder for selecting fields of BoardingRecord entities.
+type BoardingRecordSelect struct {
+ *BoardingRecordQuery
+ selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (brs *BoardingRecordSelect) Aggregate(fns ...AggregateFunc) *BoardingRecordSelect {
+ brs.fns = append(brs.fns, fns...)
+ return brs
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (brs *BoardingRecordSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, brs.ctx, "Select")
+ if err := brs.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*BoardingRecordQuery, *BoardingRecordSelect](ctx, brs.BoardingRecordQuery, brs, brs.inters, v)
+}
+
+func (brs *BoardingRecordSelect) sqlScan(ctx context.Context, root *BoardingRecordQuery, v any) error {
+ selector := root.sqlQuery(ctx)
+ aggregation := make([]string, 0, len(brs.fns))
+ for _, fn := range brs.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ switch n := len(*brs.selector.flds); {
+ case n == 0 && len(aggregation) > 0:
+ selector.Select(aggregation...)
+ case n != 0 && len(aggregation) > 0:
+ selector.AppendSelect(aggregation...)
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := brs.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
diff --git a/backend/domain/repository/ent/boardingrecord_update.go b/backend/domain/repository/ent/boardingrecord_update.go
new file mode 100644
index 00000000..80e4c4b2
--- /dev/null
+++ b/backend/domain/repository/ent/boardingrecord_update.go
@@ -0,0 +1,463 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// BoardingRecordUpdate is the builder for updating BoardingRecord entities.
+type BoardingRecordUpdate struct {
+ config
+ hooks []Hook
+ mutation *BoardingRecordMutation
+}
+
+// Where appends a list predicates to the BoardingRecordUpdate builder.
+func (bru *BoardingRecordUpdate) Where(ps ...predicate.BoardingRecord) *BoardingRecordUpdate {
+ bru.mutation.Where(ps...)
+ return bru
+}
+
+// SetTimestamp sets the "timestamp" field.
+func (bru *BoardingRecordUpdate) SetTimestamp(t time.Time) *BoardingRecordUpdate {
+ bru.mutation.SetTimestamp(t)
+ return bru
+}
+
+// SetNillableTimestamp sets the "timestamp" field if the given value is not nil.
+func (bru *BoardingRecordUpdate) SetNillableTimestamp(t *time.Time) *BoardingRecordUpdate {
+ if t != nil {
+ bru.SetTimestamp(*t)
+ }
+ return bru
+}
+
+// SetIsBoarding sets the "is_boarding" field.
+func (bru *BoardingRecordUpdate) SetIsBoarding(b bool) *BoardingRecordUpdate {
+ bru.mutation.SetIsBoarding(b)
+ return bru
+}
+
+// SetNillableIsBoarding sets the "is_boarding" field if the given value is not nil.
+func (bru *BoardingRecordUpdate) SetNillableIsBoarding(b *bool) *BoardingRecordUpdate {
+ if b != nil {
+ bru.SetIsBoarding(*b)
+ }
+ return bru
+}
+
+// SetChildID sets the "child" edge to the Child entity by ID.
+func (bru *BoardingRecordUpdate) SetChildID(id uuid.UUID) *BoardingRecordUpdate {
+ bru.mutation.SetChildID(id)
+ return bru
+}
+
+// SetNillableChildID sets the "child" edge to the Child entity by ID if the given value is not nil.
+func (bru *BoardingRecordUpdate) SetNillableChildID(id *uuid.UUID) *BoardingRecordUpdate {
+ if id != nil {
+ bru = bru.SetChildID(*id)
+ }
+ return bru
+}
+
+// SetChild sets the "child" edge to the Child entity.
+func (bru *BoardingRecordUpdate) SetChild(c *Child) *BoardingRecordUpdate {
+ return bru.SetChildID(c.ID)
+}
+
+// SetBusID sets the "bus" edge to the Bus entity by ID.
+func (bru *BoardingRecordUpdate) SetBusID(id uuid.UUID) *BoardingRecordUpdate {
+ bru.mutation.SetBusID(id)
+ return bru
+}
+
+// SetNillableBusID sets the "bus" edge to the Bus entity by ID if the given value is not nil.
+func (bru *BoardingRecordUpdate) SetNillableBusID(id *uuid.UUID) *BoardingRecordUpdate {
+ if id != nil {
+ bru = bru.SetBusID(*id)
+ }
+ return bru
+}
+
+// SetBus sets the "bus" edge to the Bus entity.
+func (bru *BoardingRecordUpdate) SetBus(b *Bus) *BoardingRecordUpdate {
+ return bru.SetBusID(b.ID)
+}
+
+// Mutation returns the BoardingRecordMutation object of the builder.
+func (bru *BoardingRecordUpdate) Mutation() *BoardingRecordMutation {
+ return bru.mutation
+}
+
+// ClearChild clears the "child" edge to the Child entity.
+func (bru *BoardingRecordUpdate) ClearChild() *BoardingRecordUpdate {
+ bru.mutation.ClearChild()
+ return bru
+}
+
+// ClearBus clears the "bus" edge to the Bus entity.
+func (bru *BoardingRecordUpdate) ClearBus() *BoardingRecordUpdate {
+ bru.mutation.ClearBus()
+ return bru
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (bru *BoardingRecordUpdate) Save(ctx context.Context) (int, error) {
+ return withHooks(ctx, bru.sqlSave, bru.mutation, bru.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (bru *BoardingRecordUpdate) SaveX(ctx context.Context) int {
+ affected, err := bru.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return affected
+}
+
+// Exec executes the query.
+func (bru *BoardingRecordUpdate) Exec(ctx context.Context) error {
+ _, err := bru.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (bru *BoardingRecordUpdate) ExecX(ctx context.Context) {
+ if err := bru.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+func (bru *BoardingRecordUpdate) sqlSave(ctx context.Context) (n int, err error) {
+ _spec := sqlgraph.NewUpdateSpec(boardingrecord.Table, boardingrecord.Columns, sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID))
+ if ps := bru.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := bru.mutation.Timestamp(); ok {
+ _spec.SetField(boardingrecord.FieldTimestamp, field.TypeTime, value)
+ }
+ if value, ok := bru.mutation.IsBoarding(); ok {
+ _spec.SetField(boardingrecord.FieldIsBoarding, field.TypeBool, value)
+ }
+ if bru.mutation.ChildCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: boardingrecord.ChildTable,
+ Columns: []string{boardingrecord.ChildColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bru.mutation.ChildIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: boardingrecord.ChildTable,
+ Columns: []string{boardingrecord.ChildColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if bru.mutation.BusCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: boardingrecord.BusTable,
+ Columns: []string{boardingrecord.BusColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bru.mutation.BusIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: boardingrecord.BusTable,
+ Columns: []string{boardingrecord.BusColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if n, err = sqlgraph.UpdateNodes(ctx, bru.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{boardingrecord.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return 0, err
+ }
+ bru.mutation.done = true
+ return n, nil
+}
+
+// BoardingRecordUpdateOne is the builder for updating a single BoardingRecord entity.
+type BoardingRecordUpdateOne struct {
+ config
+ fields []string
+ hooks []Hook
+ mutation *BoardingRecordMutation
+}
+
+// SetTimestamp sets the "timestamp" field.
+func (bruo *BoardingRecordUpdateOne) SetTimestamp(t time.Time) *BoardingRecordUpdateOne {
+ bruo.mutation.SetTimestamp(t)
+ return bruo
+}
+
+// SetNillableTimestamp sets the "timestamp" field if the given value is not nil.
+func (bruo *BoardingRecordUpdateOne) SetNillableTimestamp(t *time.Time) *BoardingRecordUpdateOne {
+ if t != nil {
+ bruo.SetTimestamp(*t)
+ }
+ return bruo
+}
+
+// SetIsBoarding sets the "is_boarding" field.
+func (bruo *BoardingRecordUpdateOne) SetIsBoarding(b bool) *BoardingRecordUpdateOne {
+ bruo.mutation.SetIsBoarding(b)
+ return bruo
+}
+
+// SetNillableIsBoarding sets the "is_boarding" field if the given value is not nil.
+func (bruo *BoardingRecordUpdateOne) SetNillableIsBoarding(b *bool) *BoardingRecordUpdateOne {
+ if b != nil {
+ bruo.SetIsBoarding(*b)
+ }
+ return bruo
+}
+
+// SetChildID sets the "child" edge to the Child entity by ID.
+func (bruo *BoardingRecordUpdateOne) SetChildID(id uuid.UUID) *BoardingRecordUpdateOne {
+ bruo.mutation.SetChildID(id)
+ return bruo
+}
+
+// SetNillableChildID sets the "child" edge to the Child entity by ID if the given value is not nil.
+func (bruo *BoardingRecordUpdateOne) SetNillableChildID(id *uuid.UUID) *BoardingRecordUpdateOne {
+ if id != nil {
+ bruo = bruo.SetChildID(*id)
+ }
+ return bruo
+}
+
+// SetChild sets the "child" edge to the Child entity.
+func (bruo *BoardingRecordUpdateOne) SetChild(c *Child) *BoardingRecordUpdateOne {
+ return bruo.SetChildID(c.ID)
+}
+
+// SetBusID sets the "bus" edge to the Bus entity by ID.
+func (bruo *BoardingRecordUpdateOne) SetBusID(id uuid.UUID) *BoardingRecordUpdateOne {
+ bruo.mutation.SetBusID(id)
+ return bruo
+}
+
+// SetNillableBusID sets the "bus" edge to the Bus entity by ID if the given value is not nil.
+func (bruo *BoardingRecordUpdateOne) SetNillableBusID(id *uuid.UUID) *BoardingRecordUpdateOne {
+ if id != nil {
+ bruo = bruo.SetBusID(*id)
+ }
+ return bruo
+}
+
+// SetBus sets the "bus" edge to the Bus entity.
+func (bruo *BoardingRecordUpdateOne) SetBus(b *Bus) *BoardingRecordUpdateOne {
+ return bruo.SetBusID(b.ID)
+}
+
+// Mutation returns the BoardingRecordMutation object of the builder.
+func (bruo *BoardingRecordUpdateOne) Mutation() *BoardingRecordMutation {
+ return bruo.mutation
+}
+
+// ClearChild clears the "child" edge to the Child entity.
+func (bruo *BoardingRecordUpdateOne) ClearChild() *BoardingRecordUpdateOne {
+ bruo.mutation.ClearChild()
+ return bruo
+}
+
+// ClearBus clears the "bus" edge to the Bus entity.
+func (bruo *BoardingRecordUpdateOne) ClearBus() *BoardingRecordUpdateOne {
+ bruo.mutation.ClearBus()
+ return bruo
+}
+
+// Where appends a list predicates to the BoardingRecordUpdate builder.
+func (bruo *BoardingRecordUpdateOne) Where(ps ...predicate.BoardingRecord) *BoardingRecordUpdateOne {
+ bruo.mutation.Where(ps...)
+ return bruo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (bruo *BoardingRecordUpdateOne) Select(field string, fields ...string) *BoardingRecordUpdateOne {
+ bruo.fields = append([]string{field}, fields...)
+ return bruo
+}
+
+// Save executes the query and returns the updated BoardingRecord entity.
+func (bruo *BoardingRecordUpdateOne) Save(ctx context.Context) (*BoardingRecord, error) {
+ return withHooks(ctx, bruo.sqlSave, bruo.mutation, bruo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (bruo *BoardingRecordUpdateOne) SaveX(ctx context.Context) *BoardingRecord {
+ node, err := bruo.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// Exec executes the query on the entity.
+func (bruo *BoardingRecordUpdateOne) Exec(ctx context.Context) error {
+ _, err := bruo.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (bruo *BoardingRecordUpdateOne) ExecX(ctx context.Context) {
+ if err := bruo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+func (bruo *BoardingRecordUpdateOne) sqlSave(ctx context.Context) (_node *BoardingRecord, err error) {
+ _spec := sqlgraph.NewUpdateSpec(boardingrecord.Table, boardingrecord.Columns, sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID))
+ id, ok := bruo.mutation.ID()
+ if !ok {
+ return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "BoardingRecord.id" for update`)}
+ }
+ _spec.Node.ID.Value = id
+ if fields := bruo.fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, boardingrecord.FieldID)
+ for _, f := range fields {
+ if !boardingrecord.ValidColumn(f) {
+ return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ if f != boardingrecord.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, f)
+ }
+ }
+ }
+ if ps := bruo.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := bruo.mutation.Timestamp(); ok {
+ _spec.SetField(boardingrecord.FieldTimestamp, field.TypeTime, value)
+ }
+ if value, ok := bruo.mutation.IsBoarding(); ok {
+ _spec.SetField(boardingrecord.FieldIsBoarding, field.TypeBool, value)
+ }
+ if bruo.mutation.ChildCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: boardingrecord.ChildTable,
+ Columns: []string{boardingrecord.ChildColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bruo.mutation.ChildIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: boardingrecord.ChildTable,
+ Columns: []string{boardingrecord.ChildColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if bruo.mutation.BusCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: boardingrecord.BusTable,
+ Columns: []string{boardingrecord.BusColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bruo.mutation.BusIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: boardingrecord.BusTable,
+ Columns: []string{boardingrecord.BusColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ _node = &BoardingRecord{config: bruo.config}
+ _spec.Assign = _node.assignValues
+ _spec.ScanValues = _node.scanValues
+ if err = sqlgraph.UpdateNode(ctx, bruo.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{boardingrecord.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ bruo.mutation.done = true
+ return _node, nil
+}
diff --git a/backend/domain/repository/ent/bus.go b/backend/domain/repository/ent/bus.go
new file mode 100644
index 00000000..f9a9be1b
--- /dev/null
+++ b/backend/domain/repository/ent/bus.go
@@ -0,0 +1,353 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "fmt"
+ "strings"
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/sql"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// Bus is the model entity for the Bus schema.
+type Bus struct {
+ config `json:"-"`
+ // ID of the ent.
+ ID uuid.UUID `json:"id,omitempty"`
+ // Name holds the value of the "name" field.
+ Name string `json:"name,omitempty"`
+ // PlateNumber holds the value of the "plate_number" field.
+ PlateNumber string `json:"plate_number,omitempty"`
+ // 現在の緯度
+ Latitude float64 `json:"latitude,omitempty"`
+ // 現在の経度
+ Longitude float64 `json:"longitude,omitempty"`
+ // バスのステータス(運行中、停止中など)
+ Status bus.Status `json:"status,omitempty"`
+ // 顔識別が有効かどうか
+ EnableFaceRecognition bool `json:"enable_face_recognition,omitempty"`
+ // CreatedAt holds the value of the "created_at" field.
+ CreatedAt time.Time `json:"created_at,omitempty"`
+ // UpdatedAt holds the value of the "updated_at" field.
+ UpdatedAt time.Time `json:"updated_at,omitempty"`
+ // Edges holds the relations/edges for other nodes in the graph.
+ // The values are being populated by the BusQuery when eager-loading is set.
+ Edges BusEdges `json:"edges"`
+ bus_nursery *uuid.UUID
+ bus_next_station *uuid.UUID
+ bus_latest_morning_route *uuid.UUID
+ bus_latest_evening_route *uuid.UUID
+ selectValues sql.SelectValues
+}
+
+// BusEdges holds the relations/edges for other nodes in the graph.
+type BusEdges struct {
+ // Nursery holds the value of the nursery edge.
+ Nursery *Nursery `json:"nursery,omitempty"`
+ // BoardingRecords holds the value of the boarding_records edge.
+ BoardingRecords []*BoardingRecord `json:"boarding_records,omitempty"`
+ // NextStation holds the value of the next_station edge.
+ NextStation *Station `json:"next_station,omitempty"`
+ // BusRoute holds the value of the bus_route edge.
+ BusRoute []*BusRoute `json:"bus_route,omitempty"`
+ // LatestMorningRoute holds the value of the latest_morning_route edge.
+ LatestMorningRoute *BusRoute `json:"latest_morning_route,omitempty"`
+ // LatestEveningRoute holds the value of the latest_evening_route edge.
+ LatestEveningRoute *BusRoute `json:"latest_evening_route,omitempty"`
+ // loadedTypes holds the information for reporting if a
+ // type was loaded (or requested) in eager-loading or not.
+ loadedTypes [6]bool
+}
+
+// NurseryOrErr returns the Nursery value or an error if the edge
+// was not loaded in eager-loading, or loaded but was not found.
+func (e BusEdges) NurseryOrErr() (*Nursery, error) {
+ if e.loadedTypes[0] {
+ if e.Nursery == nil {
+ // Edge was loaded but was not found.
+ return nil, &NotFoundError{label: nursery.Label}
+ }
+ return e.Nursery, nil
+ }
+ return nil, &NotLoadedError{edge: "nursery"}
+}
+
+// BoardingRecordsOrErr returns the BoardingRecords value or an error if the edge
+// was not loaded in eager-loading.
+func (e BusEdges) BoardingRecordsOrErr() ([]*BoardingRecord, error) {
+ if e.loadedTypes[1] {
+ return e.BoardingRecords, nil
+ }
+ return nil, &NotLoadedError{edge: "boarding_records"}
+}
+
+// NextStationOrErr returns the NextStation value or an error if the edge
+// was not loaded in eager-loading, or loaded but was not found.
+func (e BusEdges) NextStationOrErr() (*Station, error) {
+ if e.loadedTypes[2] {
+ if e.NextStation == nil {
+ // Edge was loaded but was not found.
+ return nil, &NotFoundError{label: station.Label}
+ }
+ return e.NextStation, nil
+ }
+ return nil, &NotLoadedError{edge: "next_station"}
+}
+
+// BusRouteOrErr returns the BusRoute value or an error if the edge
+// was not loaded in eager-loading.
+func (e BusEdges) BusRouteOrErr() ([]*BusRoute, error) {
+ if e.loadedTypes[3] {
+ return e.BusRoute, nil
+ }
+ return nil, &NotLoadedError{edge: "bus_route"}
+}
+
+// LatestMorningRouteOrErr returns the LatestMorningRoute value or an error if the edge
+// was not loaded in eager-loading, or loaded but was not found.
+func (e BusEdges) LatestMorningRouteOrErr() (*BusRoute, error) {
+ if e.loadedTypes[4] {
+ if e.LatestMorningRoute == nil {
+ // Edge was loaded but was not found.
+ return nil, &NotFoundError{label: busroute.Label}
+ }
+ return e.LatestMorningRoute, nil
+ }
+ return nil, &NotLoadedError{edge: "latest_morning_route"}
+}
+
+// LatestEveningRouteOrErr returns the LatestEveningRoute value or an error if the edge
+// was not loaded in eager-loading, or loaded but was not found.
+func (e BusEdges) LatestEveningRouteOrErr() (*BusRoute, error) {
+ if e.loadedTypes[5] {
+ if e.LatestEveningRoute == nil {
+ // Edge was loaded but was not found.
+ return nil, &NotFoundError{label: busroute.Label}
+ }
+ return e.LatestEveningRoute, nil
+ }
+ return nil, &NotLoadedError{edge: "latest_evening_route"}
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*Bus) scanValues(columns []string) ([]any, error) {
+ values := make([]any, len(columns))
+ for i := range columns {
+ switch columns[i] {
+ case bus.FieldEnableFaceRecognition:
+ values[i] = new(sql.NullBool)
+ case bus.FieldLatitude, bus.FieldLongitude:
+ values[i] = new(sql.NullFloat64)
+ case bus.FieldName, bus.FieldPlateNumber, bus.FieldStatus:
+ values[i] = new(sql.NullString)
+ case bus.FieldCreatedAt, bus.FieldUpdatedAt:
+ values[i] = new(sql.NullTime)
+ case bus.FieldID:
+ values[i] = new(uuid.UUID)
+ case bus.ForeignKeys[0]: // bus_nursery
+ values[i] = &sql.NullScanner{S: new(uuid.UUID)}
+ case bus.ForeignKeys[1]: // bus_next_station
+ values[i] = &sql.NullScanner{S: new(uuid.UUID)}
+ case bus.ForeignKeys[2]: // bus_latest_morning_route
+ values[i] = &sql.NullScanner{S: new(uuid.UUID)}
+ case bus.ForeignKeys[3]: // bus_latest_evening_route
+ values[i] = &sql.NullScanner{S: new(uuid.UUID)}
+ default:
+ values[i] = new(sql.UnknownType)
+ }
+ }
+ return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the Bus fields.
+func (b *Bus) assignValues(columns []string, values []any) error {
+ if m, n := len(values), len(columns); m < n {
+ return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+ }
+ for i := range columns {
+ switch columns[i] {
+ case bus.FieldID:
+ if value, ok := values[i].(*uuid.UUID); !ok {
+ return fmt.Errorf("unexpected type %T for field id", values[i])
+ } else if value != nil {
+ b.ID = *value
+ }
+ case bus.FieldName:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field name", values[i])
+ } else if value.Valid {
+ b.Name = value.String
+ }
+ case bus.FieldPlateNumber:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field plate_number", values[i])
+ } else if value.Valid {
+ b.PlateNumber = value.String
+ }
+ case bus.FieldLatitude:
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field latitude", values[i])
+ } else if value.Valid {
+ b.Latitude = value.Float64
+ }
+ case bus.FieldLongitude:
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field longitude", values[i])
+ } else if value.Valid {
+ b.Longitude = value.Float64
+ }
+ case bus.FieldStatus:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field status", values[i])
+ } else if value.Valid {
+ b.Status = bus.Status(value.String)
+ }
+ case bus.FieldEnableFaceRecognition:
+ if value, ok := values[i].(*sql.NullBool); !ok {
+ return fmt.Errorf("unexpected type %T for field enable_face_recognition", values[i])
+ } else if value.Valid {
+ b.EnableFaceRecognition = value.Bool
+ }
+ case bus.FieldCreatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field created_at", values[i])
+ } else if value.Valid {
+ b.CreatedAt = value.Time
+ }
+ case bus.FieldUpdatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field updated_at", values[i])
+ } else if value.Valid {
+ b.UpdatedAt = value.Time
+ }
+ case bus.ForeignKeys[0]:
+ if value, ok := values[i].(*sql.NullScanner); !ok {
+ return fmt.Errorf("unexpected type %T for field bus_nursery", values[i])
+ } else if value.Valid {
+ b.bus_nursery = new(uuid.UUID)
+ *b.bus_nursery = *value.S.(*uuid.UUID)
+ }
+ case bus.ForeignKeys[1]:
+ if value, ok := values[i].(*sql.NullScanner); !ok {
+ return fmt.Errorf("unexpected type %T for field bus_next_station", values[i])
+ } else if value.Valid {
+ b.bus_next_station = new(uuid.UUID)
+ *b.bus_next_station = *value.S.(*uuid.UUID)
+ }
+ case bus.ForeignKeys[2]:
+ if value, ok := values[i].(*sql.NullScanner); !ok {
+ return fmt.Errorf("unexpected type %T for field bus_latest_morning_route", values[i])
+ } else if value.Valid {
+ b.bus_latest_morning_route = new(uuid.UUID)
+ *b.bus_latest_morning_route = *value.S.(*uuid.UUID)
+ }
+ case bus.ForeignKeys[3]:
+ if value, ok := values[i].(*sql.NullScanner); !ok {
+ return fmt.Errorf("unexpected type %T for field bus_latest_evening_route", values[i])
+ } else if value.Valid {
+ b.bus_latest_evening_route = new(uuid.UUID)
+ *b.bus_latest_evening_route = *value.S.(*uuid.UUID)
+ }
+ default:
+ b.selectValues.Set(columns[i], values[i])
+ }
+ }
+ return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the Bus.
+// This includes values selected through modifiers, order, etc.
+func (b *Bus) Value(name string) (ent.Value, error) {
+ return b.selectValues.Get(name)
+}
+
+// QueryNursery queries the "nursery" edge of the Bus entity.
+func (b *Bus) QueryNursery() *NurseryQuery {
+ return NewBusClient(b.config).QueryNursery(b)
+}
+
+// QueryBoardingRecords queries the "boarding_records" edge of the Bus entity.
+func (b *Bus) QueryBoardingRecords() *BoardingRecordQuery {
+ return NewBusClient(b.config).QueryBoardingRecords(b)
+}
+
+// QueryNextStation queries the "next_station" edge of the Bus entity.
+func (b *Bus) QueryNextStation() *StationQuery {
+ return NewBusClient(b.config).QueryNextStation(b)
+}
+
+// QueryBusRoute queries the "bus_route" edge of the Bus entity.
+func (b *Bus) QueryBusRoute() *BusRouteQuery {
+ return NewBusClient(b.config).QueryBusRoute(b)
+}
+
+// QueryLatestMorningRoute queries the "latest_morning_route" edge of the Bus entity.
+func (b *Bus) QueryLatestMorningRoute() *BusRouteQuery {
+ return NewBusClient(b.config).QueryLatestMorningRoute(b)
+}
+
+// QueryLatestEveningRoute queries the "latest_evening_route" edge of the Bus entity.
+func (b *Bus) QueryLatestEveningRoute() *BusRouteQuery {
+ return NewBusClient(b.config).QueryLatestEveningRoute(b)
+}
+
+// Update returns a builder for updating this Bus.
+// Note that you need to call Bus.Unwrap() before calling this method if this Bus
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (b *Bus) Update() *BusUpdateOne {
+ return NewBusClient(b.config).UpdateOne(b)
+}
+
+// Unwrap unwraps the Bus entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (b *Bus) Unwrap() *Bus {
+ _tx, ok := b.config.driver.(*txDriver)
+ if !ok {
+ panic("ent: Bus is not a transactional entity")
+ }
+ b.config.driver = _tx.drv
+ return b
+}
+
+// String implements the fmt.Stringer.
+func (b *Bus) String() string {
+ var builder strings.Builder
+ builder.WriteString("Bus(")
+ builder.WriteString(fmt.Sprintf("id=%v, ", b.ID))
+ builder.WriteString("name=")
+ builder.WriteString(b.Name)
+ builder.WriteString(", ")
+ builder.WriteString("plate_number=")
+ builder.WriteString(b.PlateNumber)
+ builder.WriteString(", ")
+ builder.WriteString("latitude=")
+ builder.WriteString(fmt.Sprintf("%v", b.Latitude))
+ builder.WriteString(", ")
+ builder.WriteString("longitude=")
+ builder.WriteString(fmt.Sprintf("%v", b.Longitude))
+ builder.WriteString(", ")
+ builder.WriteString("status=")
+ builder.WriteString(fmt.Sprintf("%v", b.Status))
+ builder.WriteString(", ")
+ builder.WriteString("enable_face_recognition=")
+ builder.WriteString(fmt.Sprintf("%v", b.EnableFaceRecognition))
+ builder.WriteString(", ")
+ builder.WriteString("created_at=")
+ builder.WriteString(b.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(", ")
+ builder.WriteString("updated_at=")
+ builder.WriteString(b.UpdatedAt.Format(time.ANSIC))
+ builder.WriteByte(')')
+ return builder.String()
+}
+
+// BusSlice is a parsable slice of Bus.
+type BusSlice []*Bus
diff --git a/backend/domain/repository/ent/bus/bus.go b/backend/domain/repository/ent/bus/bus.go
new file mode 100644
index 00000000..6a3d13b5
--- /dev/null
+++ b/backend/domain/repository/ent/bus/bus.go
@@ -0,0 +1,318 @@
+// Code generated by ent, DO NOT EDIT.
+
+package bus
+
+import (
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/google/uuid"
+)
+
+const (
+ // Label holds the string label denoting the bus type in the database.
+ Label = "bus"
+ // FieldID holds the string denoting the id field in the database.
+ FieldID = "id"
+ // FieldName holds the string denoting the name field in the database.
+ FieldName = "name"
+ // FieldPlateNumber holds the string denoting the plate_number field in the database.
+ FieldPlateNumber = "plate_number"
+ // FieldLatitude holds the string denoting the latitude field in the database.
+ FieldLatitude = "latitude"
+ // FieldLongitude holds the string denoting the longitude field in the database.
+ FieldLongitude = "longitude"
+ // FieldStatus holds the string denoting the status field in the database.
+ FieldStatus = "status"
+ // FieldEnableFaceRecognition holds the string denoting the enable_face_recognition field in the database.
+ FieldEnableFaceRecognition = "enable_face_recognition"
+ // FieldCreatedAt holds the string denoting the created_at field in the database.
+ FieldCreatedAt = "created_at"
+ // FieldUpdatedAt holds the string denoting the updated_at field in the database.
+ FieldUpdatedAt = "updated_at"
+ // EdgeNursery holds the string denoting the nursery edge name in mutations.
+ EdgeNursery = "nursery"
+ // EdgeBoardingRecords holds the string denoting the boarding_records edge name in mutations.
+ EdgeBoardingRecords = "boarding_records"
+ // EdgeNextStation holds the string denoting the next_station edge name in mutations.
+ EdgeNextStation = "next_station"
+ // EdgeBusRoute holds the string denoting the bus_route edge name in mutations.
+ EdgeBusRoute = "bus_route"
+ // EdgeLatestMorningRoute holds the string denoting the latest_morning_route edge name in mutations.
+ EdgeLatestMorningRoute = "latest_morning_route"
+ // EdgeLatestEveningRoute holds the string denoting the latest_evening_route edge name in mutations.
+ EdgeLatestEveningRoute = "latest_evening_route"
+ // Table holds the table name of the bus in the database.
+ Table = "bus"
+ // NurseryTable is the table that holds the nursery relation/edge.
+ NurseryTable = "bus"
+ // NurseryInverseTable is the table name for the Nursery entity.
+ // It exists in this package in order to avoid circular dependency with the "nursery" package.
+ NurseryInverseTable = "nurseries"
+ // NurseryColumn is the table column denoting the nursery relation/edge.
+ NurseryColumn = "bus_nursery"
+ // BoardingRecordsTable is the table that holds the boarding_records relation/edge.
+ BoardingRecordsTable = "boarding_records"
+ // BoardingRecordsInverseTable is the table name for the BoardingRecord entity.
+ // It exists in this package in order to avoid circular dependency with the "boardingrecord" package.
+ BoardingRecordsInverseTable = "boarding_records"
+ // BoardingRecordsColumn is the table column denoting the boarding_records relation/edge.
+ BoardingRecordsColumn = "bus_boarding_records"
+ // NextStationTable is the table that holds the next_station relation/edge.
+ NextStationTable = "bus"
+ // NextStationInverseTable is the table name for the Station entity.
+ // It exists in this package in order to avoid circular dependency with the "station" package.
+ NextStationInverseTable = "stations"
+ // NextStationColumn is the table column denoting the next_station relation/edge.
+ NextStationColumn = "bus_next_station"
+ // BusRouteTable is the table that holds the bus_route relation/edge. The primary key declared below.
+ BusRouteTable = "bus_route_bus"
+ // BusRouteInverseTable is the table name for the BusRoute entity.
+ // It exists in this package in order to avoid circular dependency with the "busroute" package.
+ BusRouteInverseTable = "bus_routes"
+ // LatestMorningRouteTable is the table that holds the latest_morning_route relation/edge.
+ LatestMorningRouteTable = "bus"
+ // LatestMorningRouteInverseTable is the table name for the BusRoute entity.
+ // It exists in this package in order to avoid circular dependency with the "busroute" package.
+ LatestMorningRouteInverseTable = "bus_routes"
+ // LatestMorningRouteColumn is the table column denoting the latest_morning_route relation/edge.
+ LatestMorningRouteColumn = "bus_latest_morning_route"
+ // LatestEveningRouteTable is the table that holds the latest_evening_route relation/edge.
+ LatestEveningRouteTable = "bus"
+ // LatestEveningRouteInverseTable is the table name for the BusRoute entity.
+ // It exists in this package in order to avoid circular dependency with the "busroute" package.
+ LatestEveningRouteInverseTable = "bus_routes"
+ // LatestEveningRouteColumn is the table column denoting the latest_evening_route relation/edge.
+ LatestEveningRouteColumn = "bus_latest_evening_route"
+)
+
+// Columns holds all SQL columns for bus fields.
+var Columns = []string{
+ FieldID,
+ FieldName,
+ FieldPlateNumber,
+ FieldLatitude,
+ FieldLongitude,
+ FieldStatus,
+ FieldEnableFaceRecognition,
+ FieldCreatedAt,
+ FieldUpdatedAt,
+}
+
+// ForeignKeys holds the SQL foreign-keys that are owned by the "bus"
+// table and are not defined as standalone fields in the schema.
+var ForeignKeys = []string{
+ "bus_nursery",
+ "bus_next_station",
+ "bus_latest_morning_route",
+ "bus_latest_evening_route",
+}
+
+var (
+ // BusRoutePrimaryKey and BusRouteColumn2 are the table columns denoting the
+ // primary key for the bus_route relation (M2M).
+ BusRoutePrimaryKey = []string{"bus_route_id", "bus_id"}
+)
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+ for i := range Columns {
+ if column == Columns[i] {
+ return true
+ }
+ }
+ for i := range ForeignKeys {
+ if column == ForeignKeys[i] {
+ return true
+ }
+ }
+ return false
+}
+
+var (
+ // DefaultEnableFaceRecognition holds the default value on creation for the "enable_face_recognition" field.
+ DefaultEnableFaceRecognition bool
+ // DefaultCreatedAt holds the default value on creation for the "created_at" field.
+ DefaultCreatedAt func() time.Time
+ // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
+ DefaultUpdatedAt func() time.Time
+ // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
+ UpdateDefaultUpdatedAt func() time.Time
+ // DefaultID holds the default value on creation for the "id" field.
+ DefaultID func() uuid.UUID
+)
+
+// Status defines the type for the "status" enum field.
+type Status string
+
+// StatusStopped is the default value of the Status enum.
+const DefaultStatus = StatusStopped
+
+// Status values.
+const (
+ StatusStopped Status = "stopped"
+ StatusRunning Status = "running"
+ StatusMaintenance Status = "maintenance"
+)
+
+func (s Status) String() string {
+ return string(s)
+}
+
+// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
+func StatusValidator(s Status) error {
+ switch s {
+ case StatusStopped, StatusRunning, StatusMaintenance:
+ return nil
+ default:
+ return fmt.Errorf("bus: invalid enum value for status field: %q", s)
+ }
+}
+
+// OrderOption defines the ordering options for the Bus queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByName orders the results by the name field.
+func ByName(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldName, opts...).ToFunc()
+}
+
+// ByPlateNumber orders the results by the plate_number field.
+func ByPlateNumber(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldPlateNumber, opts...).ToFunc()
+}
+
+// ByLatitude orders the results by the latitude field.
+func ByLatitude(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldLatitude, opts...).ToFunc()
+}
+
+// ByLongitude orders the results by the longitude field.
+func ByLongitude(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldLongitude, opts...).ToFunc()
+}
+
+// ByStatus orders the results by the status field.
+func ByStatus(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldStatus, opts...).ToFunc()
+}
+
+// ByEnableFaceRecognition orders the results by the enable_face_recognition field.
+func ByEnableFaceRecognition(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldEnableFaceRecognition, opts...).ToFunc()
+}
+
+// ByCreatedAt orders the results by the created_at field.
+func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
+}
+
+// ByUpdatedAt orders the results by the updated_at field.
+func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
+}
+
+// ByNurseryField orders the results by nursery field.
+func ByNurseryField(field string, opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newNurseryStep(), sql.OrderByField(field, opts...))
+ }
+}
+
+// ByBoardingRecordsCount orders the results by boarding_records count.
+func ByBoardingRecordsCount(opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborsCount(s, newBoardingRecordsStep(), opts...)
+ }
+}
+
+// ByBoardingRecords orders the results by boarding_records terms.
+func ByBoardingRecords(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newBoardingRecordsStep(), append([]sql.OrderTerm{term}, terms...)...)
+ }
+}
+
+// ByNextStationField orders the results by next_station field.
+func ByNextStationField(field string, opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newNextStationStep(), sql.OrderByField(field, opts...))
+ }
+}
+
+// ByBusRouteCount orders the results by bus_route count.
+func ByBusRouteCount(opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborsCount(s, newBusRouteStep(), opts...)
+ }
+}
+
+// ByBusRoute orders the results by bus_route terms.
+func ByBusRoute(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newBusRouteStep(), append([]sql.OrderTerm{term}, terms...)...)
+ }
+}
+
+// ByLatestMorningRouteField orders the results by latest_morning_route field.
+func ByLatestMorningRouteField(field string, opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newLatestMorningRouteStep(), sql.OrderByField(field, opts...))
+ }
+}
+
+// ByLatestEveningRouteField orders the results by latest_evening_route field.
+func ByLatestEveningRouteField(field string, opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newLatestEveningRouteStep(), sql.OrderByField(field, opts...))
+ }
+}
+func newNurseryStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(NurseryInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, NurseryTable, NurseryColumn),
+ )
+}
+func newBoardingRecordsStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(BoardingRecordsInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, BoardingRecordsTable, BoardingRecordsColumn),
+ )
+}
+func newNextStationStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(NextStationInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, NextStationTable, NextStationColumn),
+ )
+}
+func newBusRouteStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(BusRouteInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.M2M, true, BusRouteTable, BusRoutePrimaryKey...),
+ )
+}
+func newLatestMorningRouteStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(LatestMorningRouteInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, LatestMorningRouteTable, LatestMorningRouteColumn),
+ )
+}
+func newLatestEveningRouteStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(LatestEveningRouteInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, LatestEveningRouteTable, LatestEveningRouteColumn),
+ )
+}
diff --git a/backend/domain/repository/ent/bus/where.go b/backend/domain/repository/ent/bus/where.go
new file mode 100644
index 00000000..28af53a7
--- /dev/null
+++ b/backend/domain/repository/ent/bus/where.go
@@ -0,0 +1,595 @@
+// Code generated by ent, DO NOT EDIT.
+
+package bus
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id uuid.UUID) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id uuid.UUID) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id uuid.UUID) predicate.Bus {
+ return predicate.Bus(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...uuid.UUID) predicate.Bus {
+ return predicate.Bus(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...uuid.UUID) predicate.Bus {
+ return predicate.Bus(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id uuid.UUID) predicate.Bus {
+ return predicate.Bus(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id uuid.UUID) predicate.Bus {
+ return predicate.Bus(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id uuid.UUID) predicate.Bus {
+ return predicate.Bus(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id uuid.UUID) predicate.Bus {
+ return predicate.Bus(sql.FieldLTE(FieldID, id))
+}
+
+// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
+func Name(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldName, v))
+}
+
+// PlateNumber applies equality check predicate on the "plate_number" field. It's identical to PlateNumberEQ.
+func PlateNumber(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldPlateNumber, v))
+}
+
+// Latitude applies equality check predicate on the "latitude" field. It's identical to LatitudeEQ.
+func Latitude(v float64) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldLatitude, v))
+}
+
+// Longitude applies equality check predicate on the "longitude" field. It's identical to LongitudeEQ.
+func Longitude(v float64) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldLongitude, v))
+}
+
+// EnableFaceRecognition applies equality check predicate on the "enable_face_recognition" field. It's identical to EnableFaceRecognitionEQ.
+func EnableFaceRecognition(v bool) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldEnableFaceRecognition, v))
+}
+
+// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
+func UpdatedAt(v time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// NameEQ applies the EQ predicate on the "name" field.
+func NameEQ(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldName, v))
+}
+
+// NameNEQ applies the NEQ predicate on the "name" field.
+func NameNEQ(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldNEQ(FieldName, v))
+}
+
+// NameIn applies the In predicate on the "name" field.
+func NameIn(vs ...string) predicate.Bus {
+ return predicate.Bus(sql.FieldIn(FieldName, vs...))
+}
+
+// NameNotIn applies the NotIn predicate on the "name" field.
+func NameNotIn(vs ...string) predicate.Bus {
+ return predicate.Bus(sql.FieldNotIn(FieldName, vs...))
+}
+
+// NameGT applies the GT predicate on the "name" field.
+func NameGT(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldGT(FieldName, v))
+}
+
+// NameGTE applies the GTE predicate on the "name" field.
+func NameGTE(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldGTE(FieldName, v))
+}
+
+// NameLT applies the LT predicate on the "name" field.
+func NameLT(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldLT(FieldName, v))
+}
+
+// NameLTE applies the LTE predicate on the "name" field.
+func NameLTE(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldLTE(FieldName, v))
+}
+
+// NameContains applies the Contains predicate on the "name" field.
+func NameContains(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldContains(FieldName, v))
+}
+
+// NameHasPrefix applies the HasPrefix predicate on the "name" field.
+func NameHasPrefix(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldHasPrefix(FieldName, v))
+}
+
+// NameHasSuffix applies the HasSuffix predicate on the "name" field.
+func NameHasSuffix(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldHasSuffix(FieldName, v))
+}
+
+// NameEqualFold applies the EqualFold predicate on the "name" field.
+func NameEqualFold(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldEqualFold(FieldName, v))
+}
+
+// NameContainsFold applies the ContainsFold predicate on the "name" field.
+func NameContainsFold(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldContainsFold(FieldName, v))
+}
+
+// PlateNumberEQ applies the EQ predicate on the "plate_number" field.
+func PlateNumberEQ(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldPlateNumber, v))
+}
+
+// PlateNumberNEQ applies the NEQ predicate on the "plate_number" field.
+func PlateNumberNEQ(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldNEQ(FieldPlateNumber, v))
+}
+
+// PlateNumberIn applies the In predicate on the "plate_number" field.
+func PlateNumberIn(vs ...string) predicate.Bus {
+ return predicate.Bus(sql.FieldIn(FieldPlateNumber, vs...))
+}
+
+// PlateNumberNotIn applies the NotIn predicate on the "plate_number" field.
+func PlateNumberNotIn(vs ...string) predicate.Bus {
+ return predicate.Bus(sql.FieldNotIn(FieldPlateNumber, vs...))
+}
+
+// PlateNumberGT applies the GT predicate on the "plate_number" field.
+func PlateNumberGT(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldGT(FieldPlateNumber, v))
+}
+
+// PlateNumberGTE applies the GTE predicate on the "plate_number" field.
+func PlateNumberGTE(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldGTE(FieldPlateNumber, v))
+}
+
+// PlateNumberLT applies the LT predicate on the "plate_number" field.
+func PlateNumberLT(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldLT(FieldPlateNumber, v))
+}
+
+// PlateNumberLTE applies the LTE predicate on the "plate_number" field.
+func PlateNumberLTE(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldLTE(FieldPlateNumber, v))
+}
+
+// PlateNumberContains applies the Contains predicate on the "plate_number" field.
+func PlateNumberContains(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldContains(FieldPlateNumber, v))
+}
+
+// PlateNumberHasPrefix applies the HasPrefix predicate on the "plate_number" field.
+func PlateNumberHasPrefix(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldHasPrefix(FieldPlateNumber, v))
+}
+
+// PlateNumberHasSuffix applies the HasSuffix predicate on the "plate_number" field.
+func PlateNumberHasSuffix(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldHasSuffix(FieldPlateNumber, v))
+}
+
+// PlateNumberIsNil applies the IsNil predicate on the "plate_number" field.
+func PlateNumberIsNil() predicate.Bus {
+ return predicate.Bus(sql.FieldIsNull(FieldPlateNumber))
+}
+
+// PlateNumberNotNil applies the NotNil predicate on the "plate_number" field.
+func PlateNumberNotNil() predicate.Bus {
+ return predicate.Bus(sql.FieldNotNull(FieldPlateNumber))
+}
+
+// PlateNumberEqualFold applies the EqualFold predicate on the "plate_number" field.
+func PlateNumberEqualFold(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldEqualFold(FieldPlateNumber, v))
+}
+
+// PlateNumberContainsFold applies the ContainsFold predicate on the "plate_number" field.
+func PlateNumberContainsFold(v string) predicate.Bus {
+ return predicate.Bus(sql.FieldContainsFold(FieldPlateNumber, v))
+}
+
+// LatitudeEQ applies the EQ predicate on the "latitude" field.
+func LatitudeEQ(v float64) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldLatitude, v))
+}
+
+// LatitudeNEQ applies the NEQ predicate on the "latitude" field.
+func LatitudeNEQ(v float64) predicate.Bus {
+ return predicate.Bus(sql.FieldNEQ(FieldLatitude, v))
+}
+
+// LatitudeIn applies the In predicate on the "latitude" field.
+func LatitudeIn(vs ...float64) predicate.Bus {
+ return predicate.Bus(sql.FieldIn(FieldLatitude, vs...))
+}
+
+// LatitudeNotIn applies the NotIn predicate on the "latitude" field.
+func LatitudeNotIn(vs ...float64) predicate.Bus {
+ return predicate.Bus(sql.FieldNotIn(FieldLatitude, vs...))
+}
+
+// LatitudeGT applies the GT predicate on the "latitude" field.
+func LatitudeGT(v float64) predicate.Bus {
+ return predicate.Bus(sql.FieldGT(FieldLatitude, v))
+}
+
+// LatitudeGTE applies the GTE predicate on the "latitude" field.
+func LatitudeGTE(v float64) predicate.Bus {
+ return predicate.Bus(sql.FieldGTE(FieldLatitude, v))
+}
+
+// LatitudeLT applies the LT predicate on the "latitude" field.
+func LatitudeLT(v float64) predicate.Bus {
+ return predicate.Bus(sql.FieldLT(FieldLatitude, v))
+}
+
+// LatitudeLTE applies the LTE predicate on the "latitude" field.
+func LatitudeLTE(v float64) predicate.Bus {
+ return predicate.Bus(sql.FieldLTE(FieldLatitude, v))
+}
+
+// LatitudeIsNil applies the IsNil predicate on the "latitude" field.
+func LatitudeIsNil() predicate.Bus {
+ return predicate.Bus(sql.FieldIsNull(FieldLatitude))
+}
+
+// LatitudeNotNil applies the NotNil predicate on the "latitude" field.
+func LatitudeNotNil() predicate.Bus {
+ return predicate.Bus(sql.FieldNotNull(FieldLatitude))
+}
+
+// LongitudeEQ applies the EQ predicate on the "longitude" field.
+func LongitudeEQ(v float64) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldLongitude, v))
+}
+
+// LongitudeNEQ applies the NEQ predicate on the "longitude" field.
+func LongitudeNEQ(v float64) predicate.Bus {
+ return predicate.Bus(sql.FieldNEQ(FieldLongitude, v))
+}
+
+// LongitudeIn applies the In predicate on the "longitude" field.
+func LongitudeIn(vs ...float64) predicate.Bus {
+ return predicate.Bus(sql.FieldIn(FieldLongitude, vs...))
+}
+
+// LongitudeNotIn applies the NotIn predicate on the "longitude" field.
+func LongitudeNotIn(vs ...float64) predicate.Bus {
+ return predicate.Bus(sql.FieldNotIn(FieldLongitude, vs...))
+}
+
+// LongitudeGT applies the GT predicate on the "longitude" field.
+func LongitudeGT(v float64) predicate.Bus {
+ return predicate.Bus(sql.FieldGT(FieldLongitude, v))
+}
+
+// LongitudeGTE applies the GTE predicate on the "longitude" field.
+func LongitudeGTE(v float64) predicate.Bus {
+ return predicate.Bus(sql.FieldGTE(FieldLongitude, v))
+}
+
+// LongitudeLT applies the LT predicate on the "longitude" field.
+func LongitudeLT(v float64) predicate.Bus {
+ return predicate.Bus(sql.FieldLT(FieldLongitude, v))
+}
+
+// LongitudeLTE applies the LTE predicate on the "longitude" field.
+func LongitudeLTE(v float64) predicate.Bus {
+ return predicate.Bus(sql.FieldLTE(FieldLongitude, v))
+}
+
+// LongitudeIsNil applies the IsNil predicate on the "longitude" field.
+func LongitudeIsNil() predicate.Bus {
+ return predicate.Bus(sql.FieldIsNull(FieldLongitude))
+}
+
+// LongitudeNotNil applies the NotNil predicate on the "longitude" field.
+func LongitudeNotNil() predicate.Bus {
+ return predicate.Bus(sql.FieldNotNull(FieldLongitude))
+}
+
+// StatusEQ applies the EQ predicate on the "status" field.
+func StatusEQ(v Status) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldStatus, v))
+}
+
+// StatusNEQ applies the NEQ predicate on the "status" field.
+func StatusNEQ(v Status) predicate.Bus {
+ return predicate.Bus(sql.FieldNEQ(FieldStatus, v))
+}
+
+// StatusIn applies the In predicate on the "status" field.
+func StatusIn(vs ...Status) predicate.Bus {
+ return predicate.Bus(sql.FieldIn(FieldStatus, vs...))
+}
+
+// StatusNotIn applies the NotIn predicate on the "status" field.
+func StatusNotIn(vs ...Status) predicate.Bus {
+ return predicate.Bus(sql.FieldNotIn(FieldStatus, vs...))
+}
+
+// EnableFaceRecognitionEQ applies the EQ predicate on the "enable_face_recognition" field.
+func EnableFaceRecognitionEQ(v bool) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldEnableFaceRecognition, v))
+}
+
+// EnableFaceRecognitionNEQ applies the NEQ predicate on the "enable_face_recognition" field.
+func EnableFaceRecognitionNEQ(v bool) predicate.Bus {
+ return predicate.Bus(sql.FieldNEQ(FieldEnableFaceRecognition, v))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
+func UpdatedAtEQ(v time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
+func UpdatedAtNEQ(v time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldNEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtIn applies the In predicate on the "updated_at" field.
+func UpdatedAtIn(vs ...time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
+func UpdatedAtNotIn(vs ...time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldNotIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtGT applies the GT predicate on the "updated_at" field.
+func UpdatedAtGT(v time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldGT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
+func UpdatedAtGTE(v time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldGTE(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLT applies the LT predicate on the "updated_at" field.
+func UpdatedAtLT(v time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldLT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
+func UpdatedAtLTE(v time.Time) predicate.Bus {
+ return predicate.Bus(sql.FieldLTE(FieldUpdatedAt, v))
+}
+
+// HasNursery applies the HasEdge predicate on the "nursery" edge.
+func HasNursery() predicate.Bus {
+ return predicate.Bus(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, NurseryTable, NurseryColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasNurseryWith applies the HasEdge predicate on the "nursery" edge with a given conditions (other predicates).
+func HasNurseryWith(preds ...predicate.Nursery) predicate.Bus {
+ return predicate.Bus(func(s *sql.Selector) {
+ step := newNurseryStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasBoardingRecords applies the HasEdge predicate on the "boarding_records" edge.
+func HasBoardingRecords() predicate.Bus {
+ return predicate.Bus(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, BoardingRecordsTable, BoardingRecordsColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasBoardingRecordsWith applies the HasEdge predicate on the "boarding_records" edge with a given conditions (other predicates).
+func HasBoardingRecordsWith(preds ...predicate.BoardingRecord) predicate.Bus {
+ return predicate.Bus(func(s *sql.Selector) {
+ step := newBoardingRecordsStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasNextStation applies the HasEdge predicate on the "next_station" edge.
+func HasNextStation() predicate.Bus {
+ return predicate.Bus(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, NextStationTable, NextStationColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasNextStationWith applies the HasEdge predicate on the "next_station" edge with a given conditions (other predicates).
+func HasNextStationWith(preds ...predicate.Station) predicate.Bus {
+ return predicate.Bus(func(s *sql.Selector) {
+ step := newNextStationStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasBusRoute applies the HasEdge predicate on the "bus_route" edge.
+func HasBusRoute() predicate.Bus {
+ return predicate.Bus(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.M2M, true, BusRouteTable, BusRoutePrimaryKey...),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasBusRouteWith applies the HasEdge predicate on the "bus_route" edge with a given conditions (other predicates).
+func HasBusRouteWith(preds ...predicate.BusRoute) predicate.Bus {
+ return predicate.Bus(func(s *sql.Selector) {
+ step := newBusRouteStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasLatestMorningRoute applies the HasEdge predicate on the "latest_morning_route" edge.
+func HasLatestMorningRoute() predicate.Bus {
+ return predicate.Bus(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, LatestMorningRouteTable, LatestMorningRouteColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasLatestMorningRouteWith applies the HasEdge predicate on the "latest_morning_route" edge with a given conditions (other predicates).
+func HasLatestMorningRouteWith(preds ...predicate.BusRoute) predicate.Bus {
+ return predicate.Bus(func(s *sql.Selector) {
+ step := newLatestMorningRouteStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasLatestEveningRoute applies the HasEdge predicate on the "latest_evening_route" edge.
+func HasLatestEveningRoute() predicate.Bus {
+ return predicate.Bus(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, LatestEveningRouteTable, LatestEveningRouteColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasLatestEveningRouteWith applies the HasEdge predicate on the "latest_evening_route" edge with a given conditions (other predicates).
+func HasLatestEveningRouteWith(preds ...predicate.BusRoute) predicate.Bus {
+ return predicate.Bus(func(s *sql.Selector) {
+ step := newLatestEveningRouteStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.Bus) predicate.Bus {
+ return predicate.Bus(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.Bus) predicate.Bus {
+ return predicate.Bus(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.Bus) predicate.Bus {
+ return predicate.Bus(sql.NotPredicates(p))
+}
diff --git a/backend/domain/repository/ent/bus_create.go b/backend/domain/repository/ent/bus_create.go
new file mode 100644
index 00000000..8050f4cd
--- /dev/null
+++ b/backend/domain/repository/ent/bus_create.go
@@ -0,0 +1,583 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// BusCreate is the builder for creating a Bus entity.
+type BusCreate struct {
+ config
+ mutation *BusMutation
+ hooks []Hook
+}
+
+// SetName sets the "name" field.
+func (bc *BusCreate) SetName(s string) *BusCreate {
+ bc.mutation.SetName(s)
+ return bc
+}
+
+// SetPlateNumber sets the "plate_number" field.
+func (bc *BusCreate) SetPlateNumber(s string) *BusCreate {
+ bc.mutation.SetPlateNumber(s)
+ return bc
+}
+
+// SetNillablePlateNumber sets the "plate_number" field if the given value is not nil.
+func (bc *BusCreate) SetNillablePlateNumber(s *string) *BusCreate {
+ if s != nil {
+ bc.SetPlateNumber(*s)
+ }
+ return bc
+}
+
+// SetLatitude sets the "latitude" field.
+func (bc *BusCreate) SetLatitude(f float64) *BusCreate {
+ bc.mutation.SetLatitude(f)
+ return bc
+}
+
+// SetNillableLatitude sets the "latitude" field if the given value is not nil.
+func (bc *BusCreate) SetNillableLatitude(f *float64) *BusCreate {
+ if f != nil {
+ bc.SetLatitude(*f)
+ }
+ return bc
+}
+
+// SetLongitude sets the "longitude" field.
+func (bc *BusCreate) SetLongitude(f float64) *BusCreate {
+ bc.mutation.SetLongitude(f)
+ return bc
+}
+
+// SetNillableLongitude sets the "longitude" field if the given value is not nil.
+func (bc *BusCreate) SetNillableLongitude(f *float64) *BusCreate {
+ if f != nil {
+ bc.SetLongitude(*f)
+ }
+ return bc
+}
+
+// SetStatus sets the "status" field.
+func (bc *BusCreate) SetStatus(b bus.Status) *BusCreate {
+ bc.mutation.SetStatus(b)
+ return bc
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (bc *BusCreate) SetNillableStatus(b *bus.Status) *BusCreate {
+ if b != nil {
+ bc.SetStatus(*b)
+ }
+ return bc
+}
+
+// SetEnableFaceRecognition sets the "enable_face_recognition" field.
+func (bc *BusCreate) SetEnableFaceRecognition(b bool) *BusCreate {
+ bc.mutation.SetEnableFaceRecognition(b)
+ return bc
+}
+
+// SetNillableEnableFaceRecognition sets the "enable_face_recognition" field if the given value is not nil.
+func (bc *BusCreate) SetNillableEnableFaceRecognition(b *bool) *BusCreate {
+ if b != nil {
+ bc.SetEnableFaceRecognition(*b)
+ }
+ return bc
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (bc *BusCreate) SetCreatedAt(t time.Time) *BusCreate {
+ bc.mutation.SetCreatedAt(t)
+ return bc
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (bc *BusCreate) SetNillableCreatedAt(t *time.Time) *BusCreate {
+ if t != nil {
+ bc.SetCreatedAt(*t)
+ }
+ return bc
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (bc *BusCreate) SetUpdatedAt(t time.Time) *BusCreate {
+ bc.mutation.SetUpdatedAt(t)
+ return bc
+}
+
+// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
+func (bc *BusCreate) SetNillableUpdatedAt(t *time.Time) *BusCreate {
+ if t != nil {
+ bc.SetUpdatedAt(*t)
+ }
+ return bc
+}
+
+// SetID sets the "id" field.
+func (bc *BusCreate) SetID(u uuid.UUID) *BusCreate {
+ bc.mutation.SetID(u)
+ return bc
+}
+
+// SetNillableID sets the "id" field if the given value is not nil.
+func (bc *BusCreate) SetNillableID(u *uuid.UUID) *BusCreate {
+ if u != nil {
+ bc.SetID(*u)
+ }
+ return bc
+}
+
+// SetNurseryID sets the "nursery" edge to the Nursery entity by ID.
+func (bc *BusCreate) SetNurseryID(id uuid.UUID) *BusCreate {
+ bc.mutation.SetNurseryID(id)
+ return bc
+}
+
+// SetNillableNurseryID sets the "nursery" edge to the Nursery entity by ID if the given value is not nil.
+func (bc *BusCreate) SetNillableNurseryID(id *uuid.UUID) *BusCreate {
+ if id != nil {
+ bc = bc.SetNurseryID(*id)
+ }
+ return bc
+}
+
+// SetNursery sets the "nursery" edge to the Nursery entity.
+func (bc *BusCreate) SetNursery(n *Nursery) *BusCreate {
+ return bc.SetNurseryID(n.ID)
+}
+
+// AddBoardingRecordIDs adds the "boarding_records" edge to the BoardingRecord entity by IDs.
+func (bc *BusCreate) AddBoardingRecordIDs(ids ...uuid.UUID) *BusCreate {
+ bc.mutation.AddBoardingRecordIDs(ids...)
+ return bc
+}
+
+// AddBoardingRecords adds the "boarding_records" edges to the BoardingRecord entity.
+func (bc *BusCreate) AddBoardingRecords(b ...*BoardingRecord) *BusCreate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bc.AddBoardingRecordIDs(ids...)
+}
+
+// SetNextStationID sets the "next_station" edge to the Station entity by ID.
+func (bc *BusCreate) SetNextStationID(id uuid.UUID) *BusCreate {
+ bc.mutation.SetNextStationID(id)
+ return bc
+}
+
+// SetNillableNextStationID sets the "next_station" edge to the Station entity by ID if the given value is not nil.
+func (bc *BusCreate) SetNillableNextStationID(id *uuid.UUID) *BusCreate {
+ if id != nil {
+ bc = bc.SetNextStationID(*id)
+ }
+ return bc
+}
+
+// SetNextStation sets the "next_station" edge to the Station entity.
+func (bc *BusCreate) SetNextStation(s *Station) *BusCreate {
+ return bc.SetNextStationID(s.ID)
+}
+
+// AddBusRouteIDs adds the "bus_route" edge to the BusRoute entity by IDs.
+func (bc *BusCreate) AddBusRouteIDs(ids ...uuid.UUID) *BusCreate {
+ bc.mutation.AddBusRouteIDs(ids...)
+ return bc
+}
+
+// AddBusRoute adds the "bus_route" edges to the BusRoute entity.
+func (bc *BusCreate) AddBusRoute(b ...*BusRoute) *BusCreate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bc.AddBusRouteIDs(ids...)
+}
+
+// SetLatestMorningRouteID sets the "latest_morning_route" edge to the BusRoute entity by ID.
+func (bc *BusCreate) SetLatestMorningRouteID(id uuid.UUID) *BusCreate {
+ bc.mutation.SetLatestMorningRouteID(id)
+ return bc
+}
+
+// SetNillableLatestMorningRouteID sets the "latest_morning_route" edge to the BusRoute entity by ID if the given value is not nil.
+func (bc *BusCreate) SetNillableLatestMorningRouteID(id *uuid.UUID) *BusCreate {
+ if id != nil {
+ bc = bc.SetLatestMorningRouteID(*id)
+ }
+ return bc
+}
+
+// SetLatestMorningRoute sets the "latest_morning_route" edge to the BusRoute entity.
+func (bc *BusCreate) SetLatestMorningRoute(b *BusRoute) *BusCreate {
+ return bc.SetLatestMorningRouteID(b.ID)
+}
+
+// SetLatestEveningRouteID sets the "latest_evening_route" edge to the BusRoute entity by ID.
+func (bc *BusCreate) SetLatestEveningRouteID(id uuid.UUID) *BusCreate {
+ bc.mutation.SetLatestEveningRouteID(id)
+ return bc
+}
+
+// SetNillableLatestEveningRouteID sets the "latest_evening_route" edge to the BusRoute entity by ID if the given value is not nil.
+func (bc *BusCreate) SetNillableLatestEveningRouteID(id *uuid.UUID) *BusCreate {
+ if id != nil {
+ bc = bc.SetLatestEveningRouteID(*id)
+ }
+ return bc
+}
+
+// SetLatestEveningRoute sets the "latest_evening_route" edge to the BusRoute entity.
+func (bc *BusCreate) SetLatestEveningRoute(b *BusRoute) *BusCreate {
+ return bc.SetLatestEveningRouteID(b.ID)
+}
+
+// Mutation returns the BusMutation object of the builder.
+func (bc *BusCreate) Mutation() *BusMutation {
+ return bc.mutation
+}
+
+// Save creates the Bus in the database.
+func (bc *BusCreate) Save(ctx context.Context) (*Bus, error) {
+ bc.defaults()
+ return withHooks(ctx, bc.sqlSave, bc.mutation, bc.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (bc *BusCreate) SaveX(ctx context.Context) *Bus {
+ v, err := bc.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (bc *BusCreate) Exec(ctx context.Context) error {
+ _, err := bc.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (bc *BusCreate) ExecX(ctx context.Context) {
+ if err := bc.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (bc *BusCreate) defaults() {
+ if _, ok := bc.mutation.Status(); !ok {
+ v := bus.DefaultStatus
+ bc.mutation.SetStatus(v)
+ }
+ if _, ok := bc.mutation.EnableFaceRecognition(); !ok {
+ v := bus.DefaultEnableFaceRecognition
+ bc.mutation.SetEnableFaceRecognition(v)
+ }
+ if _, ok := bc.mutation.CreatedAt(); !ok {
+ v := bus.DefaultCreatedAt()
+ bc.mutation.SetCreatedAt(v)
+ }
+ if _, ok := bc.mutation.UpdatedAt(); !ok {
+ v := bus.DefaultUpdatedAt()
+ bc.mutation.SetUpdatedAt(v)
+ }
+ if _, ok := bc.mutation.ID(); !ok {
+ v := bus.DefaultID()
+ bc.mutation.SetID(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (bc *BusCreate) check() error {
+ if _, ok := bc.mutation.Name(); !ok {
+ return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Bus.name"`)}
+ }
+ if _, ok := bc.mutation.Status(); !ok {
+ return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "Bus.status"`)}
+ }
+ if v, ok := bc.mutation.Status(); ok {
+ if err := bus.StatusValidator(v); err != nil {
+ return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Bus.status": %w`, err)}
+ }
+ }
+ if _, ok := bc.mutation.EnableFaceRecognition(); !ok {
+ return &ValidationError{Name: "enable_face_recognition", err: errors.New(`ent: missing required field "Bus.enable_face_recognition"`)}
+ }
+ if _, ok := bc.mutation.CreatedAt(); !ok {
+ return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Bus.created_at"`)}
+ }
+ if _, ok := bc.mutation.UpdatedAt(); !ok {
+ return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Bus.updated_at"`)}
+ }
+ return nil
+}
+
+func (bc *BusCreate) sqlSave(ctx context.Context) (*Bus, error) {
+ if err := bc.check(); err != nil {
+ return nil, err
+ }
+ _node, _spec := bc.createSpec()
+ if err := sqlgraph.CreateNode(ctx, bc.driver, _spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ if _spec.ID.Value != nil {
+ if id, ok := _spec.ID.Value.(*uuid.UUID); ok {
+ _node.ID = *id
+ } else if err := _node.ID.Scan(_spec.ID.Value); err != nil {
+ return nil, err
+ }
+ }
+ bc.mutation.id = &_node.ID
+ bc.mutation.done = true
+ return _node, nil
+}
+
+func (bc *BusCreate) createSpec() (*Bus, *sqlgraph.CreateSpec) {
+ var (
+ _node = &Bus{config: bc.config}
+ _spec = sqlgraph.NewCreateSpec(bus.Table, sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID))
+ )
+ if id, ok := bc.mutation.ID(); ok {
+ _node.ID = id
+ _spec.ID.Value = &id
+ }
+ if value, ok := bc.mutation.Name(); ok {
+ _spec.SetField(bus.FieldName, field.TypeString, value)
+ _node.Name = value
+ }
+ if value, ok := bc.mutation.PlateNumber(); ok {
+ _spec.SetField(bus.FieldPlateNumber, field.TypeString, value)
+ _node.PlateNumber = value
+ }
+ if value, ok := bc.mutation.Latitude(); ok {
+ _spec.SetField(bus.FieldLatitude, field.TypeFloat64, value)
+ _node.Latitude = value
+ }
+ if value, ok := bc.mutation.Longitude(); ok {
+ _spec.SetField(bus.FieldLongitude, field.TypeFloat64, value)
+ _node.Longitude = value
+ }
+ if value, ok := bc.mutation.Status(); ok {
+ _spec.SetField(bus.FieldStatus, field.TypeEnum, value)
+ _node.Status = value
+ }
+ if value, ok := bc.mutation.EnableFaceRecognition(); ok {
+ _spec.SetField(bus.FieldEnableFaceRecognition, field.TypeBool, value)
+ _node.EnableFaceRecognition = value
+ }
+ if value, ok := bc.mutation.CreatedAt(); ok {
+ _spec.SetField(bus.FieldCreatedAt, field.TypeTime, value)
+ _node.CreatedAt = value
+ }
+ if value, ok := bc.mutation.UpdatedAt(); ok {
+ _spec.SetField(bus.FieldUpdatedAt, field.TypeTime, value)
+ _node.UpdatedAt = value
+ }
+ if nodes := bc.mutation.NurseryIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.NurseryTable,
+ Columns: []string{bus.NurseryColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(nursery.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _node.bus_nursery = &nodes[0]
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := bc.mutation.BoardingRecordsIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: bus.BoardingRecordsTable,
+ Columns: []string{bus.BoardingRecordsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := bc.mutation.NextStationIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.NextStationTable,
+ Columns: []string{bus.NextStationColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _node.bus_next_station = &nodes[0]
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := bc.mutation.BusRouteIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2M,
+ Inverse: true,
+ Table: bus.BusRouteTable,
+ Columns: bus.BusRoutePrimaryKey,
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := bc.mutation.LatestMorningRouteIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.LatestMorningRouteTable,
+ Columns: []string{bus.LatestMorningRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _node.bus_latest_morning_route = &nodes[0]
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := bc.mutation.LatestEveningRouteIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.LatestEveningRouteTable,
+ Columns: []string{bus.LatestEveningRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _node.bus_latest_evening_route = &nodes[0]
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ return _node, _spec
+}
+
+// BusCreateBulk is the builder for creating many Bus entities in bulk.
+type BusCreateBulk struct {
+ config
+ err error
+ builders []*BusCreate
+}
+
+// Save creates the Bus entities in the database.
+func (bcb *BusCreateBulk) Save(ctx context.Context) ([]*Bus, error) {
+ if bcb.err != nil {
+ return nil, bcb.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(bcb.builders))
+ nodes := make([]*Bus, len(bcb.builders))
+ mutators := make([]Mutator, len(bcb.builders))
+ for i := range bcb.builders {
+ func(i int, root context.Context) {
+ builder := bcb.builders[i]
+ builder.defaults()
+ var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+ mutation, ok := m.(*BusMutation)
+ if !ok {
+ return nil, fmt.Errorf("unexpected mutation type %T", m)
+ }
+ if err := builder.check(); err != nil {
+ return nil, err
+ }
+ builder.mutation = mutation
+ var err error
+ nodes[i], specs[i] = builder.createSpec()
+ if i < len(mutators)-1 {
+ _, err = mutators[i+1].Mutate(root, bcb.builders[i+1].mutation)
+ } else {
+ spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+ // Invoke the actual operation on the latest mutation in the chain.
+ if err = sqlgraph.BatchCreate(ctx, bcb.driver, spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ }
+ }
+ if err != nil {
+ return nil, err
+ }
+ mutation.id = &nodes[i].ID
+ mutation.done = true
+ return nodes[i], nil
+ })
+ for i := len(builder.hooks) - 1; i >= 0; i-- {
+ mut = builder.hooks[i](mut)
+ }
+ mutators[i] = mut
+ }(i, ctx)
+ }
+ if len(mutators) > 0 {
+ if _, err := mutators[0].Mutate(ctx, bcb.builders[0].mutation); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (bcb *BusCreateBulk) SaveX(ctx context.Context) []*Bus {
+ v, err := bcb.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (bcb *BusCreateBulk) Exec(ctx context.Context) error {
+ _, err := bcb.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (bcb *BusCreateBulk) ExecX(ctx context.Context) {
+ if err := bcb.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/bus_delete.go b/backend/domain/repository/ent/bus_delete.go
new file mode 100644
index 00000000..08a5162c
--- /dev/null
+++ b/backend/domain/repository/ent/bus_delete.go
@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+)
+
+// BusDelete is the builder for deleting a Bus entity.
+type BusDelete struct {
+ config
+ hooks []Hook
+ mutation *BusMutation
+}
+
+// Where appends a list predicates to the BusDelete builder.
+func (bd *BusDelete) Where(ps ...predicate.Bus) *BusDelete {
+ bd.mutation.Where(ps...)
+ return bd
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (bd *BusDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, bd.sqlExec, bd.mutation, bd.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (bd *BusDelete) ExecX(ctx context.Context) int {
+ n, err := bd.Exec(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return n
+}
+
+func (bd *BusDelete) sqlExec(ctx context.Context) (int, error) {
+ _spec := sqlgraph.NewDeleteSpec(bus.Table, sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID))
+ if ps := bd.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ affected, err := sqlgraph.DeleteNodes(ctx, bd.driver, _spec)
+ if err != nil && sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ bd.mutation.done = true
+ return affected, err
+}
+
+// BusDeleteOne is the builder for deleting a single Bus entity.
+type BusDeleteOne struct {
+ bd *BusDelete
+}
+
+// Where appends a list predicates to the BusDelete builder.
+func (bdo *BusDeleteOne) Where(ps ...predicate.Bus) *BusDeleteOne {
+ bdo.bd.mutation.Where(ps...)
+ return bdo
+}
+
+// Exec executes the deletion query.
+func (bdo *BusDeleteOne) Exec(ctx context.Context) error {
+ n, err := bdo.bd.Exec(ctx)
+ switch {
+ case err != nil:
+ return err
+ case n == 0:
+ return &NotFoundError{bus.Label}
+ default:
+ return nil
+ }
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (bdo *BusDeleteOne) ExecX(ctx context.Context) {
+ if err := bdo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/bus_query.go b/backend/domain/repository/ent/bus_query.go
new file mode 100644
index 00000000..4748fe77
--- /dev/null
+++ b/backend/domain/repository/ent/bus_query.go
@@ -0,0 +1,1018 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "database/sql/driver"
+ "fmt"
+ "math"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// BusQuery is the builder for querying Bus entities.
+type BusQuery struct {
+ config
+ ctx *QueryContext
+ order []bus.OrderOption
+ inters []Interceptor
+ predicates []predicate.Bus
+ withNursery *NurseryQuery
+ withBoardingRecords *BoardingRecordQuery
+ withNextStation *StationQuery
+ withBusRoute *BusRouteQuery
+ withLatestMorningRoute *BusRouteQuery
+ withLatestEveningRoute *BusRouteQuery
+ withFKs bool
+ // intermediate query (i.e. traversal path).
+ sql *sql.Selector
+ path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the BusQuery builder.
+func (bq *BusQuery) Where(ps ...predicate.Bus) *BusQuery {
+ bq.predicates = append(bq.predicates, ps...)
+ return bq
+}
+
+// Limit the number of records to be returned by this query.
+func (bq *BusQuery) Limit(limit int) *BusQuery {
+ bq.ctx.Limit = &limit
+ return bq
+}
+
+// Offset to start from.
+func (bq *BusQuery) Offset(offset int) *BusQuery {
+ bq.ctx.Offset = &offset
+ return bq
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (bq *BusQuery) Unique(unique bool) *BusQuery {
+ bq.ctx.Unique = &unique
+ return bq
+}
+
+// Order specifies how the records should be ordered.
+func (bq *BusQuery) Order(o ...bus.OrderOption) *BusQuery {
+ bq.order = append(bq.order, o...)
+ return bq
+}
+
+// QueryNursery chains the current query on the "nursery" edge.
+func (bq *BusQuery) QueryNursery() *NurseryQuery {
+ query := (&NurseryClient{config: bq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := bq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := bq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(bus.Table, bus.FieldID, selector),
+ sqlgraph.To(nursery.Table, nursery.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, bus.NurseryTable, bus.NurseryColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(bq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryBoardingRecords chains the current query on the "boarding_records" edge.
+func (bq *BusQuery) QueryBoardingRecords() *BoardingRecordQuery {
+ query := (&BoardingRecordClient{config: bq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := bq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := bq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(bus.Table, bus.FieldID, selector),
+ sqlgraph.To(boardingrecord.Table, boardingrecord.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, bus.BoardingRecordsTable, bus.BoardingRecordsColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(bq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryNextStation chains the current query on the "next_station" edge.
+func (bq *BusQuery) QueryNextStation() *StationQuery {
+ query := (&StationClient{config: bq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := bq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := bq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(bus.Table, bus.FieldID, selector),
+ sqlgraph.To(station.Table, station.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, bus.NextStationTable, bus.NextStationColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(bq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryBusRoute chains the current query on the "bus_route" edge.
+func (bq *BusQuery) QueryBusRoute() *BusRouteQuery {
+ query := (&BusRouteClient{config: bq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := bq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := bq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(bus.Table, bus.FieldID, selector),
+ sqlgraph.To(busroute.Table, busroute.FieldID),
+ sqlgraph.Edge(sqlgraph.M2M, true, bus.BusRouteTable, bus.BusRoutePrimaryKey...),
+ )
+ fromU = sqlgraph.SetNeighbors(bq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryLatestMorningRoute chains the current query on the "latest_morning_route" edge.
+func (bq *BusQuery) QueryLatestMorningRoute() *BusRouteQuery {
+ query := (&BusRouteClient{config: bq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := bq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := bq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(bus.Table, bus.FieldID, selector),
+ sqlgraph.To(busroute.Table, busroute.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, bus.LatestMorningRouteTable, bus.LatestMorningRouteColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(bq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryLatestEveningRoute chains the current query on the "latest_evening_route" edge.
+func (bq *BusQuery) QueryLatestEveningRoute() *BusRouteQuery {
+ query := (&BusRouteClient{config: bq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := bq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := bq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(bus.Table, bus.FieldID, selector),
+ sqlgraph.To(busroute.Table, busroute.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, bus.LatestEveningRouteTable, bus.LatestEveningRouteColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(bq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// First returns the first Bus entity from the query.
+// Returns a *NotFoundError when no Bus was found.
+func (bq *BusQuery) First(ctx context.Context) (*Bus, error) {
+ nodes, err := bq.Limit(1).All(setContextOp(ctx, bq.ctx, "First"))
+ if err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nil, &NotFoundError{bus.Label}
+ }
+ return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (bq *BusQuery) FirstX(ctx context.Context) *Bus {
+ node, err := bq.First(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return node
+}
+
+// FirstID returns the first Bus ID from the query.
+// Returns a *NotFoundError when no Bus ID was found.
+func (bq *BusQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+ var ids []uuid.UUID
+ if ids, err = bq.Limit(1).IDs(setContextOp(ctx, bq.ctx, "FirstID")); err != nil {
+ return
+ }
+ if len(ids) == 0 {
+ err = &NotFoundError{bus.Label}
+ return
+ }
+ return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (bq *BusQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := bq.FirstID(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return id
+}
+
+// Only returns a single Bus entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one Bus entity is found.
+// Returns a *NotFoundError when no Bus entities are found.
+func (bq *BusQuery) Only(ctx context.Context) (*Bus, error) {
+ nodes, err := bq.Limit(2).All(setContextOp(ctx, bq.ctx, "Only"))
+ if err != nil {
+ return nil, err
+ }
+ switch len(nodes) {
+ case 1:
+ return nodes[0], nil
+ case 0:
+ return nil, &NotFoundError{bus.Label}
+ default:
+ return nil, &NotSingularError{bus.Label}
+ }
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (bq *BusQuery) OnlyX(ctx context.Context) *Bus {
+ node, err := bq.Only(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// OnlyID is like Only, but returns the only Bus ID in the query.
+// Returns a *NotSingularError when more than one Bus ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (bq *BusQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+ var ids []uuid.UUID
+ if ids, err = bq.Limit(2).IDs(setContextOp(ctx, bq.ctx, "OnlyID")); err != nil {
+ return
+ }
+ switch len(ids) {
+ case 1:
+ id = ids[0]
+ case 0:
+ err = &NotFoundError{bus.Label}
+ default:
+ err = &NotSingularError{bus.Label}
+ }
+ return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (bq *BusQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := bq.OnlyID(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// All executes the query and returns a list of BusSlice.
+func (bq *BusQuery) All(ctx context.Context) ([]*Bus, error) {
+ ctx = setContextOp(ctx, bq.ctx, "All")
+ if err := bq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ qr := querierAll[[]*Bus, *BusQuery]()
+ return withInterceptors[[]*Bus](ctx, bq, qr, bq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (bq *BusQuery) AllX(ctx context.Context) []*Bus {
+ nodes, err := bq.All(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return nodes
+}
+
+// IDs executes the query and returns a list of Bus IDs.
+func (bq *BusQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if bq.ctx.Unique == nil && bq.path != nil {
+ bq.Unique(true)
+ }
+ ctx = setContextOp(ctx, bq.ctx, "IDs")
+ if err = bq.Select(bus.FieldID).Scan(ctx, &ids); err != nil {
+ return nil, err
+ }
+ return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (bq *BusQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := bq.IDs(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return ids
+}
+
+// Count returns the count of the given query.
+func (bq *BusQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, bq.ctx, "Count")
+ if err := bq.prepareQuery(ctx); err != nil {
+ return 0, err
+ }
+ return withInterceptors[int](ctx, bq, querierCount[*BusQuery](), bq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (bq *BusQuery) CountX(ctx context.Context) int {
+ count, err := bq.Count(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (bq *BusQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, bq.ctx, "Exist")
+ switch _, err := bq.FirstID(ctx); {
+ case IsNotFound(err):
+ return false, nil
+ case err != nil:
+ return false, fmt.Errorf("ent: check existence: %w", err)
+ default:
+ return true, nil
+ }
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (bq *BusQuery) ExistX(ctx context.Context) bool {
+ exist, err := bq.Exist(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return exist
+}
+
+// Clone returns a duplicate of the BusQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (bq *BusQuery) Clone() *BusQuery {
+ if bq == nil {
+ return nil
+ }
+ return &BusQuery{
+ config: bq.config,
+ ctx: bq.ctx.Clone(),
+ order: append([]bus.OrderOption{}, bq.order...),
+ inters: append([]Interceptor{}, bq.inters...),
+ predicates: append([]predicate.Bus{}, bq.predicates...),
+ withNursery: bq.withNursery.Clone(),
+ withBoardingRecords: bq.withBoardingRecords.Clone(),
+ withNextStation: bq.withNextStation.Clone(),
+ withBusRoute: bq.withBusRoute.Clone(),
+ withLatestMorningRoute: bq.withLatestMorningRoute.Clone(),
+ withLatestEveningRoute: bq.withLatestEveningRoute.Clone(),
+ // clone intermediate query.
+ sql: bq.sql.Clone(),
+ path: bq.path,
+ }
+}
+
+// WithNursery tells the query-builder to eager-load the nodes that are connected to
+// the "nursery" edge. The optional arguments are used to configure the query builder of the edge.
+func (bq *BusQuery) WithNursery(opts ...func(*NurseryQuery)) *BusQuery {
+ query := (&NurseryClient{config: bq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ bq.withNursery = query
+ return bq
+}
+
+// WithBoardingRecords tells the query-builder to eager-load the nodes that are connected to
+// the "boarding_records" edge. The optional arguments are used to configure the query builder of the edge.
+func (bq *BusQuery) WithBoardingRecords(opts ...func(*BoardingRecordQuery)) *BusQuery {
+ query := (&BoardingRecordClient{config: bq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ bq.withBoardingRecords = query
+ return bq
+}
+
+// WithNextStation tells the query-builder to eager-load the nodes that are connected to
+// the "next_station" edge. The optional arguments are used to configure the query builder of the edge.
+func (bq *BusQuery) WithNextStation(opts ...func(*StationQuery)) *BusQuery {
+ query := (&StationClient{config: bq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ bq.withNextStation = query
+ return bq
+}
+
+// WithBusRoute tells the query-builder to eager-load the nodes that are connected to
+// the "bus_route" edge. The optional arguments are used to configure the query builder of the edge.
+func (bq *BusQuery) WithBusRoute(opts ...func(*BusRouteQuery)) *BusQuery {
+ query := (&BusRouteClient{config: bq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ bq.withBusRoute = query
+ return bq
+}
+
+// WithLatestMorningRoute tells the query-builder to eager-load the nodes that are connected to
+// the "latest_morning_route" edge. The optional arguments are used to configure the query builder of the edge.
+func (bq *BusQuery) WithLatestMorningRoute(opts ...func(*BusRouteQuery)) *BusQuery {
+ query := (&BusRouteClient{config: bq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ bq.withLatestMorningRoute = query
+ return bq
+}
+
+// WithLatestEveningRoute tells the query-builder to eager-load the nodes that are connected to
+// the "latest_evening_route" edge. The optional arguments are used to configure the query builder of the edge.
+func (bq *BusQuery) WithLatestEveningRoute(opts ...func(*BusRouteQuery)) *BusQuery {
+ query := (&BusRouteClient{config: bq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ bq.withLatestEveningRoute = query
+ return bq
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+// var v []struct {
+// Name string `json:"name,omitempty"`
+// Count int `json:"count,omitempty"`
+// }
+//
+// client.Bus.Query().
+// GroupBy(bus.FieldName).
+// Aggregate(ent.Count()).
+// Scan(ctx, &v)
+func (bq *BusQuery) GroupBy(field string, fields ...string) *BusGroupBy {
+ bq.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &BusGroupBy{build: bq}
+ grbuild.flds = &bq.ctx.Fields
+ grbuild.label = bus.Label
+ grbuild.scan = grbuild.Scan
+ return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+// var v []struct {
+// Name string `json:"name,omitempty"`
+// }
+//
+// client.Bus.Query().
+// Select(bus.FieldName).
+// Scan(ctx, &v)
+func (bq *BusQuery) Select(fields ...string) *BusSelect {
+ bq.ctx.Fields = append(bq.ctx.Fields, fields...)
+ sbuild := &BusSelect{BusQuery: bq}
+ sbuild.label = bus.Label
+ sbuild.flds, sbuild.scan = &bq.ctx.Fields, sbuild.Scan
+ return sbuild
+}
+
+// Aggregate returns a BusSelect configured with the given aggregations.
+func (bq *BusQuery) Aggregate(fns ...AggregateFunc) *BusSelect {
+ return bq.Select().Aggregate(fns...)
+}
+
+func (bq *BusQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range bq.inters {
+ if inter == nil {
+ return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+ }
+ if trv, ok := inter.(Traverser); ok {
+ if err := trv.Traverse(ctx, bq); err != nil {
+ return err
+ }
+ }
+ }
+ for _, f := range bq.ctx.Fields {
+ if !bus.ValidColumn(f) {
+ return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ }
+ if bq.path != nil {
+ prev, err := bq.path(ctx)
+ if err != nil {
+ return err
+ }
+ bq.sql = prev
+ }
+ return nil
+}
+
+func (bq *BusQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Bus, error) {
+ var (
+ nodes = []*Bus{}
+ withFKs = bq.withFKs
+ _spec = bq.querySpec()
+ loadedTypes = [6]bool{
+ bq.withNursery != nil,
+ bq.withBoardingRecords != nil,
+ bq.withNextStation != nil,
+ bq.withBusRoute != nil,
+ bq.withLatestMorningRoute != nil,
+ bq.withLatestEveningRoute != nil,
+ }
+ )
+ if bq.withNursery != nil || bq.withNextStation != nil || bq.withLatestMorningRoute != nil || bq.withLatestEveningRoute != nil {
+ withFKs = true
+ }
+ if withFKs {
+ _spec.Node.Columns = append(_spec.Node.Columns, bus.ForeignKeys...)
+ }
+ _spec.ScanValues = func(columns []string) ([]any, error) {
+ return (*Bus).scanValues(nil, columns)
+ }
+ _spec.Assign = func(columns []string, values []any) error {
+ node := &Bus{config: bq.config}
+ nodes = append(nodes, node)
+ node.Edges.loadedTypes = loadedTypes
+ return node.assignValues(columns, values)
+ }
+ for i := range hooks {
+ hooks[i](ctx, _spec)
+ }
+ if err := sqlgraph.QueryNodes(ctx, bq.driver, _spec); err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nodes, nil
+ }
+ if query := bq.withNursery; query != nil {
+ if err := bq.loadNursery(ctx, query, nodes, nil,
+ func(n *Bus, e *Nursery) { n.Edges.Nursery = e }); err != nil {
+ return nil, err
+ }
+ }
+ if query := bq.withBoardingRecords; query != nil {
+ if err := bq.loadBoardingRecords(ctx, query, nodes,
+ func(n *Bus) { n.Edges.BoardingRecords = []*BoardingRecord{} },
+ func(n *Bus, e *BoardingRecord) { n.Edges.BoardingRecords = append(n.Edges.BoardingRecords, e) }); err != nil {
+ return nil, err
+ }
+ }
+ if query := bq.withNextStation; query != nil {
+ if err := bq.loadNextStation(ctx, query, nodes, nil,
+ func(n *Bus, e *Station) { n.Edges.NextStation = e }); err != nil {
+ return nil, err
+ }
+ }
+ if query := bq.withBusRoute; query != nil {
+ if err := bq.loadBusRoute(ctx, query, nodes,
+ func(n *Bus) { n.Edges.BusRoute = []*BusRoute{} },
+ func(n *Bus, e *BusRoute) { n.Edges.BusRoute = append(n.Edges.BusRoute, e) }); err != nil {
+ return nil, err
+ }
+ }
+ if query := bq.withLatestMorningRoute; query != nil {
+ if err := bq.loadLatestMorningRoute(ctx, query, nodes, nil,
+ func(n *Bus, e *BusRoute) { n.Edges.LatestMorningRoute = e }); err != nil {
+ return nil, err
+ }
+ }
+ if query := bq.withLatestEveningRoute; query != nil {
+ if err := bq.loadLatestEveningRoute(ctx, query, nodes, nil,
+ func(n *Bus, e *BusRoute) { n.Edges.LatestEveningRoute = e }); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+func (bq *BusQuery) loadNursery(ctx context.Context, query *NurseryQuery, nodes []*Bus, init func(*Bus), assign func(*Bus, *Nursery)) error {
+ ids := make([]uuid.UUID, 0, len(nodes))
+ nodeids := make(map[uuid.UUID][]*Bus)
+ for i := range nodes {
+ if nodes[i].bus_nursery == nil {
+ continue
+ }
+ fk := *nodes[i].bus_nursery
+ if _, ok := nodeids[fk]; !ok {
+ ids = append(ids, fk)
+ }
+ nodeids[fk] = append(nodeids[fk], nodes[i])
+ }
+ if len(ids) == 0 {
+ return nil
+ }
+ query.Where(nursery.IDIn(ids...))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ nodes, ok := nodeids[n.ID]
+ if !ok {
+ return fmt.Errorf(`unexpected foreign-key "bus_nursery" returned %v`, n.ID)
+ }
+ for i := range nodes {
+ assign(nodes[i], n)
+ }
+ }
+ return nil
+}
+func (bq *BusQuery) loadBoardingRecords(ctx context.Context, query *BoardingRecordQuery, nodes []*Bus, init func(*Bus), assign func(*Bus, *BoardingRecord)) error {
+ fks := make([]driver.Value, 0, len(nodes))
+ nodeids := make(map[uuid.UUID]*Bus)
+ for i := range nodes {
+ fks = append(fks, nodes[i].ID)
+ nodeids[nodes[i].ID] = nodes[i]
+ if init != nil {
+ init(nodes[i])
+ }
+ }
+ query.withFKs = true
+ query.Where(predicate.BoardingRecord(func(s *sql.Selector) {
+ s.Where(sql.InValues(s.C(bus.BoardingRecordsColumn), fks...))
+ }))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ fk := n.bus_boarding_records
+ if fk == nil {
+ return fmt.Errorf(`foreign-key "bus_boarding_records" is nil for node %v`, n.ID)
+ }
+ node, ok := nodeids[*fk]
+ if !ok {
+ return fmt.Errorf(`unexpected referenced foreign-key "bus_boarding_records" returned %v for node %v`, *fk, n.ID)
+ }
+ assign(node, n)
+ }
+ return nil
+}
+func (bq *BusQuery) loadNextStation(ctx context.Context, query *StationQuery, nodes []*Bus, init func(*Bus), assign func(*Bus, *Station)) error {
+ ids := make([]uuid.UUID, 0, len(nodes))
+ nodeids := make(map[uuid.UUID][]*Bus)
+ for i := range nodes {
+ if nodes[i].bus_next_station == nil {
+ continue
+ }
+ fk := *nodes[i].bus_next_station
+ if _, ok := nodeids[fk]; !ok {
+ ids = append(ids, fk)
+ }
+ nodeids[fk] = append(nodeids[fk], nodes[i])
+ }
+ if len(ids) == 0 {
+ return nil
+ }
+ query.Where(station.IDIn(ids...))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ nodes, ok := nodeids[n.ID]
+ if !ok {
+ return fmt.Errorf(`unexpected foreign-key "bus_next_station" returned %v`, n.ID)
+ }
+ for i := range nodes {
+ assign(nodes[i], n)
+ }
+ }
+ return nil
+}
+func (bq *BusQuery) loadBusRoute(ctx context.Context, query *BusRouteQuery, nodes []*Bus, init func(*Bus), assign func(*Bus, *BusRoute)) error {
+ edgeIDs := make([]driver.Value, len(nodes))
+ byID := make(map[uuid.UUID]*Bus)
+ nids := make(map[uuid.UUID]map[*Bus]struct{})
+ for i, node := range nodes {
+ edgeIDs[i] = node.ID
+ byID[node.ID] = node
+ if init != nil {
+ init(node)
+ }
+ }
+ query.Where(func(s *sql.Selector) {
+ joinT := sql.Table(bus.BusRouteTable)
+ s.Join(joinT).On(s.C(busroute.FieldID), joinT.C(bus.BusRoutePrimaryKey[0]))
+ s.Where(sql.InValues(joinT.C(bus.BusRoutePrimaryKey[1]), edgeIDs...))
+ columns := s.SelectedColumns()
+ s.Select(joinT.C(bus.BusRoutePrimaryKey[1]))
+ s.AppendSelect(columns...)
+ s.SetDistinct(false)
+ })
+ if err := query.prepareQuery(ctx); err != nil {
+ return err
+ }
+ qr := QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
+ return query.sqlAll(ctx, func(_ context.Context, spec *sqlgraph.QuerySpec) {
+ assign := spec.Assign
+ values := spec.ScanValues
+ spec.ScanValues = func(columns []string) ([]any, error) {
+ values, err := values(columns[1:])
+ if err != nil {
+ return nil, err
+ }
+ return append([]any{new(uuid.UUID)}, values...), nil
+ }
+ spec.Assign = func(columns []string, values []any) error {
+ outValue := *values[0].(*uuid.UUID)
+ inValue := *values[1].(*uuid.UUID)
+ if nids[inValue] == nil {
+ nids[inValue] = map[*Bus]struct{}{byID[outValue]: {}}
+ return assign(columns[1:], values[1:])
+ }
+ nids[inValue][byID[outValue]] = struct{}{}
+ return nil
+ }
+ })
+ })
+ neighbors, err := withInterceptors[[]*BusRoute](ctx, query, qr, query.inters)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ nodes, ok := nids[n.ID]
+ if !ok {
+ return fmt.Errorf(`unexpected "bus_route" node returned %v`, n.ID)
+ }
+ for kn := range nodes {
+ assign(kn, n)
+ }
+ }
+ return nil
+}
+func (bq *BusQuery) loadLatestMorningRoute(ctx context.Context, query *BusRouteQuery, nodes []*Bus, init func(*Bus), assign func(*Bus, *BusRoute)) error {
+ ids := make([]uuid.UUID, 0, len(nodes))
+ nodeids := make(map[uuid.UUID][]*Bus)
+ for i := range nodes {
+ if nodes[i].bus_latest_morning_route == nil {
+ continue
+ }
+ fk := *nodes[i].bus_latest_morning_route
+ if _, ok := nodeids[fk]; !ok {
+ ids = append(ids, fk)
+ }
+ nodeids[fk] = append(nodeids[fk], nodes[i])
+ }
+ if len(ids) == 0 {
+ return nil
+ }
+ query.Where(busroute.IDIn(ids...))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ nodes, ok := nodeids[n.ID]
+ if !ok {
+ return fmt.Errorf(`unexpected foreign-key "bus_latest_morning_route" returned %v`, n.ID)
+ }
+ for i := range nodes {
+ assign(nodes[i], n)
+ }
+ }
+ return nil
+}
+func (bq *BusQuery) loadLatestEveningRoute(ctx context.Context, query *BusRouteQuery, nodes []*Bus, init func(*Bus), assign func(*Bus, *BusRoute)) error {
+ ids := make([]uuid.UUID, 0, len(nodes))
+ nodeids := make(map[uuid.UUID][]*Bus)
+ for i := range nodes {
+ if nodes[i].bus_latest_evening_route == nil {
+ continue
+ }
+ fk := *nodes[i].bus_latest_evening_route
+ if _, ok := nodeids[fk]; !ok {
+ ids = append(ids, fk)
+ }
+ nodeids[fk] = append(nodeids[fk], nodes[i])
+ }
+ if len(ids) == 0 {
+ return nil
+ }
+ query.Where(busroute.IDIn(ids...))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ nodes, ok := nodeids[n.ID]
+ if !ok {
+ return fmt.Errorf(`unexpected foreign-key "bus_latest_evening_route" returned %v`, n.ID)
+ }
+ for i := range nodes {
+ assign(nodes[i], n)
+ }
+ }
+ return nil
+}
+
+func (bq *BusQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := bq.querySpec()
+ _spec.Node.Columns = bq.ctx.Fields
+ if len(bq.ctx.Fields) > 0 {
+ _spec.Unique = bq.ctx.Unique != nil && *bq.ctx.Unique
+ }
+ return sqlgraph.CountNodes(ctx, bq.driver, _spec)
+}
+
+func (bq *BusQuery) querySpec() *sqlgraph.QuerySpec {
+ _spec := sqlgraph.NewQuerySpec(bus.Table, bus.Columns, sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID))
+ _spec.From = bq.sql
+ if unique := bq.ctx.Unique; unique != nil {
+ _spec.Unique = *unique
+ } else if bq.path != nil {
+ _spec.Unique = true
+ }
+ if fields := bq.ctx.Fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, bus.FieldID)
+ for i := range fields {
+ if fields[i] != bus.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+ }
+ }
+ }
+ if ps := bq.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if limit := bq.ctx.Limit; limit != nil {
+ _spec.Limit = *limit
+ }
+ if offset := bq.ctx.Offset; offset != nil {
+ _spec.Offset = *offset
+ }
+ if ps := bq.order; len(ps) > 0 {
+ _spec.Order = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ return _spec
+}
+
+func (bq *BusQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(bq.driver.Dialect())
+ t1 := builder.Table(bus.Table)
+ columns := bq.ctx.Fields
+ if len(columns) == 0 {
+ columns = bus.Columns
+ }
+ selector := builder.Select(t1.Columns(columns...)...).From(t1)
+ if bq.sql != nil {
+ selector = bq.sql
+ selector.Select(selector.Columns(columns...)...)
+ }
+ if bq.ctx.Unique != nil && *bq.ctx.Unique {
+ selector.Distinct()
+ }
+ for _, p := range bq.predicates {
+ p(selector)
+ }
+ for _, p := range bq.order {
+ p(selector)
+ }
+ if offset := bq.ctx.Offset; offset != nil {
+ // limit is mandatory for offset clause. We start
+ // with default value, and override it below if needed.
+ selector.Offset(*offset).Limit(math.MaxInt32)
+ }
+ if limit := bq.ctx.Limit; limit != nil {
+ selector.Limit(*limit)
+ }
+ return selector
+}
+
+// BusGroupBy is the group-by builder for Bus entities.
+type BusGroupBy struct {
+ selector
+ build *BusQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (bgb *BusGroupBy) Aggregate(fns ...AggregateFunc) *BusGroupBy {
+ bgb.fns = append(bgb.fns, fns...)
+ return bgb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (bgb *BusGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, bgb.build.ctx, "GroupBy")
+ if err := bgb.build.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*BusQuery, *BusGroupBy](ctx, bgb.build, bgb, bgb.build.inters, v)
+}
+
+func (bgb *BusGroupBy) sqlScan(ctx context.Context, root *BusQuery, v any) error {
+ selector := root.sqlQuery(ctx).Select()
+ aggregation := make([]string, 0, len(bgb.fns))
+ for _, fn := range bgb.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ if len(selector.SelectedColumns()) == 0 {
+ columns := make([]string, 0, len(*bgb.flds)+len(bgb.fns))
+ for _, f := range *bgb.flds {
+ columns = append(columns, selector.C(f))
+ }
+ columns = append(columns, aggregation...)
+ selector.Select(columns...)
+ }
+ selector.GroupBy(selector.Columns(*bgb.flds...)...)
+ if err := selector.Err(); err != nil {
+ return err
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := bgb.build.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
+
+// BusSelect is the builder for selecting fields of Bus entities.
+type BusSelect struct {
+ *BusQuery
+ selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (bs *BusSelect) Aggregate(fns ...AggregateFunc) *BusSelect {
+ bs.fns = append(bs.fns, fns...)
+ return bs
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (bs *BusSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, bs.ctx, "Select")
+ if err := bs.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*BusQuery, *BusSelect](ctx, bs.BusQuery, bs, bs.inters, v)
+}
+
+func (bs *BusSelect) sqlScan(ctx context.Context, root *BusQuery, v any) error {
+ selector := root.sqlQuery(ctx)
+ aggregation := make([]string, 0, len(bs.fns))
+ for _, fn := range bs.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ switch n := len(*bs.selector.flds); {
+ case n == 0 && len(aggregation) > 0:
+ selector.Select(aggregation...)
+ case n != 0 && len(aggregation) > 0:
+ selector.AppendSelect(aggregation...)
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := bs.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
diff --git a/backend/domain/repository/ent/bus_update.go b/backend/domain/repository/ent/bus_update.go
new file mode 100644
index 00000000..889acae3
--- /dev/null
+++ b/backend/domain/repository/ent/bus_update.go
@@ -0,0 +1,1331 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// BusUpdate is the builder for updating Bus entities.
+type BusUpdate struct {
+ config
+ hooks []Hook
+ mutation *BusMutation
+}
+
+// Where appends a list predicates to the BusUpdate builder.
+func (bu *BusUpdate) Where(ps ...predicate.Bus) *BusUpdate {
+ bu.mutation.Where(ps...)
+ return bu
+}
+
+// SetName sets the "name" field.
+func (bu *BusUpdate) SetName(s string) *BusUpdate {
+ bu.mutation.SetName(s)
+ return bu
+}
+
+// SetNillableName sets the "name" field if the given value is not nil.
+func (bu *BusUpdate) SetNillableName(s *string) *BusUpdate {
+ if s != nil {
+ bu.SetName(*s)
+ }
+ return bu
+}
+
+// SetPlateNumber sets the "plate_number" field.
+func (bu *BusUpdate) SetPlateNumber(s string) *BusUpdate {
+ bu.mutation.SetPlateNumber(s)
+ return bu
+}
+
+// SetNillablePlateNumber sets the "plate_number" field if the given value is not nil.
+func (bu *BusUpdate) SetNillablePlateNumber(s *string) *BusUpdate {
+ if s != nil {
+ bu.SetPlateNumber(*s)
+ }
+ return bu
+}
+
+// ClearPlateNumber clears the value of the "plate_number" field.
+func (bu *BusUpdate) ClearPlateNumber() *BusUpdate {
+ bu.mutation.ClearPlateNumber()
+ return bu
+}
+
+// SetLatitude sets the "latitude" field.
+func (bu *BusUpdate) SetLatitude(f float64) *BusUpdate {
+ bu.mutation.ResetLatitude()
+ bu.mutation.SetLatitude(f)
+ return bu
+}
+
+// SetNillableLatitude sets the "latitude" field if the given value is not nil.
+func (bu *BusUpdate) SetNillableLatitude(f *float64) *BusUpdate {
+ if f != nil {
+ bu.SetLatitude(*f)
+ }
+ return bu
+}
+
+// AddLatitude adds f to the "latitude" field.
+func (bu *BusUpdate) AddLatitude(f float64) *BusUpdate {
+ bu.mutation.AddLatitude(f)
+ return bu
+}
+
+// ClearLatitude clears the value of the "latitude" field.
+func (bu *BusUpdate) ClearLatitude() *BusUpdate {
+ bu.mutation.ClearLatitude()
+ return bu
+}
+
+// SetLongitude sets the "longitude" field.
+func (bu *BusUpdate) SetLongitude(f float64) *BusUpdate {
+ bu.mutation.ResetLongitude()
+ bu.mutation.SetLongitude(f)
+ return bu
+}
+
+// SetNillableLongitude sets the "longitude" field if the given value is not nil.
+func (bu *BusUpdate) SetNillableLongitude(f *float64) *BusUpdate {
+ if f != nil {
+ bu.SetLongitude(*f)
+ }
+ return bu
+}
+
+// AddLongitude adds f to the "longitude" field.
+func (bu *BusUpdate) AddLongitude(f float64) *BusUpdate {
+ bu.mutation.AddLongitude(f)
+ return bu
+}
+
+// ClearLongitude clears the value of the "longitude" field.
+func (bu *BusUpdate) ClearLongitude() *BusUpdate {
+ bu.mutation.ClearLongitude()
+ return bu
+}
+
+// SetStatus sets the "status" field.
+func (bu *BusUpdate) SetStatus(b bus.Status) *BusUpdate {
+ bu.mutation.SetStatus(b)
+ return bu
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (bu *BusUpdate) SetNillableStatus(b *bus.Status) *BusUpdate {
+ if b != nil {
+ bu.SetStatus(*b)
+ }
+ return bu
+}
+
+// SetEnableFaceRecognition sets the "enable_face_recognition" field.
+func (bu *BusUpdate) SetEnableFaceRecognition(b bool) *BusUpdate {
+ bu.mutation.SetEnableFaceRecognition(b)
+ return bu
+}
+
+// SetNillableEnableFaceRecognition sets the "enable_face_recognition" field if the given value is not nil.
+func (bu *BusUpdate) SetNillableEnableFaceRecognition(b *bool) *BusUpdate {
+ if b != nil {
+ bu.SetEnableFaceRecognition(*b)
+ }
+ return bu
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (bu *BusUpdate) SetCreatedAt(t time.Time) *BusUpdate {
+ bu.mutation.SetCreatedAt(t)
+ return bu
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (bu *BusUpdate) SetNillableCreatedAt(t *time.Time) *BusUpdate {
+ if t != nil {
+ bu.SetCreatedAt(*t)
+ }
+ return bu
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (bu *BusUpdate) SetUpdatedAt(t time.Time) *BusUpdate {
+ bu.mutation.SetUpdatedAt(t)
+ return bu
+}
+
+// SetNurseryID sets the "nursery" edge to the Nursery entity by ID.
+func (bu *BusUpdate) SetNurseryID(id uuid.UUID) *BusUpdate {
+ bu.mutation.SetNurseryID(id)
+ return bu
+}
+
+// SetNillableNurseryID sets the "nursery" edge to the Nursery entity by ID if the given value is not nil.
+func (bu *BusUpdate) SetNillableNurseryID(id *uuid.UUID) *BusUpdate {
+ if id != nil {
+ bu = bu.SetNurseryID(*id)
+ }
+ return bu
+}
+
+// SetNursery sets the "nursery" edge to the Nursery entity.
+func (bu *BusUpdate) SetNursery(n *Nursery) *BusUpdate {
+ return bu.SetNurseryID(n.ID)
+}
+
+// AddBoardingRecordIDs adds the "boarding_records" edge to the BoardingRecord entity by IDs.
+func (bu *BusUpdate) AddBoardingRecordIDs(ids ...uuid.UUID) *BusUpdate {
+ bu.mutation.AddBoardingRecordIDs(ids...)
+ return bu
+}
+
+// AddBoardingRecords adds the "boarding_records" edges to the BoardingRecord entity.
+func (bu *BusUpdate) AddBoardingRecords(b ...*BoardingRecord) *BusUpdate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bu.AddBoardingRecordIDs(ids...)
+}
+
+// SetNextStationID sets the "next_station" edge to the Station entity by ID.
+func (bu *BusUpdate) SetNextStationID(id uuid.UUID) *BusUpdate {
+ bu.mutation.SetNextStationID(id)
+ return bu
+}
+
+// SetNillableNextStationID sets the "next_station" edge to the Station entity by ID if the given value is not nil.
+func (bu *BusUpdate) SetNillableNextStationID(id *uuid.UUID) *BusUpdate {
+ if id != nil {
+ bu = bu.SetNextStationID(*id)
+ }
+ return bu
+}
+
+// SetNextStation sets the "next_station" edge to the Station entity.
+func (bu *BusUpdate) SetNextStation(s *Station) *BusUpdate {
+ return bu.SetNextStationID(s.ID)
+}
+
+// AddBusRouteIDs adds the "bus_route" edge to the BusRoute entity by IDs.
+func (bu *BusUpdate) AddBusRouteIDs(ids ...uuid.UUID) *BusUpdate {
+ bu.mutation.AddBusRouteIDs(ids...)
+ return bu
+}
+
+// AddBusRoute adds the "bus_route" edges to the BusRoute entity.
+func (bu *BusUpdate) AddBusRoute(b ...*BusRoute) *BusUpdate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bu.AddBusRouteIDs(ids...)
+}
+
+// SetLatestMorningRouteID sets the "latest_morning_route" edge to the BusRoute entity by ID.
+func (bu *BusUpdate) SetLatestMorningRouteID(id uuid.UUID) *BusUpdate {
+ bu.mutation.SetLatestMorningRouteID(id)
+ return bu
+}
+
+// SetNillableLatestMorningRouteID sets the "latest_morning_route" edge to the BusRoute entity by ID if the given value is not nil.
+func (bu *BusUpdate) SetNillableLatestMorningRouteID(id *uuid.UUID) *BusUpdate {
+ if id != nil {
+ bu = bu.SetLatestMorningRouteID(*id)
+ }
+ return bu
+}
+
+// SetLatestMorningRoute sets the "latest_morning_route" edge to the BusRoute entity.
+func (bu *BusUpdate) SetLatestMorningRoute(b *BusRoute) *BusUpdate {
+ return bu.SetLatestMorningRouteID(b.ID)
+}
+
+// SetLatestEveningRouteID sets the "latest_evening_route" edge to the BusRoute entity by ID.
+func (bu *BusUpdate) SetLatestEveningRouteID(id uuid.UUID) *BusUpdate {
+ bu.mutation.SetLatestEveningRouteID(id)
+ return bu
+}
+
+// SetNillableLatestEveningRouteID sets the "latest_evening_route" edge to the BusRoute entity by ID if the given value is not nil.
+func (bu *BusUpdate) SetNillableLatestEveningRouteID(id *uuid.UUID) *BusUpdate {
+ if id != nil {
+ bu = bu.SetLatestEveningRouteID(*id)
+ }
+ return bu
+}
+
+// SetLatestEveningRoute sets the "latest_evening_route" edge to the BusRoute entity.
+func (bu *BusUpdate) SetLatestEveningRoute(b *BusRoute) *BusUpdate {
+ return bu.SetLatestEveningRouteID(b.ID)
+}
+
+// Mutation returns the BusMutation object of the builder.
+func (bu *BusUpdate) Mutation() *BusMutation {
+ return bu.mutation
+}
+
+// ClearNursery clears the "nursery" edge to the Nursery entity.
+func (bu *BusUpdate) ClearNursery() *BusUpdate {
+ bu.mutation.ClearNursery()
+ return bu
+}
+
+// ClearBoardingRecords clears all "boarding_records" edges to the BoardingRecord entity.
+func (bu *BusUpdate) ClearBoardingRecords() *BusUpdate {
+ bu.mutation.ClearBoardingRecords()
+ return bu
+}
+
+// RemoveBoardingRecordIDs removes the "boarding_records" edge to BoardingRecord entities by IDs.
+func (bu *BusUpdate) RemoveBoardingRecordIDs(ids ...uuid.UUID) *BusUpdate {
+ bu.mutation.RemoveBoardingRecordIDs(ids...)
+ return bu
+}
+
+// RemoveBoardingRecords removes "boarding_records" edges to BoardingRecord entities.
+func (bu *BusUpdate) RemoveBoardingRecords(b ...*BoardingRecord) *BusUpdate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bu.RemoveBoardingRecordIDs(ids...)
+}
+
+// ClearNextStation clears the "next_station" edge to the Station entity.
+func (bu *BusUpdate) ClearNextStation() *BusUpdate {
+ bu.mutation.ClearNextStation()
+ return bu
+}
+
+// ClearBusRoute clears all "bus_route" edges to the BusRoute entity.
+func (bu *BusUpdate) ClearBusRoute() *BusUpdate {
+ bu.mutation.ClearBusRoute()
+ return bu
+}
+
+// RemoveBusRouteIDs removes the "bus_route" edge to BusRoute entities by IDs.
+func (bu *BusUpdate) RemoveBusRouteIDs(ids ...uuid.UUID) *BusUpdate {
+ bu.mutation.RemoveBusRouteIDs(ids...)
+ return bu
+}
+
+// RemoveBusRoute removes "bus_route" edges to BusRoute entities.
+func (bu *BusUpdate) RemoveBusRoute(b ...*BusRoute) *BusUpdate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bu.RemoveBusRouteIDs(ids...)
+}
+
+// ClearLatestMorningRoute clears the "latest_morning_route" edge to the BusRoute entity.
+func (bu *BusUpdate) ClearLatestMorningRoute() *BusUpdate {
+ bu.mutation.ClearLatestMorningRoute()
+ return bu
+}
+
+// ClearLatestEveningRoute clears the "latest_evening_route" edge to the BusRoute entity.
+func (bu *BusUpdate) ClearLatestEveningRoute() *BusUpdate {
+ bu.mutation.ClearLatestEveningRoute()
+ return bu
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (bu *BusUpdate) Save(ctx context.Context) (int, error) {
+ bu.defaults()
+ return withHooks(ctx, bu.sqlSave, bu.mutation, bu.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (bu *BusUpdate) SaveX(ctx context.Context) int {
+ affected, err := bu.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return affected
+}
+
+// Exec executes the query.
+func (bu *BusUpdate) Exec(ctx context.Context) error {
+ _, err := bu.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (bu *BusUpdate) ExecX(ctx context.Context) {
+ if err := bu.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (bu *BusUpdate) defaults() {
+ if _, ok := bu.mutation.UpdatedAt(); !ok {
+ v := bus.UpdateDefaultUpdatedAt()
+ bu.mutation.SetUpdatedAt(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (bu *BusUpdate) check() error {
+ if v, ok := bu.mutation.Status(); ok {
+ if err := bus.StatusValidator(v); err != nil {
+ return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Bus.status": %w`, err)}
+ }
+ }
+ return nil
+}
+
+func (bu *BusUpdate) sqlSave(ctx context.Context) (n int, err error) {
+ if err := bu.check(); err != nil {
+ return n, err
+ }
+ _spec := sqlgraph.NewUpdateSpec(bus.Table, bus.Columns, sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID))
+ if ps := bu.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := bu.mutation.Name(); ok {
+ _spec.SetField(bus.FieldName, field.TypeString, value)
+ }
+ if value, ok := bu.mutation.PlateNumber(); ok {
+ _spec.SetField(bus.FieldPlateNumber, field.TypeString, value)
+ }
+ if bu.mutation.PlateNumberCleared() {
+ _spec.ClearField(bus.FieldPlateNumber, field.TypeString)
+ }
+ if value, ok := bu.mutation.Latitude(); ok {
+ _spec.SetField(bus.FieldLatitude, field.TypeFloat64, value)
+ }
+ if value, ok := bu.mutation.AddedLatitude(); ok {
+ _spec.AddField(bus.FieldLatitude, field.TypeFloat64, value)
+ }
+ if bu.mutation.LatitudeCleared() {
+ _spec.ClearField(bus.FieldLatitude, field.TypeFloat64)
+ }
+ if value, ok := bu.mutation.Longitude(); ok {
+ _spec.SetField(bus.FieldLongitude, field.TypeFloat64, value)
+ }
+ if value, ok := bu.mutation.AddedLongitude(); ok {
+ _spec.AddField(bus.FieldLongitude, field.TypeFloat64, value)
+ }
+ if bu.mutation.LongitudeCleared() {
+ _spec.ClearField(bus.FieldLongitude, field.TypeFloat64)
+ }
+ if value, ok := bu.mutation.Status(); ok {
+ _spec.SetField(bus.FieldStatus, field.TypeEnum, value)
+ }
+ if value, ok := bu.mutation.EnableFaceRecognition(); ok {
+ _spec.SetField(bus.FieldEnableFaceRecognition, field.TypeBool, value)
+ }
+ if value, ok := bu.mutation.CreatedAt(); ok {
+ _spec.SetField(bus.FieldCreatedAt, field.TypeTime, value)
+ }
+ if value, ok := bu.mutation.UpdatedAt(); ok {
+ _spec.SetField(bus.FieldUpdatedAt, field.TypeTime, value)
+ }
+ if bu.mutation.NurseryCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.NurseryTable,
+ Columns: []string{bus.NurseryColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(nursery.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bu.mutation.NurseryIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.NurseryTable,
+ Columns: []string{bus.NurseryColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(nursery.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if bu.mutation.BoardingRecordsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: bus.BoardingRecordsTable,
+ Columns: []string{bus.BoardingRecordsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bu.mutation.RemovedBoardingRecordsIDs(); len(nodes) > 0 && !bu.mutation.BoardingRecordsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: bus.BoardingRecordsTable,
+ Columns: []string{bus.BoardingRecordsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bu.mutation.BoardingRecordsIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: bus.BoardingRecordsTable,
+ Columns: []string{bus.BoardingRecordsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if bu.mutation.NextStationCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.NextStationTable,
+ Columns: []string{bus.NextStationColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bu.mutation.NextStationIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.NextStationTable,
+ Columns: []string{bus.NextStationColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if bu.mutation.BusRouteCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2M,
+ Inverse: true,
+ Table: bus.BusRouteTable,
+ Columns: bus.BusRoutePrimaryKey,
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bu.mutation.RemovedBusRouteIDs(); len(nodes) > 0 && !bu.mutation.BusRouteCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2M,
+ Inverse: true,
+ Table: bus.BusRouteTable,
+ Columns: bus.BusRoutePrimaryKey,
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bu.mutation.BusRouteIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2M,
+ Inverse: true,
+ Table: bus.BusRouteTable,
+ Columns: bus.BusRoutePrimaryKey,
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if bu.mutation.LatestMorningRouteCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.LatestMorningRouteTable,
+ Columns: []string{bus.LatestMorningRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bu.mutation.LatestMorningRouteIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.LatestMorningRouteTable,
+ Columns: []string{bus.LatestMorningRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if bu.mutation.LatestEveningRouteCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.LatestEveningRouteTable,
+ Columns: []string{bus.LatestEveningRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bu.mutation.LatestEveningRouteIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.LatestEveningRouteTable,
+ Columns: []string{bus.LatestEveningRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if n, err = sqlgraph.UpdateNodes(ctx, bu.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{bus.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return 0, err
+ }
+ bu.mutation.done = true
+ return n, nil
+}
+
+// BusUpdateOne is the builder for updating a single Bus entity.
+type BusUpdateOne struct {
+ config
+ fields []string
+ hooks []Hook
+ mutation *BusMutation
+}
+
+// SetName sets the "name" field.
+func (buo *BusUpdateOne) SetName(s string) *BusUpdateOne {
+ buo.mutation.SetName(s)
+ return buo
+}
+
+// SetNillableName sets the "name" field if the given value is not nil.
+func (buo *BusUpdateOne) SetNillableName(s *string) *BusUpdateOne {
+ if s != nil {
+ buo.SetName(*s)
+ }
+ return buo
+}
+
+// SetPlateNumber sets the "plate_number" field.
+func (buo *BusUpdateOne) SetPlateNumber(s string) *BusUpdateOne {
+ buo.mutation.SetPlateNumber(s)
+ return buo
+}
+
+// SetNillablePlateNumber sets the "plate_number" field if the given value is not nil.
+func (buo *BusUpdateOne) SetNillablePlateNumber(s *string) *BusUpdateOne {
+ if s != nil {
+ buo.SetPlateNumber(*s)
+ }
+ return buo
+}
+
+// ClearPlateNumber clears the value of the "plate_number" field.
+func (buo *BusUpdateOne) ClearPlateNumber() *BusUpdateOne {
+ buo.mutation.ClearPlateNumber()
+ return buo
+}
+
+// SetLatitude sets the "latitude" field.
+func (buo *BusUpdateOne) SetLatitude(f float64) *BusUpdateOne {
+ buo.mutation.ResetLatitude()
+ buo.mutation.SetLatitude(f)
+ return buo
+}
+
+// SetNillableLatitude sets the "latitude" field if the given value is not nil.
+func (buo *BusUpdateOne) SetNillableLatitude(f *float64) *BusUpdateOne {
+ if f != nil {
+ buo.SetLatitude(*f)
+ }
+ return buo
+}
+
+// AddLatitude adds f to the "latitude" field.
+func (buo *BusUpdateOne) AddLatitude(f float64) *BusUpdateOne {
+ buo.mutation.AddLatitude(f)
+ return buo
+}
+
+// ClearLatitude clears the value of the "latitude" field.
+func (buo *BusUpdateOne) ClearLatitude() *BusUpdateOne {
+ buo.mutation.ClearLatitude()
+ return buo
+}
+
+// SetLongitude sets the "longitude" field.
+func (buo *BusUpdateOne) SetLongitude(f float64) *BusUpdateOne {
+ buo.mutation.ResetLongitude()
+ buo.mutation.SetLongitude(f)
+ return buo
+}
+
+// SetNillableLongitude sets the "longitude" field if the given value is not nil.
+func (buo *BusUpdateOne) SetNillableLongitude(f *float64) *BusUpdateOne {
+ if f != nil {
+ buo.SetLongitude(*f)
+ }
+ return buo
+}
+
+// AddLongitude adds f to the "longitude" field.
+func (buo *BusUpdateOne) AddLongitude(f float64) *BusUpdateOne {
+ buo.mutation.AddLongitude(f)
+ return buo
+}
+
+// ClearLongitude clears the value of the "longitude" field.
+func (buo *BusUpdateOne) ClearLongitude() *BusUpdateOne {
+ buo.mutation.ClearLongitude()
+ return buo
+}
+
+// SetStatus sets the "status" field.
+func (buo *BusUpdateOne) SetStatus(b bus.Status) *BusUpdateOne {
+ buo.mutation.SetStatus(b)
+ return buo
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (buo *BusUpdateOne) SetNillableStatus(b *bus.Status) *BusUpdateOne {
+ if b != nil {
+ buo.SetStatus(*b)
+ }
+ return buo
+}
+
+// SetEnableFaceRecognition sets the "enable_face_recognition" field.
+func (buo *BusUpdateOne) SetEnableFaceRecognition(b bool) *BusUpdateOne {
+ buo.mutation.SetEnableFaceRecognition(b)
+ return buo
+}
+
+// SetNillableEnableFaceRecognition sets the "enable_face_recognition" field if the given value is not nil.
+func (buo *BusUpdateOne) SetNillableEnableFaceRecognition(b *bool) *BusUpdateOne {
+ if b != nil {
+ buo.SetEnableFaceRecognition(*b)
+ }
+ return buo
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (buo *BusUpdateOne) SetCreatedAt(t time.Time) *BusUpdateOne {
+ buo.mutation.SetCreatedAt(t)
+ return buo
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (buo *BusUpdateOne) SetNillableCreatedAt(t *time.Time) *BusUpdateOne {
+ if t != nil {
+ buo.SetCreatedAt(*t)
+ }
+ return buo
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (buo *BusUpdateOne) SetUpdatedAt(t time.Time) *BusUpdateOne {
+ buo.mutation.SetUpdatedAt(t)
+ return buo
+}
+
+// SetNurseryID sets the "nursery" edge to the Nursery entity by ID.
+func (buo *BusUpdateOne) SetNurseryID(id uuid.UUID) *BusUpdateOne {
+ buo.mutation.SetNurseryID(id)
+ return buo
+}
+
+// SetNillableNurseryID sets the "nursery" edge to the Nursery entity by ID if the given value is not nil.
+func (buo *BusUpdateOne) SetNillableNurseryID(id *uuid.UUID) *BusUpdateOne {
+ if id != nil {
+ buo = buo.SetNurseryID(*id)
+ }
+ return buo
+}
+
+// SetNursery sets the "nursery" edge to the Nursery entity.
+func (buo *BusUpdateOne) SetNursery(n *Nursery) *BusUpdateOne {
+ return buo.SetNurseryID(n.ID)
+}
+
+// AddBoardingRecordIDs adds the "boarding_records" edge to the BoardingRecord entity by IDs.
+func (buo *BusUpdateOne) AddBoardingRecordIDs(ids ...uuid.UUID) *BusUpdateOne {
+ buo.mutation.AddBoardingRecordIDs(ids...)
+ return buo
+}
+
+// AddBoardingRecords adds the "boarding_records" edges to the BoardingRecord entity.
+func (buo *BusUpdateOne) AddBoardingRecords(b ...*BoardingRecord) *BusUpdateOne {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return buo.AddBoardingRecordIDs(ids...)
+}
+
+// SetNextStationID sets the "next_station" edge to the Station entity by ID.
+func (buo *BusUpdateOne) SetNextStationID(id uuid.UUID) *BusUpdateOne {
+ buo.mutation.SetNextStationID(id)
+ return buo
+}
+
+// SetNillableNextStationID sets the "next_station" edge to the Station entity by ID if the given value is not nil.
+func (buo *BusUpdateOne) SetNillableNextStationID(id *uuid.UUID) *BusUpdateOne {
+ if id != nil {
+ buo = buo.SetNextStationID(*id)
+ }
+ return buo
+}
+
+// SetNextStation sets the "next_station" edge to the Station entity.
+func (buo *BusUpdateOne) SetNextStation(s *Station) *BusUpdateOne {
+ return buo.SetNextStationID(s.ID)
+}
+
+// AddBusRouteIDs adds the "bus_route" edge to the BusRoute entity by IDs.
+func (buo *BusUpdateOne) AddBusRouteIDs(ids ...uuid.UUID) *BusUpdateOne {
+ buo.mutation.AddBusRouteIDs(ids...)
+ return buo
+}
+
+// AddBusRoute adds the "bus_route" edges to the BusRoute entity.
+func (buo *BusUpdateOne) AddBusRoute(b ...*BusRoute) *BusUpdateOne {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return buo.AddBusRouteIDs(ids...)
+}
+
+// SetLatestMorningRouteID sets the "latest_morning_route" edge to the BusRoute entity by ID.
+func (buo *BusUpdateOne) SetLatestMorningRouteID(id uuid.UUID) *BusUpdateOne {
+ buo.mutation.SetLatestMorningRouteID(id)
+ return buo
+}
+
+// SetNillableLatestMorningRouteID sets the "latest_morning_route" edge to the BusRoute entity by ID if the given value is not nil.
+func (buo *BusUpdateOne) SetNillableLatestMorningRouteID(id *uuid.UUID) *BusUpdateOne {
+ if id != nil {
+ buo = buo.SetLatestMorningRouteID(*id)
+ }
+ return buo
+}
+
+// SetLatestMorningRoute sets the "latest_morning_route" edge to the BusRoute entity.
+func (buo *BusUpdateOne) SetLatestMorningRoute(b *BusRoute) *BusUpdateOne {
+ return buo.SetLatestMorningRouteID(b.ID)
+}
+
+// SetLatestEveningRouteID sets the "latest_evening_route" edge to the BusRoute entity by ID.
+func (buo *BusUpdateOne) SetLatestEveningRouteID(id uuid.UUID) *BusUpdateOne {
+ buo.mutation.SetLatestEveningRouteID(id)
+ return buo
+}
+
+// SetNillableLatestEveningRouteID sets the "latest_evening_route" edge to the BusRoute entity by ID if the given value is not nil.
+func (buo *BusUpdateOne) SetNillableLatestEveningRouteID(id *uuid.UUID) *BusUpdateOne {
+ if id != nil {
+ buo = buo.SetLatestEveningRouteID(*id)
+ }
+ return buo
+}
+
+// SetLatestEveningRoute sets the "latest_evening_route" edge to the BusRoute entity.
+func (buo *BusUpdateOne) SetLatestEveningRoute(b *BusRoute) *BusUpdateOne {
+ return buo.SetLatestEveningRouteID(b.ID)
+}
+
+// Mutation returns the BusMutation object of the builder.
+func (buo *BusUpdateOne) Mutation() *BusMutation {
+ return buo.mutation
+}
+
+// ClearNursery clears the "nursery" edge to the Nursery entity.
+func (buo *BusUpdateOne) ClearNursery() *BusUpdateOne {
+ buo.mutation.ClearNursery()
+ return buo
+}
+
+// ClearBoardingRecords clears all "boarding_records" edges to the BoardingRecord entity.
+func (buo *BusUpdateOne) ClearBoardingRecords() *BusUpdateOne {
+ buo.mutation.ClearBoardingRecords()
+ return buo
+}
+
+// RemoveBoardingRecordIDs removes the "boarding_records" edge to BoardingRecord entities by IDs.
+func (buo *BusUpdateOne) RemoveBoardingRecordIDs(ids ...uuid.UUID) *BusUpdateOne {
+ buo.mutation.RemoveBoardingRecordIDs(ids...)
+ return buo
+}
+
+// RemoveBoardingRecords removes "boarding_records" edges to BoardingRecord entities.
+func (buo *BusUpdateOne) RemoveBoardingRecords(b ...*BoardingRecord) *BusUpdateOne {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return buo.RemoveBoardingRecordIDs(ids...)
+}
+
+// ClearNextStation clears the "next_station" edge to the Station entity.
+func (buo *BusUpdateOne) ClearNextStation() *BusUpdateOne {
+ buo.mutation.ClearNextStation()
+ return buo
+}
+
+// ClearBusRoute clears all "bus_route" edges to the BusRoute entity.
+func (buo *BusUpdateOne) ClearBusRoute() *BusUpdateOne {
+ buo.mutation.ClearBusRoute()
+ return buo
+}
+
+// RemoveBusRouteIDs removes the "bus_route" edge to BusRoute entities by IDs.
+func (buo *BusUpdateOne) RemoveBusRouteIDs(ids ...uuid.UUID) *BusUpdateOne {
+ buo.mutation.RemoveBusRouteIDs(ids...)
+ return buo
+}
+
+// RemoveBusRoute removes "bus_route" edges to BusRoute entities.
+func (buo *BusUpdateOne) RemoveBusRoute(b ...*BusRoute) *BusUpdateOne {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return buo.RemoveBusRouteIDs(ids...)
+}
+
+// ClearLatestMorningRoute clears the "latest_morning_route" edge to the BusRoute entity.
+func (buo *BusUpdateOne) ClearLatestMorningRoute() *BusUpdateOne {
+ buo.mutation.ClearLatestMorningRoute()
+ return buo
+}
+
+// ClearLatestEveningRoute clears the "latest_evening_route" edge to the BusRoute entity.
+func (buo *BusUpdateOne) ClearLatestEveningRoute() *BusUpdateOne {
+ buo.mutation.ClearLatestEveningRoute()
+ return buo
+}
+
+// Where appends a list predicates to the BusUpdate builder.
+func (buo *BusUpdateOne) Where(ps ...predicate.Bus) *BusUpdateOne {
+ buo.mutation.Where(ps...)
+ return buo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (buo *BusUpdateOne) Select(field string, fields ...string) *BusUpdateOne {
+ buo.fields = append([]string{field}, fields...)
+ return buo
+}
+
+// Save executes the query and returns the updated Bus entity.
+func (buo *BusUpdateOne) Save(ctx context.Context) (*Bus, error) {
+ buo.defaults()
+ return withHooks(ctx, buo.sqlSave, buo.mutation, buo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (buo *BusUpdateOne) SaveX(ctx context.Context) *Bus {
+ node, err := buo.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// Exec executes the query on the entity.
+func (buo *BusUpdateOne) Exec(ctx context.Context) error {
+ _, err := buo.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (buo *BusUpdateOne) ExecX(ctx context.Context) {
+ if err := buo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (buo *BusUpdateOne) defaults() {
+ if _, ok := buo.mutation.UpdatedAt(); !ok {
+ v := bus.UpdateDefaultUpdatedAt()
+ buo.mutation.SetUpdatedAt(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (buo *BusUpdateOne) check() error {
+ if v, ok := buo.mutation.Status(); ok {
+ if err := bus.StatusValidator(v); err != nil {
+ return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Bus.status": %w`, err)}
+ }
+ }
+ return nil
+}
+
+func (buo *BusUpdateOne) sqlSave(ctx context.Context) (_node *Bus, err error) {
+ if err := buo.check(); err != nil {
+ return _node, err
+ }
+ _spec := sqlgraph.NewUpdateSpec(bus.Table, bus.Columns, sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID))
+ id, ok := buo.mutation.ID()
+ if !ok {
+ return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Bus.id" for update`)}
+ }
+ _spec.Node.ID.Value = id
+ if fields := buo.fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, bus.FieldID)
+ for _, f := range fields {
+ if !bus.ValidColumn(f) {
+ return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ if f != bus.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, f)
+ }
+ }
+ }
+ if ps := buo.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := buo.mutation.Name(); ok {
+ _spec.SetField(bus.FieldName, field.TypeString, value)
+ }
+ if value, ok := buo.mutation.PlateNumber(); ok {
+ _spec.SetField(bus.FieldPlateNumber, field.TypeString, value)
+ }
+ if buo.mutation.PlateNumberCleared() {
+ _spec.ClearField(bus.FieldPlateNumber, field.TypeString)
+ }
+ if value, ok := buo.mutation.Latitude(); ok {
+ _spec.SetField(bus.FieldLatitude, field.TypeFloat64, value)
+ }
+ if value, ok := buo.mutation.AddedLatitude(); ok {
+ _spec.AddField(bus.FieldLatitude, field.TypeFloat64, value)
+ }
+ if buo.mutation.LatitudeCleared() {
+ _spec.ClearField(bus.FieldLatitude, field.TypeFloat64)
+ }
+ if value, ok := buo.mutation.Longitude(); ok {
+ _spec.SetField(bus.FieldLongitude, field.TypeFloat64, value)
+ }
+ if value, ok := buo.mutation.AddedLongitude(); ok {
+ _spec.AddField(bus.FieldLongitude, field.TypeFloat64, value)
+ }
+ if buo.mutation.LongitudeCleared() {
+ _spec.ClearField(bus.FieldLongitude, field.TypeFloat64)
+ }
+ if value, ok := buo.mutation.Status(); ok {
+ _spec.SetField(bus.FieldStatus, field.TypeEnum, value)
+ }
+ if value, ok := buo.mutation.EnableFaceRecognition(); ok {
+ _spec.SetField(bus.FieldEnableFaceRecognition, field.TypeBool, value)
+ }
+ if value, ok := buo.mutation.CreatedAt(); ok {
+ _spec.SetField(bus.FieldCreatedAt, field.TypeTime, value)
+ }
+ if value, ok := buo.mutation.UpdatedAt(); ok {
+ _spec.SetField(bus.FieldUpdatedAt, field.TypeTime, value)
+ }
+ if buo.mutation.NurseryCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.NurseryTable,
+ Columns: []string{bus.NurseryColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(nursery.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := buo.mutation.NurseryIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.NurseryTable,
+ Columns: []string{bus.NurseryColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(nursery.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if buo.mutation.BoardingRecordsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: bus.BoardingRecordsTable,
+ Columns: []string{bus.BoardingRecordsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := buo.mutation.RemovedBoardingRecordsIDs(); len(nodes) > 0 && !buo.mutation.BoardingRecordsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: bus.BoardingRecordsTable,
+ Columns: []string{bus.BoardingRecordsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := buo.mutation.BoardingRecordsIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: bus.BoardingRecordsTable,
+ Columns: []string{bus.BoardingRecordsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if buo.mutation.NextStationCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.NextStationTable,
+ Columns: []string{bus.NextStationColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := buo.mutation.NextStationIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.NextStationTable,
+ Columns: []string{bus.NextStationColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if buo.mutation.BusRouteCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2M,
+ Inverse: true,
+ Table: bus.BusRouteTable,
+ Columns: bus.BusRoutePrimaryKey,
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := buo.mutation.RemovedBusRouteIDs(); len(nodes) > 0 && !buo.mutation.BusRouteCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2M,
+ Inverse: true,
+ Table: bus.BusRouteTable,
+ Columns: bus.BusRoutePrimaryKey,
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := buo.mutation.BusRouteIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2M,
+ Inverse: true,
+ Table: bus.BusRouteTable,
+ Columns: bus.BusRoutePrimaryKey,
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if buo.mutation.LatestMorningRouteCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.LatestMorningRouteTable,
+ Columns: []string{bus.LatestMorningRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := buo.mutation.LatestMorningRouteIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.LatestMorningRouteTable,
+ Columns: []string{bus.LatestMorningRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if buo.mutation.LatestEveningRouteCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.LatestEveningRouteTable,
+ Columns: []string{bus.LatestEveningRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := buo.mutation.LatestEveningRouteIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: bus.LatestEveningRouteTable,
+ Columns: []string{bus.LatestEveningRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ _node = &Bus{config: buo.config}
+ _spec.Assign = _node.assignValues
+ _spec.ScanValues = _node.scanValues
+ if err = sqlgraph.UpdateNode(ctx, buo.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{bus.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ buo.mutation.done = true
+ return _node, nil
+}
diff --git a/backend/domain/repository/ent/busroute.go b/backend/domain/repository/ent/busroute.go
new file mode 100644
index 00000000..c72cfa41
--- /dev/null
+++ b/backend/domain/repository/ent/busroute.go
@@ -0,0 +1,219 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "fmt"
+ "strings"
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/sql"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/google/uuid"
+)
+
+// BusRoute is the model entity for the BusRoute schema.
+type BusRoute struct {
+ config `json:"-"`
+ // ID of the ent.
+ ID uuid.UUID `json:"id,omitempty"`
+ // 朝のバスか放課後のバスかを示す
+ BusType busroute.BusType `json:"bus_type,omitempty"`
+ // CreatedAt holds the value of the "created_at" field.
+ CreatedAt time.Time `json:"created_at,omitempty"`
+ // UpdatedAt holds the value of the "updated_at" field.
+ UpdatedAt time.Time `json:"updated_at,omitempty"`
+ // Edges holds the relations/edges for other nodes in the graph.
+ // The values are being populated by the BusRouteQuery when eager-loading is set.
+ Edges BusRouteEdges `json:"edges"`
+ selectValues sql.SelectValues
+}
+
+// BusRouteEdges holds the relations/edges for other nodes in the graph.
+type BusRouteEdges struct {
+ // Bus holds the value of the bus edge.
+ Bus []*Bus `json:"bus,omitempty"`
+ // ChildBusAssociations holds the value of the childBusAssociations edge.
+ ChildBusAssociations []*ChildBusAssociation `json:"childBusAssociations,omitempty"`
+ // BusRouteAssociations holds the value of the busRouteAssociations edge.
+ BusRouteAssociations []*BusRouteAssociation `json:"busRouteAssociations,omitempty"`
+ // MorningBuses holds the value of the morning_buses edge.
+ MorningBuses []*Bus `json:"morning_buses,omitempty"`
+ // EveningBuses holds the value of the evening_buses edge.
+ EveningBuses []*Bus `json:"evening_buses,omitempty"`
+ // loadedTypes holds the information for reporting if a
+ // type was loaded (or requested) in eager-loading or not.
+ loadedTypes [5]bool
+}
+
+// BusOrErr returns the Bus value or an error if the edge
+// was not loaded in eager-loading.
+func (e BusRouteEdges) BusOrErr() ([]*Bus, error) {
+ if e.loadedTypes[0] {
+ return e.Bus, nil
+ }
+ return nil, &NotLoadedError{edge: "bus"}
+}
+
+// ChildBusAssociationsOrErr returns the ChildBusAssociations value or an error if the edge
+// was not loaded in eager-loading.
+func (e BusRouteEdges) ChildBusAssociationsOrErr() ([]*ChildBusAssociation, error) {
+ if e.loadedTypes[1] {
+ return e.ChildBusAssociations, nil
+ }
+ return nil, &NotLoadedError{edge: "childBusAssociations"}
+}
+
+// BusRouteAssociationsOrErr returns the BusRouteAssociations value or an error if the edge
+// was not loaded in eager-loading.
+func (e BusRouteEdges) BusRouteAssociationsOrErr() ([]*BusRouteAssociation, error) {
+ if e.loadedTypes[2] {
+ return e.BusRouteAssociations, nil
+ }
+ return nil, &NotLoadedError{edge: "busRouteAssociations"}
+}
+
+// MorningBusesOrErr returns the MorningBuses value or an error if the edge
+// was not loaded in eager-loading.
+func (e BusRouteEdges) MorningBusesOrErr() ([]*Bus, error) {
+ if e.loadedTypes[3] {
+ return e.MorningBuses, nil
+ }
+ return nil, &NotLoadedError{edge: "morning_buses"}
+}
+
+// EveningBusesOrErr returns the EveningBuses value or an error if the edge
+// was not loaded in eager-loading.
+func (e BusRouteEdges) EveningBusesOrErr() ([]*Bus, error) {
+ if e.loadedTypes[4] {
+ return e.EveningBuses, nil
+ }
+ return nil, &NotLoadedError{edge: "evening_buses"}
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*BusRoute) scanValues(columns []string) ([]any, error) {
+ values := make([]any, len(columns))
+ for i := range columns {
+ switch columns[i] {
+ case busroute.FieldBusType:
+ values[i] = new(sql.NullString)
+ case busroute.FieldCreatedAt, busroute.FieldUpdatedAt:
+ values[i] = new(sql.NullTime)
+ case busroute.FieldID:
+ values[i] = new(uuid.UUID)
+ default:
+ values[i] = new(sql.UnknownType)
+ }
+ }
+ return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the BusRoute fields.
+func (br *BusRoute) assignValues(columns []string, values []any) error {
+ if m, n := len(values), len(columns); m < n {
+ return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+ }
+ for i := range columns {
+ switch columns[i] {
+ case busroute.FieldID:
+ if value, ok := values[i].(*uuid.UUID); !ok {
+ return fmt.Errorf("unexpected type %T for field id", values[i])
+ } else if value != nil {
+ br.ID = *value
+ }
+ case busroute.FieldBusType:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field bus_type", values[i])
+ } else if value.Valid {
+ br.BusType = busroute.BusType(value.String)
+ }
+ case busroute.FieldCreatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field created_at", values[i])
+ } else if value.Valid {
+ br.CreatedAt = value.Time
+ }
+ case busroute.FieldUpdatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field updated_at", values[i])
+ } else if value.Valid {
+ br.UpdatedAt = value.Time
+ }
+ default:
+ br.selectValues.Set(columns[i], values[i])
+ }
+ }
+ return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the BusRoute.
+// This includes values selected through modifiers, order, etc.
+func (br *BusRoute) Value(name string) (ent.Value, error) {
+ return br.selectValues.Get(name)
+}
+
+// QueryBus queries the "bus" edge of the BusRoute entity.
+func (br *BusRoute) QueryBus() *BusQuery {
+ return NewBusRouteClient(br.config).QueryBus(br)
+}
+
+// QueryChildBusAssociations queries the "childBusAssociations" edge of the BusRoute entity.
+func (br *BusRoute) QueryChildBusAssociations() *ChildBusAssociationQuery {
+ return NewBusRouteClient(br.config).QueryChildBusAssociations(br)
+}
+
+// QueryBusRouteAssociations queries the "busRouteAssociations" edge of the BusRoute entity.
+func (br *BusRoute) QueryBusRouteAssociations() *BusRouteAssociationQuery {
+ return NewBusRouteClient(br.config).QueryBusRouteAssociations(br)
+}
+
+// QueryMorningBuses queries the "morning_buses" edge of the BusRoute entity.
+func (br *BusRoute) QueryMorningBuses() *BusQuery {
+ return NewBusRouteClient(br.config).QueryMorningBuses(br)
+}
+
+// QueryEveningBuses queries the "evening_buses" edge of the BusRoute entity.
+func (br *BusRoute) QueryEveningBuses() *BusQuery {
+ return NewBusRouteClient(br.config).QueryEveningBuses(br)
+}
+
+// Update returns a builder for updating this BusRoute.
+// Note that you need to call BusRoute.Unwrap() before calling this method if this BusRoute
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (br *BusRoute) Update() *BusRouteUpdateOne {
+ return NewBusRouteClient(br.config).UpdateOne(br)
+}
+
+// Unwrap unwraps the BusRoute entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (br *BusRoute) Unwrap() *BusRoute {
+ _tx, ok := br.config.driver.(*txDriver)
+ if !ok {
+ panic("ent: BusRoute is not a transactional entity")
+ }
+ br.config.driver = _tx.drv
+ return br
+}
+
+// String implements the fmt.Stringer.
+func (br *BusRoute) String() string {
+ var builder strings.Builder
+ builder.WriteString("BusRoute(")
+ builder.WriteString(fmt.Sprintf("id=%v, ", br.ID))
+ builder.WriteString("bus_type=")
+ builder.WriteString(fmt.Sprintf("%v", br.BusType))
+ builder.WriteString(", ")
+ builder.WriteString("created_at=")
+ builder.WriteString(br.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(", ")
+ builder.WriteString("updated_at=")
+ builder.WriteString(br.UpdatedAt.Format(time.ANSIC))
+ builder.WriteByte(')')
+ return builder.String()
+}
+
+// BusRoutes is a parsable slice of BusRoute.
+type BusRoutes []*BusRoute
diff --git a/backend/domain/repository/ent/busroute/busroute.go b/backend/domain/repository/ent/busroute/busroute.go
new file mode 100644
index 00000000..b5905ee7
--- /dev/null
+++ b/backend/domain/repository/ent/busroute/busroute.go
@@ -0,0 +1,256 @@
+// Code generated by ent, DO NOT EDIT.
+
+package busroute
+
+import (
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/google/uuid"
+)
+
+const (
+ // Label holds the string label denoting the busroute type in the database.
+ Label = "bus_route"
+ // FieldID holds the string denoting the id field in the database.
+ FieldID = "id"
+ // FieldBusType holds the string denoting the bus_type field in the database.
+ FieldBusType = "bus_type"
+ // FieldCreatedAt holds the string denoting the created_at field in the database.
+ FieldCreatedAt = "created_at"
+ // FieldUpdatedAt holds the string denoting the updated_at field in the database.
+ FieldUpdatedAt = "updated_at"
+ // EdgeBus holds the string denoting the bus edge name in mutations.
+ EdgeBus = "bus"
+ // EdgeChildBusAssociations holds the string denoting the childbusassociations edge name in mutations.
+ EdgeChildBusAssociations = "childBusAssociations"
+ // EdgeBusRouteAssociations holds the string denoting the busrouteassociations edge name in mutations.
+ EdgeBusRouteAssociations = "busRouteAssociations"
+ // EdgeMorningBuses holds the string denoting the morning_buses edge name in mutations.
+ EdgeMorningBuses = "morning_buses"
+ // EdgeEveningBuses holds the string denoting the evening_buses edge name in mutations.
+ EdgeEveningBuses = "evening_buses"
+ // Table holds the table name of the busroute in the database.
+ Table = "bus_routes"
+ // BusTable is the table that holds the bus relation/edge. The primary key declared below.
+ BusTable = "bus_route_bus"
+ // BusInverseTable is the table name for the Bus entity.
+ // It exists in this package in order to avoid circular dependency with the "bus" package.
+ BusInverseTable = "bus"
+ // ChildBusAssociationsTable is the table that holds the childBusAssociations relation/edge.
+ ChildBusAssociationsTable = "child_bus_associations"
+ // ChildBusAssociationsInverseTable is the table name for the ChildBusAssociation entity.
+ // It exists in this package in order to avoid circular dependency with the "childbusassociation" package.
+ ChildBusAssociationsInverseTable = "child_bus_associations"
+ // ChildBusAssociationsColumn is the table column denoting the childBusAssociations relation/edge.
+ ChildBusAssociationsColumn = "bus_route_id"
+ // BusRouteAssociationsTable is the table that holds the busRouteAssociations relation/edge.
+ BusRouteAssociationsTable = "bus_route_associations"
+ // BusRouteAssociationsInverseTable is the table name for the BusRouteAssociation entity.
+ // It exists in this package in order to avoid circular dependency with the "busrouteassociation" package.
+ BusRouteAssociationsInverseTable = "bus_route_associations"
+ // BusRouteAssociationsColumn is the table column denoting the busRouteAssociations relation/edge.
+ BusRouteAssociationsColumn = "bus_route_id"
+ // MorningBusesTable is the table that holds the morning_buses relation/edge.
+ MorningBusesTable = "bus"
+ // MorningBusesInverseTable is the table name for the Bus entity.
+ // It exists in this package in order to avoid circular dependency with the "bus" package.
+ MorningBusesInverseTable = "bus"
+ // MorningBusesColumn is the table column denoting the morning_buses relation/edge.
+ MorningBusesColumn = "bus_latest_morning_route"
+ // EveningBusesTable is the table that holds the evening_buses relation/edge.
+ EveningBusesTable = "bus"
+ // EveningBusesInverseTable is the table name for the Bus entity.
+ // It exists in this package in order to avoid circular dependency with the "bus" package.
+ EveningBusesInverseTable = "bus"
+ // EveningBusesColumn is the table column denoting the evening_buses relation/edge.
+ EveningBusesColumn = "bus_latest_evening_route"
+)
+
+// Columns holds all SQL columns for busroute fields.
+var Columns = []string{
+ FieldID,
+ FieldBusType,
+ FieldCreatedAt,
+ FieldUpdatedAt,
+}
+
+var (
+ // BusPrimaryKey and BusColumn2 are the table columns denoting the
+ // primary key for the bus relation (M2M).
+ BusPrimaryKey = []string{"bus_route_id", "bus_id"}
+)
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+ for i := range Columns {
+ if column == Columns[i] {
+ return true
+ }
+ }
+ return false
+}
+
+var (
+ // DefaultCreatedAt holds the default value on creation for the "created_at" field.
+ DefaultCreatedAt time.Time
+ // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
+ DefaultUpdatedAt func() time.Time
+ // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
+ UpdateDefaultUpdatedAt func() time.Time
+ // DefaultID holds the default value on creation for the "id" field.
+ DefaultID func() uuid.UUID
+)
+
+// BusType defines the type for the "bus_type" enum field.
+type BusType string
+
+// BusType values.
+const (
+ BusTypeMorning BusType = "morning"
+ BusTypeEvening BusType = "evening"
+)
+
+func (bt BusType) String() string {
+ return string(bt)
+}
+
+// BusTypeValidator is a validator for the "bus_type" field enum values. It is called by the builders before save.
+func BusTypeValidator(bt BusType) error {
+ switch bt {
+ case BusTypeMorning, BusTypeEvening:
+ return nil
+ default:
+ return fmt.Errorf("busroute: invalid enum value for bus_type field: %q", bt)
+ }
+}
+
+// OrderOption defines the ordering options for the BusRoute queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByBusType orders the results by the bus_type field.
+func ByBusType(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldBusType, opts...).ToFunc()
+}
+
+// ByCreatedAt orders the results by the created_at field.
+func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
+}
+
+// ByUpdatedAt orders the results by the updated_at field.
+func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
+}
+
+// ByBusCount orders the results by bus count.
+func ByBusCount(opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborsCount(s, newBusStep(), opts...)
+ }
+}
+
+// ByBus orders the results by bus terms.
+func ByBus(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newBusStep(), append([]sql.OrderTerm{term}, terms...)...)
+ }
+}
+
+// ByChildBusAssociationsCount orders the results by childBusAssociations count.
+func ByChildBusAssociationsCount(opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborsCount(s, newChildBusAssociationsStep(), opts...)
+ }
+}
+
+// ByChildBusAssociations orders the results by childBusAssociations terms.
+func ByChildBusAssociations(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newChildBusAssociationsStep(), append([]sql.OrderTerm{term}, terms...)...)
+ }
+}
+
+// ByBusRouteAssociationsCount orders the results by busRouteAssociations count.
+func ByBusRouteAssociationsCount(opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborsCount(s, newBusRouteAssociationsStep(), opts...)
+ }
+}
+
+// ByBusRouteAssociations orders the results by busRouteAssociations terms.
+func ByBusRouteAssociations(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newBusRouteAssociationsStep(), append([]sql.OrderTerm{term}, terms...)...)
+ }
+}
+
+// ByMorningBusesCount orders the results by morning_buses count.
+func ByMorningBusesCount(opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborsCount(s, newMorningBusesStep(), opts...)
+ }
+}
+
+// ByMorningBuses orders the results by morning_buses terms.
+func ByMorningBuses(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newMorningBusesStep(), append([]sql.OrderTerm{term}, terms...)...)
+ }
+}
+
+// ByEveningBusesCount orders the results by evening_buses count.
+func ByEveningBusesCount(opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborsCount(s, newEveningBusesStep(), opts...)
+ }
+}
+
+// ByEveningBuses orders the results by evening_buses terms.
+func ByEveningBuses(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newEveningBusesStep(), append([]sql.OrderTerm{term}, terms...)...)
+ }
+}
+func newBusStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(BusInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.M2M, false, BusTable, BusPrimaryKey...),
+ )
+}
+func newChildBusAssociationsStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(ChildBusAssociationsInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, ChildBusAssociationsTable, ChildBusAssociationsColumn),
+ )
+}
+func newBusRouteAssociationsStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(BusRouteAssociationsInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, BusRouteAssociationsTable, BusRouteAssociationsColumn),
+ )
+}
+func newMorningBusesStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(MorningBusesInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, MorningBusesTable, MorningBusesColumn),
+ )
+}
+func newEveningBusesStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(EveningBusesInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, EveningBusesTable, EveningBusesColumn),
+ )
+}
diff --git a/backend/domain/repository/ent/busroute/where.go b/backend/domain/repository/ent/busroute/where.go
new file mode 100644
index 00000000..6b681c07
--- /dev/null
+++ b/backend/domain/repository/ent/busroute/where.go
@@ -0,0 +1,297 @@
+// Code generated by ent, DO NOT EDIT.
+
+package busroute
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id uuid.UUID) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id uuid.UUID) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id uuid.UUID) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...uuid.UUID) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...uuid.UUID) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id uuid.UUID) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id uuid.UUID) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id uuid.UUID) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id uuid.UUID) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldLTE(FieldID, id))
+}
+
+// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
+func UpdatedAt(v time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// BusTypeEQ applies the EQ predicate on the "bus_type" field.
+func BusTypeEQ(v BusType) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldEQ(FieldBusType, v))
+}
+
+// BusTypeNEQ applies the NEQ predicate on the "bus_type" field.
+func BusTypeNEQ(v BusType) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldNEQ(FieldBusType, v))
+}
+
+// BusTypeIn applies the In predicate on the "bus_type" field.
+func BusTypeIn(vs ...BusType) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldIn(FieldBusType, vs...))
+}
+
+// BusTypeNotIn applies the NotIn predicate on the "bus_type" field.
+func BusTypeNotIn(vs ...BusType) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldNotIn(FieldBusType, vs...))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
+func UpdatedAtEQ(v time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
+func UpdatedAtNEQ(v time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldNEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtIn applies the In predicate on the "updated_at" field.
+func UpdatedAtIn(vs ...time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
+func UpdatedAtNotIn(vs ...time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldNotIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtGT applies the GT predicate on the "updated_at" field.
+func UpdatedAtGT(v time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldGT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
+func UpdatedAtGTE(v time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldGTE(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLT applies the LT predicate on the "updated_at" field.
+func UpdatedAtLT(v time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldLT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
+func UpdatedAtLTE(v time.Time) predicate.BusRoute {
+ return predicate.BusRoute(sql.FieldLTE(FieldUpdatedAt, v))
+}
+
+// HasBus applies the HasEdge predicate on the "bus" edge.
+func HasBus() predicate.BusRoute {
+ return predicate.BusRoute(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.M2M, false, BusTable, BusPrimaryKey...),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasBusWith applies the HasEdge predicate on the "bus" edge with a given conditions (other predicates).
+func HasBusWith(preds ...predicate.Bus) predicate.BusRoute {
+ return predicate.BusRoute(func(s *sql.Selector) {
+ step := newBusStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasChildBusAssociations applies the HasEdge predicate on the "childBusAssociations" edge.
+func HasChildBusAssociations() predicate.BusRoute {
+ return predicate.BusRoute(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, ChildBusAssociationsTable, ChildBusAssociationsColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasChildBusAssociationsWith applies the HasEdge predicate on the "childBusAssociations" edge with a given conditions (other predicates).
+func HasChildBusAssociationsWith(preds ...predicate.ChildBusAssociation) predicate.BusRoute {
+ return predicate.BusRoute(func(s *sql.Selector) {
+ step := newChildBusAssociationsStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasBusRouteAssociations applies the HasEdge predicate on the "busRouteAssociations" edge.
+func HasBusRouteAssociations() predicate.BusRoute {
+ return predicate.BusRoute(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, BusRouteAssociationsTable, BusRouteAssociationsColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasBusRouteAssociationsWith applies the HasEdge predicate on the "busRouteAssociations" edge with a given conditions (other predicates).
+func HasBusRouteAssociationsWith(preds ...predicate.BusRouteAssociation) predicate.BusRoute {
+ return predicate.BusRoute(func(s *sql.Selector) {
+ step := newBusRouteAssociationsStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasMorningBuses applies the HasEdge predicate on the "morning_buses" edge.
+func HasMorningBuses() predicate.BusRoute {
+ return predicate.BusRoute(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, MorningBusesTable, MorningBusesColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasMorningBusesWith applies the HasEdge predicate on the "morning_buses" edge with a given conditions (other predicates).
+func HasMorningBusesWith(preds ...predicate.Bus) predicate.BusRoute {
+ return predicate.BusRoute(func(s *sql.Selector) {
+ step := newMorningBusesStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasEveningBuses applies the HasEdge predicate on the "evening_buses" edge.
+func HasEveningBuses() predicate.BusRoute {
+ return predicate.BusRoute(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, EveningBusesTable, EveningBusesColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasEveningBusesWith applies the HasEdge predicate on the "evening_buses" edge with a given conditions (other predicates).
+func HasEveningBusesWith(preds ...predicate.Bus) predicate.BusRoute {
+ return predicate.BusRoute(func(s *sql.Selector) {
+ step := newEveningBusesStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.BusRoute) predicate.BusRoute {
+ return predicate.BusRoute(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.BusRoute) predicate.BusRoute {
+ return predicate.BusRoute(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.BusRoute) predicate.BusRoute {
+ return predicate.BusRoute(sql.NotPredicates(p))
+}
diff --git a/backend/domain/repository/ent/busroute_create.go b/backend/domain/repository/ent/busroute_create.go
new file mode 100644
index 00000000..04429c07
--- /dev/null
+++ b/backend/domain/repository/ent/busroute_create.go
@@ -0,0 +1,427 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busrouteassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childbusassociation"
+ "github.com/google/uuid"
+)
+
+// BusRouteCreate is the builder for creating a BusRoute entity.
+type BusRouteCreate struct {
+ config
+ mutation *BusRouteMutation
+ hooks []Hook
+}
+
+// SetBusType sets the "bus_type" field.
+func (brc *BusRouteCreate) SetBusType(bt busroute.BusType) *BusRouteCreate {
+ brc.mutation.SetBusType(bt)
+ return brc
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (brc *BusRouteCreate) SetCreatedAt(t time.Time) *BusRouteCreate {
+ brc.mutation.SetCreatedAt(t)
+ return brc
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (brc *BusRouteCreate) SetNillableCreatedAt(t *time.Time) *BusRouteCreate {
+ if t != nil {
+ brc.SetCreatedAt(*t)
+ }
+ return brc
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (brc *BusRouteCreate) SetUpdatedAt(t time.Time) *BusRouteCreate {
+ brc.mutation.SetUpdatedAt(t)
+ return brc
+}
+
+// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
+func (brc *BusRouteCreate) SetNillableUpdatedAt(t *time.Time) *BusRouteCreate {
+ if t != nil {
+ brc.SetUpdatedAt(*t)
+ }
+ return brc
+}
+
+// SetID sets the "id" field.
+func (brc *BusRouteCreate) SetID(u uuid.UUID) *BusRouteCreate {
+ brc.mutation.SetID(u)
+ return brc
+}
+
+// SetNillableID sets the "id" field if the given value is not nil.
+func (brc *BusRouteCreate) SetNillableID(u *uuid.UUID) *BusRouteCreate {
+ if u != nil {
+ brc.SetID(*u)
+ }
+ return brc
+}
+
+// AddBuIDs adds the "bus" edge to the Bus entity by IDs.
+func (brc *BusRouteCreate) AddBuIDs(ids ...uuid.UUID) *BusRouteCreate {
+ brc.mutation.AddBuIDs(ids...)
+ return brc
+}
+
+// AddBus adds the "bus" edges to the Bus entity.
+func (brc *BusRouteCreate) AddBus(b ...*Bus) *BusRouteCreate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return brc.AddBuIDs(ids...)
+}
+
+// AddChildBusAssociationIDs adds the "childBusAssociations" edge to the ChildBusAssociation entity by IDs.
+func (brc *BusRouteCreate) AddChildBusAssociationIDs(ids ...int) *BusRouteCreate {
+ brc.mutation.AddChildBusAssociationIDs(ids...)
+ return brc
+}
+
+// AddChildBusAssociations adds the "childBusAssociations" edges to the ChildBusAssociation entity.
+func (brc *BusRouteCreate) AddChildBusAssociations(c ...*ChildBusAssociation) *BusRouteCreate {
+ ids := make([]int, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return brc.AddChildBusAssociationIDs(ids...)
+}
+
+// AddBusRouteAssociationIDs adds the "busRouteAssociations" edge to the BusRouteAssociation entity by IDs.
+func (brc *BusRouteCreate) AddBusRouteAssociationIDs(ids ...int) *BusRouteCreate {
+ brc.mutation.AddBusRouteAssociationIDs(ids...)
+ return brc
+}
+
+// AddBusRouteAssociations adds the "busRouteAssociations" edges to the BusRouteAssociation entity.
+func (brc *BusRouteCreate) AddBusRouteAssociations(b ...*BusRouteAssociation) *BusRouteCreate {
+ ids := make([]int, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return brc.AddBusRouteAssociationIDs(ids...)
+}
+
+// AddMorningBusIDs adds the "morning_buses" edge to the Bus entity by IDs.
+func (brc *BusRouteCreate) AddMorningBusIDs(ids ...uuid.UUID) *BusRouteCreate {
+ brc.mutation.AddMorningBusIDs(ids...)
+ return brc
+}
+
+// AddMorningBuses adds the "morning_buses" edges to the Bus entity.
+func (brc *BusRouteCreate) AddMorningBuses(b ...*Bus) *BusRouteCreate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return brc.AddMorningBusIDs(ids...)
+}
+
+// AddEveningBusIDs adds the "evening_buses" edge to the Bus entity by IDs.
+func (brc *BusRouteCreate) AddEveningBusIDs(ids ...uuid.UUID) *BusRouteCreate {
+ brc.mutation.AddEveningBusIDs(ids...)
+ return brc
+}
+
+// AddEveningBuses adds the "evening_buses" edges to the Bus entity.
+func (brc *BusRouteCreate) AddEveningBuses(b ...*Bus) *BusRouteCreate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return brc.AddEveningBusIDs(ids...)
+}
+
+// Mutation returns the BusRouteMutation object of the builder.
+func (brc *BusRouteCreate) Mutation() *BusRouteMutation {
+ return brc.mutation
+}
+
+// Save creates the BusRoute in the database.
+func (brc *BusRouteCreate) Save(ctx context.Context) (*BusRoute, error) {
+ brc.defaults()
+ return withHooks(ctx, brc.sqlSave, brc.mutation, brc.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (brc *BusRouteCreate) SaveX(ctx context.Context) *BusRoute {
+ v, err := brc.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (brc *BusRouteCreate) Exec(ctx context.Context) error {
+ _, err := brc.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (brc *BusRouteCreate) ExecX(ctx context.Context) {
+ if err := brc.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (brc *BusRouteCreate) defaults() {
+ if _, ok := brc.mutation.CreatedAt(); !ok {
+ v := busroute.DefaultCreatedAt
+ brc.mutation.SetCreatedAt(v)
+ }
+ if _, ok := brc.mutation.UpdatedAt(); !ok {
+ v := busroute.DefaultUpdatedAt()
+ brc.mutation.SetUpdatedAt(v)
+ }
+ if _, ok := brc.mutation.ID(); !ok {
+ v := busroute.DefaultID()
+ brc.mutation.SetID(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (brc *BusRouteCreate) check() error {
+ if _, ok := brc.mutation.BusType(); !ok {
+ return &ValidationError{Name: "bus_type", err: errors.New(`ent: missing required field "BusRoute.bus_type"`)}
+ }
+ if v, ok := brc.mutation.BusType(); ok {
+ if err := busroute.BusTypeValidator(v); err != nil {
+ return &ValidationError{Name: "bus_type", err: fmt.Errorf(`ent: validator failed for field "BusRoute.bus_type": %w`, err)}
+ }
+ }
+ if _, ok := brc.mutation.CreatedAt(); !ok {
+ return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "BusRoute.created_at"`)}
+ }
+ if _, ok := brc.mutation.UpdatedAt(); !ok {
+ return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "BusRoute.updated_at"`)}
+ }
+ return nil
+}
+
+func (brc *BusRouteCreate) sqlSave(ctx context.Context) (*BusRoute, error) {
+ if err := brc.check(); err != nil {
+ return nil, err
+ }
+ _node, _spec := brc.createSpec()
+ if err := sqlgraph.CreateNode(ctx, brc.driver, _spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ if _spec.ID.Value != nil {
+ if id, ok := _spec.ID.Value.(*uuid.UUID); ok {
+ _node.ID = *id
+ } else if err := _node.ID.Scan(_spec.ID.Value); err != nil {
+ return nil, err
+ }
+ }
+ brc.mutation.id = &_node.ID
+ brc.mutation.done = true
+ return _node, nil
+}
+
+func (brc *BusRouteCreate) createSpec() (*BusRoute, *sqlgraph.CreateSpec) {
+ var (
+ _node = &BusRoute{config: brc.config}
+ _spec = sqlgraph.NewCreateSpec(busroute.Table, sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID))
+ )
+ if id, ok := brc.mutation.ID(); ok {
+ _node.ID = id
+ _spec.ID.Value = &id
+ }
+ if value, ok := brc.mutation.BusType(); ok {
+ _spec.SetField(busroute.FieldBusType, field.TypeEnum, value)
+ _node.BusType = value
+ }
+ if value, ok := brc.mutation.CreatedAt(); ok {
+ _spec.SetField(busroute.FieldCreatedAt, field.TypeTime, value)
+ _node.CreatedAt = value
+ }
+ if value, ok := brc.mutation.UpdatedAt(); ok {
+ _spec.SetField(busroute.FieldUpdatedAt, field.TypeTime, value)
+ _node.UpdatedAt = value
+ }
+ if nodes := brc.mutation.BusIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2M,
+ Inverse: false,
+ Table: busroute.BusTable,
+ Columns: busroute.BusPrimaryKey,
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := brc.mutation.ChildBusAssociationsIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: busroute.ChildBusAssociationsTable,
+ Columns: []string{busroute.ChildBusAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := brc.mutation.BusRouteAssociationsIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: busroute.BusRouteAssociationsTable,
+ Columns: []string{busroute.BusRouteAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := brc.mutation.MorningBusesIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: busroute.MorningBusesTable,
+ Columns: []string{busroute.MorningBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := brc.mutation.EveningBusesIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: busroute.EveningBusesTable,
+ Columns: []string{busroute.EveningBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ return _node, _spec
+}
+
+// BusRouteCreateBulk is the builder for creating many BusRoute entities in bulk.
+type BusRouteCreateBulk struct {
+ config
+ err error
+ builders []*BusRouteCreate
+}
+
+// Save creates the BusRoute entities in the database.
+func (brcb *BusRouteCreateBulk) Save(ctx context.Context) ([]*BusRoute, error) {
+ if brcb.err != nil {
+ return nil, brcb.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(brcb.builders))
+ nodes := make([]*BusRoute, len(brcb.builders))
+ mutators := make([]Mutator, len(brcb.builders))
+ for i := range brcb.builders {
+ func(i int, root context.Context) {
+ builder := brcb.builders[i]
+ builder.defaults()
+ var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+ mutation, ok := m.(*BusRouteMutation)
+ if !ok {
+ return nil, fmt.Errorf("unexpected mutation type %T", m)
+ }
+ if err := builder.check(); err != nil {
+ return nil, err
+ }
+ builder.mutation = mutation
+ var err error
+ nodes[i], specs[i] = builder.createSpec()
+ if i < len(mutators)-1 {
+ _, err = mutators[i+1].Mutate(root, brcb.builders[i+1].mutation)
+ } else {
+ spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+ // Invoke the actual operation on the latest mutation in the chain.
+ if err = sqlgraph.BatchCreate(ctx, brcb.driver, spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ }
+ }
+ if err != nil {
+ return nil, err
+ }
+ mutation.id = &nodes[i].ID
+ mutation.done = true
+ return nodes[i], nil
+ })
+ for i := len(builder.hooks) - 1; i >= 0; i-- {
+ mut = builder.hooks[i](mut)
+ }
+ mutators[i] = mut
+ }(i, ctx)
+ }
+ if len(mutators) > 0 {
+ if _, err := mutators[0].Mutate(ctx, brcb.builders[0].mutation); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (brcb *BusRouteCreateBulk) SaveX(ctx context.Context) []*BusRoute {
+ v, err := brcb.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (brcb *BusRouteCreateBulk) Exec(ctx context.Context) error {
+ _, err := brcb.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (brcb *BusRouteCreateBulk) ExecX(ctx context.Context) {
+ if err := brcb.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/busroute_delete.go b/backend/domain/repository/ent/busroute_delete.go
new file mode 100644
index 00000000..7b864110
--- /dev/null
+++ b/backend/domain/repository/ent/busroute_delete.go
@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+)
+
+// BusRouteDelete is the builder for deleting a BusRoute entity.
+type BusRouteDelete struct {
+ config
+ hooks []Hook
+ mutation *BusRouteMutation
+}
+
+// Where appends a list predicates to the BusRouteDelete builder.
+func (brd *BusRouteDelete) Where(ps ...predicate.BusRoute) *BusRouteDelete {
+ brd.mutation.Where(ps...)
+ return brd
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (brd *BusRouteDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, brd.sqlExec, brd.mutation, brd.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (brd *BusRouteDelete) ExecX(ctx context.Context) int {
+ n, err := brd.Exec(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return n
+}
+
+func (brd *BusRouteDelete) sqlExec(ctx context.Context) (int, error) {
+ _spec := sqlgraph.NewDeleteSpec(busroute.Table, sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID))
+ if ps := brd.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ affected, err := sqlgraph.DeleteNodes(ctx, brd.driver, _spec)
+ if err != nil && sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ brd.mutation.done = true
+ return affected, err
+}
+
+// BusRouteDeleteOne is the builder for deleting a single BusRoute entity.
+type BusRouteDeleteOne struct {
+ brd *BusRouteDelete
+}
+
+// Where appends a list predicates to the BusRouteDelete builder.
+func (brdo *BusRouteDeleteOne) Where(ps ...predicate.BusRoute) *BusRouteDeleteOne {
+ brdo.brd.mutation.Where(ps...)
+ return brdo
+}
+
+// Exec executes the deletion query.
+func (brdo *BusRouteDeleteOne) Exec(ctx context.Context) error {
+ n, err := brdo.brd.Exec(ctx)
+ switch {
+ case err != nil:
+ return err
+ case n == 0:
+ return &NotFoundError{busroute.Label}
+ default:
+ return nil
+ }
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (brdo *BusRouteDeleteOne) ExecX(ctx context.Context) {
+ if err := brdo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/busroute_query.go b/backend/domain/repository/ent/busroute_query.go
new file mode 100644
index 00000000..996b028c
--- /dev/null
+++ b/backend/domain/repository/ent/busroute_query.go
@@ -0,0 +1,937 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "database/sql/driver"
+ "fmt"
+ "math"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busrouteassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childbusassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// BusRouteQuery is the builder for querying BusRoute entities.
+type BusRouteQuery struct {
+ config
+ ctx *QueryContext
+ order []busroute.OrderOption
+ inters []Interceptor
+ predicates []predicate.BusRoute
+ withBus *BusQuery
+ withChildBusAssociations *ChildBusAssociationQuery
+ withBusRouteAssociations *BusRouteAssociationQuery
+ withMorningBuses *BusQuery
+ withEveningBuses *BusQuery
+ // intermediate query (i.e. traversal path).
+ sql *sql.Selector
+ path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the BusRouteQuery builder.
+func (brq *BusRouteQuery) Where(ps ...predicate.BusRoute) *BusRouteQuery {
+ brq.predicates = append(brq.predicates, ps...)
+ return brq
+}
+
+// Limit the number of records to be returned by this query.
+func (brq *BusRouteQuery) Limit(limit int) *BusRouteQuery {
+ brq.ctx.Limit = &limit
+ return brq
+}
+
+// Offset to start from.
+func (brq *BusRouteQuery) Offset(offset int) *BusRouteQuery {
+ brq.ctx.Offset = &offset
+ return brq
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (brq *BusRouteQuery) Unique(unique bool) *BusRouteQuery {
+ brq.ctx.Unique = &unique
+ return brq
+}
+
+// Order specifies how the records should be ordered.
+func (brq *BusRouteQuery) Order(o ...busroute.OrderOption) *BusRouteQuery {
+ brq.order = append(brq.order, o...)
+ return brq
+}
+
+// QueryBus chains the current query on the "bus" edge.
+func (brq *BusRouteQuery) QueryBus() *BusQuery {
+ query := (&BusClient{config: brq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := brq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := brq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(busroute.Table, busroute.FieldID, selector),
+ sqlgraph.To(bus.Table, bus.FieldID),
+ sqlgraph.Edge(sqlgraph.M2M, false, busroute.BusTable, busroute.BusPrimaryKey...),
+ )
+ fromU = sqlgraph.SetNeighbors(brq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryChildBusAssociations chains the current query on the "childBusAssociations" edge.
+func (brq *BusRouteQuery) QueryChildBusAssociations() *ChildBusAssociationQuery {
+ query := (&ChildBusAssociationClient{config: brq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := brq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := brq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(busroute.Table, busroute.FieldID, selector),
+ sqlgraph.To(childbusassociation.Table, childbusassociation.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, busroute.ChildBusAssociationsTable, busroute.ChildBusAssociationsColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(brq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryBusRouteAssociations chains the current query on the "busRouteAssociations" edge.
+func (brq *BusRouteQuery) QueryBusRouteAssociations() *BusRouteAssociationQuery {
+ query := (&BusRouteAssociationClient{config: brq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := brq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := brq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(busroute.Table, busroute.FieldID, selector),
+ sqlgraph.To(busrouteassociation.Table, busrouteassociation.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, busroute.BusRouteAssociationsTable, busroute.BusRouteAssociationsColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(brq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryMorningBuses chains the current query on the "morning_buses" edge.
+func (brq *BusRouteQuery) QueryMorningBuses() *BusQuery {
+ query := (&BusClient{config: brq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := brq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := brq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(busroute.Table, busroute.FieldID, selector),
+ sqlgraph.To(bus.Table, bus.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, busroute.MorningBusesTable, busroute.MorningBusesColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(brq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryEveningBuses chains the current query on the "evening_buses" edge.
+func (brq *BusRouteQuery) QueryEveningBuses() *BusQuery {
+ query := (&BusClient{config: brq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := brq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := brq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(busroute.Table, busroute.FieldID, selector),
+ sqlgraph.To(bus.Table, bus.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, busroute.EveningBusesTable, busroute.EveningBusesColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(brq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// First returns the first BusRoute entity from the query.
+// Returns a *NotFoundError when no BusRoute was found.
+func (brq *BusRouteQuery) First(ctx context.Context) (*BusRoute, error) {
+ nodes, err := brq.Limit(1).All(setContextOp(ctx, brq.ctx, "First"))
+ if err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nil, &NotFoundError{busroute.Label}
+ }
+ return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (brq *BusRouteQuery) FirstX(ctx context.Context) *BusRoute {
+ node, err := brq.First(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return node
+}
+
+// FirstID returns the first BusRoute ID from the query.
+// Returns a *NotFoundError when no BusRoute ID was found.
+func (brq *BusRouteQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+ var ids []uuid.UUID
+ if ids, err = brq.Limit(1).IDs(setContextOp(ctx, brq.ctx, "FirstID")); err != nil {
+ return
+ }
+ if len(ids) == 0 {
+ err = &NotFoundError{busroute.Label}
+ return
+ }
+ return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (brq *BusRouteQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := brq.FirstID(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return id
+}
+
+// Only returns a single BusRoute entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one BusRoute entity is found.
+// Returns a *NotFoundError when no BusRoute entities are found.
+func (brq *BusRouteQuery) Only(ctx context.Context) (*BusRoute, error) {
+ nodes, err := brq.Limit(2).All(setContextOp(ctx, brq.ctx, "Only"))
+ if err != nil {
+ return nil, err
+ }
+ switch len(nodes) {
+ case 1:
+ return nodes[0], nil
+ case 0:
+ return nil, &NotFoundError{busroute.Label}
+ default:
+ return nil, &NotSingularError{busroute.Label}
+ }
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (brq *BusRouteQuery) OnlyX(ctx context.Context) *BusRoute {
+ node, err := brq.Only(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// OnlyID is like Only, but returns the only BusRoute ID in the query.
+// Returns a *NotSingularError when more than one BusRoute ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (brq *BusRouteQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+ var ids []uuid.UUID
+ if ids, err = brq.Limit(2).IDs(setContextOp(ctx, brq.ctx, "OnlyID")); err != nil {
+ return
+ }
+ switch len(ids) {
+ case 1:
+ id = ids[0]
+ case 0:
+ err = &NotFoundError{busroute.Label}
+ default:
+ err = &NotSingularError{busroute.Label}
+ }
+ return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (brq *BusRouteQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := brq.OnlyID(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// All executes the query and returns a list of BusRoutes.
+func (brq *BusRouteQuery) All(ctx context.Context) ([]*BusRoute, error) {
+ ctx = setContextOp(ctx, brq.ctx, "All")
+ if err := brq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ qr := querierAll[[]*BusRoute, *BusRouteQuery]()
+ return withInterceptors[[]*BusRoute](ctx, brq, qr, brq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (brq *BusRouteQuery) AllX(ctx context.Context) []*BusRoute {
+ nodes, err := brq.All(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return nodes
+}
+
+// IDs executes the query and returns a list of BusRoute IDs.
+func (brq *BusRouteQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if brq.ctx.Unique == nil && brq.path != nil {
+ brq.Unique(true)
+ }
+ ctx = setContextOp(ctx, brq.ctx, "IDs")
+ if err = brq.Select(busroute.FieldID).Scan(ctx, &ids); err != nil {
+ return nil, err
+ }
+ return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (brq *BusRouteQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := brq.IDs(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return ids
+}
+
+// Count returns the count of the given query.
+func (brq *BusRouteQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, brq.ctx, "Count")
+ if err := brq.prepareQuery(ctx); err != nil {
+ return 0, err
+ }
+ return withInterceptors[int](ctx, brq, querierCount[*BusRouteQuery](), brq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (brq *BusRouteQuery) CountX(ctx context.Context) int {
+ count, err := brq.Count(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (brq *BusRouteQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, brq.ctx, "Exist")
+ switch _, err := brq.FirstID(ctx); {
+ case IsNotFound(err):
+ return false, nil
+ case err != nil:
+ return false, fmt.Errorf("ent: check existence: %w", err)
+ default:
+ return true, nil
+ }
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (brq *BusRouteQuery) ExistX(ctx context.Context) bool {
+ exist, err := brq.Exist(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return exist
+}
+
+// Clone returns a duplicate of the BusRouteQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (brq *BusRouteQuery) Clone() *BusRouteQuery {
+ if brq == nil {
+ return nil
+ }
+ return &BusRouteQuery{
+ config: brq.config,
+ ctx: brq.ctx.Clone(),
+ order: append([]busroute.OrderOption{}, brq.order...),
+ inters: append([]Interceptor{}, brq.inters...),
+ predicates: append([]predicate.BusRoute{}, brq.predicates...),
+ withBus: brq.withBus.Clone(),
+ withChildBusAssociations: brq.withChildBusAssociations.Clone(),
+ withBusRouteAssociations: brq.withBusRouteAssociations.Clone(),
+ withMorningBuses: brq.withMorningBuses.Clone(),
+ withEveningBuses: brq.withEveningBuses.Clone(),
+ // clone intermediate query.
+ sql: brq.sql.Clone(),
+ path: brq.path,
+ }
+}
+
+// WithBus tells the query-builder to eager-load the nodes that are connected to
+// the "bus" edge. The optional arguments are used to configure the query builder of the edge.
+func (brq *BusRouteQuery) WithBus(opts ...func(*BusQuery)) *BusRouteQuery {
+ query := (&BusClient{config: brq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ brq.withBus = query
+ return brq
+}
+
+// WithChildBusAssociations tells the query-builder to eager-load the nodes that are connected to
+// the "childBusAssociations" edge. The optional arguments are used to configure the query builder of the edge.
+func (brq *BusRouteQuery) WithChildBusAssociations(opts ...func(*ChildBusAssociationQuery)) *BusRouteQuery {
+ query := (&ChildBusAssociationClient{config: brq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ brq.withChildBusAssociations = query
+ return brq
+}
+
+// WithBusRouteAssociations tells the query-builder to eager-load the nodes that are connected to
+// the "busRouteAssociations" edge. The optional arguments are used to configure the query builder of the edge.
+func (brq *BusRouteQuery) WithBusRouteAssociations(opts ...func(*BusRouteAssociationQuery)) *BusRouteQuery {
+ query := (&BusRouteAssociationClient{config: brq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ brq.withBusRouteAssociations = query
+ return brq
+}
+
+// WithMorningBuses tells the query-builder to eager-load the nodes that are connected to
+// the "morning_buses" edge. The optional arguments are used to configure the query builder of the edge.
+func (brq *BusRouteQuery) WithMorningBuses(opts ...func(*BusQuery)) *BusRouteQuery {
+ query := (&BusClient{config: brq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ brq.withMorningBuses = query
+ return brq
+}
+
+// WithEveningBuses tells the query-builder to eager-load the nodes that are connected to
+// the "evening_buses" edge. The optional arguments are used to configure the query builder of the edge.
+func (brq *BusRouteQuery) WithEveningBuses(opts ...func(*BusQuery)) *BusRouteQuery {
+ query := (&BusClient{config: brq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ brq.withEveningBuses = query
+ return brq
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+// var v []struct {
+// BusType busroute.BusType `json:"bus_type,omitempty"`
+// Count int `json:"count,omitempty"`
+// }
+//
+// client.BusRoute.Query().
+// GroupBy(busroute.FieldBusType).
+// Aggregate(ent.Count()).
+// Scan(ctx, &v)
+func (brq *BusRouteQuery) GroupBy(field string, fields ...string) *BusRouteGroupBy {
+ brq.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &BusRouteGroupBy{build: brq}
+ grbuild.flds = &brq.ctx.Fields
+ grbuild.label = busroute.Label
+ grbuild.scan = grbuild.Scan
+ return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+// var v []struct {
+// BusType busroute.BusType `json:"bus_type,omitempty"`
+// }
+//
+// client.BusRoute.Query().
+// Select(busroute.FieldBusType).
+// Scan(ctx, &v)
+func (brq *BusRouteQuery) Select(fields ...string) *BusRouteSelect {
+ brq.ctx.Fields = append(brq.ctx.Fields, fields...)
+ sbuild := &BusRouteSelect{BusRouteQuery: brq}
+ sbuild.label = busroute.Label
+ sbuild.flds, sbuild.scan = &brq.ctx.Fields, sbuild.Scan
+ return sbuild
+}
+
+// Aggregate returns a BusRouteSelect configured with the given aggregations.
+func (brq *BusRouteQuery) Aggregate(fns ...AggregateFunc) *BusRouteSelect {
+ return brq.Select().Aggregate(fns...)
+}
+
+func (brq *BusRouteQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range brq.inters {
+ if inter == nil {
+ return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+ }
+ if trv, ok := inter.(Traverser); ok {
+ if err := trv.Traverse(ctx, brq); err != nil {
+ return err
+ }
+ }
+ }
+ for _, f := range brq.ctx.Fields {
+ if !busroute.ValidColumn(f) {
+ return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ }
+ if brq.path != nil {
+ prev, err := brq.path(ctx)
+ if err != nil {
+ return err
+ }
+ brq.sql = prev
+ }
+ return nil
+}
+
+func (brq *BusRouteQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*BusRoute, error) {
+ var (
+ nodes = []*BusRoute{}
+ _spec = brq.querySpec()
+ loadedTypes = [5]bool{
+ brq.withBus != nil,
+ brq.withChildBusAssociations != nil,
+ brq.withBusRouteAssociations != nil,
+ brq.withMorningBuses != nil,
+ brq.withEveningBuses != nil,
+ }
+ )
+ _spec.ScanValues = func(columns []string) ([]any, error) {
+ return (*BusRoute).scanValues(nil, columns)
+ }
+ _spec.Assign = func(columns []string, values []any) error {
+ node := &BusRoute{config: brq.config}
+ nodes = append(nodes, node)
+ node.Edges.loadedTypes = loadedTypes
+ return node.assignValues(columns, values)
+ }
+ for i := range hooks {
+ hooks[i](ctx, _spec)
+ }
+ if err := sqlgraph.QueryNodes(ctx, brq.driver, _spec); err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nodes, nil
+ }
+ if query := brq.withBus; query != nil {
+ if err := brq.loadBus(ctx, query, nodes,
+ func(n *BusRoute) { n.Edges.Bus = []*Bus{} },
+ func(n *BusRoute, e *Bus) { n.Edges.Bus = append(n.Edges.Bus, e) }); err != nil {
+ return nil, err
+ }
+ }
+ if query := brq.withChildBusAssociations; query != nil {
+ if err := brq.loadChildBusAssociations(ctx, query, nodes,
+ func(n *BusRoute) { n.Edges.ChildBusAssociations = []*ChildBusAssociation{} },
+ func(n *BusRoute, e *ChildBusAssociation) {
+ n.Edges.ChildBusAssociations = append(n.Edges.ChildBusAssociations, e)
+ }); err != nil {
+ return nil, err
+ }
+ }
+ if query := brq.withBusRouteAssociations; query != nil {
+ if err := brq.loadBusRouteAssociations(ctx, query, nodes,
+ func(n *BusRoute) { n.Edges.BusRouteAssociations = []*BusRouteAssociation{} },
+ func(n *BusRoute, e *BusRouteAssociation) {
+ n.Edges.BusRouteAssociations = append(n.Edges.BusRouteAssociations, e)
+ }); err != nil {
+ return nil, err
+ }
+ }
+ if query := brq.withMorningBuses; query != nil {
+ if err := brq.loadMorningBuses(ctx, query, nodes,
+ func(n *BusRoute) { n.Edges.MorningBuses = []*Bus{} },
+ func(n *BusRoute, e *Bus) { n.Edges.MorningBuses = append(n.Edges.MorningBuses, e) }); err != nil {
+ return nil, err
+ }
+ }
+ if query := brq.withEveningBuses; query != nil {
+ if err := brq.loadEveningBuses(ctx, query, nodes,
+ func(n *BusRoute) { n.Edges.EveningBuses = []*Bus{} },
+ func(n *BusRoute, e *Bus) { n.Edges.EveningBuses = append(n.Edges.EveningBuses, e) }); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+func (brq *BusRouteQuery) loadBus(ctx context.Context, query *BusQuery, nodes []*BusRoute, init func(*BusRoute), assign func(*BusRoute, *Bus)) error {
+ edgeIDs := make([]driver.Value, len(nodes))
+ byID := make(map[uuid.UUID]*BusRoute)
+ nids := make(map[uuid.UUID]map[*BusRoute]struct{})
+ for i, node := range nodes {
+ edgeIDs[i] = node.ID
+ byID[node.ID] = node
+ if init != nil {
+ init(node)
+ }
+ }
+ query.Where(func(s *sql.Selector) {
+ joinT := sql.Table(busroute.BusTable)
+ s.Join(joinT).On(s.C(bus.FieldID), joinT.C(busroute.BusPrimaryKey[1]))
+ s.Where(sql.InValues(joinT.C(busroute.BusPrimaryKey[0]), edgeIDs...))
+ columns := s.SelectedColumns()
+ s.Select(joinT.C(busroute.BusPrimaryKey[0]))
+ s.AppendSelect(columns...)
+ s.SetDistinct(false)
+ })
+ if err := query.prepareQuery(ctx); err != nil {
+ return err
+ }
+ qr := QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
+ return query.sqlAll(ctx, func(_ context.Context, spec *sqlgraph.QuerySpec) {
+ assign := spec.Assign
+ values := spec.ScanValues
+ spec.ScanValues = func(columns []string) ([]any, error) {
+ values, err := values(columns[1:])
+ if err != nil {
+ return nil, err
+ }
+ return append([]any{new(uuid.UUID)}, values...), nil
+ }
+ spec.Assign = func(columns []string, values []any) error {
+ outValue := *values[0].(*uuid.UUID)
+ inValue := *values[1].(*uuid.UUID)
+ if nids[inValue] == nil {
+ nids[inValue] = map[*BusRoute]struct{}{byID[outValue]: {}}
+ return assign(columns[1:], values[1:])
+ }
+ nids[inValue][byID[outValue]] = struct{}{}
+ return nil
+ }
+ })
+ })
+ neighbors, err := withInterceptors[[]*Bus](ctx, query, qr, query.inters)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ nodes, ok := nids[n.ID]
+ if !ok {
+ return fmt.Errorf(`unexpected "bus" node returned %v`, n.ID)
+ }
+ for kn := range nodes {
+ assign(kn, n)
+ }
+ }
+ return nil
+}
+func (brq *BusRouteQuery) loadChildBusAssociations(ctx context.Context, query *ChildBusAssociationQuery, nodes []*BusRoute, init func(*BusRoute), assign func(*BusRoute, *ChildBusAssociation)) error {
+ fks := make([]driver.Value, 0, len(nodes))
+ nodeids := make(map[uuid.UUID]*BusRoute)
+ for i := range nodes {
+ fks = append(fks, nodes[i].ID)
+ nodeids[nodes[i].ID] = nodes[i]
+ if init != nil {
+ init(nodes[i])
+ }
+ }
+ if len(query.ctx.Fields) > 0 {
+ query.ctx.AppendFieldOnce(childbusassociation.FieldBusRouteID)
+ }
+ query.Where(predicate.ChildBusAssociation(func(s *sql.Selector) {
+ s.Where(sql.InValues(s.C(busroute.ChildBusAssociationsColumn), fks...))
+ }))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ fk := n.BusRouteID
+ node, ok := nodeids[fk]
+ if !ok {
+ return fmt.Errorf(`unexpected referenced foreign-key "bus_route_id" returned %v for node %v`, fk, n.ID)
+ }
+ assign(node, n)
+ }
+ return nil
+}
+func (brq *BusRouteQuery) loadBusRouteAssociations(ctx context.Context, query *BusRouteAssociationQuery, nodes []*BusRoute, init func(*BusRoute), assign func(*BusRoute, *BusRouteAssociation)) error {
+ fks := make([]driver.Value, 0, len(nodes))
+ nodeids := make(map[uuid.UUID]*BusRoute)
+ for i := range nodes {
+ fks = append(fks, nodes[i].ID)
+ nodeids[nodes[i].ID] = nodes[i]
+ if init != nil {
+ init(nodes[i])
+ }
+ }
+ if len(query.ctx.Fields) > 0 {
+ query.ctx.AppendFieldOnce(busrouteassociation.FieldBusRouteID)
+ }
+ query.Where(predicate.BusRouteAssociation(func(s *sql.Selector) {
+ s.Where(sql.InValues(s.C(busroute.BusRouteAssociationsColumn), fks...))
+ }))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ fk := n.BusRouteID
+ node, ok := nodeids[fk]
+ if !ok {
+ return fmt.Errorf(`unexpected referenced foreign-key "bus_route_id" returned %v for node %v`, fk, n.ID)
+ }
+ assign(node, n)
+ }
+ return nil
+}
+func (brq *BusRouteQuery) loadMorningBuses(ctx context.Context, query *BusQuery, nodes []*BusRoute, init func(*BusRoute), assign func(*BusRoute, *Bus)) error {
+ fks := make([]driver.Value, 0, len(nodes))
+ nodeids := make(map[uuid.UUID]*BusRoute)
+ for i := range nodes {
+ fks = append(fks, nodes[i].ID)
+ nodeids[nodes[i].ID] = nodes[i]
+ if init != nil {
+ init(nodes[i])
+ }
+ }
+ query.withFKs = true
+ query.Where(predicate.Bus(func(s *sql.Selector) {
+ s.Where(sql.InValues(s.C(busroute.MorningBusesColumn), fks...))
+ }))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ fk := n.bus_latest_morning_route
+ if fk == nil {
+ return fmt.Errorf(`foreign-key "bus_latest_morning_route" is nil for node %v`, n.ID)
+ }
+ node, ok := nodeids[*fk]
+ if !ok {
+ return fmt.Errorf(`unexpected referenced foreign-key "bus_latest_morning_route" returned %v for node %v`, *fk, n.ID)
+ }
+ assign(node, n)
+ }
+ return nil
+}
+func (brq *BusRouteQuery) loadEveningBuses(ctx context.Context, query *BusQuery, nodes []*BusRoute, init func(*BusRoute), assign func(*BusRoute, *Bus)) error {
+ fks := make([]driver.Value, 0, len(nodes))
+ nodeids := make(map[uuid.UUID]*BusRoute)
+ for i := range nodes {
+ fks = append(fks, nodes[i].ID)
+ nodeids[nodes[i].ID] = nodes[i]
+ if init != nil {
+ init(nodes[i])
+ }
+ }
+ query.withFKs = true
+ query.Where(predicate.Bus(func(s *sql.Selector) {
+ s.Where(sql.InValues(s.C(busroute.EveningBusesColumn), fks...))
+ }))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ fk := n.bus_latest_evening_route
+ if fk == nil {
+ return fmt.Errorf(`foreign-key "bus_latest_evening_route" is nil for node %v`, n.ID)
+ }
+ node, ok := nodeids[*fk]
+ if !ok {
+ return fmt.Errorf(`unexpected referenced foreign-key "bus_latest_evening_route" returned %v for node %v`, *fk, n.ID)
+ }
+ assign(node, n)
+ }
+ return nil
+}
+
+func (brq *BusRouteQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := brq.querySpec()
+ _spec.Node.Columns = brq.ctx.Fields
+ if len(brq.ctx.Fields) > 0 {
+ _spec.Unique = brq.ctx.Unique != nil && *brq.ctx.Unique
+ }
+ return sqlgraph.CountNodes(ctx, brq.driver, _spec)
+}
+
+func (brq *BusRouteQuery) querySpec() *sqlgraph.QuerySpec {
+ _spec := sqlgraph.NewQuerySpec(busroute.Table, busroute.Columns, sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID))
+ _spec.From = brq.sql
+ if unique := brq.ctx.Unique; unique != nil {
+ _spec.Unique = *unique
+ } else if brq.path != nil {
+ _spec.Unique = true
+ }
+ if fields := brq.ctx.Fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, busroute.FieldID)
+ for i := range fields {
+ if fields[i] != busroute.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+ }
+ }
+ }
+ if ps := brq.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if limit := brq.ctx.Limit; limit != nil {
+ _spec.Limit = *limit
+ }
+ if offset := brq.ctx.Offset; offset != nil {
+ _spec.Offset = *offset
+ }
+ if ps := brq.order; len(ps) > 0 {
+ _spec.Order = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ return _spec
+}
+
+func (brq *BusRouteQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(brq.driver.Dialect())
+ t1 := builder.Table(busroute.Table)
+ columns := brq.ctx.Fields
+ if len(columns) == 0 {
+ columns = busroute.Columns
+ }
+ selector := builder.Select(t1.Columns(columns...)...).From(t1)
+ if brq.sql != nil {
+ selector = brq.sql
+ selector.Select(selector.Columns(columns...)...)
+ }
+ if brq.ctx.Unique != nil && *brq.ctx.Unique {
+ selector.Distinct()
+ }
+ for _, p := range brq.predicates {
+ p(selector)
+ }
+ for _, p := range brq.order {
+ p(selector)
+ }
+ if offset := brq.ctx.Offset; offset != nil {
+ // limit is mandatory for offset clause. We start
+ // with default value, and override it below if needed.
+ selector.Offset(*offset).Limit(math.MaxInt32)
+ }
+ if limit := brq.ctx.Limit; limit != nil {
+ selector.Limit(*limit)
+ }
+ return selector
+}
+
+// BusRouteGroupBy is the group-by builder for BusRoute entities.
+type BusRouteGroupBy struct {
+ selector
+ build *BusRouteQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (brgb *BusRouteGroupBy) Aggregate(fns ...AggregateFunc) *BusRouteGroupBy {
+ brgb.fns = append(brgb.fns, fns...)
+ return brgb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (brgb *BusRouteGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, brgb.build.ctx, "GroupBy")
+ if err := brgb.build.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*BusRouteQuery, *BusRouteGroupBy](ctx, brgb.build, brgb, brgb.build.inters, v)
+}
+
+func (brgb *BusRouteGroupBy) sqlScan(ctx context.Context, root *BusRouteQuery, v any) error {
+ selector := root.sqlQuery(ctx).Select()
+ aggregation := make([]string, 0, len(brgb.fns))
+ for _, fn := range brgb.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ if len(selector.SelectedColumns()) == 0 {
+ columns := make([]string, 0, len(*brgb.flds)+len(brgb.fns))
+ for _, f := range *brgb.flds {
+ columns = append(columns, selector.C(f))
+ }
+ columns = append(columns, aggregation...)
+ selector.Select(columns...)
+ }
+ selector.GroupBy(selector.Columns(*brgb.flds...)...)
+ if err := selector.Err(); err != nil {
+ return err
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := brgb.build.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
+
+// BusRouteSelect is the builder for selecting fields of BusRoute entities.
+type BusRouteSelect struct {
+ *BusRouteQuery
+ selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (brs *BusRouteSelect) Aggregate(fns ...AggregateFunc) *BusRouteSelect {
+ brs.fns = append(brs.fns, fns...)
+ return brs
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (brs *BusRouteSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, brs.ctx, "Select")
+ if err := brs.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*BusRouteQuery, *BusRouteSelect](ctx, brs.BusRouteQuery, brs, brs.inters, v)
+}
+
+func (brs *BusRouteSelect) sqlScan(ctx context.Context, root *BusRouteQuery, v any) error {
+ selector := root.sqlQuery(ctx)
+ aggregation := make([]string, 0, len(brs.fns))
+ for _, fn := range brs.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ switch n := len(*brs.selector.flds); {
+ case n == 0 && len(aggregation) > 0:
+ selector.Select(aggregation...)
+ case n != 0 && len(aggregation) > 0:
+ selector.AppendSelect(aggregation...)
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := brs.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
diff --git a/backend/domain/repository/ent/busroute_update.go b/backend/domain/repository/ent/busroute_update.go
new file mode 100644
index 00000000..480e14c3
--- /dev/null
+++ b/backend/domain/repository/ent/busroute_update.go
@@ -0,0 +1,1120 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busrouteassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childbusassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// BusRouteUpdate is the builder for updating BusRoute entities.
+type BusRouteUpdate struct {
+ config
+ hooks []Hook
+ mutation *BusRouteMutation
+}
+
+// Where appends a list predicates to the BusRouteUpdate builder.
+func (bru *BusRouteUpdate) Where(ps ...predicate.BusRoute) *BusRouteUpdate {
+ bru.mutation.Where(ps...)
+ return bru
+}
+
+// SetBusType sets the "bus_type" field.
+func (bru *BusRouteUpdate) SetBusType(bt busroute.BusType) *BusRouteUpdate {
+ bru.mutation.SetBusType(bt)
+ return bru
+}
+
+// SetNillableBusType sets the "bus_type" field if the given value is not nil.
+func (bru *BusRouteUpdate) SetNillableBusType(bt *busroute.BusType) *BusRouteUpdate {
+ if bt != nil {
+ bru.SetBusType(*bt)
+ }
+ return bru
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (bru *BusRouteUpdate) SetCreatedAt(t time.Time) *BusRouteUpdate {
+ bru.mutation.SetCreatedAt(t)
+ return bru
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (bru *BusRouteUpdate) SetNillableCreatedAt(t *time.Time) *BusRouteUpdate {
+ if t != nil {
+ bru.SetCreatedAt(*t)
+ }
+ return bru
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (bru *BusRouteUpdate) SetUpdatedAt(t time.Time) *BusRouteUpdate {
+ bru.mutation.SetUpdatedAt(t)
+ return bru
+}
+
+// AddBuIDs adds the "bus" edge to the Bus entity by IDs.
+func (bru *BusRouteUpdate) AddBuIDs(ids ...uuid.UUID) *BusRouteUpdate {
+ bru.mutation.AddBuIDs(ids...)
+ return bru
+}
+
+// AddBus adds the "bus" edges to the Bus entity.
+func (bru *BusRouteUpdate) AddBus(b ...*Bus) *BusRouteUpdate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bru.AddBuIDs(ids...)
+}
+
+// AddChildBusAssociationIDs adds the "childBusAssociations" edge to the ChildBusAssociation entity by IDs.
+func (bru *BusRouteUpdate) AddChildBusAssociationIDs(ids ...int) *BusRouteUpdate {
+ bru.mutation.AddChildBusAssociationIDs(ids...)
+ return bru
+}
+
+// AddChildBusAssociations adds the "childBusAssociations" edges to the ChildBusAssociation entity.
+func (bru *BusRouteUpdate) AddChildBusAssociations(c ...*ChildBusAssociation) *BusRouteUpdate {
+ ids := make([]int, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return bru.AddChildBusAssociationIDs(ids...)
+}
+
+// AddBusRouteAssociationIDs adds the "busRouteAssociations" edge to the BusRouteAssociation entity by IDs.
+func (bru *BusRouteUpdate) AddBusRouteAssociationIDs(ids ...int) *BusRouteUpdate {
+ bru.mutation.AddBusRouteAssociationIDs(ids...)
+ return bru
+}
+
+// AddBusRouteAssociations adds the "busRouteAssociations" edges to the BusRouteAssociation entity.
+func (bru *BusRouteUpdate) AddBusRouteAssociations(b ...*BusRouteAssociation) *BusRouteUpdate {
+ ids := make([]int, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bru.AddBusRouteAssociationIDs(ids...)
+}
+
+// AddMorningBusIDs adds the "morning_buses" edge to the Bus entity by IDs.
+func (bru *BusRouteUpdate) AddMorningBusIDs(ids ...uuid.UUID) *BusRouteUpdate {
+ bru.mutation.AddMorningBusIDs(ids...)
+ return bru
+}
+
+// AddMorningBuses adds the "morning_buses" edges to the Bus entity.
+func (bru *BusRouteUpdate) AddMorningBuses(b ...*Bus) *BusRouteUpdate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bru.AddMorningBusIDs(ids...)
+}
+
+// AddEveningBusIDs adds the "evening_buses" edge to the Bus entity by IDs.
+func (bru *BusRouteUpdate) AddEveningBusIDs(ids ...uuid.UUID) *BusRouteUpdate {
+ bru.mutation.AddEveningBusIDs(ids...)
+ return bru
+}
+
+// AddEveningBuses adds the "evening_buses" edges to the Bus entity.
+func (bru *BusRouteUpdate) AddEveningBuses(b ...*Bus) *BusRouteUpdate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bru.AddEveningBusIDs(ids...)
+}
+
+// Mutation returns the BusRouteMutation object of the builder.
+func (bru *BusRouteUpdate) Mutation() *BusRouteMutation {
+ return bru.mutation
+}
+
+// ClearBus clears all "bus" edges to the Bus entity.
+func (bru *BusRouteUpdate) ClearBus() *BusRouteUpdate {
+ bru.mutation.ClearBus()
+ return bru
+}
+
+// RemoveBuIDs removes the "bus" edge to Bus entities by IDs.
+func (bru *BusRouteUpdate) RemoveBuIDs(ids ...uuid.UUID) *BusRouteUpdate {
+ bru.mutation.RemoveBuIDs(ids...)
+ return bru
+}
+
+// RemoveBus removes "bus" edges to Bus entities.
+func (bru *BusRouteUpdate) RemoveBus(b ...*Bus) *BusRouteUpdate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bru.RemoveBuIDs(ids...)
+}
+
+// ClearChildBusAssociations clears all "childBusAssociations" edges to the ChildBusAssociation entity.
+func (bru *BusRouteUpdate) ClearChildBusAssociations() *BusRouteUpdate {
+ bru.mutation.ClearChildBusAssociations()
+ return bru
+}
+
+// RemoveChildBusAssociationIDs removes the "childBusAssociations" edge to ChildBusAssociation entities by IDs.
+func (bru *BusRouteUpdate) RemoveChildBusAssociationIDs(ids ...int) *BusRouteUpdate {
+ bru.mutation.RemoveChildBusAssociationIDs(ids...)
+ return bru
+}
+
+// RemoveChildBusAssociations removes "childBusAssociations" edges to ChildBusAssociation entities.
+func (bru *BusRouteUpdate) RemoveChildBusAssociations(c ...*ChildBusAssociation) *BusRouteUpdate {
+ ids := make([]int, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return bru.RemoveChildBusAssociationIDs(ids...)
+}
+
+// ClearBusRouteAssociations clears all "busRouteAssociations" edges to the BusRouteAssociation entity.
+func (bru *BusRouteUpdate) ClearBusRouteAssociations() *BusRouteUpdate {
+ bru.mutation.ClearBusRouteAssociations()
+ return bru
+}
+
+// RemoveBusRouteAssociationIDs removes the "busRouteAssociations" edge to BusRouteAssociation entities by IDs.
+func (bru *BusRouteUpdate) RemoveBusRouteAssociationIDs(ids ...int) *BusRouteUpdate {
+ bru.mutation.RemoveBusRouteAssociationIDs(ids...)
+ return bru
+}
+
+// RemoveBusRouteAssociations removes "busRouteAssociations" edges to BusRouteAssociation entities.
+func (bru *BusRouteUpdate) RemoveBusRouteAssociations(b ...*BusRouteAssociation) *BusRouteUpdate {
+ ids := make([]int, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bru.RemoveBusRouteAssociationIDs(ids...)
+}
+
+// ClearMorningBuses clears all "morning_buses" edges to the Bus entity.
+func (bru *BusRouteUpdate) ClearMorningBuses() *BusRouteUpdate {
+ bru.mutation.ClearMorningBuses()
+ return bru
+}
+
+// RemoveMorningBusIDs removes the "morning_buses" edge to Bus entities by IDs.
+func (bru *BusRouteUpdate) RemoveMorningBusIDs(ids ...uuid.UUID) *BusRouteUpdate {
+ bru.mutation.RemoveMorningBusIDs(ids...)
+ return bru
+}
+
+// RemoveMorningBuses removes "morning_buses" edges to Bus entities.
+func (bru *BusRouteUpdate) RemoveMorningBuses(b ...*Bus) *BusRouteUpdate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bru.RemoveMorningBusIDs(ids...)
+}
+
+// ClearEveningBuses clears all "evening_buses" edges to the Bus entity.
+func (bru *BusRouteUpdate) ClearEveningBuses() *BusRouteUpdate {
+ bru.mutation.ClearEveningBuses()
+ return bru
+}
+
+// RemoveEveningBusIDs removes the "evening_buses" edge to Bus entities by IDs.
+func (bru *BusRouteUpdate) RemoveEveningBusIDs(ids ...uuid.UUID) *BusRouteUpdate {
+ bru.mutation.RemoveEveningBusIDs(ids...)
+ return bru
+}
+
+// RemoveEveningBuses removes "evening_buses" edges to Bus entities.
+func (bru *BusRouteUpdate) RemoveEveningBuses(b ...*Bus) *BusRouteUpdate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bru.RemoveEveningBusIDs(ids...)
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (bru *BusRouteUpdate) Save(ctx context.Context) (int, error) {
+ bru.defaults()
+ return withHooks(ctx, bru.sqlSave, bru.mutation, bru.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (bru *BusRouteUpdate) SaveX(ctx context.Context) int {
+ affected, err := bru.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return affected
+}
+
+// Exec executes the query.
+func (bru *BusRouteUpdate) Exec(ctx context.Context) error {
+ _, err := bru.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (bru *BusRouteUpdate) ExecX(ctx context.Context) {
+ if err := bru.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (bru *BusRouteUpdate) defaults() {
+ if _, ok := bru.mutation.UpdatedAt(); !ok {
+ v := busroute.UpdateDefaultUpdatedAt()
+ bru.mutation.SetUpdatedAt(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (bru *BusRouteUpdate) check() error {
+ if v, ok := bru.mutation.BusType(); ok {
+ if err := busroute.BusTypeValidator(v); err != nil {
+ return &ValidationError{Name: "bus_type", err: fmt.Errorf(`ent: validator failed for field "BusRoute.bus_type": %w`, err)}
+ }
+ }
+ return nil
+}
+
+func (bru *BusRouteUpdate) sqlSave(ctx context.Context) (n int, err error) {
+ if err := bru.check(); err != nil {
+ return n, err
+ }
+ _spec := sqlgraph.NewUpdateSpec(busroute.Table, busroute.Columns, sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID))
+ if ps := bru.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := bru.mutation.BusType(); ok {
+ _spec.SetField(busroute.FieldBusType, field.TypeEnum, value)
+ }
+ if value, ok := bru.mutation.CreatedAt(); ok {
+ _spec.SetField(busroute.FieldCreatedAt, field.TypeTime, value)
+ }
+ if value, ok := bru.mutation.UpdatedAt(); ok {
+ _spec.SetField(busroute.FieldUpdatedAt, field.TypeTime, value)
+ }
+ if bru.mutation.BusCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2M,
+ Inverse: false,
+ Table: busroute.BusTable,
+ Columns: busroute.BusPrimaryKey,
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bru.mutation.RemovedBusIDs(); len(nodes) > 0 && !bru.mutation.BusCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2M,
+ Inverse: false,
+ Table: busroute.BusTable,
+ Columns: busroute.BusPrimaryKey,
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bru.mutation.BusIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2M,
+ Inverse: false,
+ Table: busroute.BusTable,
+ Columns: busroute.BusPrimaryKey,
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if bru.mutation.ChildBusAssociationsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: busroute.ChildBusAssociationsTable,
+ Columns: []string{busroute.ChildBusAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bru.mutation.RemovedChildBusAssociationsIDs(); len(nodes) > 0 && !bru.mutation.ChildBusAssociationsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: busroute.ChildBusAssociationsTable,
+ Columns: []string{busroute.ChildBusAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bru.mutation.ChildBusAssociationsIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: busroute.ChildBusAssociationsTable,
+ Columns: []string{busroute.ChildBusAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if bru.mutation.BusRouteAssociationsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: busroute.BusRouteAssociationsTable,
+ Columns: []string{busroute.BusRouteAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bru.mutation.RemovedBusRouteAssociationsIDs(); len(nodes) > 0 && !bru.mutation.BusRouteAssociationsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: busroute.BusRouteAssociationsTable,
+ Columns: []string{busroute.BusRouteAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bru.mutation.BusRouteAssociationsIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: busroute.BusRouteAssociationsTable,
+ Columns: []string{busroute.BusRouteAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if bru.mutation.MorningBusesCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: busroute.MorningBusesTable,
+ Columns: []string{busroute.MorningBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bru.mutation.RemovedMorningBusesIDs(); len(nodes) > 0 && !bru.mutation.MorningBusesCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: busroute.MorningBusesTable,
+ Columns: []string{busroute.MorningBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bru.mutation.MorningBusesIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: busroute.MorningBusesTable,
+ Columns: []string{busroute.MorningBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if bru.mutation.EveningBusesCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: busroute.EveningBusesTable,
+ Columns: []string{busroute.EveningBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bru.mutation.RemovedEveningBusesIDs(); len(nodes) > 0 && !bru.mutation.EveningBusesCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: busroute.EveningBusesTable,
+ Columns: []string{busroute.EveningBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bru.mutation.EveningBusesIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: busroute.EveningBusesTable,
+ Columns: []string{busroute.EveningBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if n, err = sqlgraph.UpdateNodes(ctx, bru.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{busroute.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return 0, err
+ }
+ bru.mutation.done = true
+ return n, nil
+}
+
+// BusRouteUpdateOne is the builder for updating a single BusRoute entity.
+type BusRouteUpdateOne struct {
+ config
+ fields []string
+ hooks []Hook
+ mutation *BusRouteMutation
+}
+
+// SetBusType sets the "bus_type" field.
+func (bruo *BusRouteUpdateOne) SetBusType(bt busroute.BusType) *BusRouteUpdateOne {
+ bruo.mutation.SetBusType(bt)
+ return bruo
+}
+
+// SetNillableBusType sets the "bus_type" field if the given value is not nil.
+func (bruo *BusRouteUpdateOne) SetNillableBusType(bt *busroute.BusType) *BusRouteUpdateOne {
+ if bt != nil {
+ bruo.SetBusType(*bt)
+ }
+ return bruo
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (bruo *BusRouteUpdateOne) SetCreatedAt(t time.Time) *BusRouteUpdateOne {
+ bruo.mutation.SetCreatedAt(t)
+ return bruo
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (bruo *BusRouteUpdateOne) SetNillableCreatedAt(t *time.Time) *BusRouteUpdateOne {
+ if t != nil {
+ bruo.SetCreatedAt(*t)
+ }
+ return bruo
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (bruo *BusRouteUpdateOne) SetUpdatedAt(t time.Time) *BusRouteUpdateOne {
+ bruo.mutation.SetUpdatedAt(t)
+ return bruo
+}
+
+// AddBuIDs adds the "bus" edge to the Bus entity by IDs.
+func (bruo *BusRouteUpdateOne) AddBuIDs(ids ...uuid.UUID) *BusRouteUpdateOne {
+ bruo.mutation.AddBuIDs(ids...)
+ return bruo
+}
+
+// AddBus adds the "bus" edges to the Bus entity.
+func (bruo *BusRouteUpdateOne) AddBus(b ...*Bus) *BusRouteUpdateOne {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bruo.AddBuIDs(ids...)
+}
+
+// AddChildBusAssociationIDs adds the "childBusAssociations" edge to the ChildBusAssociation entity by IDs.
+func (bruo *BusRouteUpdateOne) AddChildBusAssociationIDs(ids ...int) *BusRouteUpdateOne {
+ bruo.mutation.AddChildBusAssociationIDs(ids...)
+ return bruo
+}
+
+// AddChildBusAssociations adds the "childBusAssociations" edges to the ChildBusAssociation entity.
+func (bruo *BusRouteUpdateOne) AddChildBusAssociations(c ...*ChildBusAssociation) *BusRouteUpdateOne {
+ ids := make([]int, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return bruo.AddChildBusAssociationIDs(ids...)
+}
+
+// AddBusRouteAssociationIDs adds the "busRouteAssociations" edge to the BusRouteAssociation entity by IDs.
+func (bruo *BusRouteUpdateOne) AddBusRouteAssociationIDs(ids ...int) *BusRouteUpdateOne {
+ bruo.mutation.AddBusRouteAssociationIDs(ids...)
+ return bruo
+}
+
+// AddBusRouteAssociations adds the "busRouteAssociations" edges to the BusRouteAssociation entity.
+func (bruo *BusRouteUpdateOne) AddBusRouteAssociations(b ...*BusRouteAssociation) *BusRouteUpdateOne {
+ ids := make([]int, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bruo.AddBusRouteAssociationIDs(ids...)
+}
+
+// AddMorningBusIDs adds the "morning_buses" edge to the Bus entity by IDs.
+func (bruo *BusRouteUpdateOne) AddMorningBusIDs(ids ...uuid.UUID) *BusRouteUpdateOne {
+ bruo.mutation.AddMorningBusIDs(ids...)
+ return bruo
+}
+
+// AddMorningBuses adds the "morning_buses" edges to the Bus entity.
+func (bruo *BusRouteUpdateOne) AddMorningBuses(b ...*Bus) *BusRouteUpdateOne {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bruo.AddMorningBusIDs(ids...)
+}
+
+// AddEveningBusIDs adds the "evening_buses" edge to the Bus entity by IDs.
+func (bruo *BusRouteUpdateOne) AddEveningBusIDs(ids ...uuid.UUID) *BusRouteUpdateOne {
+ bruo.mutation.AddEveningBusIDs(ids...)
+ return bruo
+}
+
+// AddEveningBuses adds the "evening_buses" edges to the Bus entity.
+func (bruo *BusRouteUpdateOne) AddEveningBuses(b ...*Bus) *BusRouteUpdateOne {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bruo.AddEveningBusIDs(ids...)
+}
+
+// Mutation returns the BusRouteMutation object of the builder.
+func (bruo *BusRouteUpdateOne) Mutation() *BusRouteMutation {
+ return bruo.mutation
+}
+
+// ClearBus clears all "bus" edges to the Bus entity.
+func (bruo *BusRouteUpdateOne) ClearBus() *BusRouteUpdateOne {
+ bruo.mutation.ClearBus()
+ return bruo
+}
+
+// RemoveBuIDs removes the "bus" edge to Bus entities by IDs.
+func (bruo *BusRouteUpdateOne) RemoveBuIDs(ids ...uuid.UUID) *BusRouteUpdateOne {
+ bruo.mutation.RemoveBuIDs(ids...)
+ return bruo
+}
+
+// RemoveBus removes "bus" edges to Bus entities.
+func (bruo *BusRouteUpdateOne) RemoveBus(b ...*Bus) *BusRouteUpdateOne {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bruo.RemoveBuIDs(ids...)
+}
+
+// ClearChildBusAssociations clears all "childBusAssociations" edges to the ChildBusAssociation entity.
+func (bruo *BusRouteUpdateOne) ClearChildBusAssociations() *BusRouteUpdateOne {
+ bruo.mutation.ClearChildBusAssociations()
+ return bruo
+}
+
+// RemoveChildBusAssociationIDs removes the "childBusAssociations" edge to ChildBusAssociation entities by IDs.
+func (bruo *BusRouteUpdateOne) RemoveChildBusAssociationIDs(ids ...int) *BusRouteUpdateOne {
+ bruo.mutation.RemoveChildBusAssociationIDs(ids...)
+ return bruo
+}
+
+// RemoveChildBusAssociations removes "childBusAssociations" edges to ChildBusAssociation entities.
+func (bruo *BusRouteUpdateOne) RemoveChildBusAssociations(c ...*ChildBusAssociation) *BusRouteUpdateOne {
+ ids := make([]int, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return bruo.RemoveChildBusAssociationIDs(ids...)
+}
+
+// ClearBusRouteAssociations clears all "busRouteAssociations" edges to the BusRouteAssociation entity.
+func (bruo *BusRouteUpdateOne) ClearBusRouteAssociations() *BusRouteUpdateOne {
+ bruo.mutation.ClearBusRouteAssociations()
+ return bruo
+}
+
+// RemoveBusRouteAssociationIDs removes the "busRouteAssociations" edge to BusRouteAssociation entities by IDs.
+func (bruo *BusRouteUpdateOne) RemoveBusRouteAssociationIDs(ids ...int) *BusRouteUpdateOne {
+ bruo.mutation.RemoveBusRouteAssociationIDs(ids...)
+ return bruo
+}
+
+// RemoveBusRouteAssociations removes "busRouteAssociations" edges to BusRouteAssociation entities.
+func (bruo *BusRouteUpdateOne) RemoveBusRouteAssociations(b ...*BusRouteAssociation) *BusRouteUpdateOne {
+ ids := make([]int, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bruo.RemoveBusRouteAssociationIDs(ids...)
+}
+
+// ClearMorningBuses clears all "morning_buses" edges to the Bus entity.
+func (bruo *BusRouteUpdateOne) ClearMorningBuses() *BusRouteUpdateOne {
+ bruo.mutation.ClearMorningBuses()
+ return bruo
+}
+
+// RemoveMorningBusIDs removes the "morning_buses" edge to Bus entities by IDs.
+func (bruo *BusRouteUpdateOne) RemoveMorningBusIDs(ids ...uuid.UUID) *BusRouteUpdateOne {
+ bruo.mutation.RemoveMorningBusIDs(ids...)
+ return bruo
+}
+
+// RemoveMorningBuses removes "morning_buses" edges to Bus entities.
+func (bruo *BusRouteUpdateOne) RemoveMorningBuses(b ...*Bus) *BusRouteUpdateOne {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bruo.RemoveMorningBusIDs(ids...)
+}
+
+// ClearEveningBuses clears all "evening_buses" edges to the Bus entity.
+func (bruo *BusRouteUpdateOne) ClearEveningBuses() *BusRouteUpdateOne {
+ bruo.mutation.ClearEveningBuses()
+ return bruo
+}
+
+// RemoveEveningBusIDs removes the "evening_buses" edge to Bus entities by IDs.
+func (bruo *BusRouteUpdateOne) RemoveEveningBusIDs(ids ...uuid.UUID) *BusRouteUpdateOne {
+ bruo.mutation.RemoveEveningBusIDs(ids...)
+ return bruo
+}
+
+// RemoveEveningBuses removes "evening_buses" edges to Bus entities.
+func (bruo *BusRouteUpdateOne) RemoveEveningBuses(b ...*Bus) *BusRouteUpdateOne {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return bruo.RemoveEveningBusIDs(ids...)
+}
+
+// Where appends a list predicates to the BusRouteUpdate builder.
+func (bruo *BusRouteUpdateOne) Where(ps ...predicate.BusRoute) *BusRouteUpdateOne {
+ bruo.mutation.Where(ps...)
+ return bruo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (bruo *BusRouteUpdateOne) Select(field string, fields ...string) *BusRouteUpdateOne {
+ bruo.fields = append([]string{field}, fields...)
+ return bruo
+}
+
+// Save executes the query and returns the updated BusRoute entity.
+func (bruo *BusRouteUpdateOne) Save(ctx context.Context) (*BusRoute, error) {
+ bruo.defaults()
+ return withHooks(ctx, bruo.sqlSave, bruo.mutation, bruo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (bruo *BusRouteUpdateOne) SaveX(ctx context.Context) *BusRoute {
+ node, err := bruo.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// Exec executes the query on the entity.
+func (bruo *BusRouteUpdateOne) Exec(ctx context.Context) error {
+ _, err := bruo.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (bruo *BusRouteUpdateOne) ExecX(ctx context.Context) {
+ if err := bruo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (bruo *BusRouteUpdateOne) defaults() {
+ if _, ok := bruo.mutation.UpdatedAt(); !ok {
+ v := busroute.UpdateDefaultUpdatedAt()
+ bruo.mutation.SetUpdatedAt(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (bruo *BusRouteUpdateOne) check() error {
+ if v, ok := bruo.mutation.BusType(); ok {
+ if err := busroute.BusTypeValidator(v); err != nil {
+ return &ValidationError{Name: "bus_type", err: fmt.Errorf(`ent: validator failed for field "BusRoute.bus_type": %w`, err)}
+ }
+ }
+ return nil
+}
+
+func (bruo *BusRouteUpdateOne) sqlSave(ctx context.Context) (_node *BusRoute, err error) {
+ if err := bruo.check(); err != nil {
+ return _node, err
+ }
+ _spec := sqlgraph.NewUpdateSpec(busroute.Table, busroute.Columns, sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID))
+ id, ok := bruo.mutation.ID()
+ if !ok {
+ return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "BusRoute.id" for update`)}
+ }
+ _spec.Node.ID.Value = id
+ if fields := bruo.fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, busroute.FieldID)
+ for _, f := range fields {
+ if !busroute.ValidColumn(f) {
+ return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ if f != busroute.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, f)
+ }
+ }
+ }
+ if ps := bruo.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := bruo.mutation.BusType(); ok {
+ _spec.SetField(busroute.FieldBusType, field.TypeEnum, value)
+ }
+ if value, ok := bruo.mutation.CreatedAt(); ok {
+ _spec.SetField(busroute.FieldCreatedAt, field.TypeTime, value)
+ }
+ if value, ok := bruo.mutation.UpdatedAt(); ok {
+ _spec.SetField(busroute.FieldUpdatedAt, field.TypeTime, value)
+ }
+ if bruo.mutation.BusCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2M,
+ Inverse: false,
+ Table: busroute.BusTable,
+ Columns: busroute.BusPrimaryKey,
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bruo.mutation.RemovedBusIDs(); len(nodes) > 0 && !bruo.mutation.BusCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2M,
+ Inverse: false,
+ Table: busroute.BusTable,
+ Columns: busroute.BusPrimaryKey,
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bruo.mutation.BusIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2M,
+ Inverse: false,
+ Table: busroute.BusTable,
+ Columns: busroute.BusPrimaryKey,
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if bruo.mutation.ChildBusAssociationsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: busroute.ChildBusAssociationsTable,
+ Columns: []string{busroute.ChildBusAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bruo.mutation.RemovedChildBusAssociationsIDs(); len(nodes) > 0 && !bruo.mutation.ChildBusAssociationsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: busroute.ChildBusAssociationsTable,
+ Columns: []string{busroute.ChildBusAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bruo.mutation.ChildBusAssociationsIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: busroute.ChildBusAssociationsTable,
+ Columns: []string{busroute.ChildBusAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if bruo.mutation.BusRouteAssociationsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: busroute.BusRouteAssociationsTable,
+ Columns: []string{busroute.BusRouteAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bruo.mutation.RemovedBusRouteAssociationsIDs(); len(nodes) > 0 && !bruo.mutation.BusRouteAssociationsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: busroute.BusRouteAssociationsTable,
+ Columns: []string{busroute.BusRouteAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bruo.mutation.BusRouteAssociationsIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: busroute.BusRouteAssociationsTable,
+ Columns: []string{busroute.BusRouteAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if bruo.mutation.MorningBusesCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: busroute.MorningBusesTable,
+ Columns: []string{busroute.MorningBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bruo.mutation.RemovedMorningBusesIDs(); len(nodes) > 0 && !bruo.mutation.MorningBusesCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: busroute.MorningBusesTable,
+ Columns: []string{busroute.MorningBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bruo.mutation.MorningBusesIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: busroute.MorningBusesTable,
+ Columns: []string{busroute.MorningBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if bruo.mutation.EveningBusesCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: busroute.EveningBusesTable,
+ Columns: []string{busroute.EveningBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bruo.mutation.RemovedEveningBusesIDs(); len(nodes) > 0 && !bruo.mutation.EveningBusesCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: busroute.EveningBusesTable,
+ Columns: []string{busroute.EveningBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := bruo.mutation.EveningBusesIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: busroute.EveningBusesTable,
+ Columns: []string{busroute.EveningBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ _node = &BusRoute{config: bruo.config}
+ _spec.Assign = _node.assignValues
+ _spec.ScanValues = _node.scanValues
+ if err = sqlgraph.UpdateNode(ctx, bruo.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{busroute.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ bruo.mutation.done = true
+ return _node, nil
+}
diff --git a/backend/domain/repository/ent/busrouteassociation.go b/backend/domain/repository/ent/busrouteassociation.go
new file mode 100644
index 00000000..0ed88355
--- /dev/null
+++ b/backend/domain/repository/ent/busrouteassociation.go
@@ -0,0 +1,178 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "fmt"
+ "strings"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/sql"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busrouteassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// BusRouteAssociation is the model entity for the BusRouteAssociation schema.
+type BusRouteAssociation struct {
+ config `json:"-"`
+ // ID of the ent.
+ ID int `json:"id,omitempty"`
+ // StationID holds the value of the "station_id" field.
+ StationID uuid.UUID `json:"station_id,omitempty"`
+ // BusRouteID holds the value of the "bus_route_id" field.
+ BusRouteID uuid.UUID `json:"bus_route_id,omitempty"`
+ // Order holds the value of the "order" field.
+ Order int32 `json:"order,omitempty"`
+ // Edges holds the relations/edges for other nodes in the graph.
+ // The values are being populated by the BusRouteAssociationQuery when eager-loading is set.
+ Edges BusRouteAssociationEdges `json:"edges"`
+ selectValues sql.SelectValues
+}
+
+// BusRouteAssociationEdges holds the relations/edges for other nodes in the graph.
+type BusRouteAssociationEdges struct {
+ // Station holds the value of the station edge.
+ Station *Station `json:"station,omitempty"`
+ // BusRoute holds the value of the busRoute edge.
+ BusRoute *BusRoute `json:"busRoute,omitempty"`
+ // loadedTypes holds the information for reporting if a
+ // type was loaded (or requested) in eager-loading or not.
+ loadedTypes [2]bool
+}
+
+// StationOrErr returns the Station value or an error if the edge
+// was not loaded in eager-loading, or loaded but was not found.
+func (e BusRouteAssociationEdges) StationOrErr() (*Station, error) {
+ if e.loadedTypes[0] {
+ if e.Station == nil {
+ // Edge was loaded but was not found.
+ return nil, &NotFoundError{label: station.Label}
+ }
+ return e.Station, nil
+ }
+ return nil, &NotLoadedError{edge: "station"}
+}
+
+// BusRouteOrErr returns the BusRoute value or an error if the edge
+// was not loaded in eager-loading, or loaded but was not found.
+func (e BusRouteAssociationEdges) BusRouteOrErr() (*BusRoute, error) {
+ if e.loadedTypes[1] {
+ if e.BusRoute == nil {
+ // Edge was loaded but was not found.
+ return nil, &NotFoundError{label: busroute.Label}
+ }
+ return e.BusRoute, nil
+ }
+ return nil, &NotLoadedError{edge: "busRoute"}
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*BusRouteAssociation) scanValues(columns []string) ([]any, error) {
+ values := make([]any, len(columns))
+ for i := range columns {
+ switch columns[i] {
+ case busrouteassociation.FieldID, busrouteassociation.FieldOrder:
+ values[i] = new(sql.NullInt64)
+ case busrouteassociation.FieldStationID, busrouteassociation.FieldBusRouteID:
+ values[i] = new(uuid.UUID)
+ default:
+ values[i] = new(sql.UnknownType)
+ }
+ }
+ return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the BusRouteAssociation fields.
+func (bra *BusRouteAssociation) assignValues(columns []string, values []any) error {
+ if m, n := len(values), len(columns); m < n {
+ return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+ }
+ for i := range columns {
+ switch columns[i] {
+ case busrouteassociation.FieldID:
+ value, ok := values[i].(*sql.NullInt64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field id", value)
+ }
+ bra.ID = int(value.Int64)
+ case busrouteassociation.FieldStationID:
+ if value, ok := values[i].(*uuid.UUID); !ok {
+ return fmt.Errorf("unexpected type %T for field station_id", values[i])
+ } else if value != nil {
+ bra.StationID = *value
+ }
+ case busrouteassociation.FieldBusRouteID:
+ if value, ok := values[i].(*uuid.UUID); !ok {
+ return fmt.Errorf("unexpected type %T for field bus_route_id", values[i])
+ } else if value != nil {
+ bra.BusRouteID = *value
+ }
+ case busrouteassociation.FieldOrder:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field order", values[i])
+ } else if value.Valid {
+ bra.Order = int32(value.Int64)
+ }
+ default:
+ bra.selectValues.Set(columns[i], values[i])
+ }
+ }
+ return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the BusRouteAssociation.
+// This includes values selected through modifiers, order, etc.
+func (bra *BusRouteAssociation) Value(name string) (ent.Value, error) {
+ return bra.selectValues.Get(name)
+}
+
+// QueryStation queries the "station" edge of the BusRouteAssociation entity.
+func (bra *BusRouteAssociation) QueryStation() *StationQuery {
+ return NewBusRouteAssociationClient(bra.config).QueryStation(bra)
+}
+
+// QueryBusRoute queries the "busRoute" edge of the BusRouteAssociation entity.
+func (bra *BusRouteAssociation) QueryBusRoute() *BusRouteQuery {
+ return NewBusRouteAssociationClient(bra.config).QueryBusRoute(bra)
+}
+
+// Update returns a builder for updating this BusRouteAssociation.
+// Note that you need to call BusRouteAssociation.Unwrap() before calling this method if this BusRouteAssociation
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (bra *BusRouteAssociation) Update() *BusRouteAssociationUpdateOne {
+ return NewBusRouteAssociationClient(bra.config).UpdateOne(bra)
+}
+
+// Unwrap unwraps the BusRouteAssociation entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (bra *BusRouteAssociation) Unwrap() *BusRouteAssociation {
+ _tx, ok := bra.config.driver.(*txDriver)
+ if !ok {
+ panic("ent: BusRouteAssociation is not a transactional entity")
+ }
+ bra.config.driver = _tx.drv
+ return bra
+}
+
+// String implements the fmt.Stringer.
+func (bra *BusRouteAssociation) String() string {
+ var builder strings.Builder
+ builder.WriteString("BusRouteAssociation(")
+ builder.WriteString(fmt.Sprintf("id=%v, ", bra.ID))
+ builder.WriteString("station_id=")
+ builder.WriteString(fmt.Sprintf("%v", bra.StationID))
+ builder.WriteString(", ")
+ builder.WriteString("bus_route_id=")
+ builder.WriteString(fmt.Sprintf("%v", bra.BusRouteID))
+ builder.WriteString(", ")
+ builder.WriteString("order=")
+ builder.WriteString(fmt.Sprintf("%v", bra.Order))
+ builder.WriteByte(')')
+ return builder.String()
+}
+
+// BusRouteAssociations is a parsable slice of BusRouteAssociation.
+type BusRouteAssociations []*BusRouteAssociation
diff --git a/backend/domain/repository/ent/busrouteassociation/busrouteassociation.go b/backend/domain/repository/ent/busrouteassociation/busrouteassociation.go
new file mode 100644
index 00000000..0657f7cb
--- /dev/null
+++ b/backend/domain/repository/ent/busrouteassociation/busrouteassociation.go
@@ -0,0 +1,110 @@
+// Code generated by ent, DO NOT EDIT.
+
+package busrouteassociation
+
+import (
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+)
+
+const (
+ // Label holds the string label denoting the busrouteassociation type in the database.
+ Label = "bus_route_association"
+ // FieldID holds the string denoting the id field in the database.
+ FieldID = "id"
+ // FieldStationID holds the string denoting the station_id field in the database.
+ FieldStationID = "station_id"
+ // FieldBusRouteID holds the string denoting the bus_route_id field in the database.
+ FieldBusRouteID = "bus_route_id"
+ // FieldOrder holds the string denoting the order field in the database.
+ FieldOrder = "order"
+ // EdgeStation holds the string denoting the station edge name in mutations.
+ EdgeStation = "station"
+ // EdgeBusRoute holds the string denoting the busroute edge name in mutations.
+ EdgeBusRoute = "busRoute"
+ // Table holds the table name of the busrouteassociation in the database.
+ Table = "bus_route_associations"
+ // StationTable is the table that holds the station relation/edge.
+ StationTable = "bus_route_associations"
+ // StationInverseTable is the table name for the Station entity.
+ // It exists in this package in order to avoid circular dependency with the "station" package.
+ StationInverseTable = "stations"
+ // StationColumn is the table column denoting the station relation/edge.
+ StationColumn = "station_id"
+ // BusRouteTable is the table that holds the busRoute relation/edge.
+ BusRouteTable = "bus_route_associations"
+ // BusRouteInverseTable is the table name for the BusRoute entity.
+ // It exists in this package in order to avoid circular dependency with the "busroute" package.
+ BusRouteInverseTable = "bus_routes"
+ // BusRouteColumn is the table column denoting the busRoute relation/edge.
+ BusRouteColumn = "bus_route_id"
+)
+
+// Columns holds all SQL columns for busrouteassociation fields.
+var Columns = []string{
+ FieldID,
+ FieldStationID,
+ FieldBusRouteID,
+ FieldOrder,
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+ for i := range Columns {
+ if column == Columns[i] {
+ return true
+ }
+ }
+ return false
+}
+
+// OrderOption defines the ordering options for the BusRouteAssociation queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByStationID orders the results by the station_id field.
+func ByStationID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldStationID, opts...).ToFunc()
+}
+
+// ByBusRouteID orders the results by the bus_route_id field.
+func ByBusRouteID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldBusRouteID, opts...).ToFunc()
+}
+
+// ByOrder orders the results by the order field.
+func ByOrder(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldOrder, opts...).ToFunc()
+}
+
+// ByStationField orders the results by station field.
+func ByStationField(field string, opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newStationStep(), sql.OrderByField(field, opts...))
+ }
+}
+
+// ByBusRouteField orders the results by busRoute field.
+func ByBusRouteField(field string, opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newBusRouteStep(), sql.OrderByField(field, opts...))
+ }
+}
+func newStationStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(StationInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, StationTable, StationColumn),
+ )
+}
+func newBusRouteStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(BusRouteInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, BusRouteTable, BusRouteColumn),
+ )
+}
diff --git a/backend/domain/repository/ent/busrouteassociation/where.go b/backend/domain/repository/ent/busrouteassociation/where.go
new file mode 100644
index 00000000..b223c0c1
--- /dev/null
+++ b/backend/domain/repository/ent/busrouteassociation/where.go
@@ -0,0 +1,211 @@
+// Code generated by ent, DO NOT EDIT.
+
+package busrouteassociation
+
+import (
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id int) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id int) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id int) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...int) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...int) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id int) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id int) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id int) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id int) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldLTE(FieldID, id))
+}
+
+// StationID applies equality check predicate on the "station_id" field. It's identical to StationIDEQ.
+func StationID(v uuid.UUID) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldEQ(FieldStationID, v))
+}
+
+// BusRouteID applies equality check predicate on the "bus_route_id" field. It's identical to BusRouteIDEQ.
+func BusRouteID(v uuid.UUID) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldEQ(FieldBusRouteID, v))
+}
+
+// Order applies equality check predicate on the "order" field. It's identical to OrderEQ.
+func Order(v int32) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldEQ(FieldOrder, v))
+}
+
+// StationIDEQ applies the EQ predicate on the "station_id" field.
+func StationIDEQ(v uuid.UUID) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldEQ(FieldStationID, v))
+}
+
+// StationIDNEQ applies the NEQ predicate on the "station_id" field.
+func StationIDNEQ(v uuid.UUID) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldNEQ(FieldStationID, v))
+}
+
+// StationIDIn applies the In predicate on the "station_id" field.
+func StationIDIn(vs ...uuid.UUID) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldIn(FieldStationID, vs...))
+}
+
+// StationIDNotIn applies the NotIn predicate on the "station_id" field.
+func StationIDNotIn(vs ...uuid.UUID) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldNotIn(FieldStationID, vs...))
+}
+
+// BusRouteIDEQ applies the EQ predicate on the "bus_route_id" field.
+func BusRouteIDEQ(v uuid.UUID) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldEQ(FieldBusRouteID, v))
+}
+
+// BusRouteIDNEQ applies the NEQ predicate on the "bus_route_id" field.
+func BusRouteIDNEQ(v uuid.UUID) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldNEQ(FieldBusRouteID, v))
+}
+
+// BusRouteIDIn applies the In predicate on the "bus_route_id" field.
+func BusRouteIDIn(vs ...uuid.UUID) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldIn(FieldBusRouteID, vs...))
+}
+
+// BusRouteIDNotIn applies the NotIn predicate on the "bus_route_id" field.
+func BusRouteIDNotIn(vs ...uuid.UUID) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldNotIn(FieldBusRouteID, vs...))
+}
+
+// OrderEQ applies the EQ predicate on the "order" field.
+func OrderEQ(v int32) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldEQ(FieldOrder, v))
+}
+
+// OrderNEQ applies the NEQ predicate on the "order" field.
+func OrderNEQ(v int32) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldNEQ(FieldOrder, v))
+}
+
+// OrderIn applies the In predicate on the "order" field.
+func OrderIn(vs ...int32) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldIn(FieldOrder, vs...))
+}
+
+// OrderNotIn applies the NotIn predicate on the "order" field.
+func OrderNotIn(vs ...int32) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldNotIn(FieldOrder, vs...))
+}
+
+// OrderGT applies the GT predicate on the "order" field.
+func OrderGT(v int32) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldGT(FieldOrder, v))
+}
+
+// OrderGTE applies the GTE predicate on the "order" field.
+func OrderGTE(v int32) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldGTE(FieldOrder, v))
+}
+
+// OrderLT applies the LT predicate on the "order" field.
+func OrderLT(v int32) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldLT(FieldOrder, v))
+}
+
+// OrderLTE applies the LTE predicate on the "order" field.
+func OrderLTE(v int32) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.FieldLTE(FieldOrder, v))
+}
+
+// HasStation applies the HasEdge predicate on the "station" edge.
+func HasStation() predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, StationTable, StationColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasStationWith applies the HasEdge predicate on the "station" edge with a given conditions (other predicates).
+func HasStationWith(preds ...predicate.Station) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(func(s *sql.Selector) {
+ step := newStationStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasBusRoute applies the HasEdge predicate on the "busRoute" edge.
+func HasBusRoute() predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, BusRouteTable, BusRouteColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasBusRouteWith applies the HasEdge predicate on the "busRoute" edge with a given conditions (other predicates).
+func HasBusRouteWith(preds ...predicate.BusRoute) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(func(s *sql.Selector) {
+ step := newBusRouteStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.BusRouteAssociation) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.BusRouteAssociation) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.BusRouteAssociation) predicate.BusRouteAssociation {
+ return predicate.BusRouteAssociation(sql.NotPredicates(p))
+}
diff --git a/backend/domain/repository/ent/busrouteassociation_create.go b/backend/domain/repository/ent/busrouteassociation_create.go
new file mode 100644
index 00000000..0d6695f7
--- /dev/null
+++ b/backend/domain/repository/ent/busrouteassociation_create.go
@@ -0,0 +1,254 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busrouteassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// BusRouteAssociationCreate is the builder for creating a BusRouteAssociation entity.
+type BusRouteAssociationCreate struct {
+ config
+ mutation *BusRouteAssociationMutation
+ hooks []Hook
+}
+
+// SetStationID sets the "station_id" field.
+func (brac *BusRouteAssociationCreate) SetStationID(u uuid.UUID) *BusRouteAssociationCreate {
+ brac.mutation.SetStationID(u)
+ return brac
+}
+
+// SetBusRouteID sets the "bus_route_id" field.
+func (brac *BusRouteAssociationCreate) SetBusRouteID(u uuid.UUID) *BusRouteAssociationCreate {
+ brac.mutation.SetBusRouteID(u)
+ return brac
+}
+
+// SetOrder sets the "order" field.
+func (brac *BusRouteAssociationCreate) SetOrder(i int32) *BusRouteAssociationCreate {
+ brac.mutation.SetOrder(i)
+ return brac
+}
+
+// SetStation sets the "station" edge to the Station entity.
+func (brac *BusRouteAssociationCreate) SetStation(s *Station) *BusRouteAssociationCreate {
+ return brac.SetStationID(s.ID)
+}
+
+// SetBusRoute sets the "busRoute" edge to the BusRoute entity.
+func (brac *BusRouteAssociationCreate) SetBusRoute(b *BusRoute) *BusRouteAssociationCreate {
+ return brac.SetBusRouteID(b.ID)
+}
+
+// Mutation returns the BusRouteAssociationMutation object of the builder.
+func (brac *BusRouteAssociationCreate) Mutation() *BusRouteAssociationMutation {
+ return brac.mutation
+}
+
+// Save creates the BusRouteAssociation in the database.
+func (brac *BusRouteAssociationCreate) Save(ctx context.Context) (*BusRouteAssociation, error) {
+ return withHooks(ctx, brac.sqlSave, brac.mutation, brac.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (brac *BusRouteAssociationCreate) SaveX(ctx context.Context) *BusRouteAssociation {
+ v, err := brac.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (brac *BusRouteAssociationCreate) Exec(ctx context.Context) error {
+ _, err := brac.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (brac *BusRouteAssociationCreate) ExecX(ctx context.Context) {
+ if err := brac.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (brac *BusRouteAssociationCreate) check() error {
+ if _, ok := brac.mutation.StationID(); !ok {
+ return &ValidationError{Name: "station_id", err: errors.New(`ent: missing required field "BusRouteAssociation.station_id"`)}
+ }
+ if _, ok := brac.mutation.BusRouteID(); !ok {
+ return &ValidationError{Name: "bus_route_id", err: errors.New(`ent: missing required field "BusRouteAssociation.bus_route_id"`)}
+ }
+ if _, ok := brac.mutation.Order(); !ok {
+ return &ValidationError{Name: "order", err: errors.New(`ent: missing required field "BusRouteAssociation.order"`)}
+ }
+ if _, ok := brac.mutation.StationID(); !ok {
+ return &ValidationError{Name: "station", err: errors.New(`ent: missing required edge "BusRouteAssociation.station"`)}
+ }
+ if _, ok := brac.mutation.BusRouteID(); !ok {
+ return &ValidationError{Name: "busRoute", err: errors.New(`ent: missing required edge "BusRouteAssociation.busRoute"`)}
+ }
+ return nil
+}
+
+func (brac *BusRouteAssociationCreate) sqlSave(ctx context.Context) (*BusRouteAssociation, error) {
+ if err := brac.check(); err != nil {
+ return nil, err
+ }
+ _node, _spec := brac.createSpec()
+ if err := sqlgraph.CreateNode(ctx, brac.driver, _spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ id := _spec.ID.Value.(int64)
+ _node.ID = int(id)
+ brac.mutation.id = &_node.ID
+ brac.mutation.done = true
+ return _node, nil
+}
+
+func (brac *BusRouteAssociationCreate) createSpec() (*BusRouteAssociation, *sqlgraph.CreateSpec) {
+ var (
+ _node = &BusRouteAssociation{config: brac.config}
+ _spec = sqlgraph.NewCreateSpec(busrouteassociation.Table, sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt))
+ )
+ if value, ok := brac.mutation.Order(); ok {
+ _spec.SetField(busrouteassociation.FieldOrder, field.TypeInt32, value)
+ _node.Order = value
+ }
+ if nodes := brac.mutation.StationIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: busrouteassociation.StationTable,
+ Columns: []string{busrouteassociation.StationColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _node.StationID = nodes[0]
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := brac.mutation.BusRouteIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: busrouteassociation.BusRouteTable,
+ Columns: []string{busrouteassociation.BusRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _node.BusRouteID = nodes[0]
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ return _node, _spec
+}
+
+// BusRouteAssociationCreateBulk is the builder for creating many BusRouteAssociation entities in bulk.
+type BusRouteAssociationCreateBulk struct {
+ config
+ err error
+ builders []*BusRouteAssociationCreate
+}
+
+// Save creates the BusRouteAssociation entities in the database.
+func (bracb *BusRouteAssociationCreateBulk) Save(ctx context.Context) ([]*BusRouteAssociation, error) {
+ if bracb.err != nil {
+ return nil, bracb.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(bracb.builders))
+ nodes := make([]*BusRouteAssociation, len(bracb.builders))
+ mutators := make([]Mutator, len(bracb.builders))
+ for i := range bracb.builders {
+ func(i int, root context.Context) {
+ builder := bracb.builders[i]
+ var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+ mutation, ok := m.(*BusRouteAssociationMutation)
+ if !ok {
+ return nil, fmt.Errorf("unexpected mutation type %T", m)
+ }
+ if err := builder.check(); err != nil {
+ return nil, err
+ }
+ builder.mutation = mutation
+ var err error
+ nodes[i], specs[i] = builder.createSpec()
+ if i < len(mutators)-1 {
+ _, err = mutators[i+1].Mutate(root, bracb.builders[i+1].mutation)
+ } else {
+ spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+ // Invoke the actual operation on the latest mutation in the chain.
+ if err = sqlgraph.BatchCreate(ctx, bracb.driver, spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ }
+ }
+ if err != nil {
+ return nil, err
+ }
+ mutation.id = &nodes[i].ID
+ if specs[i].ID.Value != nil {
+ id := specs[i].ID.Value.(int64)
+ nodes[i].ID = int(id)
+ }
+ mutation.done = true
+ return nodes[i], nil
+ })
+ for i := len(builder.hooks) - 1; i >= 0; i-- {
+ mut = builder.hooks[i](mut)
+ }
+ mutators[i] = mut
+ }(i, ctx)
+ }
+ if len(mutators) > 0 {
+ if _, err := mutators[0].Mutate(ctx, bracb.builders[0].mutation); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (bracb *BusRouteAssociationCreateBulk) SaveX(ctx context.Context) []*BusRouteAssociation {
+ v, err := bracb.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (bracb *BusRouteAssociationCreateBulk) Exec(ctx context.Context) error {
+ _, err := bracb.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (bracb *BusRouteAssociationCreateBulk) ExecX(ctx context.Context) {
+ if err := bracb.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/busrouteassociation_delete.go b/backend/domain/repository/ent/busrouteassociation_delete.go
new file mode 100644
index 00000000..2ec0173a
--- /dev/null
+++ b/backend/domain/repository/ent/busrouteassociation_delete.go
@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busrouteassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+)
+
+// BusRouteAssociationDelete is the builder for deleting a BusRouteAssociation entity.
+type BusRouteAssociationDelete struct {
+ config
+ hooks []Hook
+ mutation *BusRouteAssociationMutation
+}
+
+// Where appends a list predicates to the BusRouteAssociationDelete builder.
+func (brad *BusRouteAssociationDelete) Where(ps ...predicate.BusRouteAssociation) *BusRouteAssociationDelete {
+ brad.mutation.Where(ps...)
+ return brad
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (brad *BusRouteAssociationDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, brad.sqlExec, brad.mutation, brad.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (brad *BusRouteAssociationDelete) ExecX(ctx context.Context) int {
+ n, err := brad.Exec(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return n
+}
+
+func (brad *BusRouteAssociationDelete) sqlExec(ctx context.Context) (int, error) {
+ _spec := sqlgraph.NewDeleteSpec(busrouteassociation.Table, sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt))
+ if ps := brad.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ affected, err := sqlgraph.DeleteNodes(ctx, brad.driver, _spec)
+ if err != nil && sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ brad.mutation.done = true
+ return affected, err
+}
+
+// BusRouteAssociationDeleteOne is the builder for deleting a single BusRouteAssociation entity.
+type BusRouteAssociationDeleteOne struct {
+ brad *BusRouteAssociationDelete
+}
+
+// Where appends a list predicates to the BusRouteAssociationDelete builder.
+func (brado *BusRouteAssociationDeleteOne) Where(ps ...predicate.BusRouteAssociation) *BusRouteAssociationDeleteOne {
+ brado.brad.mutation.Where(ps...)
+ return brado
+}
+
+// Exec executes the deletion query.
+func (brado *BusRouteAssociationDeleteOne) Exec(ctx context.Context) error {
+ n, err := brado.brad.Exec(ctx)
+ switch {
+ case err != nil:
+ return err
+ case n == 0:
+ return &NotFoundError{busrouteassociation.Label}
+ default:
+ return nil
+ }
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (brado *BusRouteAssociationDeleteOne) ExecX(ctx context.Context) {
+ if err := brado.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/busrouteassociation_query.go b/backend/domain/repository/ent/busrouteassociation_query.go
new file mode 100644
index 00000000..2dd67af6
--- /dev/null
+++ b/backend/domain/repository/ent/busrouteassociation_query.go
@@ -0,0 +1,681 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "fmt"
+ "math"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busrouteassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// BusRouteAssociationQuery is the builder for querying BusRouteAssociation entities.
+type BusRouteAssociationQuery struct {
+ config
+ ctx *QueryContext
+ order []busrouteassociation.OrderOption
+ inters []Interceptor
+ predicates []predicate.BusRouteAssociation
+ withStation *StationQuery
+ withBusRoute *BusRouteQuery
+ // intermediate query (i.e. traversal path).
+ sql *sql.Selector
+ path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the BusRouteAssociationQuery builder.
+func (braq *BusRouteAssociationQuery) Where(ps ...predicate.BusRouteAssociation) *BusRouteAssociationQuery {
+ braq.predicates = append(braq.predicates, ps...)
+ return braq
+}
+
+// Limit the number of records to be returned by this query.
+func (braq *BusRouteAssociationQuery) Limit(limit int) *BusRouteAssociationQuery {
+ braq.ctx.Limit = &limit
+ return braq
+}
+
+// Offset to start from.
+func (braq *BusRouteAssociationQuery) Offset(offset int) *BusRouteAssociationQuery {
+ braq.ctx.Offset = &offset
+ return braq
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (braq *BusRouteAssociationQuery) Unique(unique bool) *BusRouteAssociationQuery {
+ braq.ctx.Unique = &unique
+ return braq
+}
+
+// Order specifies how the records should be ordered.
+func (braq *BusRouteAssociationQuery) Order(o ...busrouteassociation.OrderOption) *BusRouteAssociationQuery {
+ braq.order = append(braq.order, o...)
+ return braq
+}
+
+// QueryStation chains the current query on the "station" edge.
+func (braq *BusRouteAssociationQuery) QueryStation() *StationQuery {
+ query := (&StationClient{config: braq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := braq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := braq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(busrouteassociation.Table, busrouteassociation.FieldID, selector),
+ sqlgraph.To(station.Table, station.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, busrouteassociation.StationTable, busrouteassociation.StationColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(braq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryBusRoute chains the current query on the "busRoute" edge.
+func (braq *BusRouteAssociationQuery) QueryBusRoute() *BusRouteQuery {
+ query := (&BusRouteClient{config: braq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := braq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := braq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(busrouteassociation.Table, busrouteassociation.FieldID, selector),
+ sqlgraph.To(busroute.Table, busroute.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, busrouteassociation.BusRouteTable, busrouteassociation.BusRouteColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(braq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// First returns the first BusRouteAssociation entity from the query.
+// Returns a *NotFoundError when no BusRouteAssociation was found.
+func (braq *BusRouteAssociationQuery) First(ctx context.Context) (*BusRouteAssociation, error) {
+ nodes, err := braq.Limit(1).All(setContextOp(ctx, braq.ctx, "First"))
+ if err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nil, &NotFoundError{busrouteassociation.Label}
+ }
+ return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (braq *BusRouteAssociationQuery) FirstX(ctx context.Context) *BusRouteAssociation {
+ node, err := braq.First(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return node
+}
+
+// FirstID returns the first BusRouteAssociation ID from the query.
+// Returns a *NotFoundError when no BusRouteAssociation ID was found.
+func (braq *BusRouteAssociationQuery) FirstID(ctx context.Context) (id int, err error) {
+ var ids []int
+ if ids, err = braq.Limit(1).IDs(setContextOp(ctx, braq.ctx, "FirstID")); err != nil {
+ return
+ }
+ if len(ids) == 0 {
+ err = &NotFoundError{busrouteassociation.Label}
+ return
+ }
+ return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (braq *BusRouteAssociationQuery) FirstIDX(ctx context.Context) int {
+ id, err := braq.FirstID(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return id
+}
+
+// Only returns a single BusRouteAssociation entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one BusRouteAssociation entity is found.
+// Returns a *NotFoundError when no BusRouteAssociation entities are found.
+func (braq *BusRouteAssociationQuery) Only(ctx context.Context) (*BusRouteAssociation, error) {
+ nodes, err := braq.Limit(2).All(setContextOp(ctx, braq.ctx, "Only"))
+ if err != nil {
+ return nil, err
+ }
+ switch len(nodes) {
+ case 1:
+ return nodes[0], nil
+ case 0:
+ return nil, &NotFoundError{busrouteassociation.Label}
+ default:
+ return nil, &NotSingularError{busrouteassociation.Label}
+ }
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (braq *BusRouteAssociationQuery) OnlyX(ctx context.Context) *BusRouteAssociation {
+ node, err := braq.Only(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// OnlyID is like Only, but returns the only BusRouteAssociation ID in the query.
+// Returns a *NotSingularError when more than one BusRouteAssociation ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (braq *BusRouteAssociationQuery) OnlyID(ctx context.Context) (id int, err error) {
+ var ids []int
+ if ids, err = braq.Limit(2).IDs(setContextOp(ctx, braq.ctx, "OnlyID")); err != nil {
+ return
+ }
+ switch len(ids) {
+ case 1:
+ id = ids[0]
+ case 0:
+ err = &NotFoundError{busrouteassociation.Label}
+ default:
+ err = &NotSingularError{busrouteassociation.Label}
+ }
+ return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (braq *BusRouteAssociationQuery) OnlyIDX(ctx context.Context) int {
+ id, err := braq.OnlyID(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// All executes the query and returns a list of BusRouteAssociations.
+func (braq *BusRouteAssociationQuery) All(ctx context.Context) ([]*BusRouteAssociation, error) {
+ ctx = setContextOp(ctx, braq.ctx, "All")
+ if err := braq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ qr := querierAll[[]*BusRouteAssociation, *BusRouteAssociationQuery]()
+ return withInterceptors[[]*BusRouteAssociation](ctx, braq, qr, braq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (braq *BusRouteAssociationQuery) AllX(ctx context.Context) []*BusRouteAssociation {
+ nodes, err := braq.All(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return nodes
+}
+
+// IDs executes the query and returns a list of BusRouteAssociation IDs.
+func (braq *BusRouteAssociationQuery) IDs(ctx context.Context) (ids []int, err error) {
+ if braq.ctx.Unique == nil && braq.path != nil {
+ braq.Unique(true)
+ }
+ ctx = setContextOp(ctx, braq.ctx, "IDs")
+ if err = braq.Select(busrouteassociation.FieldID).Scan(ctx, &ids); err != nil {
+ return nil, err
+ }
+ return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (braq *BusRouteAssociationQuery) IDsX(ctx context.Context) []int {
+ ids, err := braq.IDs(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return ids
+}
+
+// Count returns the count of the given query.
+func (braq *BusRouteAssociationQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, braq.ctx, "Count")
+ if err := braq.prepareQuery(ctx); err != nil {
+ return 0, err
+ }
+ return withInterceptors[int](ctx, braq, querierCount[*BusRouteAssociationQuery](), braq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (braq *BusRouteAssociationQuery) CountX(ctx context.Context) int {
+ count, err := braq.Count(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (braq *BusRouteAssociationQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, braq.ctx, "Exist")
+ switch _, err := braq.FirstID(ctx); {
+ case IsNotFound(err):
+ return false, nil
+ case err != nil:
+ return false, fmt.Errorf("ent: check existence: %w", err)
+ default:
+ return true, nil
+ }
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (braq *BusRouteAssociationQuery) ExistX(ctx context.Context) bool {
+ exist, err := braq.Exist(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return exist
+}
+
+// Clone returns a duplicate of the BusRouteAssociationQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (braq *BusRouteAssociationQuery) Clone() *BusRouteAssociationQuery {
+ if braq == nil {
+ return nil
+ }
+ return &BusRouteAssociationQuery{
+ config: braq.config,
+ ctx: braq.ctx.Clone(),
+ order: append([]busrouteassociation.OrderOption{}, braq.order...),
+ inters: append([]Interceptor{}, braq.inters...),
+ predicates: append([]predicate.BusRouteAssociation{}, braq.predicates...),
+ withStation: braq.withStation.Clone(),
+ withBusRoute: braq.withBusRoute.Clone(),
+ // clone intermediate query.
+ sql: braq.sql.Clone(),
+ path: braq.path,
+ }
+}
+
+// WithStation tells the query-builder to eager-load the nodes that are connected to
+// the "station" edge. The optional arguments are used to configure the query builder of the edge.
+func (braq *BusRouteAssociationQuery) WithStation(opts ...func(*StationQuery)) *BusRouteAssociationQuery {
+ query := (&StationClient{config: braq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ braq.withStation = query
+ return braq
+}
+
+// WithBusRoute tells the query-builder to eager-load the nodes that are connected to
+// the "busRoute" edge. The optional arguments are used to configure the query builder of the edge.
+func (braq *BusRouteAssociationQuery) WithBusRoute(opts ...func(*BusRouteQuery)) *BusRouteAssociationQuery {
+ query := (&BusRouteClient{config: braq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ braq.withBusRoute = query
+ return braq
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+// var v []struct {
+// StationID uuid.UUID `json:"station_id,omitempty"`
+// Count int `json:"count,omitempty"`
+// }
+//
+// client.BusRouteAssociation.Query().
+// GroupBy(busrouteassociation.FieldStationID).
+// Aggregate(ent.Count()).
+// Scan(ctx, &v)
+func (braq *BusRouteAssociationQuery) GroupBy(field string, fields ...string) *BusRouteAssociationGroupBy {
+ braq.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &BusRouteAssociationGroupBy{build: braq}
+ grbuild.flds = &braq.ctx.Fields
+ grbuild.label = busrouteassociation.Label
+ grbuild.scan = grbuild.Scan
+ return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+// var v []struct {
+// StationID uuid.UUID `json:"station_id,omitempty"`
+// }
+//
+// client.BusRouteAssociation.Query().
+// Select(busrouteassociation.FieldStationID).
+// Scan(ctx, &v)
+func (braq *BusRouteAssociationQuery) Select(fields ...string) *BusRouteAssociationSelect {
+ braq.ctx.Fields = append(braq.ctx.Fields, fields...)
+ sbuild := &BusRouteAssociationSelect{BusRouteAssociationQuery: braq}
+ sbuild.label = busrouteassociation.Label
+ sbuild.flds, sbuild.scan = &braq.ctx.Fields, sbuild.Scan
+ return sbuild
+}
+
+// Aggregate returns a BusRouteAssociationSelect configured with the given aggregations.
+func (braq *BusRouteAssociationQuery) Aggregate(fns ...AggregateFunc) *BusRouteAssociationSelect {
+ return braq.Select().Aggregate(fns...)
+}
+
+func (braq *BusRouteAssociationQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range braq.inters {
+ if inter == nil {
+ return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+ }
+ if trv, ok := inter.(Traverser); ok {
+ if err := trv.Traverse(ctx, braq); err != nil {
+ return err
+ }
+ }
+ }
+ for _, f := range braq.ctx.Fields {
+ if !busrouteassociation.ValidColumn(f) {
+ return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ }
+ if braq.path != nil {
+ prev, err := braq.path(ctx)
+ if err != nil {
+ return err
+ }
+ braq.sql = prev
+ }
+ return nil
+}
+
+func (braq *BusRouteAssociationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*BusRouteAssociation, error) {
+ var (
+ nodes = []*BusRouteAssociation{}
+ _spec = braq.querySpec()
+ loadedTypes = [2]bool{
+ braq.withStation != nil,
+ braq.withBusRoute != nil,
+ }
+ )
+ _spec.ScanValues = func(columns []string) ([]any, error) {
+ return (*BusRouteAssociation).scanValues(nil, columns)
+ }
+ _spec.Assign = func(columns []string, values []any) error {
+ node := &BusRouteAssociation{config: braq.config}
+ nodes = append(nodes, node)
+ node.Edges.loadedTypes = loadedTypes
+ return node.assignValues(columns, values)
+ }
+ for i := range hooks {
+ hooks[i](ctx, _spec)
+ }
+ if err := sqlgraph.QueryNodes(ctx, braq.driver, _spec); err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nodes, nil
+ }
+ if query := braq.withStation; query != nil {
+ if err := braq.loadStation(ctx, query, nodes, nil,
+ func(n *BusRouteAssociation, e *Station) { n.Edges.Station = e }); err != nil {
+ return nil, err
+ }
+ }
+ if query := braq.withBusRoute; query != nil {
+ if err := braq.loadBusRoute(ctx, query, nodes, nil,
+ func(n *BusRouteAssociation, e *BusRoute) { n.Edges.BusRoute = e }); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+func (braq *BusRouteAssociationQuery) loadStation(ctx context.Context, query *StationQuery, nodes []*BusRouteAssociation, init func(*BusRouteAssociation), assign func(*BusRouteAssociation, *Station)) error {
+ ids := make([]uuid.UUID, 0, len(nodes))
+ nodeids := make(map[uuid.UUID][]*BusRouteAssociation)
+ for i := range nodes {
+ fk := nodes[i].StationID
+ if _, ok := nodeids[fk]; !ok {
+ ids = append(ids, fk)
+ }
+ nodeids[fk] = append(nodeids[fk], nodes[i])
+ }
+ if len(ids) == 0 {
+ return nil
+ }
+ query.Where(station.IDIn(ids...))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ nodes, ok := nodeids[n.ID]
+ if !ok {
+ return fmt.Errorf(`unexpected foreign-key "station_id" returned %v`, n.ID)
+ }
+ for i := range nodes {
+ assign(nodes[i], n)
+ }
+ }
+ return nil
+}
+func (braq *BusRouteAssociationQuery) loadBusRoute(ctx context.Context, query *BusRouteQuery, nodes []*BusRouteAssociation, init func(*BusRouteAssociation), assign func(*BusRouteAssociation, *BusRoute)) error {
+ ids := make([]uuid.UUID, 0, len(nodes))
+ nodeids := make(map[uuid.UUID][]*BusRouteAssociation)
+ for i := range nodes {
+ fk := nodes[i].BusRouteID
+ if _, ok := nodeids[fk]; !ok {
+ ids = append(ids, fk)
+ }
+ nodeids[fk] = append(nodeids[fk], nodes[i])
+ }
+ if len(ids) == 0 {
+ return nil
+ }
+ query.Where(busroute.IDIn(ids...))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ nodes, ok := nodeids[n.ID]
+ if !ok {
+ return fmt.Errorf(`unexpected foreign-key "bus_route_id" returned %v`, n.ID)
+ }
+ for i := range nodes {
+ assign(nodes[i], n)
+ }
+ }
+ return nil
+}
+
+func (braq *BusRouteAssociationQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := braq.querySpec()
+ _spec.Node.Columns = braq.ctx.Fields
+ if len(braq.ctx.Fields) > 0 {
+ _spec.Unique = braq.ctx.Unique != nil && *braq.ctx.Unique
+ }
+ return sqlgraph.CountNodes(ctx, braq.driver, _spec)
+}
+
+func (braq *BusRouteAssociationQuery) querySpec() *sqlgraph.QuerySpec {
+ _spec := sqlgraph.NewQuerySpec(busrouteassociation.Table, busrouteassociation.Columns, sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt))
+ _spec.From = braq.sql
+ if unique := braq.ctx.Unique; unique != nil {
+ _spec.Unique = *unique
+ } else if braq.path != nil {
+ _spec.Unique = true
+ }
+ if fields := braq.ctx.Fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, busrouteassociation.FieldID)
+ for i := range fields {
+ if fields[i] != busrouteassociation.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+ }
+ }
+ if braq.withStation != nil {
+ _spec.Node.AddColumnOnce(busrouteassociation.FieldStationID)
+ }
+ if braq.withBusRoute != nil {
+ _spec.Node.AddColumnOnce(busrouteassociation.FieldBusRouteID)
+ }
+ }
+ if ps := braq.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if limit := braq.ctx.Limit; limit != nil {
+ _spec.Limit = *limit
+ }
+ if offset := braq.ctx.Offset; offset != nil {
+ _spec.Offset = *offset
+ }
+ if ps := braq.order; len(ps) > 0 {
+ _spec.Order = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ return _spec
+}
+
+func (braq *BusRouteAssociationQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(braq.driver.Dialect())
+ t1 := builder.Table(busrouteassociation.Table)
+ columns := braq.ctx.Fields
+ if len(columns) == 0 {
+ columns = busrouteassociation.Columns
+ }
+ selector := builder.Select(t1.Columns(columns...)...).From(t1)
+ if braq.sql != nil {
+ selector = braq.sql
+ selector.Select(selector.Columns(columns...)...)
+ }
+ if braq.ctx.Unique != nil && *braq.ctx.Unique {
+ selector.Distinct()
+ }
+ for _, p := range braq.predicates {
+ p(selector)
+ }
+ for _, p := range braq.order {
+ p(selector)
+ }
+ if offset := braq.ctx.Offset; offset != nil {
+ // limit is mandatory for offset clause. We start
+ // with default value, and override it below if needed.
+ selector.Offset(*offset).Limit(math.MaxInt32)
+ }
+ if limit := braq.ctx.Limit; limit != nil {
+ selector.Limit(*limit)
+ }
+ return selector
+}
+
+// BusRouteAssociationGroupBy is the group-by builder for BusRouteAssociation entities.
+type BusRouteAssociationGroupBy struct {
+ selector
+ build *BusRouteAssociationQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (bragb *BusRouteAssociationGroupBy) Aggregate(fns ...AggregateFunc) *BusRouteAssociationGroupBy {
+ bragb.fns = append(bragb.fns, fns...)
+ return bragb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (bragb *BusRouteAssociationGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, bragb.build.ctx, "GroupBy")
+ if err := bragb.build.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*BusRouteAssociationQuery, *BusRouteAssociationGroupBy](ctx, bragb.build, bragb, bragb.build.inters, v)
+}
+
+func (bragb *BusRouteAssociationGroupBy) sqlScan(ctx context.Context, root *BusRouteAssociationQuery, v any) error {
+ selector := root.sqlQuery(ctx).Select()
+ aggregation := make([]string, 0, len(bragb.fns))
+ for _, fn := range bragb.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ if len(selector.SelectedColumns()) == 0 {
+ columns := make([]string, 0, len(*bragb.flds)+len(bragb.fns))
+ for _, f := range *bragb.flds {
+ columns = append(columns, selector.C(f))
+ }
+ columns = append(columns, aggregation...)
+ selector.Select(columns...)
+ }
+ selector.GroupBy(selector.Columns(*bragb.flds...)...)
+ if err := selector.Err(); err != nil {
+ return err
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := bragb.build.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
+
+// BusRouteAssociationSelect is the builder for selecting fields of BusRouteAssociation entities.
+type BusRouteAssociationSelect struct {
+ *BusRouteAssociationQuery
+ selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (bras *BusRouteAssociationSelect) Aggregate(fns ...AggregateFunc) *BusRouteAssociationSelect {
+ bras.fns = append(bras.fns, fns...)
+ return bras
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (bras *BusRouteAssociationSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, bras.ctx, "Select")
+ if err := bras.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*BusRouteAssociationQuery, *BusRouteAssociationSelect](ctx, bras.BusRouteAssociationQuery, bras, bras.inters, v)
+}
+
+func (bras *BusRouteAssociationSelect) sqlScan(ctx context.Context, root *BusRouteAssociationQuery, v any) error {
+ selector := root.sqlQuery(ctx)
+ aggregation := make([]string, 0, len(bras.fns))
+ for _, fn := range bras.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ switch n := len(*bras.selector.flds); {
+ case n == 0 && len(aggregation) > 0:
+ selector.Select(aggregation...)
+ case n != 0 && len(aggregation) > 0:
+ selector.AppendSelect(aggregation...)
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := bras.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
diff --git a/backend/domain/repository/ent/busrouteassociation_update.go b/backend/domain/repository/ent/busrouteassociation_update.go
new file mode 100644
index 00000000..41bfe4f2
--- /dev/null
+++ b/backend/domain/repository/ent/busrouteassociation_update.go
@@ -0,0 +1,476 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busrouteassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// BusRouteAssociationUpdate is the builder for updating BusRouteAssociation entities.
+type BusRouteAssociationUpdate struct {
+ config
+ hooks []Hook
+ mutation *BusRouteAssociationMutation
+}
+
+// Where appends a list predicates to the BusRouteAssociationUpdate builder.
+func (brau *BusRouteAssociationUpdate) Where(ps ...predicate.BusRouteAssociation) *BusRouteAssociationUpdate {
+ brau.mutation.Where(ps...)
+ return brau
+}
+
+// SetStationID sets the "station_id" field.
+func (brau *BusRouteAssociationUpdate) SetStationID(u uuid.UUID) *BusRouteAssociationUpdate {
+ brau.mutation.SetStationID(u)
+ return brau
+}
+
+// SetNillableStationID sets the "station_id" field if the given value is not nil.
+func (brau *BusRouteAssociationUpdate) SetNillableStationID(u *uuid.UUID) *BusRouteAssociationUpdate {
+ if u != nil {
+ brau.SetStationID(*u)
+ }
+ return brau
+}
+
+// SetBusRouteID sets the "bus_route_id" field.
+func (brau *BusRouteAssociationUpdate) SetBusRouteID(u uuid.UUID) *BusRouteAssociationUpdate {
+ brau.mutation.SetBusRouteID(u)
+ return brau
+}
+
+// SetNillableBusRouteID sets the "bus_route_id" field if the given value is not nil.
+func (brau *BusRouteAssociationUpdate) SetNillableBusRouteID(u *uuid.UUID) *BusRouteAssociationUpdate {
+ if u != nil {
+ brau.SetBusRouteID(*u)
+ }
+ return brau
+}
+
+// SetOrder sets the "order" field.
+func (brau *BusRouteAssociationUpdate) SetOrder(i int32) *BusRouteAssociationUpdate {
+ brau.mutation.ResetOrder()
+ brau.mutation.SetOrder(i)
+ return brau
+}
+
+// SetNillableOrder sets the "order" field if the given value is not nil.
+func (brau *BusRouteAssociationUpdate) SetNillableOrder(i *int32) *BusRouteAssociationUpdate {
+ if i != nil {
+ brau.SetOrder(*i)
+ }
+ return brau
+}
+
+// AddOrder adds i to the "order" field.
+func (brau *BusRouteAssociationUpdate) AddOrder(i int32) *BusRouteAssociationUpdate {
+ brau.mutation.AddOrder(i)
+ return brau
+}
+
+// SetStation sets the "station" edge to the Station entity.
+func (brau *BusRouteAssociationUpdate) SetStation(s *Station) *BusRouteAssociationUpdate {
+ return brau.SetStationID(s.ID)
+}
+
+// SetBusRoute sets the "busRoute" edge to the BusRoute entity.
+func (brau *BusRouteAssociationUpdate) SetBusRoute(b *BusRoute) *BusRouteAssociationUpdate {
+ return brau.SetBusRouteID(b.ID)
+}
+
+// Mutation returns the BusRouteAssociationMutation object of the builder.
+func (brau *BusRouteAssociationUpdate) Mutation() *BusRouteAssociationMutation {
+ return brau.mutation
+}
+
+// ClearStation clears the "station" edge to the Station entity.
+func (brau *BusRouteAssociationUpdate) ClearStation() *BusRouteAssociationUpdate {
+ brau.mutation.ClearStation()
+ return brau
+}
+
+// ClearBusRoute clears the "busRoute" edge to the BusRoute entity.
+func (brau *BusRouteAssociationUpdate) ClearBusRoute() *BusRouteAssociationUpdate {
+ brau.mutation.ClearBusRoute()
+ return brau
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (brau *BusRouteAssociationUpdate) Save(ctx context.Context) (int, error) {
+ return withHooks(ctx, brau.sqlSave, brau.mutation, brau.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (brau *BusRouteAssociationUpdate) SaveX(ctx context.Context) int {
+ affected, err := brau.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return affected
+}
+
+// Exec executes the query.
+func (brau *BusRouteAssociationUpdate) Exec(ctx context.Context) error {
+ _, err := brau.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (brau *BusRouteAssociationUpdate) ExecX(ctx context.Context) {
+ if err := brau.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (brau *BusRouteAssociationUpdate) check() error {
+ if _, ok := brau.mutation.StationID(); brau.mutation.StationCleared() && !ok {
+ return errors.New(`ent: clearing a required unique edge "BusRouteAssociation.station"`)
+ }
+ if _, ok := brau.mutation.BusRouteID(); brau.mutation.BusRouteCleared() && !ok {
+ return errors.New(`ent: clearing a required unique edge "BusRouteAssociation.busRoute"`)
+ }
+ return nil
+}
+
+func (brau *BusRouteAssociationUpdate) sqlSave(ctx context.Context) (n int, err error) {
+ if err := brau.check(); err != nil {
+ return n, err
+ }
+ _spec := sqlgraph.NewUpdateSpec(busrouteassociation.Table, busrouteassociation.Columns, sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt))
+ if ps := brau.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := brau.mutation.Order(); ok {
+ _spec.SetField(busrouteassociation.FieldOrder, field.TypeInt32, value)
+ }
+ if value, ok := brau.mutation.AddedOrder(); ok {
+ _spec.AddField(busrouteassociation.FieldOrder, field.TypeInt32, value)
+ }
+ if brau.mutation.StationCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: busrouteassociation.StationTable,
+ Columns: []string{busrouteassociation.StationColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := brau.mutation.StationIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: busrouteassociation.StationTable,
+ Columns: []string{busrouteassociation.StationColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if brau.mutation.BusRouteCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: busrouteassociation.BusRouteTable,
+ Columns: []string{busrouteassociation.BusRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := brau.mutation.BusRouteIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: busrouteassociation.BusRouteTable,
+ Columns: []string{busrouteassociation.BusRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if n, err = sqlgraph.UpdateNodes(ctx, brau.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{busrouteassociation.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return 0, err
+ }
+ brau.mutation.done = true
+ return n, nil
+}
+
+// BusRouteAssociationUpdateOne is the builder for updating a single BusRouteAssociation entity.
+type BusRouteAssociationUpdateOne struct {
+ config
+ fields []string
+ hooks []Hook
+ mutation *BusRouteAssociationMutation
+}
+
+// SetStationID sets the "station_id" field.
+func (brauo *BusRouteAssociationUpdateOne) SetStationID(u uuid.UUID) *BusRouteAssociationUpdateOne {
+ brauo.mutation.SetStationID(u)
+ return brauo
+}
+
+// SetNillableStationID sets the "station_id" field if the given value is not nil.
+func (brauo *BusRouteAssociationUpdateOne) SetNillableStationID(u *uuid.UUID) *BusRouteAssociationUpdateOne {
+ if u != nil {
+ brauo.SetStationID(*u)
+ }
+ return brauo
+}
+
+// SetBusRouteID sets the "bus_route_id" field.
+func (brauo *BusRouteAssociationUpdateOne) SetBusRouteID(u uuid.UUID) *BusRouteAssociationUpdateOne {
+ brauo.mutation.SetBusRouteID(u)
+ return brauo
+}
+
+// SetNillableBusRouteID sets the "bus_route_id" field if the given value is not nil.
+func (brauo *BusRouteAssociationUpdateOne) SetNillableBusRouteID(u *uuid.UUID) *BusRouteAssociationUpdateOne {
+ if u != nil {
+ brauo.SetBusRouteID(*u)
+ }
+ return brauo
+}
+
+// SetOrder sets the "order" field.
+func (brauo *BusRouteAssociationUpdateOne) SetOrder(i int32) *BusRouteAssociationUpdateOne {
+ brauo.mutation.ResetOrder()
+ brauo.mutation.SetOrder(i)
+ return brauo
+}
+
+// SetNillableOrder sets the "order" field if the given value is not nil.
+func (brauo *BusRouteAssociationUpdateOne) SetNillableOrder(i *int32) *BusRouteAssociationUpdateOne {
+ if i != nil {
+ brauo.SetOrder(*i)
+ }
+ return brauo
+}
+
+// AddOrder adds i to the "order" field.
+func (brauo *BusRouteAssociationUpdateOne) AddOrder(i int32) *BusRouteAssociationUpdateOne {
+ brauo.mutation.AddOrder(i)
+ return brauo
+}
+
+// SetStation sets the "station" edge to the Station entity.
+func (brauo *BusRouteAssociationUpdateOne) SetStation(s *Station) *BusRouteAssociationUpdateOne {
+ return brauo.SetStationID(s.ID)
+}
+
+// SetBusRoute sets the "busRoute" edge to the BusRoute entity.
+func (brauo *BusRouteAssociationUpdateOne) SetBusRoute(b *BusRoute) *BusRouteAssociationUpdateOne {
+ return brauo.SetBusRouteID(b.ID)
+}
+
+// Mutation returns the BusRouteAssociationMutation object of the builder.
+func (brauo *BusRouteAssociationUpdateOne) Mutation() *BusRouteAssociationMutation {
+ return brauo.mutation
+}
+
+// ClearStation clears the "station" edge to the Station entity.
+func (brauo *BusRouteAssociationUpdateOne) ClearStation() *BusRouteAssociationUpdateOne {
+ brauo.mutation.ClearStation()
+ return brauo
+}
+
+// ClearBusRoute clears the "busRoute" edge to the BusRoute entity.
+func (brauo *BusRouteAssociationUpdateOne) ClearBusRoute() *BusRouteAssociationUpdateOne {
+ brauo.mutation.ClearBusRoute()
+ return brauo
+}
+
+// Where appends a list predicates to the BusRouteAssociationUpdate builder.
+func (brauo *BusRouteAssociationUpdateOne) Where(ps ...predicate.BusRouteAssociation) *BusRouteAssociationUpdateOne {
+ brauo.mutation.Where(ps...)
+ return brauo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (brauo *BusRouteAssociationUpdateOne) Select(field string, fields ...string) *BusRouteAssociationUpdateOne {
+ brauo.fields = append([]string{field}, fields...)
+ return brauo
+}
+
+// Save executes the query and returns the updated BusRouteAssociation entity.
+func (brauo *BusRouteAssociationUpdateOne) Save(ctx context.Context) (*BusRouteAssociation, error) {
+ return withHooks(ctx, brauo.sqlSave, brauo.mutation, brauo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (brauo *BusRouteAssociationUpdateOne) SaveX(ctx context.Context) *BusRouteAssociation {
+ node, err := brauo.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// Exec executes the query on the entity.
+func (brauo *BusRouteAssociationUpdateOne) Exec(ctx context.Context) error {
+ _, err := brauo.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (brauo *BusRouteAssociationUpdateOne) ExecX(ctx context.Context) {
+ if err := brauo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (brauo *BusRouteAssociationUpdateOne) check() error {
+ if _, ok := brauo.mutation.StationID(); brauo.mutation.StationCleared() && !ok {
+ return errors.New(`ent: clearing a required unique edge "BusRouteAssociation.station"`)
+ }
+ if _, ok := brauo.mutation.BusRouteID(); brauo.mutation.BusRouteCleared() && !ok {
+ return errors.New(`ent: clearing a required unique edge "BusRouteAssociation.busRoute"`)
+ }
+ return nil
+}
+
+func (brauo *BusRouteAssociationUpdateOne) sqlSave(ctx context.Context) (_node *BusRouteAssociation, err error) {
+ if err := brauo.check(); err != nil {
+ return _node, err
+ }
+ _spec := sqlgraph.NewUpdateSpec(busrouteassociation.Table, busrouteassociation.Columns, sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt))
+ id, ok := brauo.mutation.ID()
+ if !ok {
+ return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "BusRouteAssociation.id" for update`)}
+ }
+ _spec.Node.ID.Value = id
+ if fields := brauo.fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, busrouteassociation.FieldID)
+ for _, f := range fields {
+ if !busrouteassociation.ValidColumn(f) {
+ return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ if f != busrouteassociation.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, f)
+ }
+ }
+ }
+ if ps := brauo.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := brauo.mutation.Order(); ok {
+ _spec.SetField(busrouteassociation.FieldOrder, field.TypeInt32, value)
+ }
+ if value, ok := brauo.mutation.AddedOrder(); ok {
+ _spec.AddField(busrouteassociation.FieldOrder, field.TypeInt32, value)
+ }
+ if brauo.mutation.StationCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: busrouteassociation.StationTable,
+ Columns: []string{busrouteassociation.StationColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := brauo.mutation.StationIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: busrouteassociation.StationTable,
+ Columns: []string{busrouteassociation.StationColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if brauo.mutation.BusRouteCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: busrouteassociation.BusRouteTable,
+ Columns: []string{busrouteassociation.BusRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := brauo.mutation.BusRouteIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: busrouteassociation.BusRouteTable,
+ Columns: []string{busrouteassociation.BusRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ _node = &BusRouteAssociation{config: brauo.config}
+ _spec.Assign = _node.assignValues
+ _spec.ScanValues = _node.scanValues
+ if err = sqlgraph.UpdateNode(ctx, brauo.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{busrouteassociation.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ brauo.mutation.done = true
+ return _node, nil
+}
diff --git a/backend/domain/repository/ent/child.go b/backend/domain/repository/ent/child.go
new file mode 100644
index 00000000..b61b7662
--- /dev/null
+++ b/backend/domain/repository/ent/child.go
@@ -0,0 +1,310 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "fmt"
+ "strings"
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/sql"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/google/uuid"
+)
+
+// Child is the model entity for the Child schema.
+type Child struct {
+ config `json:"-"`
+ // ID of the ent.
+ ID uuid.UUID `json:"id,omitempty"`
+ // Name holds the value of the "name" field.
+ Name string `json:"name,omitempty"`
+ // Age holds the value of the "age" field.
+ Age int `json:"age,omitempty"`
+ // Sex holds the value of the "sex" field.
+ Sex child.Sex `json:"sex,omitempty"`
+ // 持ち物が欠けていないかをチェックするかどうか
+ CheckForMissingItems bool `json:"check_for_missing_items,omitempty"`
+ // HasBag holds the value of the "has_bag" field.
+ HasBag bool `json:"has_bag,omitempty"`
+ // HasLunchBox holds the value of the "has_lunch_box" field.
+ HasLunchBox bool `json:"has_lunch_box,omitempty"`
+ // HasWaterBottle holds the value of the "has_water_bottle" field.
+ HasWaterBottle bool `json:"has_water_bottle,omitempty"`
+ // HasUmbrella holds the value of the "has_umbrella" field.
+ HasUmbrella bool `json:"has_umbrella,omitempty"`
+ // HasOther holds the value of the "has_other" field.
+ HasOther bool `json:"has_other,omitempty"`
+ // CreatedAt holds the value of the "created_at" field.
+ CreatedAt time.Time `json:"created_at,omitempty"`
+ // UpdatedAt holds the value of the "updated_at" field.
+ UpdatedAt time.Time `json:"updated_at,omitempty"`
+ // Edges holds the relations/edges for other nodes in the graph.
+ // The values are being populated by the ChildQuery when eager-loading is set.
+ Edges ChildEdges `json:"edges"`
+ guardian_children *uuid.UUID
+ selectValues sql.SelectValues
+}
+
+// ChildEdges holds the relations/edges for other nodes in the graph.
+type ChildEdges struct {
+ // Guardian holds the value of the guardian edge.
+ Guardian *Guardian `json:"guardian,omitempty"`
+ // ChildBusAssociations holds the value of the childBusAssociations edge.
+ ChildBusAssociations []*ChildBusAssociation `json:"childBusAssociations,omitempty"`
+ // BoardingRecord holds the value of the boarding_record edge.
+ BoardingRecord []*BoardingRecord `json:"boarding_record,omitempty"`
+ // Photos holds the value of the photos edge.
+ Photos []*ChildPhoto `json:"photos,omitempty"`
+ // loadedTypes holds the information for reporting if a
+ // type was loaded (or requested) in eager-loading or not.
+ loadedTypes [4]bool
+}
+
+// GuardianOrErr returns the Guardian value or an error if the edge
+// was not loaded in eager-loading, or loaded but was not found.
+func (e ChildEdges) GuardianOrErr() (*Guardian, error) {
+ if e.loadedTypes[0] {
+ if e.Guardian == nil {
+ // Edge was loaded but was not found.
+ return nil, &NotFoundError{label: guardian.Label}
+ }
+ return e.Guardian, nil
+ }
+ return nil, &NotLoadedError{edge: "guardian"}
+}
+
+// ChildBusAssociationsOrErr returns the ChildBusAssociations value or an error if the edge
+// was not loaded in eager-loading.
+func (e ChildEdges) ChildBusAssociationsOrErr() ([]*ChildBusAssociation, error) {
+ if e.loadedTypes[1] {
+ return e.ChildBusAssociations, nil
+ }
+ return nil, &NotLoadedError{edge: "childBusAssociations"}
+}
+
+// BoardingRecordOrErr returns the BoardingRecord value or an error if the edge
+// was not loaded in eager-loading.
+func (e ChildEdges) BoardingRecordOrErr() ([]*BoardingRecord, error) {
+ if e.loadedTypes[2] {
+ return e.BoardingRecord, nil
+ }
+ return nil, &NotLoadedError{edge: "boarding_record"}
+}
+
+// PhotosOrErr returns the Photos value or an error if the edge
+// was not loaded in eager-loading.
+func (e ChildEdges) PhotosOrErr() ([]*ChildPhoto, error) {
+ if e.loadedTypes[3] {
+ return e.Photos, nil
+ }
+ return nil, &NotLoadedError{edge: "photos"}
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*Child) scanValues(columns []string) ([]any, error) {
+ values := make([]any, len(columns))
+ for i := range columns {
+ switch columns[i] {
+ case child.FieldCheckForMissingItems, child.FieldHasBag, child.FieldHasLunchBox, child.FieldHasWaterBottle, child.FieldHasUmbrella, child.FieldHasOther:
+ values[i] = new(sql.NullBool)
+ case child.FieldAge:
+ values[i] = new(sql.NullInt64)
+ case child.FieldName, child.FieldSex:
+ values[i] = new(sql.NullString)
+ case child.FieldCreatedAt, child.FieldUpdatedAt:
+ values[i] = new(sql.NullTime)
+ case child.FieldID:
+ values[i] = new(uuid.UUID)
+ case child.ForeignKeys[0]: // guardian_children
+ values[i] = &sql.NullScanner{S: new(uuid.UUID)}
+ default:
+ values[i] = new(sql.UnknownType)
+ }
+ }
+ return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the Child fields.
+func (c *Child) assignValues(columns []string, values []any) error {
+ if m, n := len(values), len(columns); m < n {
+ return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+ }
+ for i := range columns {
+ switch columns[i] {
+ case child.FieldID:
+ if value, ok := values[i].(*uuid.UUID); !ok {
+ return fmt.Errorf("unexpected type %T for field id", values[i])
+ } else if value != nil {
+ c.ID = *value
+ }
+ case child.FieldName:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field name", values[i])
+ } else if value.Valid {
+ c.Name = value.String
+ }
+ case child.FieldAge:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field age", values[i])
+ } else if value.Valid {
+ c.Age = int(value.Int64)
+ }
+ case child.FieldSex:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field sex", values[i])
+ } else if value.Valid {
+ c.Sex = child.Sex(value.String)
+ }
+ case child.FieldCheckForMissingItems:
+ if value, ok := values[i].(*sql.NullBool); !ok {
+ return fmt.Errorf("unexpected type %T for field check_for_missing_items", values[i])
+ } else if value.Valid {
+ c.CheckForMissingItems = value.Bool
+ }
+ case child.FieldHasBag:
+ if value, ok := values[i].(*sql.NullBool); !ok {
+ return fmt.Errorf("unexpected type %T for field has_bag", values[i])
+ } else if value.Valid {
+ c.HasBag = value.Bool
+ }
+ case child.FieldHasLunchBox:
+ if value, ok := values[i].(*sql.NullBool); !ok {
+ return fmt.Errorf("unexpected type %T for field has_lunch_box", values[i])
+ } else if value.Valid {
+ c.HasLunchBox = value.Bool
+ }
+ case child.FieldHasWaterBottle:
+ if value, ok := values[i].(*sql.NullBool); !ok {
+ return fmt.Errorf("unexpected type %T for field has_water_bottle", values[i])
+ } else if value.Valid {
+ c.HasWaterBottle = value.Bool
+ }
+ case child.FieldHasUmbrella:
+ if value, ok := values[i].(*sql.NullBool); !ok {
+ return fmt.Errorf("unexpected type %T for field has_umbrella", values[i])
+ } else if value.Valid {
+ c.HasUmbrella = value.Bool
+ }
+ case child.FieldHasOther:
+ if value, ok := values[i].(*sql.NullBool); !ok {
+ return fmt.Errorf("unexpected type %T for field has_other", values[i])
+ } else if value.Valid {
+ c.HasOther = value.Bool
+ }
+ case child.FieldCreatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field created_at", values[i])
+ } else if value.Valid {
+ c.CreatedAt = value.Time
+ }
+ case child.FieldUpdatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field updated_at", values[i])
+ } else if value.Valid {
+ c.UpdatedAt = value.Time
+ }
+ case child.ForeignKeys[0]:
+ if value, ok := values[i].(*sql.NullScanner); !ok {
+ return fmt.Errorf("unexpected type %T for field guardian_children", values[i])
+ } else if value.Valid {
+ c.guardian_children = new(uuid.UUID)
+ *c.guardian_children = *value.S.(*uuid.UUID)
+ }
+ default:
+ c.selectValues.Set(columns[i], values[i])
+ }
+ }
+ return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the Child.
+// This includes values selected through modifiers, order, etc.
+func (c *Child) Value(name string) (ent.Value, error) {
+ return c.selectValues.Get(name)
+}
+
+// QueryGuardian queries the "guardian" edge of the Child entity.
+func (c *Child) QueryGuardian() *GuardianQuery {
+ return NewChildClient(c.config).QueryGuardian(c)
+}
+
+// QueryChildBusAssociations queries the "childBusAssociations" edge of the Child entity.
+func (c *Child) QueryChildBusAssociations() *ChildBusAssociationQuery {
+ return NewChildClient(c.config).QueryChildBusAssociations(c)
+}
+
+// QueryBoardingRecord queries the "boarding_record" edge of the Child entity.
+func (c *Child) QueryBoardingRecord() *BoardingRecordQuery {
+ return NewChildClient(c.config).QueryBoardingRecord(c)
+}
+
+// QueryPhotos queries the "photos" edge of the Child entity.
+func (c *Child) QueryPhotos() *ChildPhotoQuery {
+ return NewChildClient(c.config).QueryPhotos(c)
+}
+
+// Update returns a builder for updating this Child.
+// Note that you need to call Child.Unwrap() before calling this method if this Child
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (c *Child) Update() *ChildUpdateOne {
+ return NewChildClient(c.config).UpdateOne(c)
+}
+
+// Unwrap unwraps the Child entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (c *Child) Unwrap() *Child {
+ _tx, ok := c.config.driver.(*txDriver)
+ if !ok {
+ panic("ent: Child is not a transactional entity")
+ }
+ c.config.driver = _tx.drv
+ return c
+}
+
+// String implements the fmt.Stringer.
+func (c *Child) String() string {
+ var builder strings.Builder
+ builder.WriteString("Child(")
+ builder.WriteString(fmt.Sprintf("id=%v, ", c.ID))
+ builder.WriteString("name=")
+ builder.WriteString(c.Name)
+ builder.WriteString(", ")
+ builder.WriteString("age=")
+ builder.WriteString(fmt.Sprintf("%v", c.Age))
+ builder.WriteString(", ")
+ builder.WriteString("sex=")
+ builder.WriteString(fmt.Sprintf("%v", c.Sex))
+ builder.WriteString(", ")
+ builder.WriteString("check_for_missing_items=")
+ builder.WriteString(fmt.Sprintf("%v", c.CheckForMissingItems))
+ builder.WriteString(", ")
+ builder.WriteString("has_bag=")
+ builder.WriteString(fmt.Sprintf("%v", c.HasBag))
+ builder.WriteString(", ")
+ builder.WriteString("has_lunch_box=")
+ builder.WriteString(fmt.Sprintf("%v", c.HasLunchBox))
+ builder.WriteString(", ")
+ builder.WriteString("has_water_bottle=")
+ builder.WriteString(fmt.Sprintf("%v", c.HasWaterBottle))
+ builder.WriteString(", ")
+ builder.WriteString("has_umbrella=")
+ builder.WriteString(fmt.Sprintf("%v", c.HasUmbrella))
+ builder.WriteString(", ")
+ builder.WriteString("has_other=")
+ builder.WriteString(fmt.Sprintf("%v", c.HasOther))
+ builder.WriteString(", ")
+ builder.WriteString("created_at=")
+ builder.WriteString(c.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(", ")
+ builder.WriteString("updated_at=")
+ builder.WriteString(c.UpdatedAt.Format(time.ANSIC))
+ builder.WriteByte(')')
+ return builder.String()
+}
+
+// Childs is a parsable slice of Child.
+type Childs []*Child
diff --git a/backend/domain/repository/ent/child/child.go b/backend/domain/repository/ent/child/child.go
new file mode 100644
index 00000000..d5c72df2
--- /dev/null
+++ b/backend/domain/repository/ent/child/child.go
@@ -0,0 +1,303 @@
+// Code generated by ent, DO NOT EDIT.
+
+package child
+
+import (
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/google/uuid"
+)
+
+const (
+ // Label holds the string label denoting the child type in the database.
+ Label = "child"
+ // FieldID holds the string denoting the id field in the database.
+ FieldID = "id"
+ // FieldName holds the string denoting the name field in the database.
+ FieldName = "name"
+ // FieldAge holds the string denoting the age field in the database.
+ FieldAge = "age"
+ // FieldSex holds the string denoting the sex field in the database.
+ FieldSex = "sex"
+ // FieldCheckForMissingItems holds the string denoting the check_for_missing_items field in the database.
+ FieldCheckForMissingItems = "check_for_missing_items"
+ // FieldHasBag holds the string denoting the has_bag field in the database.
+ FieldHasBag = "has_bag"
+ // FieldHasLunchBox holds the string denoting the has_lunch_box field in the database.
+ FieldHasLunchBox = "has_lunch_box"
+ // FieldHasWaterBottle holds the string denoting the has_water_bottle field in the database.
+ FieldHasWaterBottle = "has_water_bottle"
+ // FieldHasUmbrella holds the string denoting the has_umbrella field in the database.
+ FieldHasUmbrella = "has_umbrella"
+ // FieldHasOther holds the string denoting the has_other field in the database.
+ FieldHasOther = "has_other"
+ // FieldCreatedAt holds the string denoting the created_at field in the database.
+ FieldCreatedAt = "created_at"
+ // FieldUpdatedAt holds the string denoting the updated_at field in the database.
+ FieldUpdatedAt = "updated_at"
+ // EdgeGuardian holds the string denoting the guardian edge name in mutations.
+ EdgeGuardian = "guardian"
+ // EdgeChildBusAssociations holds the string denoting the childbusassociations edge name in mutations.
+ EdgeChildBusAssociations = "childBusAssociations"
+ // EdgeBoardingRecord holds the string denoting the boarding_record edge name in mutations.
+ EdgeBoardingRecord = "boarding_record"
+ // EdgePhotos holds the string denoting the photos edge name in mutations.
+ EdgePhotos = "photos"
+ // Table holds the table name of the child in the database.
+ Table = "childs"
+ // GuardianTable is the table that holds the guardian relation/edge.
+ GuardianTable = "childs"
+ // GuardianInverseTable is the table name for the Guardian entity.
+ // It exists in this package in order to avoid circular dependency with the "guardian" package.
+ GuardianInverseTable = "guardians"
+ // GuardianColumn is the table column denoting the guardian relation/edge.
+ GuardianColumn = "guardian_children"
+ // ChildBusAssociationsTable is the table that holds the childBusAssociations relation/edge.
+ ChildBusAssociationsTable = "child_bus_associations"
+ // ChildBusAssociationsInverseTable is the table name for the ChildBusAssociation entity.
+ // It exists in this package in order to avoid circular dependency with the "childbusassociation" package.
+ ChildBusAssociationsInverseTable = "child_bus_associations"
+ // ChildBusAssociationsColumn is the table column denoting the childBusAssociations relation/edge.
+ ChildBusAssociationsColumn = "child_id"
+ // BoardingRecordTable is the table that holds the boarding_record relation/edge.
+ BoardingRecordTable = "boarding_records"
+ // BoardingRecordInverseTable is the table name for the BoardingRecord entity.
+ // It exists in this package in order to avoid circular dependency with the "boardingrecord" package.
+ BoardingRecordInverseTable = "boarding_records"
+ // BoardingRecordColumn is the table column denoting the boarding_record relation/edge.
+ BoardingRecordColumn = "child_boarding_record"
+ // PhotosTable is the table that holds the photos relation/edge.
+ PhotosTable = "child_photos"
+ // PhotosInverseTable is the table name for the ChildPhoto entity.
+ // It exists in this package in order to avoid circular dependency with the "childphoto" package.
+ PhotosInverseTable = "child_photos"
+ // PhotosColumn is the table column denoting the photos relation/edge.
+ PhotosColumn = "child_photos"
+)
+
+// Columns holds all SQL columns for child fields.
+var Columns = []string{
+ FieldID,
+ FieldName,
+ FieldAge,
+ FieldSex,
+ FieldCheckForMissingItems,
+ FieldHasBag,
+ FieldHasLunchBox,
+ FieldHasWaterBottle,
+ FieldHasUmbrella,
+ FieldHasOther,
+ FieldCreatedAt,
+ FieldUpdatedAt,
+}
+
+// ForeignKeys holds the SQL foreign-keys that are owned by the "childs"
+// table and are not defined as standalone fields in the schema.
+var ForeignKeys = []string{
+ "guardian_children",
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+ for i := range Columns {
+ if column == Columns[i] {
+ return true
+ }
+ }
+ for i := range ForeignKeys {
+ if column == ForeignKeys[i] {
+ return true
+ }
+ }
+ return false
+}
+
+var (
+ // DefaultCheckForMissingItems holds the default value on creation for the "check_for_missing_items" field.
+ DefaultCheckForMissingItems bool
+ // DefaultHasBag holds the default value on creation for the "has_bag" field.
+ DefaultHasBag bool
+ // DefaultHasLunchBox holds the default value on creation for the "has_lunch_box" field.
+ DefaultHasLunchBox bool
+ // DefaultHasWaterBottle holds the default value on creation for the "has_water_bottle" field.
+ DefaultHasWaterBottle bool
+ // DefaultHasUmbrella holds the default value on creation for the "has_umbrella" field.
+ DefaultHasUmbrella bool
+ // DefaultHasOther holds the default value on creation for the "has_other" field.
+ DefaultHasOther bool
+ // DefaultCreatedAt holds the default value on creation for the "created_at" field.
+ DefaultCreatedAt func() time.Time
+ // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
+ DefaultUpdatedAt func() time.Time
+ // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
+ UpdateDefaultUpdatedAt func() time.Time
+ // DefaultID holds the default value on creation for the "id" field.
+ DefaultID func() uuid.UUID
+)
+
+// Sex defines the type for the "sex" enum field.
+type Sex string
+
+// Sex values.
+const (
+ SexMan Sex = "man"
+ SexWoman Sex = "woman"
+ SexOther Sex = "other"
+)
+
+func (s Sex) String() string {
+ return string(s)
+}
+
+// SexValidator is a validator for the "sex" field enum values. It is called by the builders before save.
+func SexValidator(s Sex) error {
+ switch s {
+ case SexMan, SexWoman, SexOther:
+ return nil
+ default:
+ return fmt.Errorf("child: invalid enum value for sex field: %q", s)
+ }
+}
+
+// OrderOption defines the ordering options for the Child queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByName orders the results by the name field.
+func ByName(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldName, opts...).ToFunc()
+}
+
+// ByAge orders the results by the age field.
+func ByAge(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldAge, opts...).ToFunc()
+}
+
+// BySex orders the results by the sex field.
+func BySex(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldSex, opts...).ToFunc()
+}
+
+// ByCheckForMissingItems orders the results by the check_for_missing_items field.
+func ByCheckForMissingItems(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldCheckForMissingItems, opts...).ToFunc()
+}
+
+// ByHasBag orders the results by the has_bag field.
+func ByHasBag(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldHasBag, opts...).ToFunc()
+}
+
+// ByHasLunchBox orders the results by the has_lunch_box field.
+func ByHasLunchBox(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldHasLunchBox, opts...).ToFunc()
+}
+
+// ByHasWaterBottle orders the results by the has_water_bottle field.
+func ByHasWaterBottle(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldHasWaterBottle, opts...).ToFunc()
+}
+
+// ByHasUmbrella orders the results by the has_umbrella field.
+func ByHasUmbrella(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldHasUmbrella, opts...).ToFunc()
+}
+
+// ByHasOther orders the results by the has_other field.
+func ByHasOther(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldHasOther, opts...).ToFunc()
+}
+
+// ByCreatedAt orders the results by the created_at field.
+func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
+}
+
+// ByUpdatedAt orders the results by the updated_at field.
+func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
+}
+
+// ByGuardianField orders the results by guardian field.
+func ByGuardianField(field string, opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newGuardianStep(), sql.OrderByField(field, opts...))
+ }
+}
+
+// ByChildBusAssociationsCount orders the results by childBusAssociations count.
+func ByChildBusAssociationsCount(opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborsCount(s, newChildBusAssociationsStep(), opts...)
+ }
+}
+
+// ByChildBusAssociations orders the results by childBusAssociations terms.
+func ByChildBusAssociations(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newChildBusAssociationsStep(), append([]sql.OrderTerm{term}, terms...)...)
+ }
+}
+
+// ByBoardingRecordCount orders the results by boarding_record count.
+func ByBoardingRecordCount(opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborsCount(s, newBoardingRecordStep(), opts...)
+ }
+}
+
+// ByBoardingRecord orders the results by boarding_record terms.
+func ByBoardingRecord(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newBoardingRecordStep(), append([]sql.OrderTerm{term}, terms...)...)
+ }
+}
+
+// ByPhotosCount orders the results by photos count.
+func ByPhotosCount(opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborsCount(s, newPhotosStep(), opts...)
+ }
+}
+
+// ByPhotos orders the results by photos terms.
+func ByPhotos(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newPhotosStep(), append([]sql.OrderTerm{term}, terms...)...)
+ }
+}
+func newGuardianStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(GuardianInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, GuardianTable, GuardianColumn),
+ )
+}
+func newChildBusAssociationsStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(ChildBusAssociationsInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, ChildBusAssociationsTable, ChildBusAssociationsColumn),
+ )
+}
+func newBoardingRecordStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(BoardingRecordInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, BoardingRecordTable, BoardingRecordColumn),
+ )
+}
+func newPhotosStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(PhotosInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, PhotosTable, PhotosColumn),
+ )
+}
diff --git a/backend/domain/repository/ent/child/where.go b/backend/domain/repository/ent/child/where.go
new file mode 100644
index 00000000..4c900e83
--- /dev/null
+++ b/backend/domain/repository/ent/child/where.go
@@ -0,0 +1,479 @@
+// Code generated by ent, DO NOT EDIT.
+
+package child
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id uuid.UUID) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id uuid.UUID) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id uuid.UUID) predicate.Child {
+ return predicate.Child(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...uuid.UUID) predicate.Child {
+ return predicate.Child(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...uuid.UUID) predicate.Child {
+ return predicate.Child(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id uuid.UUID) predicate.Child {
+ return predicate.Child(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id uuid.UUID) predicate.Child {
+ return predicate.Child(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id uuid.UUID) predicate.Child {
+ return predicate.Child(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id uuid.UUID) predicate.Child {
+ return predicate.Child(sql.FieldLTE(FieldID, id))
+}
+
+// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
+func Name(v string) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldName, v))
+}
+
+// Age applies equality check predicate on the "age" field. It's identical to AgeEQ.
+func Age(v int) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldAge, v))
+}
+
+// CheckForMissingItems applies equality check predicate on the "check_for_missing_items" field. It's identical to CheckForMissingItemsEQ.
+func CheckForMissingItems(v bool) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldCheckForMissingItems, v))
+}
+
+// HasBag applies equality check predicate on the "has_bag" field. It's identical to HasBagEQ.
+func HasBag(v bool) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldHasBag, v))
+}
+
+// HasLunchBox applies equality check predicate on the "has_lunch_box" field. It's identical to HasLunchBoxEQ.
+func HasLunchBox(v bool) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldHasLunchBox, v))
+}
+
+// HasWaterBottle applies equality check predicate on the "has_water_bottle" field. It's identical to HasWaterBottleEQ.
+func HasWaterBottle(v bool) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldHasWaterBottle, v))
+}
+
+// HasUmbrella applies equality check predicate on the "has_umbrella" field. It's identical to HasUmbrellaEQ.
+func HasUmbrella(v bool) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldHasUmbrella, v))
+}
+
+// HasOther applies equality check predicate on the "has_other" field. It's identical to HasOtherEQ.
+func HasOther(v bool) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldHasOther, v))
+}
+
+// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
+func UpdatedAt(v time.Time) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// NameEQ applies the EQ predicate on the "name" field.
+func NameEQ(v string) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldName, v))
+}
+
+// NameNEQ applies the NEQ predicate on the "name" field.
+func NameNEQ(v string) predicate.Child {
+ return predicate.Child(sql.FieldNEQ(FieldName, v))
+}
+
+// NameIn applies the In predicate on the "name" field.
+func NameIn(vs ...string) predicate.Child {
+ return predicate.Child(sql.FieldIn(FieldName, vs...))
+}
+
+// NameNotIn applies the NotIn predicate on the "name" field.
+func NameNotIn(vs ...string) predicate.Child {
+ return predicate.Child(sql.FieldNotIn(FieldName, vs...))
+}
+
+// NameGT applies the GT predicate on the "name" field.
+func NameGT(v string) predicate.Child {
+ return predicate.Child(sql.FieldGT(FieldName, v))
+}
+
+// NameGTE applies the GTE predicate on the "name" field.
+func NameGTE(v string) predicate.Child {
+ return predicate.Child(sql.FieldGTE(FieldName, v))
+}
+
+// NameLT applies the LT predicate on the "name" field.
+func NameLT(v string) predicate.Child {
+ return predicate.Child(sql.FieldLT(FieldName, v))
+}
+
+// NameLTE applies the LTE predicate on the "name" field.
+func NameLTE(v string) predicate.Child {
+ return predicate.Child(sql.FieldLTE(FieldName, v))
+}
+
+// NameContains applies the Contains predicate on the "name" field.
+func NameContains(v string) predicate.Child {
+ return predicate.Child(sql.FieldContains(FieldName, v))
+}
+
+// NameHasPrefix applies the HasPrefix predicate on the "name" field.
+func NameHasPrefix(v string) predicate.Child {
+ return predicate.Child(sql.FieldHasPrefix(FieldName, v))
+}
+
+// NameHasSuffix applies the HasSuffix predicate on the "name" field.
+func NameHasSuffix(v string) predicate.Child {
+ return predicate.Child(sql.FieldHasSuffix(FieldName, v))
+}
+
+// NameEqualFold applies the EqualFold predicate on the "name" field.
+func NameEqualFold(v string) predicate.Child {
+ return predicate.Child(sql.FieldEqualFold(FieldName, v))
+}
+
+// NameContainsFold applies the ContainsFold predicate on the "name" field.
+func NameContainsFold(v string) predicate.Child {
+ return predicate.Child(sql.FieldContainsFold(FieldName, v))
+}
+
+// AgeEQ applies the EQ predicate on the "age" field.
+func AgeEQ(v int) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldAge, v))
+}
+
+// AgeNEQ applies the NEQ predicate on the "age" field.
+func AgeNEQ(v int) predicate.Child {
+ return predicate.Child(sql.FieldNEQ(FieldAge, v))
+}
+
+// AgeIn applies the In predicate on the "age" field.
+func AgeIn(vs ...int) predicate.Child {
+ return predicate.Child(sql.FieldIn(FieldAge, vs...))
+}
+
+// AgeNotIn applies the NotIn predicate on the "age" field.
+func AgeNotIn(vs ...int) predicate.Child {
+ return predicate.Child(sql.FieldNotIn(FieldAge, vs...))
+}
+
+// AgeGT applies the GT predicate on the "age" field.
+func AgeGT(v int) predicate.Child {
+ return predicate.Child(sql.FieldGT(FieldAge, v))
+}
+
+// AgeGTE applies the GTE predicate on the "age" field.
+func AgeGTE(v int) predicate.Child {
+ return predicate.Child(sql.FieldGTE(FieldAge, v))
+}
+
+// AgeLT applies the LT predicate on the "age" field.
+func AgeLT(v int) predicate.Child {
+ return predicate.Child(sql.FieldLT(FieldAge, v))
+}
+
+// AgeLTE applies the LTE predicate on the "age" field.
+func AgeLTE(v int) predicate.Child {
+ return predicate.Child(sql.FieldLTE(FieldAge, v))
+}
+
+// SexEQ applies the EQ predicate on the "sex" field.
+func SexEQ(v Sex) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldSex, v))
+}
+
+// SexNEQ applies the NEQ predicate on the "sex" field.
+func SexNEQ(v Sex) predicate.Child {
+ return predicate.Child(sql.FieldNEQ(FieldSex, v))
+}
+
+// SexIn applies the In predicate on the "sex" field.
+func SexIn(vs ...Sex) predicate.Child {
+ return predicate.Child(sql.FieldIn(FieldSex, vs...))
+}
+
+// SexNotIn applies the NotIn predicate on the "sex" field.
+func SexNotIn(vs ...Sex) predicate.Child {
+ return predicate.Child(sql.FieldNotIn(FieldSex, vs...))
+}
+
+// CheckForMissingItemsEQ applies the EQ predicate on the "check_for_missing_items" field.
+func CheckForMissingItemsEQ(v bool) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldCheckForMissingItems, v))
+}
+
+// CheckForMissingItemsNEQ applies the NEQ predicate on the "check_for_missing_items" field.
+func CheckForMissingItemsNEQ(v bool) predicate.Child {
+ return predicate.Child(sql.FieldNEQ(FieldCheckForMissingItems, v))
+}
+
+// HasBagEQ applies the EQ predicate on the "has_bag" field.
+func HasBagEQ(v bool) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldHasBag, v))
+}
+
+// HasBagNEQ applies the NEQ predicate on the "has_bag" field.
+func HasBagNEQ(v bool) predicate.Child {
+ return predicate.Child(sql.FieldNEQ(FieldHasBag, v))
+}
+
+// HasLunchBoxEQ applies the EQ predicate on the "has_lunch_box" field.
+func HasLunchBoxEQ(v bool) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldHasLunchBox, v))
+}
+
+// HasLunchBoxNEQ applies the NEQ predicate on the "has_lunch_box" field.
+func HasLunchBoxNEQ(v bool) predicate.Child {
+ return predicate.Child(sql.FieldNEQ(FieldHasLunchBox, v))
+}
+
+// HasWaterBottleEQ applies the EQ predicate on the "has_water_bottle" field.
+func HasWaterBottleEQ(v bool) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldHasWaterBottle, v))
+}
+
+// HasWaterBottleNEQ applies the NEQ predicate on the "has_water_bottle" field.
+func HasWaterBottleNEQ(v bool) predicate.Child {
+ return predicate.Child(sql.FieldNEQ(FieldHasWaterBottle, v))
+}
+
+// HasUmbrellaEQ applies the EQ predicate on the "has_umbrella" field.
+func HasUmbrellaEQ(v bool) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldHasUmbrella, v))
+}
+
+// HasUmbrellaNEQ applies the NEQ predicate on the "has_umbrella" field.
+func HasUmbrellaNEQ(v bool) predicate.Child {
+ return predicate.Child(sql.FieldNEQ(FieldHasUmbrella, v))
+}
+
+// HasOtherEQ applies the EQ predicate on the "has_other" field.
+func HasOtherEQ(v bool) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldHasOther, v))
+}
+
+// HasOtherNEQ applies the NEQ predicate on the "has_other" field.
+func HasOtherNEQ(v bool) predicate.Child {
+ return predicate.Child(sql.FieldNEQ(FieldHasOther, v))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.Child {
+ return predicate.Child(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.Child {
+ return predicate.Child(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.Child {
+ return predicate.Child(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.Child {
+ return predicate.Child(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.Child {
+ return predicate.Child(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.Child {
+ return predicate.Child(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.Child {
+ return predicate.Child(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
+func UpdatedAtEQ(v time.Time) predicate.Child {
+ return predicate.Child(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
+func UpdatedAtNEQ(v time.Time) predicate.Child {
+ return predicate.Child(sql.FieldNEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtIn applies the In predicate on the "updated_at" field.
+func UpdatedAtIn(vs ...time.Time) predicate.Child {
+ return predicate.Child(sql.FieldIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
+func UpdatedAtNotIn(vs ...time.Time) predicate.Child {
+ return predicate.Child(sql.FieldNotIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtGT applies the GT predicate on the "updated_at" field.
+func UpdatedAtGT(v time.Time) predicate.Child {
+ return predicate.Child(sql.FieldGT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
+func UpdatedAtGTE(v time.Time) predicate.Child {
+ return predicate.Child(sql.FieldGTE(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLT applies the LT predicate on the "updated_at" field.
+func UpdatedAtLT(v time.Time) predicate.Child {
+ return predicate.Child(sql.FieldLT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
+func UpdatedAtLTE(v time.Time) predicate.Child {
+ return predicate.Child(sql.FieldLTE(FieldUpdatedAt, v))
+}
+
+// HasGuardian applies the HasEdge predicate on the "guardian" edge.
+func HasGuardian() predicate.Child {
+ return predicate.Child(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, GuardianTable, GuardianColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasGuardianWith applies the HasEdge predicate on the "guardian" edge with a given conditions (other predicates).
+func HasGuardianWith(preds ...predicate.Guardian) predicate.Child {
+ return predicate.Child(func(s *sql.Selector) {
+ step := newGuardianStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasChildBusAssociations applies the HasEdge predicate on the "childBusAssociations" edge.
+func HasChildBusAssociations() predicate.Child {
+ return predicate.Child(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, ChildBusAssociationsTable, ChildBusAssociationsColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasChildBusAssociationsWith applies the HasEdge predicate on the "childBusAssociations" edge with a given conditions (other predicates).
+func HasChildBusAssociationsWith(preds ...predicate.ChildBusAssociation) predicate.Child {
+ return predicate.Child(func(s *sql.Selector) {
+ step := newChildBusAssociationsStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasBoardingRecord applies the HasEdge predicate on the "boarding_record" edge.
+func HasBoardingRecord() predicate.Child {
+ return predicate.Child(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, BoardingRecordTable, BoardingRecordColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasBoardingRecordWith applies the HasEdge predicate on the "boarding_record" edge with a given conditions (other predicates).
+func HasBoardingRecordWith(preds ...predicate.BoardingRecord) predicate.Child {
+ return predicate.Child(func(s *sql.Selector) {
+ step := newBoardingRecordStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasPhotos applies the HasEdge predicate on the "photos" edge.
+func HasPhotos() predicate.Child {
+ return predicate.Child(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, PhotosTable, PhotosColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasPhotosWith applies the HasEdge predicate on the "photos" edge with a given conditions (other predicates).
+func HasPhotosWith(preds ...predicate.ChildPhoto) predicate.Child {
+ return predicate.Child(func(s *sql.Selector) {
+ step := newPhotosStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.Child) predicate.Child {
+ return predicate.Child(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.Child) predicate.Child {
+ return predicate.Child(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.Child) predicate.Child {
+ return predicate.Child(sql.NotPredicates(p))
+}
diff --git a/backend/domain/repository/ent/child_create.go b/backend/domain/repository/ent/child_create.go
new file mode 100644
index 00000000..e3be439b
--- /dev/null
+++ b/backend/domain/repository/ent/child_create.go
@@ -0,0 +1,578 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childbusassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childphoto"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/google/uuid"
+)
+
+// ChildCreate is the builder for creating a Child entity.
+type ChildCreate struct {
+ config
+ mutation *ChildMutation
+ hooks []Hook
+}
+
+// SetName sets the "name" field.
+func (cc *ChildCreate) SetName(s string) *ChildCreate {
+ cc.mutation.SetName(s)
+ return cc
+}
+
+// SetAge sets the "age" field.
+func (cc *ChildCreate) SetAge(i int) *ChildCreate {
+ cc.mutation.SetAge(i)
+ return cc
+}
+
+// SetSex sets the "sex" field.
+func (cc *ChildCreate) SetSex(c child.Sex) *ChildCreate {
+ cc.mutation.SetSex(c)
+ return cc
+}
+
+// SetCheckForMissingItems sets the "check_for_missing_items" field.
+func (cc *ChildCreate) SetCheckForMissingItems(b bool) *ChildCreate {
+ cc.mutation.SetCheckForMissingItems(b)
+ return cc
+}
+
+// SetNillableCheckForMissingItems sets the "check_for_missing_items" field if the given value is not nil.
+func (cc *ChildCreate) SetNillableCheckForMissingItems(b *bool) *ChildCreate {
+ if b != nil {
+ cc.SetCheckForMissingItems(*b)
+ }
+ return cc
+}
+
+// SetHasBag sets the "has_bag" field.
+func (cc *ChildCreate) SetHasBag(b bool) *ChildCreate {
+ cc.mutation.SetHasBag(b)
+ return cc
+}
+
+// SetNillableHasBag sets the "has_bag" field if the given value is not nil.
+func (cc *ChildCreate) SetNillableHasBag(b *bool) *ChildCreate {
+ if b != nil {
+ cc.SetHasBag(*b)
+ }
+ return cc
+}
+
+// SetHasLunchBox sets the "has_lunch_box" field.
+func (cc *ChildCreate) SetHasLunchBox(b bool) *ChildCreate {
+ cc.mutation.SetHasLunchBox(b)
+ return cc
+}
+
+// SetNillableHasLunchBox sets the "has_lunch_box" field if the given value is not nil.
+func (cc *ChildCreate) SetNillableHasLunchBox(b *bool) *ChildCreate {
+ if b != nil {
+ cc.SetHasLunchBox(*b)
+ }
+ return cc
+}
+
+// SetHasWaterBottle sets the "has_water_bottle" field.
+func (cc *ChildCreate) SetHasWaterBottle(b bool) *ChildCreate {
+ cc.mutation.SetHasWaterBottle(b)
+ return cc
+}
+
+// SetNillableHasWaterBottle sets the "has_water_bottle" field if the given value is not nil.
+func (cc *ChildCreate) SetNillableHasWaterBottle(b *bool) *ChildCreate {
+ if b != nil {
+ cc.SetHasWaterBottle(*b)
+ }
+ return cc
+}
+
+// SetHasUmbrella sets the "has_umbrella" field.
+func (cc *ChildCreate) SetHasUmbrella(b bool) *ChildCreate {
+ cc.mutation.SetHasUmbrella(b)
+ return cc
+}
+
+// SetNillableHasUmbrella sets the "has_umbrella" field if the given value is not nil.
+func (cc *ChildCreate) SetNillableHasUmbrella(b *bool) *ChildCreate {
+ if b != nil {
+ cc.SetHasUmbrella(*b)
+ }
+ return cc
+}
+
+// SetHasOther sets the "has_other" field.
+func (cc *ChildCreate) SetHasOther(b bool) *ChildCreate {
+ cc.mutation.SetHasOther(b)
+ return cc
+}
+
+// SetNillableHasOther sets the "has_other" field if the given value is not nil.
+func (cc *ChildCreate) SetNillableHasOther(b *bool) *ChildCreate {
+ if b != nil {
+ cc.SetHasOther(*b)
+ }
+ return cc
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (cc *ChildCreate) SetCreatedAt(t time.Time) *ChildCreate {
+ cc.mutation.SetCreatedAt(t)
+ return cc
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (cc *ChildCreate) SetNillableCreatedAt(t *time.Time) *ChildCreate {
+ if t != nil {
+ cc.SetCreatedAt(*t)
+ }
+ return cc
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (cc *ChildCreate) SetUpdatedAt(t time.Time) *ChildCreate {
+ cc.mutation.SetUpdatedAt(t)
+ return cc
+}
+
+// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
+func (cc *ChildCreate) SetNillableUpdatedAt(t *time.Time) *ChildCreate {
+ if t != nil {
+ cc.SetUpdatedAt(*t)
+ }
+ return cc
+}
+
+// SetID sets the "id" field.
+func (cc *ChildCreate) SetID(u uuid.UUID) *ChildCreate {
+ cc.mutation.SetID(u)
+ return cc
+}
+
+// SetNillableID sets the "id" field if the given value is not nil.
+func (cc *ChildCreate) SetNillableID(u *uuid.UUID) *ChildCreate {
+ if u != nil {
+ cc.SetID(*u)
+ }
+ return cc
+}
+
+// SetGuardianID sets the "guardian" edge to the Guardian entity by ID.
+func (cc *ChildCreate) SetGuardianID(id uuid.UUID) *ChildCreate {
+ cc.mutation.SetGuardianID(id)
+ return cc
+}
+
+// SetNillableGuardianID sets the "guardian" edge to the Guardian entity by ID if the given value is not nil.
+func (cc *ChildCreate) SetNillableGuardianID(id *uuid.UUID) *ChildCreate {
+ if id != nil {
+ cc = cc.SetGuardianID(*id)
+ }
+ return cc
+}
+
+// SetGuardian sets the "guardian" edge to the Guardian entity.
+func (cc *ChildCreate) SetGuardian(g *Guardian) *ChildCreate {
+ return cc.SetGuardianID(g.ID)
+}
+
+// AddChildBusAssociationIDs adds the "childBusAssociations" edge to the ChildBusAssociation entity by IDs.
+func (cc *ChildCreate) AddChildBusAssociationIDs(ids ...int) *ChildCreate {
+ cc.mutation.AddChildBusAssociationIDs(ids...)
+ return cc
+}
+
+// AddChildBusAssociations adds the "childBusAssociations" edges to the ChildBusAssociation entity.
+func (cc *ChildCreate) AddChildBusAssociations(c ...*ChildBusAssociation) *ChildCreate {
+ ids := make([]int, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return cc.AddChildBusAssociationIDs(ids...)
+}
+
+// AddBoardingRecordIDs adds the "boarding_record" edge to the BoardingRecord entity by IDs.
+func (cc *ChildCreate) AddBoardingRecordIDs(ids ...uuid.UUID) *ChildCreate {
+ cc.mutation.AddBoardingRecordIDs(ids...)
+ return cc
+}
+
+// AddBoardingRecord adds the "boarding_record" edges to the BoardingRecord entity.
+func (cc *ChildCreate) AddBoardingRecord(b ...*BoardingRecord) *ChildCreate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return cc.AddBoardingRecordIDs(ids...)
+}
+
+// AddPhotoIDs adds the "photos" edge to the ChildPhoto entity by IDs.
+func (cc *ChildCreate) AddPhotoIDs(ids ...uuid.UUID) *ChildCreate {
+ cc.mutation.AddPhotoIDs(ids...)
+ return cc
+}
+
+// AddPhotos adds the "photos" edges to the ChildPhoto entity.
+func (cc *ChildCreate) AddPhotos(c ...*ChildPhoto) *ChildCreate {
+ ids := make([]uuid.UUID, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return cc.AddPhotoIDs(ids...)
+}
+
+// Mutation returns the ChildMutation object of the builder.
+func (cc *ChildCreate) Mutation() *ChildMutation {
+ return cc.mutation
+}
+
+// Save creates the Child in the database.
+func (cc *ChildCreate) Save(ctx context.Context) (*Child, error) {
+ cc.defaults()
+ return withHooks(ctx, cc.sqlSave, cc.mutation, cc.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (cc *ChildCreate) SaveX(ctx context.Context) *Child {
+ v, err := cc.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (cc *ChildCreate) Exec(ctx context.Context) error {
+ _, err := cc.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cc *ChildCreate) ExecX(ctx context.Context) {
+ if err := cc.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (cc *ChildCreate) defaults() {
+ if _, ok := cc.mutation.CheckForMissingItems(); !ok {
+ v := child.DefaultCheckForMissingItems
+ cc.mutation.SetCheckForMissingItems(v)
+ }
+ if _, ok := cc.mutation.HasBag(); !ok {
+ v := child.DefaultHasBag
+ cc.mutation.SetHasBag(v)
+ }
+ if _, ok := cc.mutation.HasLunchBox(); !ok {
+ v := child.DefaultHasLunchBox
+ cc.mutation.SetHasLunchBox(v)
+ }
+ if _, ok := cc.mutation.HasWaterBottle(); !ok {
+ v := child.DefaultHasWaterBottle
+ cc.mutation.SetHasWaterBottle(v)
+ }
+ if _, ok := cc.mutation.HasUmbrella(); !ok {
+ v := child.DefaultHasUmbrella
+ cc.mutation.SetHasUmbrella(v)
+ }
+ if _, ok := cc.mutation.HasOther(); !ok {
+ v := child.DefaultHasOther
+ cc.mutation.SetHasOther(v)
+ }
+ if _, ok := cc.mutation.CreatedAt(); !ok {
+ v := child.DefaultCreatedAt()
+ cc.mutation.SetCreatedAt(v)
+ }
+ if _, ok := cc.mutation.UpdatedAt(); !ok {
+ v := child.DefaultUpdatedAt()
+ cc.mutation.SetUpdatedAt(v)
+ }
+ if _, ok := cc.mutation.ID(); !ok {
+ v := child.DefaultID()
+ cc.mutation.SetID(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (cc *ChildCreate) check() error {
+ if _, ok := cc.mutation.Name(); !ok {
+ return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Child.name"`)}
+ }
+ if _, ok := cc.mutation.Age(); !ok {
+ return &ValidationError{Name: "age", err: errors.New(`ent: missing required field "Child.age"`)}
+ }
+ if _, ok := cc.mutation.Sex(); !ok {
+ return &ValidationError{Name: "sex", err: errors.New(`ent: missing required field "Child.sex"`)}
+ }
+ if v, ok := cc.mutation.Sex(); ok {
+ if err := child.SexValidator(v); err != nil {
+ return &ValidationError{Name: "sex", err: fmt.Errorf(`ent: validator failed for field "Child.sex": %w`, err)}
+ }
+ }
+ if _, ok := cc.mutation.CheckForMissingItems(); !ok {
+ return &ValidationError{Name: "check_for_missing_items", err: errors.New(`ent: missing required field "Child.check_for_missing_items"`)}
+ }
+ if _, ok := cc.mutation.HasBag(); !ok {
+ return &ValidationError{Name: "has_bag", err: errors.New(`ent: missing required field "Child.has_bag"`)}
+ }
+ if _, ok := cc.mutation.HasLunchBox(); !ok {
+ return &ValidationError{Name: "has_lunch_box", err: errors.New(`ent: missing required field "Child.has_lunch_box"`)}
+ }
+ if _, ok := cc.mutation.HasWaterBottle(); !ok {
+ return &ValidationError{Name: "has_water_bottle", err: errors.New(`ent: missing required field "Child.has_water_bottle"`)}
+ }
+ if _, ok := cc.mutation.HasUmbrella(); !ok {
+ return &ValidationError{Name: "has_umbrella", err: errors.New(`ent: missing required field "Child.has_umbrella"`)}
+ }
+ if _, ok := cc.mutation.HasOther(); !ok {
+ return &ValidationError{Name: "has_other", err: errors.New(`ent: missing required field "Child.has_other"`)}
+ }
+ if _, ok := cc.mutation.CreatedAt(); !ok {
+ return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Child.created_at"`)}
+ }
+ if _, ok := cc.mutation.UpdatedAt(); !ok {
+ return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Child.updated_at"`)}
+ }
+ return nil
+}
+
+func (cc *ChildCreate) sqlSave(ctx context.Context) (*Child, error) {
+ if err := cc.check(); err != nil {
+ return nil, err
+ }
+ _node, _spec := cc.createSpec()
+ if err := sqlgraph.CreateNode(ctx, cc.driver, _spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ if _spec.ID.Value != nil {
+ if id, ok := _spec.ID.Value.(*uuid.UUID); ok {
+ _node.ID = *id
+ } else if err := _node.ID.Scan(_spec.ID.Value); err != nil {
+ return nil, err
+ }
+ }
+ cc.mutation.id = &_node.ID
+ cc.mutation.done = true
+ return _node, nil
+}
+
+func (cc *ChildCreate) createSpec() (*Child, *sqlgraph.CreateSpec) {
+ var (
+ _node = &Child{config: cc.config}
+ _spec = sqlgraph.NewCreateSpec(child.Table, sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID))
+ )
+ if id, ok := cc.mutation.ID(); ok {
+ _node.ID = id
+ _spec.ID.Value = &id
+ }
+ if value, ok := cc.mutation.Name(); ok {
+ _spec.SetField(child.FieldName, field.TypeString, value)
+ _node.Name = value
+ }
+ if value, ok := cc.mutation.Age(); ok {
+ _spec.SetField(child.FieldAge, field.TypeInt, value)
+ _node.Age = value
+ }
+ if value, ok := cc.mutation.Sex(); ok {
+ _spec.SetField(child.FieldSex, field.TypeEnum, value)
+ _node.Sex = value
+ }
+ if value, ok := cc.mutation.CheckForMissingItems(); ok {
+ _spec.SetField(child.FieldCheckForMissingItems, field.TypeBool, value)
+ _node.CheckForMissingItems = value
+ }
+ if value, ok := cc.mutation.HasBag(); ok {
+ _spec.SetField(child.FieldHasBag, field.TypeBool, value)
+ _node.HasBag = value
+ }
+ if value, ok := cc.mutation.HasLunchBox(); ok {
+ _spec.SetField(child.FieldHasLunchBox, field.TypeBool, value)
+ _node.HasLunchBox = value
+ }
+ if value, ok := cc.mutation.HasWaterBottle(); ok {
+ _spec.SetField(child.FieldHasWaterBottle, field.TypeBool, value)
+ _node.HasWaterBottle = value
+ }
+ if value, ok := cc.mutation.HasUmbrella(); ok {
+ _spec.SetField(child.FieldHasUmbrella, field.TypeBool, value)
+ _node.HasUmbrella = value
+ }
+ if value, ok := cc.mutation.HasOther(); ok {
+ _spec.SetField(child.FieldHasOther, field.TypeBool, value)
+ _node.HasOther = value
+ }
+ if value, ok := cc.mutation.CreatedAt(); ok {
+ _spec.SetField(child.FieldCreatedAt, field.TypeTime, value)
+ _node.CreatedAt = value
+ }
+ if value, ok := cc.mutation.UpdatedAt(); ok {
+ _spec.SetField(child.FieldUpdatedAt, field.TypeTime, value)
+ _node.UpdatedAt = value
+ }
+ if nodes := cc.mutation.GuardianIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: child.GuardianTable,
+ Columns: []string{child.GuardianColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _node.guardian_children = &nodes[0]
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := cc.mutation.ChildBusAssociationsIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.ChildBusAssociationsTable,
+ Columns: []string{child.ChildBusAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := cc.mutation.BoardingRecordIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.BoardingRecordTable,
+ Columns: []string{child.BoardingRecordColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := cc.mutation.PhotosIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.PhotosTable,
+ Columns: []string{child.PhotosColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childphoto.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ return _node, _spec
+}
+
+// ChildCreateBulk is the builder for creating many Child entities in bulk.
+type ChildCreateBulk struct {
+ config
+ err error
+ builders []*ChildCreate
+}
+
+// Save creates the Child entities in the database.
+func (ccb *ChildCreateBulk) Save(ctx context.Context) ([]*Child, error) {
+ if ccb.err != nil {
+ return nil, ccb.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(ccb.builders))
+ nodes := make([]*Child, len(ccb.builders))
+ mutators := make([]Mutator, len(ccb.builders))
+ for i := range ccb.builders {
+ func(i int, root context.Context) {
+ builder := ccb.builders[i]
+ builder.defaults()
+ var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+ mutation, ok := m.(*ChildMutation)
+ if !ok {
+ return nil, fmt.Errorf("unexpected mutation type %T", m)
+ }
+ if err := builder.check(); err != nil {
+ return nil, err
+ }
+ builder.mutation = mutation
+ var err error
+ nodes[i], specs[i] = builder.createSpec()
+ if i < len(mutators)-1 {
+ _, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)
+ } else {
+ spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+ // Invoke the actual operation on the latest mutation in the chain.
+ if err = sqlgraph.BatchCreate(ctx, ccb.driver, spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ }
+ }
+ if err != nil {
+ return nil, err
+ }
+ mutation.id = &nodes[i].ID
+ mutation.done = true
+ return nodes[i], nil
+ })
+ for i := len(builder.hooks) - 1; i >= 0; i-- {
+ mut = builder.hooks[i](mut)
+ }
+ mutators[i] = mut
+ }(i, ctx)
+ }
+ if len(mutators) > 0 {
+ if _, err := mutators[0].Mutate(ctx, ccb.builders[0].mutation); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (ccb *ChildCreateBulk) SaveX(ctx context.Context) []*Child {
+ v, err := ccb.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (ccb *ChildCreateBulk) Exec(ctx context.Context) error {
+ _, err := ccb.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (ccb *ChildCreateBulk) ExecX(ctx context.Context) {
+ if err := ccb.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/child_delete.go b/backend/domain/repository/ent/child_delete.go
new file mode 100644
index 00000000..302169b3
--- /dev/null
+++ b/backend/domain/repository/ent/child_delete.go
@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+)
+
+// ChildDelete is the builder for deleting a Child entity.
+type ChildDelete struct {
+ config
+ hooks []Hook
+ mutation *ChildMutation
+}
+
+// Where appends a list predicates to the ChildDelete builder.
+func (cd *ChildDelete) Where(ps ...predicate.Child) *ChildDelete {
+ cd.mutation.Where(ps...)
+ return cd
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (cd *ChildDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, cd.sqlExec, cd.mutation, cd.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cd *ChildDelete) ExecX(ctx context.Context) int {
+ n, err := cd.Exec(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return n
+}
+
+func (cd *ChildDelete) sqlExec(ctx context.Context) (int, error) {
+ _spec := sqlgraph.NewDeleteSpec(child.Table, sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID))
+ if ps := cd.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ affected, err := sqlgraph.DeleteNodes(ctx, cd.driver, _spec)
+ if err != nil && sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ cd.mutation.done = true
+ return affected, err
+}
+
+// ChildDeleteOne is the builder for deleting a single Child entity.
+type ChildDeleteOne struct {
+ cd *ChildDelete
+}
+
+// Where appends a list predicates to the ChildDelete builder.
+func (cdo *ChildDeleteOne) Where(ps ...predicate.Child) *ChildDeleteOne {
+ cdo.cd.mutation.Where(ps...)
+ return cdo
+}
+
+// Exec executes the deletion query.
+func (cdo *ChildDeleteOne) Exec(ctx context.Context) error {
+ n, err := cdo.cd.Exec(ctx)
+ switch {
+ case err != nil:
+ return err
+ case n == 0:
+ return &NotFoundError{child.Label}
+ default:
+ return nil
+ }
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cdo *ChildDeleteOne) ExecX(ctx context.Context) {
+ if err := cdo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/child_query.go b/backend/domain/repository/ent/child_query.go
new file mode 100644
index 00000000..da7877d2
--- /dev/null
+++ b/backend/domain/repository/ent/child_query.go
@@ -0,0 +1,841 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "database/sql/driver"
+ "fmt"
+ "math"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childbusassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childphoto"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// ChildQuery is the builder for querying Child entities.
+type ChildQuery struct {
+ config
+ ctx *QueryContext
+ order []child.OrderOption
+ inters []Interceptor
+ predicates []predicate.Child
+ withGuardian *GuardianQuery
+ withChildBusAssociations *ChildBusAssociationQuery
+ withBoardingRecord *BoardingRecordQuery
+ withPhotos *ChildPhotoQuery
+ withFKs bool
+ // intermediate query (i.e. traversal path).
+ sql *sql.Selector
+ path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the ChildQuery builder.
+func (cq *ChildQuery) Where(ps ...predicate.Child) *ChildQuery {
+ cq.predicates = append(cq.predicates, ps...)
+ return cq
+}
+
+// Limit the number of records to be returned by this query.
+func (cq *ChildQuery) Limit(limit int) *ChildQuery {
+ cq.ctx.Limit = &limit
+ return cq
+}
+
+// Offset to start from.
+func (cq *ChildQuery) Offset(offset int) *ChildQuery {
+ cq.ctx.Offset = &offset
+ return cq
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (cq *ChildQuery) Unique(unique bool) *ChildQuery {
+ cq.ctx.Unique = &unique
+ return cq
+}
+
+// Order specifies how the records should be ordered.
+func (cq *ChildQuery) Order(o ...child.OrderOption) *ChildQuery {
+ cq.order = append(cq.order, o...)
+ return cq
+}
+
+// QueryGuardian chains the current query on the "guardian" edge.
+func (cq *ChildQuery) QueryGuardian() *GuardianQuery {
+ query := (&GuardianClient{config: cq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := cq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := cq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(child.Table, child.FieldID, selector),
+ sqlgraph.To(guardian.Table, guardian.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, child.GuardianTable, child.GuardianColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(cq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryChildBusAssociations chains the current query on the "childBusAssociations" edge.
+func (cq *ChildQuery) QueryChildBusAssociations() *ChildBusAssociationQuery {
+ query := (&ChildBusAssociationClient{config: cq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := cq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := cq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(child.Table, child.FieldID, selector),
+ sqlgraph.To(childbusassociation.Table, childbusassociation.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, child.ChildBusAssociationsTable, child.ChildBusAssociationsColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(cq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryBoardingRecord chains the current query on the "boarding_record" edge.
+func (cq *ChildQuery) QueryBoardingRecord() *BoardingRecordQuery {
+ query := (&BoardingRecordClient{config: cq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := cq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := cq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(child.Table, child.FieldID, selector),
+ sqlgraph.To(boardingrecord.Table, boardingrecord.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, child.BoardingRecordTable, child.BoardingRecordColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(cq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryPhotos chains the current query on the "photos" edge.
+func (cq *ChildQuery) QueryPhotos() *ChildPhotoQuery {
+ query := (&ChildPhotoClient{config: cq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := cq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := cq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(child.Table, child.FieldID, selector),
+ sqlgraph.To(childphoto.Table, childphoto.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, child.PhotosTable, child.PhotosColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(cq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// First returns the first Child entity from the query.
+// Returns a *NotFoundError when no Child was found.
+func (cq *ChildQuery) First(ctx context.Context) (*Child, error) {
+ nodes, err := cq.Limit(1).All(setContextOp(ctx, cq.ctx, "First"))
+ if err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nil, &NotFoundError{child.Label}
+ }
+ return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (cq *ChildQuery) FirstX(ctx context.Context) *Child {
+ node, err := cq.First(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return node
+}
+
+// FirstID returns the first Child ID from the query.
+// Returns a *NotFoundError when no Child ID was found.
+func (cq *ChildQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+ var ids []uuid.UUID
+ if ids, err = cq.Limit(1).IDs(setContextOp(ctx, cq.ctx, "FirstID")); err != nil {
+ return
+ }
+ if len(ids) == 0 {
+ err = &NotFoundError{child.Label}
+ return
+ }
+ return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (cq *ChildQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := cq.FirstID(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return id
+}
+
+// Only returns a single Child entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one Child entity is found.
+// Returns a *NotFoundError when no Child entities are found.
+func (cq *ChildQuery) Only(ctx context.Context) (*Child, error) {
+ nodes, err := cq.Limit(2).All(setContextOp(ctx, cq.ctx, "Only"))
+ if err != nil {
+ return nil, err
+ }
+ switch len(nodes) {
+ case 1:
+ return nodes[0], nil
+ case 0:
+ return nil, &NotFoundError{child.Label}
+ default:
+ return nil, &NotSingularError{child.Label}
+ }
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (cq *ChildQuery) OnlyX(ctx context.Context) *Child {
+ node, err := cq.Only(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// OnlyID is like Only, but returns the only Child ID in the query.
+// Returns a *NotSingularError when more than one Child ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (cq *ChildQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+ var ids []uuid.UUID
+ if ids, err = cq.Limit(2).IDs(setContextOp(ctx, cq.ctx, "OnlyID")); err != nil {
+ return
+ }
+ switch len(ids) {
+ case 1:
+ id = ids[0]
+ case 0:
+ err = &NotFoundError{child.Label}
+ default:
+ err = &NotSingularError{child.Label}
+ }
+ return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (cq *ChildQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := cq.OnlyID(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// All executes the query and returns a list of Childs.
+func (cq *ChildQuery) All(ctx context.Context) ([]*Child, error) {
+ ctx = setContextOp(ctx, cq.ctx, "All")
+ if err := cq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ qr := querierAll[[]*Child, *ChildQuery]()
+ return withInterceptors[[]*Child](ctx, cq, qr, cq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (cq *ChildQuery) AllX(ctx context.Context) []*Child {
+ nodes, err := cq.All(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return nodes
+}
+
+// IDs executes the query and returns a list of Child IDs.
+func (cq *ChildQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if cq.ctx.Unique == nil && cq.path != nil {
+ cq.Unique(true)
+ }
+ ctx = setContextOp(ctx, cq.ctx, "IDs")
+ if err = cq.Select(child.FieldID).Scan(ctx, &ids); err != nil {
+ return nil, err
+ }
+ return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (cq *ChildQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := cq.IDs(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return ids
+}
+
+// Count returns the count of the given query.
+func (cq *ChildQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, cq.ctx, "Count")
+ if err := cq.prepareQuery(ctx); err != nil {
+ return 0, err
+ }
+ return withInterceptors[int](ctx, cq, querierCount[*ChildQuery](), cq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (cq *ChildQuery) CountX(ctx context.Context) int {
+ count, err := cq.Count(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (cq *ChildQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, cq.ctx, "Exist")
+ switch _, err := cq.FirstID(ctx); {
+ case IsNotFound(err):
+ return false, nil
+ case err != nil:
+ return false, fmt.Errorf("ent: check existence: %w", err)
+ default:
+ return true, nil
+ }
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (cq *ChildQuery) ExistX(ctx context.Context) bool {
+ exist, err := cq.Exist(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return exist
+}
+
+// Clone returns a duplicate of the ChildQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (cq *ChildQuery) Clone() *ChildQuery {
+ if cq == nil {
+ return nil
+ }
+ return &ChildQuery{
+ config: cq.config,
+ ctx: cq.ctx.Clone(),
+ order: append([]child.OrderOption{}, cq.order...),
+ inters: append([]Interceptor{}, cq.inters...),
+ predicates: append([]predicate.Child{}, cq.predicates...),
+ withGuardian: cq.withGuardian.Clone(),
+ withChildBusAssociations: cq.withChildBusAssociations.Clone(),
+ withBoardingRecord: cq.withBoardingRecord.Clone(),
+ withPhotos: cq.withPhotos.Clone(),
+ // clone intermediate query.
+ sql: cq.sql.Clone(),
+ path: cq.path,
+ }
+}
+
+// WithGuardian tells the query-builder to eager-load the nodes that are connected to
+// the "guardian" edge. The optional arguments are used to configure the query builder of the edge.
+func (cq *ChildQuery) WithGuardian(opts ...func(*GuardianQuery)) *ChildQuery {
+ query := (&GuardianClient{config: cq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ cq.withGuardian = query
+ return cq
+}
+
+// WithChildBusAssociations tells the query-builder to eager-load the nodes that are connected to
+// the "childBusAssociations" edge. The optional arguments are used to configure the query builder of the edge.
+func (cq *ChildQuery) WithChildBusAssociations(opts ...func(*ChildBusAssociationQuery)) *ChildQuery {
+ query := (&ChildBusAssociationClient{config: cq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ cq.withChildBusAssociations = query
+ return cq
+}
+
+// WithBoardingRecord tells the query-builder to eager-load the nodes that are connected to
+// the "boarding_record" edge. The optional arguments are used to configure the query builder of the edge.
+func (cq *ChildQuery) WithBoardingRecord(opts ...func(*BoardingRecordQuery)) *ChildQuery {
+ query := (&BoardingRecordClient{config: cq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ cq.withBoardingRecord = query
+ return cq
+}
+
+// WithPhotos tells the query-builder to eager-load the nodes that are connected to
+// the "photos" edge. The optional arguments are used to configure the query builder of the edge.
+func (cq *ChildQuery) WithPhotos(opts ...func(*ChildPhotoQuery)) *ChildQuery {
+ query := (&ChildPhotoClient{config: cq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ cq.withPhotos = query
+ return cq
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+// var v []struct {
+// Name string `json:"name,omitempty"`
+// Count int `json:"count,omitempty"`
+// }
+//
+// client.Child.Query().
+// GroupBy(child.FieldName).
+// Aggregate(ent.Count()).
+// Scan(ctx, &v)
+func (cq *ChildQuery) GroupBy(field string, fields ...string) *ChildGroupBy {
+ cq.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &ChildGroupBy{build: cq}
+ grbuild.flds = &cq.ctx.Fields
+ grbuild.label = child.Label
+ grbuild.scan = grbuild.Scan
+ return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+// var v []struct {
+// Name string `json:"name,omitempty"`
+// }
+//
+// client.Child.Query().
+// Select(child.FieldName).
+// Scan(ctx, &v)
+func (cq *ChildQuery) Select(fields ...string) *ChildSelect {
+ cq.ctx.Fields = append(cq.ctx.Fields, fields...)
+ sbuild := &ChildSelect{ChildQuery: cq}
+ sbuild.label = child.Label
+ sbuild.flds, sbuild.scan = &cq.ctx.Fields, sbuild.Scan
+ return sbuild
+}
+
+// Aggregate returns a ChildSelect configured with the given aggregations.
+func (cq *ChildQuery) Aggregate(fns ...AggregateFunc) *ChildSelect {
+ return cq.Select().Aggregate(fns...)
+}
+
+func (cq *ChildQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range cq.inters {
+ if inter == nil {
+ return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+ }
+ if trv, ok := inter.(Traverser); ok {
+ if err := trv.Traverse(ctx, cq); err != nil {
+ return err
+ }
+ }
+ }
+ for _, f := range cq.ctx.Fields {
+ if !child.ValidColumn(f) {
+ return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ }
+ if cq.path != nil {
+ prev, err := cq.path(ctx)
+ if err != nil {
+ return err
+ }
+ cq.sql = prev
+ }
+ return nil
+}
+
+func (cq *ChildQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Child, error) {
+ var (
+ nodes = []*Child{}
+ withFKs = cq.withFKs
+ _spec = cq.querySpec()
+ loadedTypes = [4]bool{
+ cq.withGuardian != nil,
+ cq.withChildBusAssociations != nil,
+ cq.withBoardingRecord != nil,
+ cq.withPhotos != nil,
+ }
+ )
+ if cq.withGuardian != nil {
+ withFKs = true
+ }
+ if withFKs {
+ _spec.Node.Columns = append(_spec.Node.Columns, child.ForeignKeys...)
+ }
+ _spec.ScanValues = func(columns []string) ([]any, error) {
+ return (*Child).scanValues(nil, columns)
+ }
+ _spec.Assign = func(columns []string, values []any) error {
+ node := &Child{config: cq.config}
+ nodes = append(nodes, node)
+ node.Edges.loadedTypes = loadedTypes
+ return node.assignValues(columns, values)
+ }
+ for i := range hooks {
+ hooks[i](ctx, _spec)
+ }
+ if err := sqlgraph.QueryNodes(ctx, cq.driver, _spec); err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nodes, nil
+ }
+ if query := cq.withGuardian; query != nil {
+ if err := cq.loadGuardian(ctx, query, nodes, nil,
+ func(n *Child, e *Guardian) { n.Edges.Guardian = e }); err != nil {
+ return nil, err
+ }
+ }
+ if query := cq.withChildBusAssociations; query != nil {
+ if err := cq.loadChildBusAssociations(ctx, query, nodes,
+ func(n *Child) { n.Edges.ChildBusAssociations = []*ChildBusAssociation{} },
+ func(n *Child, e *ChildBusAssociation) {
+ n.Edges.ChildBusAssociations = append(n.Edges.ChildBusAssociations, e)
+ }); err != nil {
+ return nil, err
+ }
+ }
+ if query := cq.withBoardingRecord; query != nil {
+ if err := cq.loadBoardingRecord(ctx, query, nodes,
+ func(n *Child) { n.Edges.BoardingRecord = []*BoardingRecord{} },
+ func(n *Child, e *BoardingRecord) { n.Edges.BoardingRecord = append(n.Edges.BoardingRecord, e) }); err != nil {
+ return nil, err
+ }
+ }
+ if query := cq.withPhotos; query != nil {
+ if err := cq.loadPhotos(ctx, query, nodes,
+ func(n *Child) { n.Edges.Photos = []*ChildPhoto{} },
+ func(n *Child, e *ChildPhoto) { n.Edges.Photos = append(n.Edges.Photos, e) }); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+func (cq *ChildQuery) loadGuardian(ctx context.Context, query *GuardianQuery, nodes []*Child, init func(*Child), assign func(*Child, *Guardian)) error {
+ ids := make([]uuid.UUID, 0, len(nodes))
+ nodeids := make(map[uuid.UUID][]*Child)
+ for i := range nodes {
+ if nodes[i].guardian_children == nil {
+ continue
+ }
+ fk := *nodes[i].guardian_children
+ if _, ok := nodeids[fk]; !ok {
+ ids = append(ids, fk)
+ }
+ nodeids[fk] = append(nodeids[fk], nodes[i])
+ }
+ if len(ids) == 0 {
+ return nil
+ }
+ query.Where(guardian.IDIn(ids...))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ nodes, ok := nodeids[n.ID]
+ if !ok {
+ return fmt.Errorf(`unexpected foreign-key "guardian_children" returned %v`, n.ID)
+ }
+ for i := range nodes {
+ assign(nodes[i], n)
+ }
+ }
+ return nil
+}
+func (cq *ChildQuery) loadChildBusAssociations(ctx context.Context, query *ChildBusAssociationQuery, nodes []*Child, init func(*Child), assign func(*Child, *ChildBusAssociation)) error {
+ fks := make([]driver.Value, 0, len(nodes))
+ nodeids := make(map[uuid.UUID]*Child)
+ for i := range nodes {
+ fks = append(fks, nodes[i].ID)
+ nodeids[nodes[i].ID] = nodes[i]
+ if init != nil {
+ init(nodes[i])
+ }
+ }
+ if len(query.ctx.Fields) > 0 {
+ query.ctx.AppendFieldOnce(childbusassociation.FieldChildID)
+ }
+ query.Where(predicate.ChildBusAssociation(func(s *sql.Selector) {
+ s.Where(sql.InValues(s.C(child.ChildBusAssociationsColumn), fks...))
+ }))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ fk := n.ChildID
+ node, ok := nodeids[fk]
+ if !ok {
+ return fmt.Errorf(`unexpected referenced foreign-key "child_id" returned %v for node %v`, fk, n.ID)
+ }
+ assign(node, n)
+ }
+ return nil
+}
+func (cq *ChildQuery) loadBoardingRecord(ctx context.Context, query *BoardingRecordQuery, nodes []*Child, init func(*Child), assign func(*Child, *BoardingRecord)) error {
+ fks := make([]driver.Value, 0, len(nodes))
+ nodeids := make(map[uuid.UUID]*Child)
+ for i := range nodes {
+ fks = append(fks, nodes[i].ID)
+ nodeids[nodes[i].ID] = nodes[i]
+ if init != nil {
+ init(nodes[i])
+ }
+ }
+ query.withFKs = true
+ query.Where(predicate.BoardingRecord(func(s *sql.Selector) {
+ s.Where(sql.InValues(s.C(child.BoardingRecordColumn), fks...))
+ }))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ fk := n.child_boarding_record
+ if fk == nil {
+ return fmt.Errorf(`foreign-key "child_boarding_record" is nil for node %v`, n.ID)
+ }
+ node, ok := nodeids[*fk]
+ if !ok {
+ return fmt.Errorf(`unexpected referenced foreign-key "child_boarding_record" returned %v for node %v`, *fk, n.ID)
+ }
+ assign(node, n)
+ }
+ return nil
+}
+func (cq *ChildQuery) loadPhotos(ctx context.Context, query *ChildPhotoQuery, nodes []*Child, init func(*Child), assign func(*Child, *ChildPhoto)) error {
+ fks := make([]driver.Value, 0, len(nodes))
+ nodeids := make(map[uuid.UUID]*Child)
+ for i := range nodes {
+ fks = append(fks, nodes[i].ID)
+ nodeids[nodes[i].ID] = nodes[i]
+ if init != nil {
+ init(nodes[i])
+ }
+ }
+ query.withFKs = true
+ query.Where(predicate.ChildPhoto(func(s *sql.Selector) {
+ s.Where(sql.InValues(s.C(child.PhotosColumn), fks...))
+ }))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ fk := n.child_photos
+ if fk == nil {
+ return fmt.Errorf(`foreign-key "child_photos" is nil for node %v`, n.ID)
+ }
+ node, ok := nodeids[*fk]
+ if !ok {
+ return fmt.Errorf(`unexpected referenced foreign-key "child_photos" returned %v for node %v`, *fk, n.ID)
+ }
+ assign(node, n)
+ }
+ return nil
+}
+
+func (cq *ChildQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := cq.querySpec()
+ _spec.Node.Columns = cq.ctx.Fields
+ if len(cq.ctx.Fields) > 0 {
+ _spec.Unique = cq.ctx.Unique != nil && *cq.ctx.Unique
+ }
+ return sqlgraph.CountNodes(ctx, cq.driver, _spec)
+}
+
+func (cq *ChildQuery) querySpec() *sqlgraph.QuerySpec {
+ _spec := sqlgraph.NewQuerySpec(child.Table, child.Columns, sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID))
+ _spec.From = cq.sql
+ if unique := cq.ctx.Unique; unique != nil {
+ _spec.Unique = *unique
+ } else if cq.path != nil {
+ _spec.Unique = true
+ }
+ if fields := cq.ctx.Fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, child.FieldID)
+ for i := range fields {
+ if fields[i] != child.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+ }
+ }
+ }
+ if ps := cq.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if limit := cq.ctx.Limit; limit != nil {
+ _spec.Limit = *limit
+ }
+ if offset := cq.ctx.Offset; offset != nil {
+ _spec.Offset = *offset
+ }
+ if ps := cq.order; len(ps) > 0 {
+ _spec.Order = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ return _spec
+}
+
+func (cq *ChildQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(cq.driver.Dialect())
+ t1 := builder.Table(child.Table)
+ columns := cq.ctx.Fields
+ if len(columns) == 0 {
+ columns = child.Columns
+ }
+ selector := builder.Select(t1.Columns(columns...)...).From(t1)
+ if cq.sql != nil {
+ selector = cq.sql
+ selector.Select(selector.Columns(columns...)...)
+ }
+ if cq.ctx.Unique != nil && *cq.ctx.Unique {
+ selector.Distinct()
+ }
+ for _, p := range cq.predicates {
+ p(selector)
+ }
+ for _, p := range cq.order {
+ p(selector)
+ }
+ if offset := cq.ctx.Offset; offset != nil {
+ // limit is mandatory for offset clause. We start
+ // with default value, and override it below if needed.
+ selector.Offset(*offset).Limit(math.MaxInt32)
+ }
+ if limit := cq.ctx.Limit; limit != nil {
+ selector.Limit(*limit)
+ }
+ return selector
+}
+
+// ChildGroupBy is the group-by builder for Child entities.
+type ChildGroupBy struct {
+ selector
+ build *ChildQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (cgb *ChildGroupBy) Aggregate(fns ...AggregateFunc) *ChildGroupBy {
+ cgb.fns = append(cgb.fns, fns...)
+ return cgb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (cgb *ChildGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, cgb.build.ctx, "GroupBy")
+ if err := cgb.build.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*ChildQuery, *ChildGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v)
+}
+
+func (cgb *ChildGroupBy) sqlScan(ctx context.Context, root *ChildQuery, v any) error {
+ selector := root.sqlQuery(ctx).Select()
+ aggregation := make([]string, 0, len(cgb.fns))
+ for _, fn := range cgb.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ if len(selector.SelectedColumns()) == 0 {
+ columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns))
+ for _, f := range *cgb.flds {
+ columns = append(columns, selector.C(f))
+ }
+ columns = append(columns, aggregation...)
+ selector.Select(columns...)
+ }
+ selector.GroupBy(selector.Columns(*cgb.flds...)...)
+ if err := selector.Err(); err != nil {
+ return err
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
+
+// ChildSelect is the builder for selecting fields of Child entities.
+type ChildSelect struct {
+ *ChildQuery
+ selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (cs *ChildSelect) Aggregate(fns ...AggregateFunc) *ChildSelect {
+ cs.fns = append(cs.fns, fns...)
+ return cs
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (cs *ChildSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, cs.ctx, "Select")
+ if err := cs.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*ChildQuery, *ChildSelect](ctx, cs.ChildQuery, cs, cs.inters, v)
+}
+
+func (cs *ChildSelect) sqlScan(ctx context.Context, root *ChildQuery, v any) error {
+ selector := root.sqlQuery(ctx)
+ aggregation := make([]string, 0, len(cs.fns))
+ for _, fn := range cs.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ switch n := len(*cs.selector.flds); {
+ case n == 0 && len(aggregation) > 0:
+ selector.Select(aggregation...)
+ case n != 0 && len(aggregation) > 0:
+ selector.AppendSelect(aggregation...)
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := cs.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
diff --git a/backend/domain/repository/ent/child_update.go b/backend/domain/repository/ent/child_update.go
new file mode 100644
index 00000000..086fd7ea
--- /dev/null
+++ b/backend/domain/repository/ent/child_update.go
@@ -0,0 +1,1197 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childbusassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childphoto"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// ChildUpdate is the builder for updating Child entities.
+type ChildUpdate struct {
+ config
+ hooks []Hook
+ mutation *ChildMutation
+}
+
+// Where appends a list predicates to the ChildUpdate builder.
+func (cu *ChildUpdate) Where(ps ...predicate.Child) *ChildUpdate {
+ cu.mutation.Where(ps...)
+ return cu
+}
+
+// SetName sets the "name" field.
+func (cu *ChildUpdate) SetName(s string) *ChildUpdate {
+ cu.mutation.SetName(s)
+ return cu
+}
+
+// SetNillableName sets the "name" field if the given value is not nil.
+func (cu *ChildUpdate) SetNillableName(s *string) *ChildUpdate {
+ if s != nil {
+ cu.SetName(*s)
+ }
+ return cu
+}
+
+// SetAge sets the "age" field.
+func (cu *ChildUpdate) SetAge(i int) *ChildUpdate {
+ cu.mutation.ResetAge()
+ cu.mutation.SetAge(i)
+ return cu
+}
+
+// SetNillableAge sets the "age" field if the given value is not nil.
+func (cu *ChildUpdate) SetNillableAge(i *int) *ChildUpdate {
+ if i != nil {
+ cu.SetAge(*i)
+ }
+ return cu
+}
+
+// AddAge adds i to the "age" field.
+func (cu *ChildUpdate) AddAge(i int) *ChildUpdate {
+ cu.mutation.AddAge(i)
+ return cu
+}
+
+// SetSex sets the "sex" field.
+func (cu *ChildUpdate) SetSex(c child.Sex) *ChildUpdate {
+ cu.mutation.SetSex(c)
+ return cu
+}
+
+// SetNillableSex sets the "sex" field if the given value is not nil.
+func (cu *ChildUpdate) SetNillableSex(c *child.Sex) *ChildUpdate {
+ if c != nil {
+ cu.SetSex(*c)
+ }
+ return cu
+}
+
+// SetCheckForMissingItems sets the "check_for_missing_items" field.
+func (cu *ChildUpdate) SetCheckForMissingItems(b bool) *ChildUpdate {
+ cu.mutation.SetCheckForMissingItems(b)
+ return cu
+}
+
+// SetNillableCheckForMissingItems sets the "check_for_missing_items" field if the given value is not nil.
+func (cu *ChildUpdate) SetNillableCheckForMissingItems(b *bool) *ChildUpdate {
+ if b != nil {
+ cu.SetCheckForMissingItems(*b)
+ }
+ return cu
+}
+
+// SetHasBag sets the "has_bag" field.
+func (cu *ChildUpdate) SetHasBag(b bool) *ChildUpdate {
+ cu.mutation.SetHasBag(b)
+ return cu
+}
+
+// SetNillableHasBag sets the "has_bag" field if the given value is not nil.
+func (cu *ChildUpdate) SetNillableHasBag(b *bool) *ChildUpdate {
+ if b != nil {
+ cu.SetHasBag(*b)
+ }
+ return cu
+}
+
+// SetHasLunchBox sets the "has_lunch_box" field.
+func (cu *ChildUpdate) SetHasLunchBox(b bool) *ChildUpdate {
+ cu.mutation.SetHasLunchBox(b)
+ return cu
+}
+
+// SetNillableHasLunchBox sets the "has_lunch_box" field if the given value is not nil.
+func (cu *ChildUpdate) SetNillableHasLunchBox(b *bool) *ChildUpdate {
+ if b != nil {
+ cu.SetHasLunchBox(*b)
+ }
+ return cu
+}
+
+// SetHasWaterBottle sets the "has_water_bottle" field.
+func (cu *ChildUpdate) SetHasWaterBottle(b bool) *ChildUpdate {
+ cu.mutation.SetHasWaterBottle(b)
+ return cu
+}
+
+// SetNillableHasWaterBottle sets the "has_water_bottle" field if the given value is not nil.
+func (cu *ChildUpdate) SetNillableHasWaterBottle(b *bool) *ChildUpdate {
+ if b != nil {
+ cu.SetHasWaterBottle(*b)
+ }
+ return cu
+}
+
+// SetHasUmbrella sets the "has_umbrella" field.
+func (cu *ChildUpdate) SetHasUmbrella(b bool) *ChildUpdate {
+ cu.mutation.SetHasUmbrella(b)
+ return cu
+}
+
+// SetNillableHasUmbrella sets the "has_umbrella" field if the given value is not nil.
+func (cu *ChildUpdate) SetNillableHasUmbrella(b *bool) *ChildUpdate {
+ if b != nil {
+ cu.SetHasUmbrella(*b)
+ }
+ return cu
+}
+
+// SetHasOther sets the "has_other" field.
+func (cu *ChildUpdate) SetHasOther(b bool) *ChildUpdate {
+ cu.mutation.SetHasOther(b)
+ return cu
+}
+
+// SetNillableHasOther sets the "has_other" field if the given value is not nil.
+func (cu *ChildUpdate) SetNillableHasOther(b *bool) *ChildUpdate {
+ if b != nil {
+ cu.SetHasOther(*b)
+ }
+ return cu
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (cu *ChildUpdate) SetCreatedAt(t time.Time) *ChildUpdate {
+ cu.mutation.SetCreatedAt(t)
+ return cu
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (cu *ChildUpdate) SetNillableCreatedAt(t *time.Time) *ChildUpdate {
+ if t != nil {
+ cu.SetCreatedAt(*t)
+ }
+ return cu
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (cu *ChildUpdate) SetUpdatedAt(t time.Time) *ChildUpdate {
+ cu.mutation.SetUpdatedAt(t)
+ return cu
+}
+
+// SetGuardianID sets the "guardian" edge to the Guardian entity by ID.
+func (cu *ChildUpdate) SetGuardianID(id uuid.UUID) *ChildUpdate {
+ cu.mutation.SetGuardianID(id)
+ return cu
+}
+
+// SetNillableGuardianID sets the "guardian" edge to the Guardian entity by ID if the given value is not nil.
+func (cu *ChildUpdate) SetNillableGuardianID(id *uuid.UUID) *ChildUpdate {
+ if id != nil {
+ cu = cu.SetGuardianID(*id)
+ }
+ return cu
+}
+
+// SetGuardian sets the "guardian" edge to the Guardian entity.
+func (cu *ChildUpdate) SetGuardian(g *Guardian) *ChildUpdate {
+ return cu.SetGuardianID(g.ID)
+}
+
+// AddChildBusAssociationIDs adds the "childBusAssociations" edge to the ChildBusAssociation entity by IDs.
+func (cu *ChildUpdate) AddChildBusAssociationIDs(ids ...int) *ChildUpdate {
+ cu.mutation.AddChildBusAssociationIDs(ids...)
+ return cu
+}
+
+// AddChildBusAssociations adds the "childBusAssociations" edges to the ChildBusAssociation entity.
+func (cu *ChildUpdate) AddChildBusAssociations(c ...*ChildBusAssociation) *ChildUpdate {
+ ids := make([]int, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return cu.AddChildBusAssociationIDs(ids...)
+}
+
+// AddBoardingRecordIDs adds the "boarding_record" edge to the BoardingRecord entity by IDs.
+func (cu *ChildUpdate) AddBoardingRecordIDs(ids ...uuid.UUID) *ChildUpdate {
+ cu.mutation.AddBoardingRecordIDs(ids...)
+ return cu
+}
+
+// AddBoardingRecord adds the "boarding_record" edges to the BoardingRecord entity.
+func (cu *ChildUpdate) AddBoardingRecord(b ...*BoardingRecord) *ChildUpdate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return cu.AddBoardingRecordIDs(ids...)
+}
+
+// AddPhotoIDs adds the "photos" edge to the ChildPhoto entity by IDs.
+func (cu *ChildUpdate) AddPhotoIDs(ids ...uuid.UUID) *ChildUpdate {
+ cu.mutation.AddPhotoIDs(ids...)
+ return cu
+}
+
+// AddPhotos adds the "photos" edges to the ChildPhoto entity.
+func (cu *ChildUpdate) AddPhotos(c ...*ChildPhoto) *ChildUpdate {
+ ids := make([]uuid.UUID, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return cu.AddPhotoIDs(ids...)
+}
+
+// Mutation returns the ChildMutation object of the builder.
+func (cu *ChildUpdate) Mutation() *ChildMutation {
+ return cu.mutation
+}
+
+// ClearGuardian clears the "guardian" edge to the Guardian entity.
+func (cu *ChildUpdate) ClearGuardian() *ChildUpdate {
+ cu.mutation.ClearGuardian()
+ return cu
+}
+
+// ClearChildBusAssociations clears all "childBusAssociations" edges to the ChildBusAssociation entity.
+func (cu *ChildUpdate) ClearChildBusAssociations() *ChildUpdate {
+ cu.mutation.ClearChildBusAssociations()
+ return cu
+}
+
+// RemoveChildBusAssociationIDs removes the "childBusAssociations" edge to ChildBusAssociation entities by IDs.
+func (cu *ChildUpdate) RemoveChildBusAssociationIDs(ids ...int) *ChildUpdate {
+ cu.mutation.RemoveChildBusAssociationIDs(ids...)
+ return cu
+}
+
+// RemoveChildBusAssociations removes "childBusAssociations" edges to ChildBusAssociation entities.
+func (cu *ChildUpdate) RemoveChildBusAssociations(c ...*ChildBusAssociation) *ChildUpdate {
+ ids := make([]int, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return cu.RemoveChildBusAssociationIDs(ids...)
+}
+
+// ClearBoardingRecord clears all "boarding_record" edges to the BoardingRecord entity.
+func (cu *ChildUpdate) ClearBoardingRecord() *ChildUpdate {
+ cu.mutation.ClearBoardingRecord()
+ return cu
+}
+
+// RemoveBoardingRecordIDs removes the "boarding_record" edge to BoardingRecord entities by IDs.
+func (cu *ChildUpdate) RemoveBoardingRecordIDs(ids ...uuid.UUID) *ChildUpdate {
+ cu.mutation.RemoveBoardingRecordIDs(ids...)
+ return cu
+}
+
+// RemoveBoardingRecord removes "boarding_record" edges to BoardingRecord entities.
+func (cu *ChildUpdate) RemoveBoardingRecord(b ...*BoardingRecord) *ChildUpdate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return cu.RemoveBoardingRecordIDs(ids...)
+}
+
+// ClearPhotos clears all "photos" edges to the ChildPhoto entity.
+func (cu *ChildUpdate) ClearPhotos() *ChildUpdate {
+ cu.mutation.ClearPhotos()
+ return cu
+}
+
+// RemovePhotoIDs removes the "photos" edge to ChildPhoto entities by IDs.
+func (cu *ChildUpdate) RemovePhotoIDs(ids ...uuid.UUID) *ChildUpdate {
+ cu.mutation.RemovePhotoIDs(ids...)
+ return cu
+}
+
+// RemovePhotos removes "photos" edges to ChildPhoto entities.
+func (cu *ChildUpdate) RemovePhotos(c ...*ChildPhoto) *ChildUpdate {
+ ids := make([]uuid.UUID, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return cu.RemovePhotoIDs(ids...)
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (cu *ChildUpdate) Save(ctx context.Context) (int, error) {
+ cu.defaults()
+ return withHooks(ctx, cu.sqlSave, cu.mutation, cu.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (cu *ChildUpdate) SaveX(ctx context.Context) int {
+ affected, err := cu.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return affected
+}
+
+// Exec executes the query.
+func (cu *ChildUpdate) Exec(ctx context.Context) error {
+ _, err := cu.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cu *ChildUpdate) ExecX(ctx context.Context) {
+ if err := cu.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (cu *ChildUpdate) defaults() {
+ if _, ok := cu.mutation.UpdatedAt(); !ok {
+ v := child.UpdateDefaultUpdatedAt()
+ cu.mutation.SetUpdatedAt(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (cu *ChildUpdate) check() error {
+ if v, ok := cu.mutation.Sex(); ok {
+ if err := child.SexValidator(v); err != nil {
+ return &ValidationError{Name: "sex", err: fmt.Errorf(`ent: validator failed for field "Child.sex": %w`, err)}
+ }
+ }
+ return nil
+}
+
+func (cu *ChildUpdate) sqlSave(ctx context.Context) (n int, err error) {
+ if err := cu.check(); err != nil {
+ return n, err
+ }
+ _spec := sqlgraph.NewUpdateSpec(child.Table, child.Columns, sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID))
+ if ps := cu.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := cu.mutation.Name(); ok {
+ _spec.SetField(child.FieldName, field.TypeString, value)
+ }
+ if value, ok := cu.mutation.Age(); ok {
+ _spec.SetField(child.FieldAge, field.TypeInt, value)
+ }
+ if value, ok := cu.mutation.AddedAge(); ok {
+ _spec.AddField(child.FieldAge, field.TypeInt, value)
+ }
+ if value, ok := cu.mutation.Sex(); ok {
+ _spec.SetField(child.FieldSex, field.TypeEnum, value)
+ }
+ if value, ok := cu.mutation.CheckForMissingItems(); ok {
+ _spec.SetField(child.FieldCheckForMissingItems, field.TypeBool, value)
+ }
+ if value, ok := cu.mutation.HasBag(); ok {
+ _spec.SetField(child.FieldHasBag, field.TypeBool, value)
+ }
+ if value, ok := cu.mutation.HasLunchBox(); ok {
+ _spec.SetField(child.FieldHasLunchBox, field.TypeBool, value)
+ }
+ if value, ok := cu.mutation.HasWaterBottle(); ok {
+ _spec.SetField(child.FieldHasWaterBottle, field.TypeBool, value)
+ }
+ if value, ok := cu.mutation.HasUmbrella(); ok {
+ _spec.SetField(child.FieldHasUmbrella, field.TypeBool, value)
+ }
+ if value, ok := cu.mutation.HasOther(); ok {
+ _spec.SetField(child.FieldHasOther, field.TypeBool, value)
+ }
+ if value, ok := cu.mutation.CreatedAt(); ok {
+ _spec.SetField(child.FieldCreatedAt, field.TypeTime, value)
+ }
+ if value, ok := cu.mutation.UpdatedAt(); ok {
+ _spec.SetField(child.FieldUpdatedAt, field.TypeTime, value)
+ }
+ if cu.mutation.GuardianCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: child.GuardianTable,
+ Columns: []string{child.GuardianColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cu.mutation.GuardianIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: child.GuardianTable,
+ Columns: []string{child.GuardianColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if cu.mutation.ChildBusAssociationsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.ChildBusAssociationsTable,
+ Columns: []string{child.ChildBusAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cu.mutation.RemovedChildBusAssociationsIDs(); len(nodes) > 0 && !cu.mutation.ChildBusAssociationsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.ChildBusAssociationsTable,
+ Columns: []string{child.ChildBusAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cu.mutation.ChildBusAssociationsIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.ChildBusAssociationsTable,
+ Columns: []string{child.ChildBusAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if cu.mutation.BoardingRecordCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.BoardingRecordTable,
+ Columns: []string{child.BoardingRecordColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cu.mutation.RemovedBoardingRecordIDs(); len(nodes) > 0 && !cu.mutation.BoardingRecordCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.BoardingRecordTable,
+ Columns: []string{child.BoardingRecordColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cu.mutation.BoardingRecordIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.BoardingRecordTable,
+ Columns: []string{child.BoardingRecordColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if cu.mutation.PhotosCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.PhotosTable,
+ Columns: []string{child.PhotosColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childphoto.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cu.mutation.RemovedPhotosIDs(); len(nodes) > 0 && !cu.mutation.PhotosCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.PhotosTable,
+ Columns: []string{child.PhotosColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childphoto.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cu.mutation.PhotosIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.PhotosTable,
+ Columns: []string{child.PhotosColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childphoto.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if n, err = sqlgraph.UpdateNodes(ctx, cu.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{child.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return 0, err
+ }
+ cu.mutation.done = true
+ return n, nil
+}
+
+// ChildUpdateOne is the builder for updating a single Child entity.
+type ChildUpdateOne struct {
+ config
+ fields []string
+ hooks []Hook
+ mutation *ChildMutation
+}
+
+// SetName sets the "name" field.
+func (cuo *ChildUpdateOne) SetName(s string) *ChildUpdateOne {
+ cuo.mutation.SetName(s)
+ return cuo
+}
+
+// SetNillableName sets the "name" field if the given value is not nil.
+func (cuo *ChildUpdateOne) SetNillableName(s *string) *ChildUpdateOne {
+ if s != nil {
+ cuo.SetName(*s)
+ }
+ return cuo
+}
+
+// SetAge sets the "age" field.
+func (cuo *ChildUpdateOne) SetAge(i int) *ChildUpdateOne {
+ cuo.mutation.ResetAge()
+ cuo.mutation.SetAge(i)
+ return cuo
+}
+
+// SetNillableAge sets the "age" field if the given value is not nil.
+func (cuo *ChildUpdateOne) SetNillableAge(i *int) *ChildUpdateOne {
+ if i != nil {
+ cuo.SetAge(*i)
+ }
+ return cuo
+}
+
+// AddAge adds i to the "age" field.
+func (cuo *ChildUpdateOne) AddAge(i int) *ChildUpdateOne {
+ cuo.mutation.AddAge(i)
+ return cuo
+}
+
+// SetSex sets the "sex" field.
+func (cuo *ChildUpdateOne) SetSex(c child.Sex) *ChildUpdateOne {
+ cuo.mutation.SetSex(c)
+ return cuo
+}
+
+// SetNillableSex sets the "sex" field if the given value is not nil.
+func (cuo *ChildUpdateOne) SetNillableSex(c *child.Sex) *ChildUpdateOne {
+ if c != nil {
+ cuo.SetSex(*c)
+ }
+ return cuo
+}
+
+// SetCheckForMissingItems sets the "check_for_missing_items" field.
+func (cuo *ChildUpdateOne) SetCheckForMissingItems(b bool) *ChildUpdateOne {
+ cuo.mutation.SetCheckForMissingItems(b)
+ return cuo
+}
+
+// SetNillableCheckForMissingItems sets the "check_for_missing_items" field if the given value is not nil.
+func (cuo *ChildUpdateOne) SetNillableCheckForMissingItems(b *bool) *ChildUpdateOne {
+ if b != nil {
+ cuo.SetCheckForMissingItems(*b)
+ }
+ return cuo
+}
+
+// SetHasBag sets the "has_bag" field.
+func (cuo *ChildUpdateOne) SetHasBag(b bool) *ChildUpdateOne {
+ cuo.mutation.SetHasBag(b)
+ return cuo
+}
+
+// SetNillableHasBag sets the "has_bag" field if the given value is not nil.
+func (cuo *ChildUpdateOne) SetNillableHasBag(b *bool) *ChildUpdateOne {
+ if b != nil {
+ cuo.SetHasBag(*b)
+ }
+ return cuo
+}
+
+// SetHasLunchBox sets the "has_lunch_box" field.
+func (cuo *ChildUpdateOne) SetHasLunchBox(b bool) *ChildUpdateOne {
+ cuo.mutation.SetHasLunchBox(b)
+ return cuo
+}
+
+// SetNillableHasLunchBox sets the "has_lunch_box" field if the given value is not nil.
+func (cuo *ChildUpdateOne) SetNillableHasLunchBox(b *bool) *ChildUpdateOne {
+ if b != nil {
+ cuo.SetHasLunchBox(*b)
+ }
+ return cuo
+}
+
+// SetHasWaterBottle sets the "has_water_bottle" field.
+func (cuo *ChildUpdateOne) SetHasWaterBottle(b bool) *ChildUpdateOne {
+ cuo.mutation.SetHasWaterBottle(b)
+ return cuo
+}
+
+// SetNillableHasWaterBottle sets the "has_water_bottle" field if the given value is not nil.
+func (cuo *ChildUpdateOne) SetNillableHasWaterBottle(b *bool) *ChildUpdateOne {
+ if b != nil {
+ cuo.SetHasWaterBottle(*b)
+ }
+ return cuo
+}
+
+// SetHasUmbrella sets the "has_umbrella" field.
+func (cuo *ChildUpdateOne) SetHasUmbrella(b bool) *ChildUpdateOne {
+ cuo.mutation.SetHasUmbrella(b)
+ return cuo
+}
+
+// SetNillableHasUmbrella sets the "has_umbrella" field if the given value is not nil.
+func (cuo *ChildUpdateOne) SetNillableHasUmbrella(b *bool) *ChildUpdateOne {
+ if b != nil {
+ cuo.SetHasUmbrella(*b)
+ }
+ return cuo
+}
+
+// SetHasOther sets the "has_other" field.
+func (cuo *ChildUpdateOne) SetHasOther(b bool) *ChildUpdateOne {
+ cuo.mutation.SetHasOther(b)
+ return cuo
+}
+
+// SetNillableHasOther sets the "has_other" field if the given value is not nil.
+func (cuo *ChildUpdateOne) SetNillableHasOther(b *bool) *ChildUpdateOne {
+ if b != nil {
+ cuo.SetHasOther(*b)
+ }
+ return cuo
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (cuo *ChildUpdateOne) SetCreatedAt(t time.Time) *ChildUpdateOne {
+ cuo.mutation.SetCreatedAt(t)
+ return cuo
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (cuo *ChildUpdateOne) SetNillableCreatedAt(t *time.Time) *ChildUpdateOne {
+ if t != nil {
+ cuo.SetCreatedAt(*t)
+ }
+ return cuo
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (cuo *ChildUpdateOne) SetUpdatedAt(t time.Time) *ChildUpdateOne {
+ cuo.mutation.SetUpdatedAt(t)
+ return cuo
+}
+
+// SetGuardianID sets the "guardian" edge to the Guardian entity by ID.
+func (cuo *ChildUpdateOne) SetGuardianID(id uuid.UUID) *ChildUpdateOne {
+ cuo.mutation.SetGuardianID(id)
+ return cuo
+}
+
+// SetNillableGuardianID sets the "guardian" edge to the Guardian entity by ID if the given value is not nil.
+func (cuo *ChildUpdateOne) SetNillableGuardianID(id *uuid.UUID) *ChildUpdateOne {
+ if id != nil {
+ cuo = cuo.SetGuardianID(*id)
+ }
+ return cuo
+}
+
+// SetGuardian sets the "guardian" edge to the Guardian entity.
+func (cuo *ChildUpdateOne) SetGuardian(g *Guardian) *ChildUpdateOne {
+ return cuo.SetGuardianID(g.ID)
+}
+
+// AddChildBusAssociationIDs adds the "childBusAssociations" edge to the ChildBusAssociation entity by IDs.
+func (cuo *ChildUpdateOne) AddChildBusAssociationIDs(ids ...int) *ChildUpdateOne {
+ cuo.mutation.AddChildBusAssociationIDs(ids...)
+ return cuo
+}
+
+// AddChildBusAssociations adds the "childBusAssociations" edges to the ChildBusAssociation entity.
+func (cuo *ChildUpdateOne) AddChildBusAssociations(c ...*ChildBusAssociation) *ChildUpdateOne {
+ ids := make([]int, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return cuo.AddChildBusAssociationIDs(ids...)
+}
+
+// AddBoardingRecordIDs adds the "boarding_record" edge to the BoardingRecord entity by IDs.
+func (cuo *ChildUpdateOne) AddBoardingRecordIDs(ids ...uuid.UUID) *ChildUpdateOne {
+ cuo.mutation.AddBoardingRecordIDs(ids...)
+ return cuo
+}
+
+// AddBoardingRecord adds the "boarding_record" edges to the BoardingRecord entity.
+func (cuo *ChildUpdateOne) AddBoardingRecord(b ...*BoardingRecord) *ChildUpdateOne {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return cuo.AddBoardingRecordIDs(ids...)
+}
+
+// AddPhotoIDs adds the "photos" edge to the ChildPhoto entity by IDs.
+func (cuo *ChildUpdateOne) AddPhotoIDs(ids ...uuid.UUID) *ChildUpdateOne {
+ cuo.mutation.AddPhotoIDs(ids...)
+ return cuo
+}
+
+// AddPhotos adds the "photos" edges to the ChildPhoto entity.
+func (cuo *ChildUpdateOne) AddPhotos(c ...*ChildPhoto) *ChildUpdateOne {
+ ids := make([]uuid.UUID, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return cuo.AddPhotoIDs(ids...)
+}
+
+// Mutation returns the ChildMutation object of the builder.
+func (cuo *ChildUpdateOne) Mutation() *ChildMutation {
+ return cuo.mutation
+}
+
+// ClearGuardian clears the "guardian" edge to the Guardian entity.
+func (cuo *ChildUpdateOne) ClearGuardian() *ChildUpdateOne {
+ cuo.mutation.ClearGuardian()
+ return cuo
+}
+
+// ClearChildBusAssociations clears all "childBusAssociations" edges to the ChildBusAssociation entity.
+func (cuo *ChildUpdateOne) ClearChildBusAssociations() *ChildUpdateOne {
+ cuo.mutation.ClearChildBusAssociations()
+ return cuo
+}
+
+// RemoveChildBusAssociationIDs removes the "childBusAssociations" edge to ChildBusAssociation entities by IDs.
+func (cuo *ChildUpdateOne) RemoveChildBusAssociationIDs(ids ...int) *ChildUpdateOne {
+ cuo.mutation.RemoveChildBusAssociationIDs(ids...)
+ return cuo
+}
+
+// RemoveChildBusAssociations removes "childBusAssociations" edges to ChildBusAssociation entities.
+func (cuo *ChildUpdateOne) RemoveChildBusAssociations(c ...*ChildBusAssociation) *ChildUpdateOne {
+ ids := make([]int, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return cuo.RemoveChildBusAssociationIDs(ids...)
+}
+
+// ClearBoardingRecord clears all "boarding_record" edges to the BoardingRecord entity.
+func (cuo *ChildUpdateOne) ClearBoardingRecord() *ChildUpdateOne {
+ cuo.mutation.ClearBoardingRecord()
+ return cuo
+}
+
+// RemoveBoardingRecordIDs removes the "boarding_record" edge to BoardingRecord entities by IDs.
+func (cuo *ChildUpdateOne) RemoveBoardingRecordIDs(ids ...uuid.UUID) *ChildUpdateOne {
+ cuo.mutation.RemoveBoardingRecordIDs(ids...)
+ return cuo
+}
+
+// RemoveBoardingRecord removes "boarding_record" edges to BoardingRecord entities.
+func (cuo *ChildUpdateOne) RemoveBoardingRecord(b ...*BoardingRecord) *ChildUpdateOne {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return cuo.RemoveBoardingRecordIDs(ids...)
+}
+
+// ClearPhotos clears all "photos" edges to the ChildPhoto entity.
+func (cuo *ChildUpdateOne) ClearPhotos() *ChildUpdateOne {
+ cuo.mutation.ClearPhotos()
+ return cuo
+}
+
+// RemovePhotoIDs removes the "photos" edge to ChildPhoto entities by IDs.
+func (cuo *ChildUpdateOne) RemovePhotoIDs(ids ...uuid.UUID) *ChildUpdateOne {
+ cuo.mutation.RemovePhotoIDs(ids...)
+ return cuo
+}
+
+// RemovePhotos removes "photos" edges to ChildPhoto entities.
+func (cuo *ChildUpdateOne) RemovePhotos(c ...*ChildPhoto) *ChildUpdateOne {
+ ids := make([]uuid.UUID, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return cuo.RemovePhotoIDs(ids...)
+}
+
+// Where appends a list predicates to the ChildUpdate builder.
+func (cuo *ChildUpdateOne) Where(ps ...predicate.Child) *ChildUpdateOne {
+ cuo.mutation.Where(ps...)
+ return cuo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (cuo *ChildUpdateOne) Select(field string, fields ...string) *ChildUpdateOne {
+ cuo.fields = append([]string{field}, fields...)
+ return cuo
+}
+
+// Save executes the query and returns the updated Child entity.
+func (cuo *ChildUpdateOne) Save(ctx context.Context) (*Child, error) {
+ cuo.defaults()
+ return withHooks(ctx, cuo.sqlSave, cuo.mutation, cuo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (cuo *ChildUpdateOne) SaveX(ctx context.Context) *Child {
+ node, err := cuo.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// Exec executes the query on the entity.
+func (cuo *ChildUpdateOne) Exec(ctx context.Context) error {
+ _, err := cuo.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cuo *ChildUpdateOne) ExecX(ctx context.Context) {
+ if err := cuo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (cuo *ChildUpdateOne) defaults() {
+ if _, ok := cuo.mutation.UpdatedAt(); !ok {
+ v := child.UpdateDefaultUpdatedAt()
+ cuo.mutation.SetUpdatedAt(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (cuo *ChildUpdateOne) check() error {
+ if v, ok := cuo.mutation.Sex(); ok {
+ if err := child.SexValidator(v); err != nil {
+ return &ValidationError{Name: "sex", err: fmt.Errorf(`ent: validator failed for field "Child.sex": %w`, err)}
+ }
+ }
+ return nil
+}
+
+func (cuo *ChildUpdateOne) sqlSave(ctx context.Context) (_node *Child, err error) {
+ if err := cuo.check(); err != nil {
+ return _node, err
+ }
+ _spec := sqlgraph.NewUpdateSpec(child.Table, child.Columns, sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID))
+ id, ok := cuo.mutation.ID()
+ if !ok {
+ return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Child.id" for update`)}
+ }
+ _spec.Node.ID.Value = id
+ if fields := cuo.fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, child.FieldID)
+ for _, f := range fields {
+ if !child.ValidColumn(f) {
+ return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ if f != child.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, f)
+ }
+ }
+ }
+ if ps := cuo.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := cuo.mutation.Name(); ok {
+ _spec.SetField(child.FieldName, field.TypeString, value)
+ }
+ if value, ok := cuo.mutation.Age(); ok {
+ _spec.SetField(child.FieldAge, field.TypeInt, value)
+ }
+ if value, ok := cuo.mutation.AddedAge(); ok {
+ _spec.AddField(child.FieldAge, field.TypeInt, value)
+ }
+ if value, ok := cuo.mutation.Sex(); ok {
+ _spec.SetField(child.FieldSex, field.TypeEnum, value)
+ }
+ if value, ok := cuo.mutation.CheckForMissingItems(); ok {
+ _spec.SetField(child.FieldCheckForMissingItems, field.TypeBool, value)
+ }
+ if value, ok := cuo.mutation.HasBag(); ok {
+ _spec.SetField(child.FieldHasBag, field.TypeBool, value)
+ }
+ if value, ok := cuo.mutation.HasLunchBox(); ok {
+ _spec.SetField(child.FieldHasLunchBox, field.TypeBool, value)
+ }
+ if value, ok := cuo.mutation.HasWaterBottle(); ok {
+ _spec.SetField(child.FieldHasWaterBottle, field.TypeBool, value)
+ }
+ if value, ok := cuo.mutation.HasUmbrella(); ok {
+ _spec.SetField(child.FieldHasUmbrella, field.TypeBool, value)
+ }
+ if value, ok := cuo.mutation.HasOther(); ok {
+ _spec.SetField(child.FieldHasOther, field.TypeBool, value)
+ }
+ if value, ok := cuo.mutation.CreatedAt(); ok {
+ _spec.SetField(child.FieldCreatedAt, field.TypeTime, value)
+ }
+ if value, ok := cuo.mutation.UpdatedAt(); ok {
+ _spec.SetField(child.FieldUpdatedAt, field.TypeTime, value)
+ }
+ if cuo.mutation.GuardianCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: child.GuardianTable,
+ Columns: []string{child.GuardianColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cuo.mutation.GuardianIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: child.GuardianTable,
+ Columns: []string{child.GuardianColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if cuo.mutation.ChildBusAssociationsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.ChildBusAssociationsTable,
+ Columns: []string{child.ChildBusAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cuo.mutation.RemovedChildBusAssociationsIDs(); len(nodes) > 0 && !cuo.mutation.ChildBusAssociationsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.ChildBusAssociationsTable,
+ Columns: []string{child.ChildBusAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cuo.mutation.ChildBusAssociationsIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.ChildBusAssociationsTable,
+ Columns: []string{child.ChildBusAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if cuo.mutation.BoardingRecordCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.BoardingRecordTable,
+ Columns: []string{child.BoardingRecordColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cuo.mutation.RemovedBoardingRecordIDs(); len(nodes) > 0 && !cuo.mutation.BoardingRecordCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.BoardingRecordTable,
+ Columns: []string{child.BoardingRecordColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cuo.mutation.BoardingRecordIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.BoardingRecordTable,
+ Columns: []string{child.BoardingRecordColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(boardingrecord.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if cuo.mutation.PhotosCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.PhotosTable,
+ Columns: []string{child.PhotosColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childphoto.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cuo.mutation.RemovedPhotosIDs(); len(nodes) > 0 && !cuo.mutation.PhotosCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.PhotosTable,
+ Columns: []string{child.PhotosColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childphoto.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cuo.mutation.PhotosIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: child.PhotosTable,
+ Columns: []string{child.PhotosColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(childphoto.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ _node = &Child{config: cuo.config}
+ _spec.Assign = _node.assignValues
+ _spec.ScanValues = _node.scanValues
+ if err = sqlgraph.UpdateNode(ctx, cuo.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{child.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ cuo.mutation.done = true
+ return _node, nil
+}
diff --git a/backend/domain/repository/ent/childbusassociation.go b/backend/domain/repository/ent/childbusassociation.go
new file mode 100644
index 00000000..2b74bb4d
--- /dev/null
+++ b/backend/domain/repository/ent/childbusassociation.go
@@ -0,0 +1,167 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "fmt"
+ "strings"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/sql"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childbusassociation"
+ "github.com/google/uuid"
+)
+
+// ChildBusAssociation is the model entity for the ChildBusAssociation schema.
+type ChildBusAssociation struct {
+ config `json:"-"`
+ // ID of the ent.
+ ID int `json:"id,omitempty"`
+ // ChildID holds the value of the "child_id" field.
+ ChildID uuid.UUID `json:"child_id,omitempty"`
+ // BusRouteID holds the value of the "bus_route_id" field.
+ BusRouteID uuid.UUID `json:"bus_route_id,omitempty"`
+ // Edges holds the relations/edges for other nodes in the graph.
+ // The values are being populated by the ChildBusAssociationQuery when eager-loading is set.
+ Edges ChildBusAssociationEdges `json:"edges"`
+ selectValues sql.SelectValues
+}
+
+// ChildBusAssociationEdges holds the relations/edges for other nodes in the graph.
+type ChildBusAssociationEdges struct {
+ // Child holds the value of the child edge.
+ Child *Child `json:"child,omitempty"`
+ // BusRoute holds the value of the bus_route edge.
+ BusRoute *BusRoute `json:"bus_route,omitempty"`
+ // loadedTypes holds the information for reporting if a
+ // type was loaded (or requested) in eager-loading or not.
+ loadedTypes [2]bool
+}
+
+// ChildOrErr returns the Child value or an error if the edge
+// was not loaded in eager-loading, or loaded but was not found.
+func (e ChildBusAssociationEdges) ChildOrErr() (*Child, error) {
+ if e.loadedTypes[0] {
+ if e.Child == nil {
+ // Edge was loaded but was not found.
+ return nil, &NotFoundError{label: child.Label}
+ }
+ return e.Child, nil
+ }
+ return nil, &NotLoadedError{edge: "child"}
+}
+
+// BusRouteOrErr returns the BusRoute value or an error if the edge
+// was not loaded in eager-loading, or loaded but was not found.
+func (e ChildBusAssociationEdges) BusRouteOrErr() (*BusRoute, error) {
+ if e.loadedTypes[1] {
+ if e.BusRoute == nil {
+ // Edge was loaded but was not found.
+ return nil, &NotFoundError{label: busroute.Label}
+ }
+ return e.BusRoute, nil
+ }
+ return nil, &NotLoadedError{edge: "bus_route"}
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*ChildBusAssociation) scanValues(columns []string) ([]any, error) {
+ values := make([]any, len(columns))
+ for i := range columns {
+ switch columns[i] {
+ case childbusassociation.FieldID:
+ values[i] = new(sql.NullInt64)
+ case childbusassociation.FieldChildID, childbusassociation.FieldBusRouteID:
+ values[i] = new(uuid.UUID)
+ default:
+ values[i] = new(sql.UnknownType)
+ }
+ }
+ return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the ChildBusAssociation fields.
+func (cba *ChildBusAssociation) assignValues(columns []string, values []any) error {
+ if m, n := len(values), len(columns); m < n {
+ return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+ }
+ for i := range columns {
+ switch columns[i] {
+ case childbusassociation.FieldID:
+ value, ok := values[i].(*sql.NullInt64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field id", value)
+ }
+ cba.ID = int(value.Int64)
+ case childbusassociation.FieldChildID:
+ if value, ok := values[i].(*uuid.UUID); !ok {
+ return fmt.Errorf("unexpected type %T for field child_id", values[i])
+ } else if value != nil {
+ cba.ChildID = *value
+ }
+ case childbusassociation.FieldBusRouteID:
+ if value, ok := values[i].(*uuid.UUID); !ok {
+ return fmt.Errorf("unexpected type %T for field bus_route_id", values[i])
+ } else if value != nil {
+ cba.BusRouteID = *value
+ }
+ default:
+ cba.selectValues.Set(columns[i], values[i])
+ }
+ }
+ return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the ChildBusAssociation.
+// This includes values selected through modifiers, order, etc.
+func (cba *ChildBusAssociation) Value(name string) (ent.Value, error) {
+ return cba.selectValues.Get(name)
+}
+
+// QueryChild queries the "child" edge of the ChildBusAssociation entity.
+func (cba *ChildBusAssociation) QueryChild() *ChildQuery {
+ return NewChildBusAssociationClient(cba.config).QueryChild(cba)
+}
+
+// QueryBusRoute queries the "bus_route" edge of the ChildBusAssociation entity.
+func (cba *ChildBusAssociation) QueryBusRoute() *BusRouteQuery {
+ return NewChildBusAssociationClient(cba.config).QueryBusRoute(cba)
+}
+
+// Update returns a builder for updating this ChildBusAssociation.
+// Note that you need to call ChildBusAssociation.Unwrap() before calling this method if this ChildBusAssociation
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (cba *ChildBusAssociation) Update() *ChildBusAssociationUpdateOne {
+ return NewChildBusAssociationClient(cba.config).UpdateOne(cba)
+}
+
+// Unwrap unwraps the ChildBusAssociation entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (cba *ChildBusAssociation) Unwrap() *ChildBusAssociation {
+ _tx, ok := cba.config.driver.(*txDriver)
+ if !ok {
+ panic("ent: ChildBusAssociation is not a transactional entity")
+ }
+ cba.config.driver = _tx.drv
+ return cba
+}
+
+// String implements the fmt.Stringer.
+func (cba *ChildBusAssociation) String() string {
+ var builder strings.Builder
+ builder.WriteString("ChildBusAssociation(")
+ builder.WriteString(fmt.Sprintf("id=%v, ", cba.ID))
+ builder.WriteString("child_id=")
+ builder.WriteString(fmt.Sprintf("%v", cba.ChildID))
+ builder.WriteString(", ")
+ builder.WriteString("bus_route_id=")
+ builder.WriteString(fmt.Sprintf("%v", cba.BusRouteID))
+ builder.WriteByte(')')
+ return builder.String()
+}
+
+// ChildBusAssociations is a parsable slice of ChildBusAssociation.
+type ChildBusAssociations []*ChildBusAssociation
diff --git a/backend/domain/repository/ent/childbusassociation/childbusassociation.go b/backend/domain/repository/ent/childbusassociation/childbusassociation.go
new file mode 100644
index 00000000..df021730
--- /dev/null
+++ b/backend/domain/repository/ent/childbusassociation/childbusassociation.go
@@ -0,0 +1,102 @@
+// Code generated by ent, DO NOT EDIT.
+
+package childbusassociation
+
+import (
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+)
+
+const (
+ // Label holds the string label denoting the childbusassociation type in the database.
+ Label = "child_bus_association"
+ // FieldID holds the string denoting the id field in the database.
+ FieldID = "id"
+ // FieldChildID holds the string denoting the child_id field in the database.
+ FieldChildID = "child_id"
+ // FieldBusRouteID holds the string denoting the bus_route_id field in the database.
+ FieldBusRouteID = "bus_route_id"
+ // EdgeChild holds the string denoting the child edge name in mutations.
+ EdgeChild = "child"
+ // EdgeBusRoute holds the string denoting the bus_route edge name in mutations.
+ EdgeBusRoute = "bus_route"
+ // Table holds the table name of the childbusassociation in the database.
+ Table = "child_bus_associations"
+ // ChildTable is the table that holds the child relation/edge.
+ ChildTable = "child_bus_associations"
+ // ChildInverseTable is the table name for the Child entity.
+ // It exists in this package in order to avoid circular dependency with the "child" package.
+ ChildInverseTable = "childs"
+ // ChildColumn is the table column denoting the child relation/edge.
+ ChildColumn = "child_id"
+ // BusRouteTable is the table that holds the bus_route relation/edge.
+ BusRouteTable = "child_bus_associations"
+ // BusRouteInverseTable is the table name for the BusRoute entity.
+ // It exists in this package in order to avoid circular dependency with the "busroute" package.
+ BusRouteInverseTable = "bus_routes"
+ // BusRouteColumn is the table column denoting the bus_route relation/edge.
+ BusRouteColumn = "bus_route_id"
+)
+
+// Columns holds all SQL columns for childbusassociation fields.
+var Columns = []string{
+ FieldID,
+ FieldChildID,
+ FieldBusRouteID,
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+ for i := range Columns {
+ if column == Columns[i] {
+ return true
+ }
+ }
+ return false
+}
+
+// OrderOption defines the ordering options for the ChildBusAssociation queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByChildID orders the results by the child_id field.
+func ByChildID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldChildID, opts...).ToFunc()
+}
+
+// ByBusRouteID orders the results by the bus_route_id field.
+func ByBusRouteID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldBusRouteID, opts...).ToFunc()
+}
+
+// ByChildField orders the results by child field.
+func ByChildField(field string, opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newChildStep(), sql.OrderByField(field, opts...))
+ }
+}
+
+// ByBusRouteField orders the results by bus_route field.
+func ByBusRouteField(field string, opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newBusRouteStep(), sql.OrderByField(field, opts...))
+ }
+}
+func newChildStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(ChildInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, ChildTable, ChildColumn),
+ )
+}
+func newBusRouteStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(BusRouteInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, BusRouteTable, BusRouteColumn),
+ )
+}
diff --git a/backend/domain/repository/ent/childbusassociation/where.go b/backend/domain/repository/ent/childbusassociation/where.go
new file mode 100644
index 00000000..2facdd84
--- /dev/null
+++ b/backend/domain/repository/ent/childbusassociation/where.go
@@ -0,0 +1,166 @@
+// Code generated by ent, DO NOT EDIT.
+
+package childbusassociation
+
+import (
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id int) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id int) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id int) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...int) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...int) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id int) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id int) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id int) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id int) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldLTE(FieldID, id))
+}
+
+// ChildID applies equality check predicate on the "child_id" field. It's identical to ChildIDEQ.
+func ChildID(v uuid.UUID) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldEQ(FieldChildID, v))
+}
+
+// BusRouteID applies equality check predicate on the "bus_route_id" field. It's identical to BusRouteIDEQ.
+func BusRouteID(v uuid.UUID) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldEQ(FieldBusRouteID, v))
+}
+
+// ChildIDEQ applies the EQ predicate on the "child_id" field.
+func ChildIDEQ(v uuid.UUID) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldEQ(FieldChildID, v))
+}
+
+// ChildIDNEQ applies the NEQ predicate on the "child_id" field.
+func ChildIDNEQ(v uuid.UUID) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldNEQ(FieldChildID, v))
+}
+
+// ChildIDIn applies the In predicate on the "child_id" field.
+func ChildIDIn(vs ...uuid.UUID) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldIn(FieldChildID, vs...))
+}
+
+// ChildIDNotIn applies the NotIn predicate on the "child_id" field.
+func ChildIDNotIn(vs ...uuid.UUID) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldNotIn(FieldChildID, vs...))
+}
+
+// BusRouteIDEQ applies the EQ predicate on the "bus_route_id" field.
+func BusRouteIDEQ(v uuid.UUID) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldEQ(FieldBusRouteID, v))
+}
+
+// BusRouteIDNEQ applies the NEQ predicate on the "bus_route_id" field.
+func BusRouteIDNEQ(v uuid.UUID) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldNEQ(FieldBusRouteID, v))
+}
+
+// BusRouteIDIn applies the In predicate on the "bus_route_id" field.
+func BusRouteIDIn(vs ...uuid.UUID) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldIn(FieldBusRouteID, vs...))
+}
+
+// BusRouteIDNotIn applies the NotIn predicate on the "bus_route_id" field.
+func BusRouteIDNotIn(vs ...uuid.UUID) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.FieldNotIn(FieldBusRouteID, vs...))
+}
+
+// HasChild applies the HasEdge predicate on the "child" edge.
+func HasChild() predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, ChildTable, ChildColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasChildWith applies the HasEdge predicate on the "child" edge with a given conditions (other predicates).
+func HasChildWith(preds ...predicate.Child) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(func(s *sql.Selector) {
+ step := newChildStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasBusRoute applies the HasEdge predicate on the "bus_route" edge.
+func HasBusRoute() predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, BusRouteTable, BusRouteColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasBusRouteWith applies the HasEdge predicate on the "bus_route" edge with a given conditions (other predicates).
+func HasBusRouteWith(preds ...predicate.BusRoute) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(func(s *sql.Selector) {
+ step := newBusRouteStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.ChildBusAssociation) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.ChildBusAssociation) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.ChildBusAssociation) predicate.ChildBusAssociation {
+ return predicate.ChildBusAssociation(sql.NotPredicates(p))
+}
diff --git a/backend/domain/repository/ent/childbusassociation_create.go b/backend/domain/repository/ent/childbusassociation_create.go
new file mode 100644
index 00000000..472b1f97
--- /dev/null
+++ b/backend/domain/repository/ent/childbusassociation_create.go
@@ -0,0 +1,241 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childbusassociation"
+ "github.com/google/uuid"
+)
+
+// ChildBusAssociationCreate is the builder for creating a ChildBusAssociation entity.
+type ChildBusAssociationCreate struct {
+ config
+ mutation *ChildBusAssociationMutation
+ hooks []Hook
+}
+
+// SetChildID sets the "child_id" field.
+func (cbac *ChildBusAssociationCreate) SetChildID(u uuid.UUID) *ChildBusAssociationCreate {
+ cbac.mutation.SetChildID(u)
+ return cbac
+}
+
+// SetBusRouteID sets the "bus_route_id" field.
+func (cbac *ChildBusAssociationCreate) SetBusRouteID(u uuid.UUID) *ChildBusAssociationCreate {
+ cbac.mutation.SetBusRouteID(u)
+ return cbac
+}
+
+// SetChild sets the "child" edge to the Child entity.
+func (cbac *ChildBusAssociationCreate) SetChild(c *Child) *ChildBusAssociationCreate {
+ return cbac.SetChildID(c.ID)
+}
+
+// SetBusRoute sets the "bus_route" edge to the BusRoute entity.
+func (cbac *ChildBusAssociationCreate) SetBusRoute(b *BusRoute) *ChildBusAssociationCreate {
+ return cbac.SetBusRouteID(b.ID)
+}
+
+// Mutation returns the ChildBusAssociationMutation object of the builder.
+func (cbac *ChildBusAssociationCreate) Mutation() *ChildBusAssociationMutation {
+ return cbac.mutation
+}
+
+// Save creates the ChildBusAssociation in the database.
+func (cbac *ChildBusAssociationCreate) Save(ctx context.Context) (*ChildBusAssociation, error) {
+ return withHooks(ctx, cbac.sqlSave, cbac.mutation, cbac.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (cbac *ChildBusAssociationCreate) SaveX(ctx context.Context) *ChildBusAssociation {
+ v, err := cbac.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (cbac *ChildBusAssociationCreate) Exec(ctx context.Context) error {
+ _, err := cbac.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cbac *ChildBusAssociationCreate) ExecX(ctx context.Context) {
+ if err := cbac.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (cbac *ChildBusAssociationCreate) check() error {
+ if _, ok := cbac.mutation.ChildID(); !ok {
+ return &ValidationError{Name: "child_id", err: errors.New(`ent: missing required field "ChildBusAssociation.child_id"`)}
+ }
+ if _, ok := cbac.mutation.BusRouteID(); !ok {
+ return &ValidationError{Name: "bus_route_id", err: errors.New(`ent: missing required field "ChildBusAssociation.bus_route_id"`)}
+ }
+ if _, ok := cbac.mutation.ChildID(); !ok {
+ return &ValidationError{Name: "child", err: errors.New(`ent: missing required edge "ChildBusAssociation.child"`)}
+ }
+ if _, ok := cbac.mutation.BusRouteID(); !ok {
+ return &ValidationError{Name: "bus_route", err: errors.New(`ent: missing required edge "ChildBusAssociation.bus_route"`)}
+ }
+ return nil
+}
+
+func (cbac *ChildBusAssociationCreate) sqlSave(ctx context.Context) (*ChildBusAssociation, error) {
+ if err := cbac.check(); err != nil {
+ return nil, err
+ }
+ _node, _spec := cbac.createSpec()
+ if err := sqlgraph.CreateNode(ctx, cbac.driver, _spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ id := _spec.ID.Value.(int64)
+ _node.ID = int(id)
+ cbac.mutation.id = &_node.ID
+ cbac.mutation.done = true
+ return _node, nil
+}
+
+func (cbac *ChildBusAssociationCreate) createSpec() (*ChildBusAssociation, *sqlgraph.CreateSpec) {
+ var (
+ _node = &ChildBusAssociation{config: cbac.config}
+ _spec = sqlgraph.NewCreateSpec(childbusassociation.Table, sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt))
+ )
+ if nodes := cbac.mutation.ChildIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: childbusassociation.ChildTable,
+ Columns: []string{childbusassociation.ChildColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _node.ChildID = nodes[0]
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := cbac.mutation.BusRouteIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: childbusassociation.BusRouteTable,
+ Columns: []string{childbusassociation.BusRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _node.BusRouteID = nodes[0]
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ return _node, _spec
+}
+
+// ChildBusAssociationCreateBulk is the builder for creating many ChildBusAssociation entities in bulk.
+type ChildBusAssociationCreateBulk struct {
+ config
+ err error
+ builders []*ChildBusAssociationCreate
+}
+
+// Save creates the ChildBusAssociation entities in the database.
+func (cbacb *ChildBusAssociationCreateBulk) Save(ctx context.Context) ([]*ChildBusAssociation, error) {
+ if cbacb.err != nil {
+ return nil, cbacb.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(cbacb.builders))
+ nodes := make([]*ChildBusAssociation, len(cbacb.builders))
+ mutators := make([]Mutator, len(cbacb.builders))
+ for i := range cbacb.builders {
+ func(i int, root context.Context) {
+ builder := cbacb.builders[i]
+ var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+ mutation, ok := m.(*ChildBusAssociationMutation)
+ if !ok {
+ return nil, fmt.Errorf("unexpected mutation type %T", m)
+ }
+ if err := builder.check(); err != nil {
+ return nil, err
+ }
+ builder.mutation = mutation
+ var err error
+ nodes[i], specs[i] = builder.createSpec()
+ if i < len(mutators)-1 {
+ _, err = mutators[i+1].Mutate(root, cbacb.builders[i+1].mutation)
+ } else {
+ spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+ // Invoke the actual operation on the latest mutation in the chain.
+ if err = sqlgraph.BatchCreate(ctx, cbacb.driver, spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ }
+ }
+ if err != nil {
+ return nil, err
+ }
+ mutation.id = &nodes[i].ID
+ if specs[i].ID.Value != nil {
+ id := specs[i].ID.Value.(int64)
+ nodes[i].ID = int(id)
+ }
+ mutation.done = true
+ return nodes[i], nil
+ })
+ for i := len(builder.hooks) - 1; i >= 0; i-- {
+ mut = builder.hooks[i](mut)
+ }
+ mutators[i] = mut
+ }(i, ctx)
+ }
+ if len(mutators) > 0 {
+ if _, err := mutators[0].Mutate(ctx, cbacb.builders[0].mutation); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (cbacb *ChildBusAssociationCreateBulk) SaveX(ctx context.Context) []*ChildBusAssociation {
+ v, err := cbacb.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (cbacb *ChildBusAssociationCreateBulk) Exec(ctx context.Context) error {
+ _, err := cbacb.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cbacb *ChildBusAssociationCreateBulk) ExecX(ctx context.Context) {
+ if err := cbacb.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/childbusassociation_delete.go b/backend/domain/repository/ent/childbusassociation_delete.go
new file mode 100644
index 00000000..0a7ddd5d
--- /dev/null
+++ b/backend/domain/repository/ent/childbusassociation_delete.go
@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childbusassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+)
+
+// ChildBusAssociationDelete is the builder for deleting a ChildBusAssociation entity.
+type ChildBusAssociationDelete struct {
+ config
+ hooks []Hook
+ mutation *ChildBusAssociationMutation
+}
+
+// Where appends a list predicates to the ChildBusAssociationDelete builder.
+func (cbad *ChildBusAssociationDelete) Where(ps ...predicate.ChildBusAssociation) *ChildBusAssociationDelete {
+ cbad.mutation.Where(ps...)
+ return cbad
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (cbad *ChildBusAssociationDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, cbad.sqlExec, cbad.mutation, cbad.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cbad *ChildBusAssociationDelete) ExecX(ctx context.Context) int {
+ n, err := cbad.Exec(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return n
+}
+
+func (cbad *ChildBusAssociationDelete) sqlExec(ctx context.Context) (int, error) {
+ _spec := sqlgraph.NewDeleteSpec(childbusassociation.Table, sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt))
+ if ps := cbad.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ affected, err := sqlgraph.DeleteNodes(ctx, cbad.driver, _spec)
+ if err != nil && sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ cbad.mutation.done = true
+ return affected, err
+}
+
+// ChildBusAssociationDeleteOne is the builder for deleting a single ChildBusAssociation entity.
+type ChildBusAssociationDeleteOne struct {
+ cbad *ChildBusAssociationDelete
+}
+
+// Where appends a list predicates to the ChildBusAssociationDelete builder.
+func (cbado *ChildBusAssociationDeleteOne) Where(ps ...predicate.ChildBusAssociation) *ChildBusAssociationDeleteOne {
+ cbado.cbad.mutation.Where(ps...)
+ return cbado
+}
+
+// Exec executes the deletion query.
+func (cbado *ChildBusAssociationDeleteOne) Exec(ctx context.Context) error {
+ n, err := cbado.cbad.Exec(ctx)
+ switch {
+ case err != nil:
+ return err
+ case n == 0:
+ return &NotFoundError{childbusassociation.Label}
+ default:
+ return nil
+ }
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cbado *ChildBusAssociationDeleteOne) ExecX(ctx context.Context) {
+ if err := cbado.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/childbusassociation_query.go b/backend/domain/repository/ent/childbusassociation_query.go
new file mode 100644
index 00000000..ade7fe01
--- /dev/null
+++ b/backend/domain/repository/ent/childbusassociation_query.go
@@ -0,0 +1,681 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "fmt"
+ "math"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childbusassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// ChildBusAssociationQuery is the builder for querying ChildBusAssociation entities.
+type ChildBusAssociationQuery struct {
+ config
+ ctx *QueryContext
+ order []childbusassociation.OrderOption
+ inters []Interceptor
+ predicates []predicate.ChildBusAssociation
+ withChild *ChildQuery
+ withBusRoute *BusRouteQuery
+ // intermediate query (i.e. traversal path).
+ sql *sql.Selector
+ path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the ChildBusAssociationQuery builder.
+func (cbaq *ChildBusAssociationQuery) Where(ps ...predicate.ChildBusAssociation) *ChildBusAssociationQuery {
+ cbaq.predicates = append(cbaq.predicates, ps...)
+ return cbaq
+}
+
+// Limit the number of records to be returned by this query.
+func (cbaq *ChildBusAssociationQuery) Limit(limit int) *ChildBusAssociationQuery {
+ cbaq.ctx.Limit = &limit
+ return cbaq
+}
+
+// Offset to start from.
+func (cbaq *ChildBusAssociationQuery) Offset(offset int) *ChildBusAssociationQuery {
+ cbaq.ctx.Offset = &offset
+ return cbaq
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (cbaq *ChildBusAssociationQuery) Unique(unique bool) *ChildBusAssociationQuery {
+ cbaq.ctx.Unique = &unique
+ return cbaq
+}
+
+// Order specifies how the records should be ordered.
+func (cbaq *ChildBusAssociationQuery) Order(o ...childbusassociation.OrderOption) *ChildBusAssociationQuery {
+ cbaq.order = append(cbaq.order, o...)
+ return cbaq
+}
+
+// QueryChild chains the current query on the "child" edge.
+func (cbaq *ChildBusAssociationQuery) QueryChild() *ChildQuery {
+ query := (&ChildClient{config: cbaq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := cbaq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := cbaq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(childbusassociation.Table, childbusassociation.FieldID, selector),
+ sqlgraph.To(child.Table, child.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, childbusassociation.ChildTable, childbusassociation.ChildColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(cbaq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryBusRoute chains the current query on the "bus_route" edge.
+func (cbaq *ChildBusAssociationQuery) QueryBusRoute() *BusRouteQuery {
+ query := (&BusRouteClient{config: cbaq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := cbaq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := cbaq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(childbusassociation.Table, childbusassociation.FieldID, selector),
+ sqlgraph.To(busroute.Table, busroute.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, childbusassociation.BusRouteTable, childbusassociation.BusRouteColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(cbaq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// First returns the first ChildBusAssociation entity from the query.
+// Returns a *NotFoundError when no ChildBusAssociation was found.
+func (cbaq *ChildBusAssociationQuery) First(ctx context.Context) (*ChildBusAssociation, error) {
+ nodes, err := cbaq.Limit(1).All(setContextOp(ctx, cbaq.ctx, "First"))
+ if err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nil, &NotFoundError{childbusassociation.Label}
+ }
+ return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (cbaq *ChildBusAssociationQuery) FirstX(ctx context.Context) *ChildBusAssociation {
+ node, err := cbaq.First(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return node
+}
+
+// FirstID returns the first ChildBusAssociation ID from the query.
+// Returns a *NotFoundError when no ChildBusAssociation ID was found.
+func (cbaq *ChildBusAssociationQuery) FirstID(ctx context.Context) (id int, err error) {
+ var ids []int
+ if ids, err = cbaq.Limit(1).IDs(setContextOp(ctx, cbaq.ctx, "FirstID")); err != nil {
+ return
+ }
+ if len(ids) == 0 {
+ err = &NotFoundError{childbusassociation.Label}
+ return
+ }
+ return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (cbaq *ChildBusAssociationQuery) FirstIDX(ctx context.Context) int {
+ id, err := cbaq.FirstID(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return id
+}
+
+// Only returns a single ChildBusAssociation entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one ChildBusAssociation entity is found.
+// Returns a *NotFoundError when no ChildBusAssociation entities are found.
+func (cbaq *ChildBusAssociationQuery) Only(ctx context.Context) (*ChildBusAssociation, error) {
+ nodes, err := cbaq.Limit(2).All(setContextOp(ctx, cbaq.ctx, "Only"))
+ if err != nil {
+ return nil, err
+ }
+ switch len(nodes) {
+ case 1:
+ return nodes[0], nil
+ case 0:
+ return nil, &NotFoundError{childbusassociation.Label}
+ default:
+ return nil, &NotSingularError{childbusassociation.Label}
+ }
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (cbaq *ChildBusAssociationQuery) OnlyX(ctx context.Context) *ChildBusAssociation {
+ node, err := cbaq.Only(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// OnlyID is like Only, but returns the only ChildBusAssociation ID in the query.
+// Returns a *NotSingularError when more than one ChildBusAssociation ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (cbaq *ChildBusAssociationQuery) OnlyID(ctx context.Context) (id int, err error) {
+ var ids []int
+ if ids, err = cbaq.Limit(2).IDs(setContextOp(ctx, cbaq.ctx, "OnlyID")); err != nil {
+ return
+ }
+ switch len(ids) {
+ case 1:
+ id = ids[0]
+ case 0:
+ err = &NotFoundError{childbusassociation.Label}
+ default:
+ err = &NotSingularError{childbusassociation.Label}
+ }
+ return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (cbaq *ChildBusAssociationQuery) OnlyIDX(ctx context.Context) int {
+ id, err := cbaq.OnlyID(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// All executes the query and returns a list of ChildBusAssociations.
+func (cbaq *ChildBusAssociationQuery) All(ctx context.Context) ([]*ChildBusAssociation, error) {
+ ctx = setContextOp(ctx, cbaq.ctx, "All")
+ if err := cbaq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ qr := querierAll[[]*ChildBusAssociation, *ChildBusAssociationQuery]()
+ return withInterceptors[[]*ChildBusAssociation](ctx, cbaq, qr, cbaq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (cbaq *ChildBusAssociationQuery) AllX(ctx context.Context) []*ChildBusAssociation {
+ nodes, err := cbaq.All(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return nodes
+}
+
+// IDs executes the query and returns a list of ChildBusAssociation IDs.
+func (cbaq *ChildBusAssociationQuery) IDs(ctx context.Context) (ids []int, err error) {
+ if cbaq.ctx.Unique == nil && cbaq.path != nil {
+ cbaq.Unique(true)
+ }
+ ctx = setContextOp(ctx, cbaq.ctx, "IDs")
+ if err = cbaq.Select(childbusassociation.FieldID).Scan(ctx, &ids); err != nil {
+ return nil, err
+ }
+ return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (cbaq *ChildBusAssociationQuery) IDsX(ctx context.Context) []int {
+ ids, err := cbaq.IDs(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return ids
+}
+
+// Count returns the count of the given query.
+func (cbaq *ChildBusAssociationQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, cbaq.ctx, "Count")
+ if err := cbaq.prepareQuery(ctx); err != nil {
+ return 0, err
+ }
+ return withInterceptors[int](ctx, cbaq, querierCount[*ChildBusAssociationQuery](), cbaq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (cbaq *ChildBusAssociationQuery) CountX(ctx context.Context) int {
+ count, err := cbaq.Count(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (cbaq *ChildBusAssociationQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, cbaq.ctx, "Exist")
+ switch _, err := cbaq.FirstID(ctx); {
+ case IsNotFound(err):
+ return false, nil
+ case err != nil:
+ return false, fmt.Errorf("ent: check existence: %w", err)
+ default:
+ return true, nil
+ }
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (cbaq *ChildBusAssociationQuery) ExistX(ctx context.Context) bool {
+ exist, err := cbaq.Exist(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return exist
+}
+
+// Clone returns a duplicate of the ChildBusAssociationQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (cbaq *ChildBusAssociationQuery) Clone() *ChildBusAssociationQuery {
+ if cbaq == nil {
+ return nil
+ }
+ return &ChildBusAssociationQuery{
+ config: cbaq.config,
+ ctx: cbaq.ctx.Clone(),
+ order: append([]childbusassociation.OrderOption{}, cbaq.order...),
+ inters: append([]Interceptor{}, cbaq.inters...),
+ predicates: append([]predicate.ChildBusAssociation{}, cbaq.predicates...),
+ withChild: cbaq.withChild.Clone(),
+ withBusRoute: cbaq.withBusRoute.Clone(),
+ // clone intermediate query.
+ sql: cbaq.sql.Clone(),
+ path: cbaq.path,
+ }
+}
+
+// WithChild tells the query-builder to eager-load the nodes that are connected to
+// the "child" edge. The optional arguments are used to configure the query builder of the edge.
+func (cbaq *ChildBusAssociationQuery) WithChild(opts ...func(*ChildQuery)) *ChildBusAssociationQuery {
+ query := (&ChildClient{config: cbaq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ cbaq.withChild = query
+ return cbaq
+}
+
+// WithBusRoute tells the query-builder to eager-load the nodes that are connected to
+// the "bus_route" edge. The optional arguments are used to configure the query builder of the edge.
+func (cbaq *ChildBusAssociationQuery) WithBusRoute(opts ...func(*BusRouteQuery)) *ChildBusAssociationQuery {
+ query := (&BusRouteClient{config: cbaq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ cbaq.withBusRoute = query
+ return cbaq
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+// var v []struct {
+// ChildID uuid.UUID `json:"child_id,omitempty"`
+// Count int `json:"count,omitempty"`
+// }
+//
+// client.ChildBusAssociation.Query().
+// GroupBy(childbusassociation.FieldChildID).
+// Aggregate(ent.Count()).
+// Scan(ctx, &v)
+func (cbaq *ChildBusAssociationQuery) GroupBy(field string, fields ...string) *ChildBusAssociationGroupBy {
+ cbaq.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &ChildBusAssociationGroupBy{build: cbaq}
+ grbuild.flds = &cbaq.ctx.Fields
+ grbuild.label = childbusassociation.Label
+ grbuild.scan = grbuild.Scan
+ return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+// var v []struct {
+// ChildID uuid.UUID `json:"child_id,omitempty"`
+// }
+//
+// client.ChildBusAssociation.Query().
+// Select(childbusassociation.FieldChildID).
+// Scan(ctx, &v)
+func (cbaq *ChildBusAssociationQuery) Select(fields ...string) *ChildBusAssociationSelect {
+ cbaq.ctx.Fields = append(cbaq.ctx.Fields, fields...)
+ sbuild := &ChildBusAssociationSelect{ChildBusAssociationQuery: cbaq}
+ sbuild.label = childbusassociation.Label
+ sbuild.flds, sbuild.scan = &cbaq.ctx.Fields, sbuild.Scan
+ return sbuild
+}
+
+// Aggregate returns a ChildBusAssociationSelect configured with the given aggregations.
+func (cbaq *ChildBusAssociationQuery) Aggregate(fns ...AggregateFunc) *ChildBusAssociationSelect {
+ return cbaq.Select().Aggregate(fns...)
+}
+
+func (cbaq *ChildBusAssociationQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range cbaq.inters {
+ if inter == nil {
+ return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+ }
+ if trv, ok := inter.(Traverser); ok {
+ if err := trv.Traverse(ctx, cbaq); err != nil {
+ return err
+ }
+ }
+ }
+ for _, f := range cbaq.ctx.Fields {
+ if !childbusassociation.ValidColumn(f) {
+ return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ }
+ if cbaq.path != nil {
+ prev, err := cbaq.path(ctx)
+ if err != nil {
+ return err
+ }
+ cbaq.sql = prev
+ }
+ return nil
+}
+
+func (cbaq *ChildBusAssociationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*ChildBusAssociation, error) {
+ var (
+ nodes = []*ChildBusAssociation{}
+ _spec = cbaq.querySpec()
+ loadedTypes = [2]bool{
+ cbaq.withChild != nil,
+ cbaq.withBusRoute != nil,
+ }
+ )
+ _spec.ScanValues = func(columns []string) ([]any, error) {
+ return (*ChildBusAssociation).scanValues(nil, columns)
+ }
+ _spec.Assign = func(columns []string, values []any) error {
+ node := &ChildBusAssociation{config: cbaq.config}
+ nodes = append(nodes, node)
+ node.Edges.loadedTypes = loadedTypes
+ return node.assignValues(columns, values)
+ }
+ for i := range hooks {
+ hooks[i](ctx, _spec)
+ }
+ if err := sqlgraph.QueryNodes(ctx, cbaq.driver, _spec); err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nodes, nil
+ }
+ if query := cbaq.withChild; query != nil {
+ if err := cbaq.loadChild(ctx, query, nodes, nil,
+ func(n *ChildBusAssociation, e *Child) { n.Edges.Child = e }); err != nil {
+ return nil, err
+ }
+ }
+ if query := cbaq.withBusRoute; query != nil {
+ if err := cbaq.loadBusRoute(ctx, query, nodes, nil,
+ func(n *ChildBusAssociation, e *BusRoute) { n.Edges.BusRoute = e }); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+func (cbaq *ChildBusAssociationQuery) loadChild(ctx context.Context, query *ChildQuery, nodes []*ChildBusAssociation, init func(*ChildBusAssociation), assign func(*ChildBusAssociation, *Child)) error {
+ ids := make([]uuid.UUID, 0, len(nodes))
+ nodeids := make(map[uuid.UUID][]*ChildBusAssociation)
+ for i := range nodes {
+ fk := nodes[i].ChildID
+ if _, ok := nodeids[fk]; !ok {
+ ids = append(ids, fk)
+ }
+ nodeids[fk] = append(nodeids[fk], nodes[i])
+ }
+ if len(ids) == 0 {
+ return nil
+ }
+ query.Where(child.IDIn(ids...))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ nodes, ok := nodeids[n.ID]
+ if !ok {
+ return fmt.Errorf(`unexpected foreign-key "child_id" returned %v`, n.ID)
+ }
+ for i := range nodes {
+ assign(nodes[i], n)
+ }
+ }
+ return nil
+}
+func (cbaq *ChildBusAssociationQuery) loadBusRoute(ctx context.Context, query *BusRouteQuery, nodes []*ChildBusAssociation, init func(*ChildBusAssociation), assign func(*ChildBusAssociation, *BusRoute)) error {
+ ids := make([]uuid.UUID, 0, len(nodes))
+ nodeids := make(map[uuid.UUID][]*ChildBusAssociation)
+ for i := range nodes {
+ fk := nodes[i].BusRouteID
+ if _, ok := nodeids[fk]; !ok {
+ ids = append(ids, fk)
+ }
+ nodeids[fk] = append(nodeids[fk], nodes[i])
+ }
+ if len(ids) == 0 {
+ return nil
+ }
+ query.Where(busroute.IDIn(ids...))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ nodes, ok := nodeids[n.ID]
+ if !ok {
+ return fmt.Errorf(`unexpected foreign-key "bus_route_id" returned %v`, n.ID)
+ }
+ for i := range nodes {
+ assign(nodes[i], n)
+ }
+ }
+ return nil
+}
+
+func (cbaq *ChildBusAssociationQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := cbaq.querySpec()
+ _spec.Node.Columns = cbaq.ctx.Fields
+ if len(cbaq.ctx.Fields) > 0 {
+ _spec.Unique = cbaq.ctx.Unique != nil && *cbaq.ctx.Unique
+ }
+ return sqlgraph.CountNodes(ctx, cbaq.driver, _spec)
+}
+
+func (cbaq *ChildBusAssociationQuery) querySpec() *sqlgraph.QuerySpec {
+ _spec := sqlgraph.NewQuerySpec(childbusassociation.Table, childbusassociation.Columns, sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt))
+ _spec.From = cbaq.sql
+ if unique := cbaq.ctx.Unique; unique != nil {
+ _spec.Unique = *unique
+ } else if cbaq.path != nil {
+ _spec.Unique = true
+ }
+ if fields := cbaq.ctx.Fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, childbusassociation.FieldID)
+ for i := range fields {
+ if fields[i] != childbusassociation.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+ }
+ }
+ if cbaq.withChild != nil {
+ _spec.Node.AddColumnOnce(childbusassociation.FieldChildID)
+ }
+ if cbaq.withBusRoute != nil {
+ _spec.Node.AddColumnOnce(childbusassociation.FieldBusRouteID)
+ }
+ }
+ if ps := cbaq.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if limit := cbaq.ctx.Limit; limit != nil {
+ _spec.Limit = *limit
+ }
+ if offset := cbaq.ctx.Offset; offset != nil {
+ _spec.Offset = *offset
+ }
+ if ps := cbaq.order; len(ps) > 0 {
+ _spec.Order = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ return _spec
+}
+
+func (cbaq *ChildBusAssociationQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(cbaq.driver.Dialect())
+ t1 := builder.Table(childbusassociation.Table)
+ columns := cbaq.ctx.Fields
+ if len(columns) == 0 {
+ columns = childbusassociation.Columns
+ }
+ selector := builder.Select(t1.Columns(columns...)...).From(t1)
+ if cbaq.sql != nil {
+ selector = cbaq.sql
+ selector.Select(selector.Columns(columns...)...)
+ }
+ if cbaq.ctx.Unique != nil && *cbaq.ctx.Unique {
+ selector.Distinct()
+ }
+ for _, p := range cbaq.predicates {
+ p(selector)
+ }
+ for _, p := range cbaq.order {
+ p(selector)
+ }
+ if offset := cbaq.ctx.Offset; offset != nil {
+ // limit is mandatory for offset clause. We start
+ // with default value, and override it below if needed.
+ selector.Offset(*offset).Limit(math.MaxInt32)
+ }
+ if limit := cbaq.ctx.Limit; limit != nil {
+ selector.Limit(*limit)
+ }
+ return selector
+}
+
+// ChildBusAssociationGroupBy is the group-by builder for ChildBusAssociation entities.
+type ChildBusAssociationGroupBy struct {
+ selector
+ build *ChildBusAssociationQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (cbagb *ChildBusAssociationGroupBy) Aggregate(fns ...AggregateFunc) *ChildBusAssociationGroupBy {
+ cbagb.fns = append(cbagb.fns, fns...)
+ return cbagb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (cbagb *ChildBusAssociationGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, cbagb.build.ctx, "GroupBy")
+ if err := cbagb.build.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*ChildBusAssociationQuery, *ChildBusAssociationGroupBy](ctx, cbagb.build, cbagb, cbagb.build.inters, v)
+}
+
+func (cbagb *ChildBusAssociationGroupBy) sqlScan(ctx context.Context, root *ChildBusAssociationQuery, v any) error {
+ selector := root.sqlQuery(ctx).Select()
+ aggregation := make([]string, 0, len(cbagb.fns))
+ for _, fn := range cbagb.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ if len(selector.SelectedColumns()) == 0 {
+ columns := make([]string, 0, len(*cbagb.flds)+len(cbagb.fns))
+ for _, f := range *cbagb.flds {
+ columns = append(columns, selector.C(f))
+ }
+ columns = append(columns, aggregation...)
+ selector.Select(columns...)
+ }
+ selector.GroupBy(selector.Columns(*cbagb.flds...)...)
+ if err := selector.Err(); err != nil {
+ return err
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := cbagb.build.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
+
+// ChildBusAssociationSelect is the builder for selecting fields of ChildBusAssociation entities.
+type ChildBusAssociationSelect struct {
+ *ChildBusAssociationQuery
+ selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (cbas *ChildBusAssociationSelect) Aggregate(fns ...AggregateFunc) *ChildBusAssociationSelect {
+ cbas.fns = append(cbas.fns, fns...)
+ return cbas
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (cbas *ChildBusAssociationSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, cbas.ctx, "Select")
+ if err := cbas.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*ChildBusAssociationQuery, *ChildBusAssociationSelect](ctx, cbas.ChildBusAssociationQuery, cbas, cbas.inters, v)
+}
+
+func (cbas *ChildBusAssociationSelect) sqlScan(ctx context.Context, root *ChildBusAssociationQuery, v any) error {
+ selector := root.sqlQuery(ctx)
+ aggregation := make([]string, 0, len(cbas.fns))
+ for _, fn := range cbas.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ switch n := len(*cbas.selector.flds); {
+ case n == 0 && len(aggregation) > 0:
+ selector.Select(aggregation...)
+ case n != 0 && len(aggregation) > 0:
+ selector.AppendSelect(aggregation...)
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := cbas.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
diff --git a/backend/domain/repository/ent/childbusassociation_update.go b/backend/domain/repository/ent/childbusassociation_update.go
new file mode 100644
index 00000000..1571e789
--- /dev/null
+++ b/backend/domain/repository/ent/childbusassociation_update.go
@@ -0,0 +1,422 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childbusassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// ChildBusAssociationUpdate is the builder for updating ChildBusAssociation entities.
+type ChildBusAssociationUpdate struct {
+ config
+ hooks []Hook
+ mutation *ChildBusAssociationMutation
+}
+
+// Where appends a list predicates to the ChildBusAssociationUpdate builder.
+func (cbau *ChildBusAssociationUpdate) Where(ps ...predicate.ChildBusAssociation) *ChildBusAssociationUpdate {
+ cbau.mutation.Where(ps...)
+ return cbau
+}
+
+// SetChildID sets the "child_id" field.
+func (cbau *ChildBusAssociationUpdate) SetChildID(u uuid.UUID) *ChildBusAssociationUpdate {
+ cbau.mutation.SetChildID(u)
+ return cbau
+}
+
+// SetNillableChildID sets the "child_id" field if the given value is not nil.
+func (cbau *ChildBusAssociationUpdate) SetNillableChildID(u *uuid.UUID) *ChildBusAssociationUpdate {
+ if u != nil {
+ cbau.SetChildID(*u)
+ }
+ return cbau
+}
+
+// SetBusRouteID sets the "bus_route_id" field.
+func (cbau *ChildBusAssociationUpdate) SetBusRouteID(u uuid.UUID) *ChildBusAssociationUpdate {
+ cbau.mutation.SetBusRouteID(u)
+ return cbau
+}
+
+// SetNillableBusRouteID sets the "bus_route_id" field if the given value is not nil.
+func (cbau *ChildBusAssociationUpdate) SetNillableBusRouteID(u *uuid.UUID) *ChildBusAssociationUpdate {
+ if u != nil {
+ cbau.SetBusRouteID(*u)
+ }
+ return cbau
+}
+
+// SetChild sets the "child" edge to the Child entity.
+func (cbau *ChildBusAssociationUpdate) SetChild(c *Child) *ChildBusAssociationUpdate {
+ return cbau.SetChildID(c.ID)
+}
+
+// SetBusRoute sets the "bus_route" edge to the BusRoute entity.
+func (cbau *ChildBusAssociationUpdate) SetBusRoute(b *BusRoute) *ChildBusAssociationUpdate {
+ return cbau.SetBusRouteID(b.ID)
+}
+
+// Mutation returns the ChildBusAssociationMutation object of the builder.
+func (cbau *ChildBusAssociationUpdate) Mutation() *ChildBusAssociationMutation {
+ return cbau.mutation
+}
+
+// ClearChild clears the "child" edge to the Child entity.
+func (cbau *ChildBusAssociationUpdate) ClearChild() *ChildBusAssociationUpdate {
+ cbau.mutation.ClearChild()
+ return cbau
+}
+
+// ClearBusRoute clears the "bus_route" edge to the BusRoute entity.
+func (cbau *ChildBusAssociationUpdate) ClearBusRoute() *ChildBusAssociationUpdate {
+ cbau.mutation.ClearBusRoute()
+ return cbau
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (cbau *ChildBusAssociationUpdate) Save(ctx context.Context) (int, error) {
+ return withHooks(ctx, cbau.sqlSave, cbau.mutation, cbau.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (cbau *ChildBusAssociationUpdate) SaveX(ctx context.Context) int {
+ affected, err := cbau.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return affected
+}
+
+// Exec executes the query.
+func (cbau *ChildBusAssociationUpdate) Exec(ctx context.Context) error {
+ _, err := cbau.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cbau *ChildBusAssociationUpdate) ExecX(ctx context.Context) {
+ if err := cbau.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (cbau *ChildBusAssociationUpdate) check() error {
+ if _, ok := cbau.mutation.ChildID(); cbau.mutation.ChildCleared() && !ok {
+ return errors.New(`ent: clearing a required unique edge "ChildBusAssociation.child"`)
+ }
+ if _, ok := cbau.mutation.BusRouteID(); cbau.mutation.BusRouteCleared() && !ok {
+ return errors.New(`ent: clearing a required unique edge "ChildBusAssociation.bus_route"`)
+ }
+ return nil
+}
+
+func (cbau *ChildBusAssociationUpdate) sqlSave(ctx context.Context) (n int, err error) {
+ if err := cbau.check(); err != nil {
+ return n, err
+ }
+ _spec := sqlgraph.NewUpdateSpec(childbusassociation.Table, childbusassociation.Columns, sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt))
+ if ps := cbau.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if cbau.mutation.ChildCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: childbusassociation.ChildTable,
+ Columns: []string{childbusassociation.ChildColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cbau.mutation.ChildIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: childbusassociation.ChildTable,
+ Columns: []string{childbusassociation.ChildColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if cbau.mutation.BusRouteCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: childbusassociation.BusRouteTable,
+ Columns: []string{childbusassociation.BusRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cbau.mutation.BusRouteIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: childbusassociation.BusRouteTable,
+ Columns: []string{childbusassociation.BusRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if n, err = sqlgraph.UpdateNodes(ctx, cbau.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{childbusassociation.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return 0, err
+ }
+ cbau.mutation.done = true
+ return n, nil
+}
+
+// ChildBusAssociationUpdateOne is the builder for updating a single ChildBusAssociation entity.
+type ChildBusAssociationUpdateOne struct {
+ config
+ fields []string
+ hooks []Hook
+ mutation *ChildBusAssociationMutation
+}
+
+// SetChildID sets the "child_id" field.
+func (cbauo *ChildBusAssociationUpdateOne) SetChildID(u uuid.UUID) *ChildBusAssociationUpdateOne {
+ cbauo.mutation.SetChildID(u)
+ return cbauo
+}
+
+// SetNillableChildID sets the "child_id" field if the given value is not nil.
+func (cbauo *ChildBusAssociationUpdateOne) SetNillableChildID(u *uuid.UUID) *ChildBusAssociationUpdateOne {
+ if u != nil {
+ cbauo.SetChildID(*u)
+ }
+ return cbauo
+}
+
+// SetBusRouteID sets the "bus_route_id" field.
+func (cbauo *ChildBusAssociationUpdateOne) SetBusRouteID(u uuid.UUID) *ChildBusAssociationUpdateOne {
+ cbauo.mutation.SetBusRouteID(u)
+ return cbauo
+}
+
+// SetNillableBusRouteID sets the "bus_route_id" field if the given value is not nil.
+func (cbauo *ChildBusAssociationUpdateOne) SetNillableBusRouteID(u *uuid.UUID) *ChildBusAssociationUpdateOne {
+ if u != nil {
+ cbauo.SetBusRouteID(*u)
+ }
+ return cbauo
+}
+
+// SetChild sets the "child" edge to the Child entity.
+func (cbauo *ChildBusAssociationUpdateOne) SetChild(c *Child) *ChildBusAssociationUpdateOne {
+ return cbauo.SetChildID(c.ID)
+}
+
+// SetBusRoute sets the "bus_route" edge to the BusRoute entity.
+func (cbauo *ChildBusAssociationUpdateOne) SetBusRoute(b *BusRoute) *ChildBusAssociationUpdateOne {
+ return cbauo.SetBusRouteID(b.ID)
+}
+
+// Mutation returns the ChildBusAssociationMutation object of the builder.
+func (cbauo *ChildBusAssociationUpdateOne) Mutation() *ChildBusAssociationMutation {
+ return cbauo.mutation
+}
+
+// ClearChild clears the "child" edge to the Child entity.
+func (cbauo *ChildBusAssociationUpdateOne) ClearChild() *ChildBusAssociationUpdateOne {
+ cbauo.mutation.ClearChild()
+ return cbauo
+}
+
+// ClearBusRoute clears the "bus_route" edge to the BusRoute entity.
+func (cbauo *ChildBusAssociationUpdateOne) ClearBusRoute() *ChildBusAssociationUpdateOne {
+ cbauo.mutation.ClearBusRoute()
+ return cbauo
+}
+
+// Where appends a list predicates to the ChildBusAssociationUpdate builder.
+func (cbauo *ChildBusAssociationUpdateOne) Where(ps ...predicate.ChildBusAssociation) *ChildBusAssociationUpdateOne {
+ cbauo.mutation.Where(ps...)
+ return cbauo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (cbauo *ChildBusAssociationUpdateOne) Select(field string, fields ...string) *ChildBusAssociationUpdateOne {
+ cbauo.fields = append([]string{field}, fields...)
+ return cbauo
+}
+
+// Save executes the query and returns the updated ChildBusAssociation entity.
+func (cbauo *ChildBusAssociationUpdateOne) Save(ctx context.Context) (*ChildBusAssociation, error) {
+ return withHooks(ctx, cbauo.sqlSave, cbauo.mutation, cbauo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (cbauo *ChildBusAssociationUpdateOne) SaveX(ctx context.Context) *ChildBusAssociation {
+ node, err := cbauo.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// Exec executes the query on the entity.
+func (cbauo *ChildBusAssociationUpdateOne) Exec(ctx context.Context) error {
+ _, err := cbauo.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cbauo *ChildBusAssociationUpdateOne) ExecX(ctx context.Context) {
+ if err := cbauo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (cbauo *ChildBusAssociationUpdateOne) check() error {
+ if _, ok := cbauo.mutation.ChildID(); cbauo.mutation.ChildCleared() && !ok {
+ return errors.New(`ent: clearing a required unique edge "ChildBusAssociation.child"`)
+ }
+ if _, ok := cbauo.mutation.BusRouteID(); cbauo.mutation.BusRouteCleared() && !ok {
+ return errors.New(`ent: clearing a required unique edge "ChildBusAssociation.bus_route"`)
+ }
+ return nil
+}
+
+func (cbauo *ChildBusAssociationUpdateOne) sqlSave(ctx context.Context) (_node *ChildBusAssociation, err error) {
+ if err := cbauo.check(); err != nil {
+ return _node, err
+ }
+ _spec := sqlgraph.NewUpdateSpec(childbusassociation.Table, childbusassociation.Columns, sqlgraph.NewFieldSpec(childbusassociation.FieldID, field.TypeInt))
+ id, ok := cbauo.mutation.ID()
+ if !ok {
+ return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "ChildBusAssociation.id" for update`)}
+ }
+ _spec.Node.ID.Value = id
+ if fields := cbauo.fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, childbusassociation.FieldID)
+ for _, f := range fields {
+ if !childbusassociation.ValidColumn(f) {
+ return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ if f != childbusassociation.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, f)
+ }
+ }
+ }
+ if ps := cbauo.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if cbauo.mutation.ChildCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: childbusassociation.ChildTable,
+ Columns: []string{childbusassociation.ChildColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cbauo.mutation.ChildIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: childbusassociation.ChildTable,
+ Columns: []string{childbusassociation.ChildColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if cbauo.mutation.BusRouteCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: childbusassociation.BusRouteTable,
+ Columns: []string{childbusassociation.BusRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cbauo.mutation.BusRouteIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: childbusassociation.BusRouteTable,
+ Columns: []string{childbusassociation.BusRouteColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busroute.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ _node = &ChildBusAssociation{config: cbauo.config}
+ _spec.Assign = _node.assignValues
+ _spec.ScanValues = _node.scanValues
+ if err = sqlgraph.UpdateNode(ctx, cbauo.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{childbusassociation.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ cbauo.mutation.done = true
+ return _node, nil
+}
diff --git a/backend/domain/repository/ent/childphoto.go b/backend/domain/repository/ent/childphoto.go
new file mode 100644
index 00000000..77826be0
--- /dev/null
+++ b/backend/domain/repository/ent/childphoto.go
@@ -0,0 +1,157 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "fmt"
+ "strings"
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/sql"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childphoto"
+ "github.com/google/uuid"
+)
+
+// ChildPhoto is the model entity for the ChildPhoto schema.
+type ChildPhoto struct {
+ config `json:"-"`
+ // ID of the ent.
+ ID uuid.UUID `json:"id,omitempty"`
+ // レコードの作成日時
+ CreatedAt time.Time `json:"created_at,omitempty"`
+ // レコードの最終更新日時
+ UpdatedAt time.Time `json:"updated_at,omitempty"`
+ // Edges holds the relations/edges for other nodes in the graph.
+ // The values are being populated by the ChildPhotoQuery when eager-loading is set.
+ Edges ChildPhotoEdges `json:"edges"`
+ child_photos *uuid.UUID
+ selectValues sql.SelectValues
+}
+
+// ChildPhotoEdges holds the relations/edges for other nodes in the graph.
+type ChildPhotoEdges struct {
+ // Child holds the value of the child edge.
+ Child *Child `json:"child,omitempty"`
+ // loadedTypes holds the information for reporting if a
+ // type was loaded (or requested) in eager-loading or not.
+ loadedTypes [1]bool
+}
+
+// ChildOrErr returns the Child value or an error if the edge
+// was not loaded in eager-loading, or loaded but was not found.
+func (e ChildPhotoEdges) ChildOrErr() (*Child, error) {
+ if e.loadedTypes[0] {
+ if e.Child == nil {
+ // Edge was loaded but was not found.
+ return nil, &NotFoundError{label: child.Label}
+ }
+ return e.Child, nil
+ }
+ return nil, &NotLoadedError{edge: "child"}
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*ChildPhoto) scanValues(columns []string) ([]any, error) {
+ values := make([]any, len(columns))
+ for i := range columns {
+ switch columns[i] {
+ case childphoto.FieldCreatedAt, childphoto.FieldUpdatedAt:
+ values[i] = new(sql.NullTime)
+ case childphoto.FieldID:
+ values[i] = new(uuid.UUID)
+ case childphoto.ForeignKeys[0]: // child_photos
+ values[i] = &sql.NullScanner{S: new(uuid.UUID)}
+ default:
+ values[i] = new(sql.UnknownType)
+ }
+ }
+ return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the ChildPhoto fields.
+func (cp *ChildPhoto) assignValues(columns []string, values []any) error {
+ if m, n := len(values), len(columns); m < n {
+ return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+ }
+ for i := range columns {
+ switch columns[i] {
+ case childphoto.FieldID:
+ if value, ok := values[i].(*uuid.UUID); !ok {
+ return fmt.Errorf("unexpected type %T for field id", values[i])
+ } else if value != nil {
+ cp.ID = *value
+ }
+ case childphoto.FieldCreatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field created_at", values[i])
+ } else if value.Valid {
+ cp.CreatedAt = value.Time
+ }
+ case childphoto.FieldUpdatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field updated_at", values[i])
+ } else if value.Valid {
+ cp.UpdatedAt = value.Time
+ }
+ case childphoto.ForeignKeys[0]:
+ if value, ok := values[i].(*sql.NullScanner); !ok {
+ return fmt.Errorf("unexpected type %T for field child_photos", values[i])
+ } else if value.Valid {
+ cp.child_photos = new(uuid.UUID)
+ *cp.child_photos = *value.S.(*uuid.UUID)
+ }
+ default:
+ cp.selectValues.Set(columns[i], values[i])
+ }
+ }
+ return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the ChildPhoto.
+// This includes values selected through modifiers, order, etc.
+func (cp *ChildPhoto) Value(name string) (ent.Value, error) {
+ return cp.selectValues.Get(name)
+}
+
+// QueryChild queries the "child" edge of the ChildPhoto entity.
+func (cp *ChildPhoto) QueryChild() *ChildQuery {
+ return NewChildPhotoClient(cp.config).QueryChild(cp)
+}
+
+// Update returns a builder for updating this ChildPhoto.
+// Note that you need to call ChildPhoto.Unwrap() before calling this method if this ChildPhoto
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (cp *ChildPhoto) Update() *ChildPhotoUpdateOne {
+ return NewChildPhotoClient(cp.config).UpdateOne(cp)
+}
+
+// Unwrap unwraps the ChildPhoto entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (cp *ChildPhoto) Unwrap() *ChildPhoto {
+ _tx, ok := cp.config.driver.(*txDriver)
+ if !ok {
+ panic("ent: ChildPhoto is not a transactional entity")
+ }
+ cp.config.driver = _tx.drv
+ return cp
+}
+
+// String implements the fmt.Stringer.
+func (cp *ChildPhoto) String() string {
+ var builder strings.Builder
+ builder.WriteString("ChildPhoto(")
+ builder.WriteString(fmt.Sprintf("id=%v, ", cp.ID))
+ builder.WriteString("created_at=")
+ builder.WriteString(cp.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(", ")
+ builder.WriteString("updated_at=")
+ builder.WriteString(cp.UpdatedAt.Format(time.ANSIC))
+ builder.WriteByte(')')
+ return builder.String()
+}
+
+// ChildPhotos is a parsable slice of ChildPhoto.
+type ChildPhotos []*ChildPhoto
diff --git a/backend/domain/repository/ent/childphoto/childphoto.go b/backend/domain/repository/ent/childphoto/childphoto.go
new file mode 100644
index 00000000..e44fcff1
--- /dev/null
+++ b/backend/domain/repository/ent/childphoto/childphoto.go
@@ -0,0 +1,104 @@
+// Code generated by ent, DO NOT EDIT.
+
+package childphoto
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/google/uuid"
+)
+
+const (
+ // Label holds the string label denoting the childphoto type in the database.
+ Label = "child_photo"
+ // FieldID holds the string denoting the id field in the database.
+ FieldID = "id"
+ // FieldCreatedAt holds the string denoting the created_at field in the database.
+ FieldCreatedAt = "created_at"
+ // FieldUpdatedAt holds the string denoting the updated_at field in the database.
+ FieldUpdatedAt = "updated_at"
+ // EdgeChild holds the string denoting the child edge name in mutations.
+ EdgeChild = "child"
+ // Table holds the table name of the childphoto in the database.
+ Table = "child_photos"
+ // ChildTable is the table that holds the child relation/edge.
+ ChildTable = "child_photos"
+ // ChildInverseTable is the table name for the Child entity.
+ // It exists in this package in order to avoid circular dependency with the "child" package.
+ ChildInverseTable = "childs"
+ // ChildColumn is the table column denoting the child relation/edge.
+ ChildColumn = "child_photos"
+)
+
+// Columns holds all SQL columns for childphoto fields.
+var Columns = []string{
+ FieldID,
+ FieldCreatedAt,
+ FieldUpdatedAt,
+}
+
+// ForeignKeys holds the SQL foreign-keys that are owned by the "child_photos"
+// table and are not defined as standalone fields in the schema.
+var ForeignKeys = []string{
+ "child_photos",
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+ for i := range Columns {
+ if column == Columns[i] {
+ return true
+ }
+ }
+ for i := range ForeignKeys {
+ if column == ForeignKeys[i] {
+ return true
+ }
+ }
+ return false
+}
+
+var (
+ // DefaultCreatedAt holds the default value on creation for the "created_at" field.
+ DefaultCreatedAt func() time.Time
+ // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
+ DefaultUpdatedAt func() time.Time
+ // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
+ UpdateDefaultUpdatedAt func() time.Time
+ // DefaultID holds the default value on creation for the "id" field.
+ DefaultID func() uuid.UUID
+)
+
+// OrderOption defines the ordering options for the ChildPhoto queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByCreatedAt orders the results by the created_at field.
+func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
+}
+
+// ByUpdatedAt orders the results by the updated_at field.
+func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
+}
+
+// ByChildField orders the results by child field.
+func ByChildField(field string, opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newChildStep(), sql.OrderByField(field, opts...))
+ }
+}
+func newChildStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(ChildInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, ChildTable, ChildColumn),
+ )
+}
diff --git a/backend/domain/repository/ent/childphoto/where.go b/backend/domain/repository/ent/childphoto/where.go
new file mode 100644
index 00000000..dec324c4
--- /dev/null
+++ b/backend/domain/repository/ent/childphoto/where.go
@@ -0,0 +1,185 @@
+// Code generated by ent, DO NOT EDIT.
+
+package childphoto
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id uuid.UUID) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id uuid.UUID) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id uuid.UUID) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...uuid.UUID) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...uuid.UUID) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id uuid.UUID) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id uuid.UUID) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id uuid.UUID) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id uuid.UUID) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldLTE(FieldID, id))
+}
+
+// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
+func UpdatedAt(v time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
+func UpdatedAtEQ(v time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
+func UpdatedAtNEQ(v time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldNEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtIn applies the In predicate on the "updated_at" field.
+func UpdatedAtIn(vs ...time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
+func UpdatedAtNotIn(vs ...time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldNotIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtGT applies the GT predicate on the "updated_at" field.
+func UpdatedAtGT(v time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldGT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
+func UpdatedAtGTE(v time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldGTE(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLT applies the LT predicate on the "updated_at" field.
+func UpdatedAtLT(v time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldLT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
+func UpdatedAtLTE(v time.Time) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.FieldLTE(FieldUpdatedAt, v))
+}
+
+// HasChild applies the HasEdge predicate on the "child" edge.
+func HasChild() predicate.ChildPhoto {
+ return predicate.ChildPhoto(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, ChildTable, ChildColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasChildWith applies the HasEdge predicate on the "child" edge with a given conditions (other predicates).
+func HasChildWith(preds ...predicate.Child) predicate.ChildPhoto {
+ return predicate.ChildPhoto(func(s *sql.Selector) {
+ step := newChildStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.ChildPhoto) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.ChildPhoto) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.ChildPhoto) predicate.ChildPhoto {
+ return predicate.ChildPhoto(sql.NotPredicates(p))
+}
diff --git a/backend/domain/repository/ent/childphoto_create.go b/backend/domain/repository/ent/childphoto_create.go
new file mode 100644
index 00000000..bba1543a
--- /dev/null
+++ b/backend/domain/repository/ent/childphoto_create.go
@@ -0,0 +1,288 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childphoto"
+ "github.com/google/uuid"
+)
+
+// ChildPhotoCreate is the builder for creating a ChildPhoto entity.
+type ChildPhotoCreate struct {
+ config
+ mutation *ChildPhotoMutation
+ hooks []Hook
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (cpc *ChildPhotoCreate) SetCreatedAt(t time.Time) *ChildPhotoCreate {
+ cpc.mutation.SetCreatedAt(t)
+ return cpc
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (cpc *ChildPhotoCreate) SetNillableCreatedAt(t *time.Time) *ChildPhotoCreate {
+ if t != nil {
+ cpc.SetCreatedAt(*t)
+ }
+ return cpc
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (cpc *ChildPhotoCreate) SetUpdatedAt(t time.Time) *ChildPhotoCreate {
+ cpc.mutation.SetUpdatedAt(t)
+ return cpc
+}
+
+// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
+func (cpc *ChildPhotoCreate) SetNillableUpdatedAt(t *time.Time) *ChildPhotoCreate {
+ if t != nil {
+ cpc.SetUpdatedAt(*t)
+ }
+ return cpc
+}
+
+// SetID sets the "id" field.
+func (cpc *ChildPhotoCreate) SetID(u uuid.UUID) *ChildPhotoCreate {
+ cpc.mutation.SetID(u)
+ return cpc
+}
+
+// SetNillableID sets the "id" field if the given value is not nil.
+func (cpc *ChildPhotoCreate) SetNillableID(u *uuid.UUID) *ChildPhotoCreate {
+ if u != nil {
+ cpc.SetID(*u)
+ }
+ return cpc
+}
+
+// SetChildID sets the "child" edge to the Child entity by ID.
+func (cpc *ChildPhotoCreate) SetChildID(id uuid.UUID) *ChildPhotoCreate {
+ cpc.mutation.SetChildID(id)
+ return cpc
+}
+
+// SetNillableChildID sets the "child" edge to the Child entity by ID if the given value is not nil.
+func (cpc *ChildPhotoCreate) SetNillableChildID(id *uuid.UUID) *ChildPhotoCreate {
+ if id != nil {
+ cpc = cpc.SetChildID(*id)
+ }
+ return cpc
+}
+
+// SetChild sets the "child" edge to the Child entity.
+func (cpc *ChildPhotoCreate) SetChild(c *Child) *ChildPhotoCreate {
+ return cpc.SetChildID(c.ID)
+}
+
+// Mutation returns the ChildPhotoMutation object of the builder.
+func (cpc *ChildPhotoCreate) Mutation() *ChildPhotoMutation {
+ return cpc.mutation
+}
+
+// Save creates the ChildPhoto in the database.
+func (cpc *ChildPhotoCreate) Save(ctx context.Context) (*ChildPhoto, error) {
+ cpc.defaults()
+ return withHooks(ctx, cpc.sqlSave, cpc.mutation, cpc.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (cpc *ChildPhotoCreate) SaveX(ctx context.Context) *ChildPhoto {
+ v, err := cpc.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (cpc *ChildPhotoCreate) Exec(ctx context.Context) error {
+ _, err := cpc.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cpc *ChildPhotoCreate) ExecX(ctx context.Context) {
+ if err := cpc.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (cpc *ChildPhotoCreate) defaults() {
+ if _, ok := cpc.mutation.CreatedAt(); !ok {
+ v := childphoto.DefaultCreatedAt()
+ cpc.mutation.SetCreatedAt(v)
+ }
+ if _, ok := cpc.mutation.UpdatedAt(); !ok {
+ v := childphoto.DefaultUpdatedAt()
+ cpc.mutation.SetUpdatedAt(v)
+ }
+ if _, ok := cpc.mutation.ID(); !ok {
+ v := childphoto.DefaultID()
+ cpc.mutation.SetID(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (cpc *ChildPhotoCreate) check() error {
+ if _, ok := cpc.mutation.CreatedAt(); !ok {
+ return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "ChildPhoto.created_at"`)}
+ }
+ if _, ok := cpc.mutation.UpdatedAt(); !ok {
+ return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "ChildPhoto.updated_at"`)}
+ }
+ return nil
+}
+
+func (cpc *ChildPhotoCreate) sqlSave(ctx context.Context) (*ChildPhoto, error) {
+ if err := cpc.check(); err != nil {
+ return nil, err
+ }
+ _node, _spec := cpc.createSpec()
+ if err := sqlgraph.CreateNode(ctx, cpc.driver, _spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ if _spec.ID.Value != nil {
+ if id, ok := _spec.ID.Value.(*uuid.UUID); ok {
+ _node.ID = *id
+ } else if err := _node.ID.Scan(_spec.ID.Value); err != nil {
+ return nil, err
+ }
+ }
+ cpc.mutation.id = &_node.ID
+ cpc.mutation.done = true
+ return _node, nil
+}
+
+func (cpc *ChildPhotoCreate) createSpec() (*ChildPhoto, *sqlgraph.CreateSpec) {
+ var (
+ _node = &ChildPhoto{config: cpc.config}
+ _spec = sqlgraph.NewCreateSpec(childphoto.Table, sqlgraph.NewFieldSpec(childphoto.FieldID, field.TypeUUID))
+ )
+ if id, ok := cpc.mutation.ID(); ok {
+ _node.ID = id
+ _spec.ID.Value = &id
+ }
+ if value, ok := cpc.mutation.CreatedAt(); ok {
+ _spec.SetField(childphoto.FieldCreatedAt, field.TypeTime, value)
+ _node.CreatedAt = value
+ }
+ if value, ok := cpc.mutation.UpdatedAt(); ok {
+ _spec.SetField(childphoto.FieldUpdatedAt, field.TypeTime, value)
+ _node.UpdatedAt = value
+ }
+ if nodes := cpc.mutation.ChildIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: childphoto.ChildTable,
+ Columns: []string{childphoto.ChildColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _node.child_photos = &nodes[0]
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ return _node, _spec
+}
+
+// ChildPhotoCreateBulk is the builder for creating many ChildPhoto entities in bulk.
+type ChildPhotoCreateBulk struct {
+ config
+ err error
+ builders []*ChildPhotoCreate
+}
+
+// Save creates the ChildPhoto entities in the database.
+func (cpcb *ChildPhotoCreateBulk) Save(ctx context.Context) ([]*ChildPhoto, error) {
+ if cpcb.err != nil {
+ return nil, cpcb.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(cpcb.builders))
+ nodes := make([]*ChildPhoto, len(cpcb.builders))
+ mutators := make([]Mutator, len(cpcb.builders))
+ for i := range cpcb.builders {
+ func(i int, root context.Context) {
+ builder := cpcb.builders[i]
+ builder.defaults()
+ var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+ mutation, ok := m.(*ChildPhotoMutation)
+ if !ok {
+ return nil, fmt.Errorf("unexpected mutation type %T", m)
+ }
+ if err := builder.check(); err != nil {
+ return nil, err
+ }
+ builder.mutation = mutation
+ var err error
+ nodes[i], specs[i] = builder.createSpec()
+ if i < len(mutators)-1 {
+ _, err = mutators[i+1].Mutate(root, cpcb.builders[i+1].mutation)
+ } else {
+ spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+ // Invoke the actual operation on the latest mutation in the chain.
+ if err = sqlgraph.BatchCreate(ctx, cpcb.driver, spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ }
+ }
+ if err != nil {
+ return nil, err
+ }
+ mutation.id = &nodes[i].ID
+ mutation.done = true
+ return nodes[i], nil
+ })
+ for i := len(builder.hooks) - 1; i >= 0; i-- {
+ mut = builder.hooks[i](mut)
+ }
+ mutators[i] = mut
+ }(i, ctx)
+ }
+ if len(mutators) > 0 {
+ if _, err := mutators[0].Mutate(ctx, cpcb.builders[0].mutation); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (cpcb *ChildPhotoCreateBulk) SaveX(ctx context.Context) []*ChildPhoto {
+ v, err := cpcb.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (cpcb *ChildPhotoCreateBulk) Exec(ctx context.Context) error {
+ _, err := cpcb.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cpcb *ChildPhotoCreateBulk) ExecX(ctx context.Context) {
+ if err := cpcb.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/childphoto_delete.go b/backend/domain/repository/ent/childphoto_delete.go
new file mode 100644
index 00000000..4e12ea20
--- /dev/null
+++ b/backend/domain/repository/ent/childphoto_delete.go
@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childphoto"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+)
+
+// ChildPhotoDelete is the builder for deleting a ChildPhoto entity.
+type ChildPhotoDelete struct {
+ config
+ hooks []Hook
+ mutation *ChildPhotoMutation
+}
+
+// Where appends a list predicates to the ChildPhotoDelete builder.
+func (cpd *ChildPhotoDelete) Where(ps ...predicate.ChildPhoto) *ChildPhotoDelete {
+ cpd.mutation.Where(ps...)
+ return cpd
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (cpd *ChildPhotoDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, cpd.sqlExec, cpd.mutation, cpd.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cpd *ChildPhotoDelete) ExecX(ctx context.Context) int {
+ n, err := cpd.Exec(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return n
+}
+
+func (cpd *ChildPhotoDelete) sqlExec(ctx context.Context) (int, error) {
+ _spec := sqlgraph.NewDeleteSpec(childphoto.Table, sqlgraph.NewFieldSpec(childphoto.FieldID, field.TypeUUID))
+ if ps := cpd.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ affected, err := sqlgraph.DeleteNodes(ctx, cpd.driver, _spec)
+ if err != nil && sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ cpd.mutation.done = true
+ return affected, err
+}
+
+// ChildPhotoDeleteOne is the builder for deleting a single ChildPhoto entity.
+type ChildPhotoDeleteOne struct {
+ cpd *ChildPhotoDelete
+}
+
+// Where appends a list predicates to the ChildPhotoDelete builder.
+func (cpdo *ChildPhotoDeleteOne) Where(ps ...predicate.ChildPhoto) *ChildPhotoDeleteOne {
+ cpdo.cpd.mutation.Where(ps...)
+ return cpdo
+}
+
+// Exec executes the deletion query.
+func (cpdo *ChildPhotoDeleteOne) Exec(ctx context.Context) error {
+ n, err := cpdo.cpd.Exec(ctx)
+ switch {
+ case err != nil:
+ return err
+ case n == 0:
+ return &NotFoundError{childphoto.Label}
+ default:
+ return nil
+ }
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cpdo *ChildPhotoDeleteOne) ExecX(ctx context.Context) {
+ if err := cpdo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/childphoto_query.go b/backend/domain/repository/ent/childphoto_query.go
new file mode 100644
index 00000000..e118c8d2
--- /dev/null
+++ b/backend/domain/repository/ent/childphoto_query.go
@@ -0,0 +1,614 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "fmt"
+ "math"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childphoto"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// ChildPhotoQuery is the builder for querying ChildPhoto entities.
+type ChildPhotoQuery struct {
+ config
+ ctx *QueryContext
+ order []childphoto.OrderOption
+ inters []Interceptor
+ predicates []predicate.ChildPhoto
+ withChild *ChildQuery
+ withFKs bool
+ // intermediate query (i.e. traversal path).
+ sql *sql.Selector
+ path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the ChildPhotoQuery builder.
+func (cpq *ChildPhotoQuery) Where(ps ...predicate.ChildPhoto) *ChildPhotoQuery {
+ cpq.predicates = append(cpq.predicates, ps...)
+ return cpq
+}
+
+// Limit the number of records to be returned by this query.
+func (cpq *ChildPhotoQuery) Limit(limit int) *ChildPhotoQuery {
+ cpq.ctx.Limit = &limit
+ return cpq
+}
+
+// Offset to start from.
+func (cpq *ChildPhotoQuery) Offset(offset int) *ChildPhotoQuery {
+ cpq.ctx.Offset = &offset
+ return cpq
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (cpq *ChildPhotoQuery) Unique(unique bool) *ChildPhotoQuery {
+ cpq.ctx.Unique = &unique
+ return cpq
+}
+
+// Order specifies how the records should be ordered.
+func (cpq *ChildPhotoQuery) Order(o ...childphoto.OrderOption) *ChildPhotoQuery {
+ cpq.order = append(cpq.order, o...)
+ return cpq
+}
+
+// QueryChild chains the current query on the "child" edge.
+func (cpq *ChildPhotoQuery) QueryChild() *ChildQuery {
+ query := (&ChildClient{config: cpq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := cpq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := cpq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(childphoto.Table, childphoto.FieldID, selector),
+ sqlgraph.To(child.Table, child.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, childphoto.ChildTable, childphoto.ChildColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(cpq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// First returns the first ChildPhoto entity from the query.
+// Returns a *NotFoundError when no ChildPhoto was found.
+func (cpq *ChildPhotoQuery) First(ctx context.Context) (*ChildPhoto, error) {
+ nodes, err := cpq.Limit(1).All(setContextOp(ctx, cpq.ctx, "First"))
+ if err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nil, &NotFoundError{childphoto.Label}
+ }
+ return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (cpq *ChildPhotoQuery) FirstX(ctx context.Context) *ChildPhoto {
+ node, err := cpq.First(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return node
+}
+
+// FirstID returns the first ChildPhoto ID from the query.
+// Returns a *NotFoundError when no ChildPhoto ID was found.
+func (cpq *ChildPhotoQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+ var ids []uuid.UUID
+ if ids, err = cpq.Limit(1).IDs(setContextOp(ctx, cpq.ctx, "FirstID")); err != nil {
+ return
+ }
+ if len(ids) == 0 {
+ err = &NotFoundError{childphoto.Label}
+ return
+ }
+ return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (cpq *ChildPhotoQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := cpq.FirstID(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return id
+}
+
+// Only returns a single ChildPhoto entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one ChildPhoto entity is found.
+// Returns a *NotFoundError when no ChildPhoto entities are found.
+func (cpq *ChildPhotoQuery) Only(ctx context.Context) (*ChildPhoto, error) {
+ nodes, err := cpq.Limit(2).All(setContextOp(ctx, cpq.ctx, "Only"))
+ if err != nil {
+ return nil, err
+ }
+ switch len(nodes) {
+ case 1:
+ return nodes[0], nil
+ case 0:
+ return nil, &NotFoundError{childphoto.Label}
+ default:
+ return nil, &NotSingularError{childphoto.Label}
+ }
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (cpq *ChildPhotoQuery) OnlyX(ctx context.Context) *ChildPhoto {
+ node, err := cpq.Only(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// OnlyID is like Only, but returns the only ChildPhoto ID in the query.
+// Returns a *NotSingularError when more than one ChildPhoto ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (cpq *ChildPhotoQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+ var ids []uuid.UUID
+ if ids, err = cpq.Limit(2).IDs(setContextOp(ctx, cpq.ctx, "OnlyID")); err != nil {
+ return
+ }
+ switch len(ids) {
+ case 1:
+ id = ids[0]
+ case 0:
+ err = &NotFoundError{childphoto.Label}
+ default:
+ err = &NotSingularError{childphoto.Label}
+ }
+ return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (cpq *ChildPhotoQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := cpq.OnlyID(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// All executes the query and returns a list of ChildPhotos.
+func (cpq *ChildPhotoQuery) All(ctx context.Context) ([]*ChildPhoto, error) {
+ ctx = setContextOp(ctx, cpq.ctx, "All")
+ if err := cpq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ qr := querierAll[[]*ChildPhoto, *ChildPhotoQuery]()
+ return withInterceptors[[]*ChildPhoto](ctx, cpq, qr, cpq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (cpq *ChildPhotoQuery) AllX(ctx context.Context) []*ChildPhoto {
+ nodes, err := cpq.All(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return nodes
+}
+
+// IDs executes the query and returns a list of ChildPhoto IDs.
+func (cpq *ChildPhotoQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if cpq.ctx.Unique == nil && cpq.path != nil {
+ cpq.Unique(true)
+ }
+ ctx = setContextOp(ctx, cpq.ctx, "IDs")
+ if err = cpq.Select(childphoto.FieldID).Scan(ctx, &ids); err != nil {
+ return nil, err
+ }
+ return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (cpq *ChildPhotoQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := cpq.IDs(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return ids
+}
+
+// Count returns the count of the given query.
+func (cpq *ChildPhotoQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, cpq.ctx, "Count")
+ if err := cpq.prepareQuery(ctx); err != nil {
+ return 0, err
+ }
+ return withInterceptors[int](ctx, cpq, querierCount[*ChildPhotoQuery](), cpq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (cpq *ChildPhotoQuery) CountX(ctx context.Context) int {
+ count, err := cpq.Count(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (cpq *ChildPhotoQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, cpq.ctx, "Exist")
+ switch _, err := cpq.FirstID(ctx); {
+ case IsNotFound(err):
+ return false, nil
+ case err != nil:
+ return false, fmt.Errorf("ent: check existence: %w", err)
+ default:
+ return true, nil
+ }
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (cpq *ChildPhotoQuery) ExistX(ctx context.Context) bool {
+ exist, err := cpq.Exist(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return exist
+}
+
+// Clone returns a duplicate of the ChildPhotoQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (cpq *ChildPhotoQuery) Clone() *ChildPhotoQuery {
+ if cpq == nil {
+ return nil
+ }
+ return &ChildPhotoQuery{
+ config: cpq.config,
+ ctx: cpq.ctx.Clone(),
+ order: append([]childphoto.OrderOption{}, cpq.order...),
+ inters: append([]Interceptor{}, cpq.inters...),
+ predicates: append([]predicate.ChildPhoto{}, cpq.predicates...),
+ withChild: cpq.withChild.Clone(),
+ // clone intermediate query.
+ sql: cpq.sql.Clone(),
+ path: cpq.path,
+ }
+}
+
+// WithChild tells the query-builder to eager-load the nodes that are connected to
+// the "child" edge. The optional arguments are used to configure the query builder of the edge.
+func (cpq *ChildPhotoQuery) WithChild(opts ...func(*ChildQuery)) *ChildPhotoQuery {
+ query := (&ChildClient{config: cpq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ cpq.withChild = query
+ return cpq
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+// var v []struct {
+// CreatedAt time.Time `json:"created_at,omitempty"`
+// Count int `json:"count,omitempty"`
+// }
+//
+// client.ChildPhoto.Query().
+// GroupBy(childphoto.FieldCreatedAt).
+// Aggregate(ent.Count()).
+// Scan(ctx, &v)
+func (cpq *ChildPhotoQuery) GroupBy(field string, fields ...string) *ChildPhotoGroupBy {
+ cpq.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &ChildPhotoGroupBy{build: cpq}
+ grbuild.flds = &cpq.ctx.Fields
+ grbuild.label = childphoto.Label
+ grbuild.scan = grbuild.Scan
+ return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+// var v []struct {
+// CreatedAt time.Time `json:"created_at,omitempty"`
+// }
+//
+// client.ChildPhoto.Query().
+// Select(childphoto.FieldCreatedAt).
+// Scan(ctx, &v)
+func (cpq *ChildPhotoQuery) Select(fields ...string) *ChildPhotoSelect {
+ cpq.ctx.Fields = append(cpq.ctx.Fields, fields...)
+ sbuild := &ChildPhotoSelect{ChildPhotoQuery: cpq}
+ sbuild.label = childphoto.Label
+ sbuild.flds, sbuild.scan = &cpq.ctx.Fields, sbuild.Scan
+ return sbuild
+}
+
+// Aggregate returns a ChildPhotoSelect configured with the given aggregations.
+func (cpq *ChildPhotoQuery) Aggregate(fns ...AggregateFunc) *ChildPhotoSelect {
+ return cpq.Select().Aggregate(fns...)
+}
+
+func (cpq *ChildPhotoQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range cpq.inters {
+ if inter == nil {
+ return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+ }
+ if trv, ok := inter.(Traverser); ok {
+ if err := trv.Traverse(ctx, cpq); err != nil {
+ return err
+ }
+ }
+ }
+ for _, f := range cpq.ctx.Fields {
+ if !childphoto.ValidColumn(f) {
+ return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ }
+ if cpq.path != nil {
+ prev, err := cpq.path(ctx)
+ if err != nil {
+ return err
+ }
+ cpq.sql = prev
+ }
+ return nil
+}
+
+func (cpq *ChildPhotoQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*ChildPhoto, error) {
+ var (
+ nodes = []*ChildPhoto{}
+ withFKs = cpq.withFKs
+ _spec = cpq.querySpec()
+ loadedTypes = [1]bool{
+ cpq.withChild != nil,
+ }
+ )
+ if cpq.withChild != nil {
+ withFKs = true
+ }
+ if withFKs {
+ _spec.Node.Columns = append(_spec.Node.Columns, childphoto.ForeignKeys...)
+ }
+ _spec.ScanValues = func(columns []string) ([]any, error) {
+ return (*ChildPhoto).scanValues(nil, columns)
+ }
+ _spec.Assign = func(columns []string, values []any) error {
+ node := &ChildPhoto{config: cpq.config}
+ nodes = append(nodes, node)
+ node.Edges.loadedTypes = loadedTypes
+ return node.assignValues(columns, values)
+ }
+ for i := range hooks {
+ hooks[i](ctx, _spec)
+ }
+ if err := sqlgraph.QueryNodes(ctx, cpq.driver, _spec); err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nodes, nil
+ }
+ if query := cpq.withChild; query != nil {
+ if err := cpq.loadChild(ctx, query, nodes, nil,
+ func(n *ChildPhoto, e *Child) { n.Edges.Child = e }); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+func (cpq *ChildPhotoQuery) loadChild(ctx context.Context, query *ChildQuery, nodes []*ChildPhoto, init func(*ChildPhoto), assign func(*ChildPhoto, *Child)) error {
+ ids := make([]uuid.UUID, 0, len(nodes))
+ nodeids := make(map[uuid.UUID][]*ChildPhoto)
+ for i := range nodes {
+ if nodes[i].child_photos == nil {
+ continue
+ }
+ fk := *nodes[i].child_photos
+ if _, ok := nodeids[fk]; !ok {
+ ids = append(ids, fk)
+ }
+ nodeids[fk] = append(nodeids[fk], nodes[i])
+ }
+ if len(ids) == 0 {
+ return nil
+ }
+ query.Where(child.IDIn(ids...))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ nodes, ok := nodeids[n.ID]
+ if !ok {
+ return fmt.Errorf(`unexpected foreign-key "child_photos" returned %v`, n.ID)
+ }
+ for i := range nodes {
+ assign(nodes[i], n)
+ }
+ }
+ return nil
+}
+
+func (cpq *ChildPhotoQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := cpq.querySpec()
+ _spec.Node.Columns = cpq.ctx.Fields
+ if len(cpq.ctx.Fields) > 0 {
+ _spec.Unique = cpq.ctx.Unique != nil && *cpq.ctx.Unique
+ }
+ return sqlgraph.CountNodes(ctx, cpq.driver, _spec)
+}
+
+func (cpq *ChildPhotoQuery) querySpec() *sqlgraph.QuerySpec {
+ _spec := sqlgraph.NewQuerySpec(childphoto.Table, childphoto.Columns, sqlgraph.NewFieldSpec(childphoto.FieldID, field.TypeUUID))
+ _spec.From = cpq.sql
+ if unique := cpq.ctx.Unique; unique != nil {
+ _spec.Unique = *unique
+ } else if cpq.path != nil {
+ _spec.Unique = true
+ }
+ if fields := cpq.ctx.Fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, childphoto.FieldID)
+ for i := range fields {
+ if fields[i] != childphoto.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+ }
+ }
+ }
+ if ps := cpq.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if limit := cpq.ctx.Limit; limit != nil {
+ _spec.Limit = *limit
+ }
+ if offset := cpq.ctx.Offset; offset != nil {
+ _spec.Offset = *offset
+ }
+ if ps := cpq.order; len(ps) > 0 {
+ _spec.Order = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ return _spec
+}
+
+func (cpq *ChildPhotoQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(cpq.driver.Dialect())
+ t1 := builder.Table(childphoto.Table)
+ columns := cpq.ctx.Fields
+ if len(columns) == 0 {
+ columns = childphoto.Columns
+ }
+ selector := builder.Select(t1.Columns(columns...)...).From(t1)
+ if cpq.sql != nil {
+ selector = cpq.sql
+ selector.Select(selector.Columns(columns...)...)
+ }
+ if cpq.ctx.Unique != nil && *cpq.ctx.Unique {
+ selector.Distinct()
+ }
+ for _, p := range cpq.predicates {
+ p(selector)
+ }
+ for _, p := range cpq.order {
+ p(selector)
+ }
+ if offset := cpq.ctx.Offset; offset != nil {
+ // limit is mandatory for offset clause. We start
+ // with default value, and override it below if needed.
+ selector.Offset(*offset).Limit(math.MaxInt32)
+ }
+ if limit := cpq.ctx.Limit; limit != nil {
+ selector.Limit(*limit)
+ }
+ return selector
+}
+
+// ChildPhotoGroupBy is the group-by builder for ChildPhoto entities.
+type ChildPhotoGroupBy struct {
+ selector
+ build *ChildPhotoQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (cpgb *ChildPhotoGroupBy) Aggregate(fns ...AggregateFunc) *ChildPhotoGroupBy {
+ cpgb.fns = append(cpgb.fns, fns...)
+ return cpgb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (cpgb *ChildPhotoGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, cpgb.build.ctx, "GroupBy")
+ if err := cpgb.build.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*ChildPhotoQuery, *ChildPhotoGroupBy](ctx, cpgb.build, cpgb, cpgb.build.inters, v)
+}
+
+func (cpgb *ChildPhotoGroupBy) sqlScan(ctx context.Context, root *ChildPhotoQuery, v any) error {
+ selector := root.sqlQuery(ctx).Select()
+ aggregation := make([]string, 0, len(cpgb.fns))
+ for _, fn := range cpgb.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ if len(selector.SelectedColumns()) == 0 {
+ columns := make([]string, 0, len(*cpgb.flds)+len(cpgb.fns))
+ for _, f := range *cpgb.flds {
+ columns = append(columns, selector.C(f))
+ }
+ columns = append(columns, aggregation...)
+ selector.Select(columns...)
+ }
+ selector.GroupBy(selector.Columns(*cpgb.flds...)...)
+ if err := selector.Err(); err != nil {
+ return err
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := cpgb.build.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
+
+// ChildPhotoSelect is the builder for selecting fields of ChildPhoto entities.
+type ChildPhotoSelect struct {
+ *ChildPhotoQuery
+ selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (cps *ChildPhotoSelect) Aggregate(fns ...AggregateFunc) *ChildPhotoSelect {
+ cps.fns = append(cps.fns, fns...)
+ return cps
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (cps *ChildPhotoSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, cps.ctx, "Select")
+ if err := cps.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*ChildPhotoQuery, *ChildPhotoSelect](ctx, cps.ChildPhotoQuery, cps, cps.inters, v)
+}
+
+func (cps *ChildPhotoSelect) sqlScan(ctx context.Context, root *ChildPhotoQuery, v any) error {
+ selector := root.sqlQuery(ctx)
+ aggregation := make([]string, 0, len(cps.fns))
+ for _, fn := range cps.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ switch n := len(*cps.selector.flds); {
+ case n == 0 && len(aggregation) > 0:
+ selector.Select(aggregation...)
+ case n != 0 && len(aggregation) > 0:
+ selector.AppendSelect(aggregation...)
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := cps.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
diff --git a/backend/domain/repository/ent/childphoto_update.go b/backend/domain/repository/ent/childphoto_update.go
new file mode 100644
index 00000000..57585e54
--- /dev/null
+++ b/backend/domain/repository/ent/childphoto_update.go
@@ -0,0 +1,356 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childphoto"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// ChildPhotoUpdate is the builder for updating ChildPhoto entities.
+type ChildPhotoUpdate struct {
+ config
+ hooks []Hook
+ mutation *ChildPhotoMutation
+}
+
+// Where appends a list predicates to the ChildPhotoUpdate builder.
+func (cpu *ChildPhotoUpdate) Where(ps ...predicate.ChildPhoto) *ChildPhotoUpdate {
+ cpu.mutation.Where(ps...)
+ return cpu
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (cpu *ChildPhotoUpdate) SetCreatedAt(t time.Time) *ChildPhotoUpdate {
+ cpu.mutation.SetCreatedAt(t)
+ return cpu
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (cpu *ChildPhotoUpdate) SetNillableCreatedAt(t *time.Time) *ChildPhotoUpdate {
+ if t != nil {
+ cpu.SetCreatedAt(*t)
+ }
+ return cpu
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (cpu *ChildPhotoUpdate) SetUpdatedAt(t time.Time) *ChildPhotoUpdate {
+ cpu.mutation.SetUpdatedAt(t)
+ return cpu
+}
+
+// SetChildID sets the "child" edge to the Child entity by ID.
+func (cpu *ChildPhotoUpdate) SetChildID(id uuid.UUID) *ChildPhotoUpdate {
+ cpu.mutation.SetChildID(id)
+ return cpu
+}
+
+// SetNillableChildID sets the "child" edge to the Child entity by ID if the given value is not nil.
+func (cpu *ChildPhotoUpdate) SetNillableChildID(id *uuid.UUID) *ChildPhotoUpdate {
+ if id != nil {
+ cpu = cpu.SetChildID(*id)
+ }
+ return cpu
+}
+
+// SetChild sets the "child" edge to the Child entity.
+func (cpu *ChildPhotoUpdate) SetChild(c *Child) *ChildPhotoUpdate {
+ return cpu.SetChildID(c.ID)
+}
+
+// Mutation returns the ChildPhotoMutation object of the builder.
+func (cpu *ChildPhotoUpdate) Mutation() *ChildPhotoMutation {
+ return cpu.mutation
+}
+
+// ClearChild clears the "child" edge to the Child entity.
+func (cpu *ChildPhotoUpdate) ClearChild() *ChildPhotoUpdate {
+ cpu.mutation.ClearChild()
+ return cpu
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (cpu *ChildPhotoUpdate) Save(ctx context.Context) (int, error) {
+ cpu.defaults()
+ return withHooks(ctx, cpu.sqlSave, cpu.mutation, cpu.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (cpu *ChildPhotoUpdate) SaveX(ctx context.Context) int {
+ affected, err := cpu.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return affected
+}
+
+// Exec executes the query.
+func (cpu *ChildPhotoUpdate) Exec(ctx context.Context) error {
+ _, err := cpu.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cpu *ChildPhotoUpdate) ExecX(ctx context.Context) {
+ if err := cpu.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (cpu *ChildPhotoUpdate) defaults() {
+ if _, ok := cpu.mutation.UpdatedAt(); !ok {
+ v := childphoto.UpdateDefaultUpdatedAt()
+ cpu.mutation.SetUpdatedAt(v)
+ }
+}
+
+func (cpu *ChildPhotoUpdate) sqlSave(ctx context.Context) (n int, err error) {
+ _spec := sqlgraph.NewUpdateSpec(childphoto.Table, childphoto.Columns, sqlgraph.NewFieldSpec(childphoto.FieldID, field.TypeUUID))
+ if ps := cpu.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := cpu.mutation.CreatedAt(); ok {
+ _spec.SetField(childphoto.FieldCreatedAt, field.TypeTime, value)
+ }
+ if value, ok := cpu.mutation.UpdatedAt(); ok {
+ _spec.SetField(childphoto.FieldUpdatedAt, field.TypeTime, value)
+ }
+ if cpu.mutation.ChildCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: childphoto.ChildTable,
+ Columns: []string{childphoto.ChildColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cpu.mutation.ChildIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: childphoto.ChildTable,
+ Columns: []string{childphoto.ChildColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if n, err = sqlgraph.UpdateNodes(ctx, cpu.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{childphoto.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return 0, err
+ }
+ cpu.mutation.done = true
+ return n, nil
+}
+
+// ChildPhotoUpdateOne is the builder for updating a single ChildPhoto entity.
+type ChildPhotoUpdateOne struct {
+ config
+ fields []string
+ hooks []Hook
+ mutation *ChildPhotoMutation
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (cpuo *ChildPhotoUpdateOne) SetCreatedAt(t time.Time) *ChildPhotoUpdateOne {
+ cpuo.mutation.SetCreatedAt(t)
+ return cpuo
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (cpuo *ChildPhotoUpdateOne) SetNillableCreatedAt(t *time.Time) *ChildPhotoUpdateOne {
+ if t != nil {
+ cpuo.SetCreatedAt(*t)
+ }
+ return cpuo
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (cpuo *ChildPhotoUpdateOne) SetUpdatedAt(t time.Time) *ChildPhotoUpdateOne {
+ cpuo.mutation.SetUpdatedAt(t)
+ return cpuo
+}
+
+// SetChildID sets the "child" edge to the Child entity by ID.
+func (cpuo *ChildPhotoUpdateOne) SetChildID(id uuid.UUID) *ChildPhotoUpdateOne {
+ cpuo.mutation.SetChildID(id)
+ return cpuo
+}
+
+// SetNillableChildID sets the "child" edge to the Child entity by ID if the given value is not nil.
+func (cpuo *ChildPhotoUpdateOne) SetNillableChildID(id *uuid.UUID) *ChildPhotoUpdateOne {
+ if id != nil {
+ cpuo = cpuo.SetChildID(*id)
+ }
+ return cpuo
+}
+
+// SetChild sets the "child" edge to the Child entity.
+func (cpuo *ChildPhotoUpdateOne) SetChild(c *Child) *ChildPhotoUpdateOne {
+ return cpuo.SetChildID(c.ID)
+}
+
+// Mutation returns the ChildPhotoMutation object of the builder.
+func (cpuo *ChildPhotoUpdateOne) Mutation() *ChildPhotoMutation {
+ return cpuo.mutation
+}
+
+// ClearChild clears the "child" edge to the Child entity.
+func (cpuo *ChildPhotoUpdateOne) ClearChild() *ChildPhotoUpdateOne {
+ cpuo.mutation.ClearChild()
+ return cpuo
+}
+
+// Where appends a list predicates to the ChildPhotoUpdate builder.
+func (cpuo *ChildPhotoUpdateOne) Where(ps ...predicate.ChildPhoto) *ChildPhotoUpdateOne {
+ cpuo.mutation.Where(ps...)
+ return cpuo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (cpuo *ChildPhotoUpdateOne) Select(field string, fields ...string) *ChildPhotoUpdateOne {
+ cpuo.fields = append([]string{field}, fields...)
+ return cpuo
+}
+
+// Save executes the query and returns the updated ChildPhoto entity.
+func (cpuo *ChildPhotoUpdateOne) Save(ctx context.Context) (*ChildPhoto, error) {
+ cpuo.defaults()
+ return withHooks(ctx, cpuo.sqlSave, cpuo.mutation, cpuo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (cpuo *ChildPhotoUpdateOne) SaveX(ctx context.Context) *ChildPhoto {
+ node, err := cpuo.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// Exec executes the query on the entity.
+func (cpuo *ChildPhotoUpdateOne) Exec(ctx context.Context) error {
+ _, err := cpuo.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (cpuo *ChildPhotoUpdateOne) ExecX(ctx context.Context) {
+ if err := cpuo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (cpuo *ChildPhotoUpdateOne) defaults() {
+ if _, ok := cpuo.mutation.UpdatedAt(); !ok {
+ v := childphoto.UpdateDefaultUpdatedAt()
+ cpuo.mutation.SetUpdatedAt(v)
+ }
+}
+
+func (cpuo *ChildPhotoUpdateOne) sqlSave(ctx context.Context) (_node *ChildPhoto, err error) {
+ _spec := sqlgraph.NewUpdateSpec(childphoto.Table, childphoto.Columns, sqlgraph.NewFieldSpec(childphoto.FieldID, field.TypeUUID))
+ id, ok := cpuo.mutation.ID()
+ if !ok {
+ return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "ChildPhoto.id" for update`)}
+ }
+ _spec.Node.ID.Value = id
+ if fields := cpuo.fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, childphoto.FieldID)
+ for _, f := range fields {
+ if !childphoto.ValidColumn(f) {
+ return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ if f != childphoto.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, f)
+ }
+ }
+ }
+ if ps := cpuo.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := cpuo.mutation.CreatedAt(); ok {
+ _spec.SetField(childphoto.FieldCreatedAt, field.TypeTime, value)
+ }
+ if value, ok := cpuo.mutation.UpdatedAt(); ok {
+ _spec.SetField(childphoto.FieldUpdatedAt, field.TypeTime, value)
+ }
+ if cpuo.mutation.ChildCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: childphoto.ChildTable,
+ Columns: []string{childphoto.ChildColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := cpuo.mutation.ChildIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: true,
+ Table: childphoto.ChildTable,
+ Columns: []string{childphoto.ChildColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ _node = &ChildPhoto{config: cpuo.config}
+ _spec.Assign = _node.assignValues
+ _spec.ScanValues = _node.scanValues
+ if err = sqlgraph.UpdateNode(ctx, cpuo.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{childphoto.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ cpuo.mutation.done = true
+ return _node, nil
+}
diff --git a/backend/domain/repository/ent/client.go b/backend/domain/repository/ent/client.go
new file mode 100644
index 00000000..e8863d0e
--- /dev/null
+++ b/backend/domain/repository/ent/client.go
@@ -0,0 +1,2103 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "log"
+ "reflect"
+
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/migrate"
+ "github.com/google/uuid"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect"
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busrouteassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childbusassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childphoto"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+)
+
+// Client is the client that holds all ent builders.
+type Client struct {
+ config
+ // Schema is the client for creating, migrating and dropping schema.
+ Schema *migrate.Schema
+ // BoardingRecord is the client for interacting with the BoardingRecord builders.
+ BoardingRecord *BoardingRecordClient
+ // Bus is the client for interacting with the Bus builders.
+ Bus *BusClient
+ // BusRoute is the client for interacting with the BusRoute builders.
+ BusRoute *BusRouteClient
+ // BusRouteAssociation is the client for interacting with the BusRouteAssociation builders.
+ BusRouteAssociation *BusRouteAssociationClient
+ // Child is the client for interacting with the Child builders.
+ Child *ChildClient
+ // ChildBusAssociation is the client for interacting with the ChildBusAssociation builders.
+ ChildBusAssociation *ChildBusAssociationClient
+ // ChildPhoto is the client for interacting with the ChildPhoto builders.
+ ChildPhoto *ChildPhotoClient
+ // Guardian is the client for interacting with the Guardian builders.
+ Guardian *GuardianClient
+ // Nursery is the client for interacting with the Nursery builders.
+ Nursery *NurseryClient
+ // Station is the client for interacting with the Station builders.
+ Station *StationClient
+}
+
+// NewClient creates a new client configured with the given options.
+func NewClient(opts ...Option) *Client {
+ client := &Client{config: newConfig(opts...)}
+ client.init()
+ return client
+}
+
+func (c *Client) init() {
+ c.Schema = migrate.NewSchema(c.driver)
+ c.BoardingRecord = NewBoardingRecordClient(c.config)
+ c.Bus = NewBusClient(c.config)
+ c.BusRoute = NewBusRouteClient(c.config)
+ c.BusRouteAssociation = NewBusRouteAssociationClient(c.config)
+ c.Child = NewChildClient(c.config)
+ c.ChildBusAssociation = NewChildBusAssociationClient(c.config)
+ c.ChildPhoto = NewChildPhotoClient(c.config)
+ c.Guardian = NewGuardianClient(c.config)
+ c.Nursery = NewNurseryClient(c.config)
+ c.Station = NewStationClient(c.config)
+}
+
+type (
+ // config is the configuration for the client and its builder.
+ config struct {
+ // driver used for executing database requests.
+ driver dialect.Driver
+ // debug enable a debug logging.
+ debug bool
+ // log used for logging on debug mode.
+ log func(...any)
+ // hooks to execute on mutations.
+ hooks *hooks
+ // interceptors to execute on queries.
+ inters *inters
+ }
+ // Option function to configure the client.
+ Option func(*config)
+)
+
+// newConfig creates a new config for the client.
+func newConfig(opts ...Option) config {
+ cfg := config{log: log.Println, hooks: &hooks{}, inters: &inters{}}
+ cfg.options(opts...)
+ return cfg
+}
+
+// options applies the options on the config object.
+func (c *config) options(opts ...Option) {
+ for _, opt := range opts {
+ opt(c)
+ }
+ if c.debug {
+ c.driver = dialect.Debug(c.driver, c.log)
+ }
+}
+
+// Debug enables debug logging on the ent.Driver.
+func Debug() Option {
+ return func(c *config) {
+ c.debug = true
+ }
+}
+
+// Log sets the logging function for debug mode.
+func Log(fn func(...any)) Option {
+ return func(c *config) {
+ c.log = fn
+ }
+}
+
+// Driver configures the client driver.
+func Driver(driver dialect.Driver) Option {
+ return func(c *config) {
+ c.driver = driver
+ }
+}
+
+// Open opens a database/sql.DB specified by the driver name and
+// the data source name, and returns a new client attached to it.
+// Optional parameters can be added for configuring the client.
+func Open(driverName, dataSourceName string, options ...Option) (*Client, error) {
+ switch driverName {
+ case dialect.MySQL, dialect.Postgres, dialect.SQLite:
+ drv, err := sql.Open(driverName, dataSourceName)
+ if err != nil {
+ return nil, err
+ }
+ return NewClient(append(options, Driver(drv))...), nil
+ default:
+ return nil, fmt.Errorf("unsupported driver: %q", driverName)
+ }
+}
+
+// ErrTxStarted is returned when trying to start a new transaction from a transactional client.
+var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")
+
+// Tx returns a new transactional client. The provided context
+// is used until the transaction is committed or rolled back.
+func (c *Client) Tx(ctx context.Context) (*Tx, error) {
+ if _, ok := c.driver.(*txDriver); ok {
+ return nil, ErrTxStarted
+ }
+ tx, err := newTx(ctx, c.driver)
+ if err != nil {
+ return nil, fmt.Errorf("ent: starting a transaction: %w", err)
+ }
+ cfg := c.config
+ cfg.driver = tx
+ return &Tx{
+ ctx: ctx,
+ config: cfg,
+ BoardingRecord: NewBoardingRecordClient(cfg),
+ Bus: NewBusClient(cfg),
+ BusRoute: NewBusRouteClient(cfg),
+ BusRouteAssociation: NewBusRouteAssociationClient(cfg),
+ Child: NewChildClient(cfg),
+ ChildBusAssociation: NewChildBusAssociationClient(cfg),
+ ChildPhoto: NewChildPhotoClient(cfg),
+ Guardian: NewGuardianClient(cfg),
+ Nursery: NewNurseryClient(cfg),
+ Station: NewStationClient(cfg),
+ }, nil
+}
+
+// BeginTx returns a transactional client with specified options.
+func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {
+ if _, ok := c.driver.(*txDriver); ok {
+ return nil, errors.New("ent: cannot start a transaction within a transaction")
+ }
+ tx, err := c.driver.(interface {
+ BeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)
+ }).BeginTx(ctx, opts)
+ if err != nil {
+ return nil, fmt.Errorf("ent: starting a transaction: %w", err)
+ }
+ cfg := c.config
+ cfg.driver = &txDriver{tx: tx, drv: c.driver}
+ return &Tx{
+ ctx: ctx,
+ config: cfg,
+ BoardingRecord: NewBoardingRecordClient(cfg),
+ Bus: NewBusClient(cfg),
+ BusRoute: NewBusRouteClient(cfg),
+ BusRouteAssociation: NewBusRouteAssociationClient(cfg),
+ Child: NewChildClient(cfg),
+ ChildBusAssociation: NewChildBusAssociationClient(cfg),
+ ChildPhoto: NewChildPhotoClient(cfg),
+ Guardian: NewGuardianClient(cfg),
+ Nursery: NewNurseryClient(cfg),
+ Station: NewStationClient(cfg),
+ }, nil
+}
+
+// Debug returns a new debug-client. It's used to get verbose logging on specific operations.
+//
+// client.Debug().
+// BoardingRecord.
+// Query().
+// Count(ctx)
+func (c *Client) Debug() *Client {
+ if c.debug {
+ return c
+ }
+ cfg := c.config
+ cfg.driver = dialect.Debug(c.driver, c.log)
+ client := &Client{config: cfg}
+ client.init()
+ return client
+}
+
+// Close closes the database connection and prevents new queries from starting.
+func (c *Client) Close() error {
+ return c.driver.Close()
+}
+
+// Use adds the mutation hooks to all the entity clients.
+// In order to add hooks to a specific client, call: `client.Node.Use(...)`.
+func (c *Client) Use(hooks ...Hook) {
+ for _, n := range []interface{ Use(...Hook) }{
+ c.BoardingRecord, c.Bus, c.BusRoute, c.BusRouteAssociation, c.Child,
+ c.ChildBusAssociation, c.ChildPhoto, c.Guardian, c.Nursery, c.Station,
+ } {
+ n.Use(hooks...)
+ }
+}
+
+// Intercept adds the query interceptors to all the entity clients.
+// In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
+func (c *Client) Intercept(interceptors ...Interceptor) {
+ for _, n := range []interface{ Intercept(...Interceptor) }{
+ c.BoardingRecord, c.Bus, c.BusRoute, c.BusRouteAssociation, c.Child,
+ c.ChildBusAssociation, c.ChildPhoto, c.Guardian, c.Nursery, c.Station,
+ } {
+ n.Intercept(interceptors...)
+ }
+}
+
+// Mutate implements the ent.Mutator interface.
+func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
+ switch m := m.(type) {
+ case *BoardingRecordMutation:
+ return c.BoardingRecord.mutate(ctx, m)
+ case *BusMutation:
+ return c.Bus.mutate(ctx, m)
+ case *BusRouteMutation:
+ return c.BusRoute.mutate(ctx, m)
+ case *BusRouteAssociationMutation:
+ return c.BusRouteAssociation.mutate(ctx, m)
+ case *ChildMutation:
+ return c.Child.mutate(ctx, m)
+ case *ChildBusAssociationMutation:
+ return c.ChildBusAssociation.mutate(ctx, m)
+ case *ChildPhotoMutation:
+ return c.ChildPhoto.mutate(ctx, m)
+ case *GuardianMutation:
+ return c.Guardian.mutate(ctx, m)
+ case *NurseryMutation:
+ return c.Nursery.mutate(ctx, m)
+ case *StationMutation:
+ return c.Station.mutate(ctx, m)
+ default:
+ return nil, fmt.Errorf("ent: unknown mutation type %T", m)
+ }
+}
+
+// BoardingRecordClient is a client for the BoardingRecord schema.
+type BoardingRecordClient struct {
+ config
+}
+
+// NewBoardingRecordClient returns a client for the BoardingRecord from the given config.
+func NewBoardingRecordClient(c config) *BoardingRecordClient {
+ return &BoardingRecordClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `boardingrecord.Hooks(f(g(h())))`.
+func (c *BoardingRecordClient) Use(hooks ...Hook) {
+ c.hooks.BoardingRecord = append(c.hooks.BoardingRecord, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `boardingrecord.Intercept(f(g(h())))`.
+func (c *BoardingRecordClient) Intercept(interceptors ...Interceptor) {
+ c.inters.BoardingRecord = append(c.inters.BoardingRecord, interceptors...)
+}
+
+// Create returns a builder for creating a BoardingRecord entity.
+func (c *BoardingRecordClient) Create() *BoardingRecordCreate {
+ mutation := newBoardingRecordMutation(c.config, OpCreate)
+ return &BoardingRecordCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of BoardingRecord entities.
+func (c *BoardingRecordClient) CreateBulk(builders ...*BoardingRecordCreate) *BoardingRecordCreateBulk {
+ return &BoardingRecordCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *BoardingRecordClient) MapCreateBulk(slice any, setFunc func(*BoardingRecordCreate, int)) *BoardingRecordCreateBulk {
+ rv := reflect.ValueOf(slice)
+ if rv.Kind() != reflect.Slice {
+ return &BoardingRecordCreateBulk{err: fmt.Errorf("calling to BoardingRecordClient.MapCreateBulk with wrong type %T, need slice", slice)}
+ }
+ builders := make([]*BoardingRecordCreate, rv.Len())
+ for i := 0; i < rv.Len(); i++ {
+ builders[i] = c.Create()
+ setFunc(builders[i], i)
+ }
+ return &BoardingRecordCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for BoardingRecord.
+func (c *BoardingRecordClient) Update() *BoardingRecordUpdate {
+ mutation := newBoardingRecordMutation(c.config, OpUpdate)
+ return &BoardingRecordUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *BoardingRecordClient) UpdateOne(br *BoardingRecord) *BoardingRecordUpdateOne {
+ mutation := newBoardingRecordMutation(c.config, OpUpdateOne, withBoardingRecord(br))
+ return &BoardingRecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *BoardingRecordClient) UpdateOneID(id uuid.UUID) *BoardingRecordUpdateOne {
+ mutation := newBoardingRecordMutation(c.config, OpUpdateOne, withBoardingRecordID(id))
+ return &BoardingRecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for BoardingRecord.
+func (c *BoardingRecordClient) Delete() *BoardingRecordDelete {
+ mutation := newBoardingRecordMutation(c.config, OpDelete)
+ return &BoardingRecordDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *BoardingRecordClient) DeleteOne(br *BoardingRecord) *BoardingRecordDeleteOne {
+ return c.DeleteOneID(br.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *BoardingRecordClient) DeleteOneID(id uuid.UUID) *BoardingRecordDeleteOne {
+ builder := c.Delete().Where(boardingrecord.ID(id))
+ builder.mutation.id = &id
+ builder.mutation.op = OpDeleteOne
+ return &BoardingRecordDeleteOne{builder}
+}
+
+// Query returns a query builder for BoardingRecord.
+func (c *BoardingRecordClient) Query() *BoardingRecordQuery {
+ return &BoardingRecordQuery{
+ config: c.config,
+ ctx: &QueryContext{Type: TypeBoardingRecord},
+ inters: c.Interceptors(),
+ }
+}
+
+// Get returns a BoardingRecord entity by its id.
+func (c *BoardingRecordClient) Get(ctx context.Context, id uuid.UUID) (*BoardingRecord, error) {
+ return c.Query().Where(boardingrecord.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *BoardingRecordClient) GetX(ctx context.Context, id uuid.UUID) *BoardingRecord {
+ obj, err := c.Get(ctx, id)
+ if err != nil {
+ panic(err)
+ }
+ return obj
+}
+
+// QueryChild queries the child edge of a BoardingRecord.
+func (c *BoardingRecordClient) QueryChild(br *BoardingRecord) *ChildQuery {
+ query := (&ChildClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := br.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(boardingrecord.Table, boardingrecord.FieldID, id),
+ sqlgraph.To(child.Table, child.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, boardingrecord.ChildTable, boardingrecord.ChildColumn),
+ )
+ fromV = sqlgraph.Neighbors(br.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryBus queries the bus edge of a BoardingRecord.
+func (c *BoardingRecordClient) QueryBus(br *BoardingRecord) *BusQuery {
+ query := (&BusClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := br.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(boardingrecord.Table, boardingrecord.FieldID, id),
+ sqlgraph.To(bus.Table, bus.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, boardingrecord.BusTable, boardingrecord.BusColumn),
+ )
+ fromV = sqlgraph.Neighbors(br.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// Hooks returns the client hooks.
+func (c *BoardingRecordClient) Hooks() []Hook {
+ return c.hooks.BoardingRecord
+}
+
+// Interceptors returns the client interceptors.
+func (c *BoardingRecordClient) Interceptors() []Interceptor {
+ return c.inters.BoardingRecord
+}
+
+func (c *BoardingRecordClient) mutate(ctx context.Context, m *BoardingRecordMutation) (Value, error) {
+ switch m.Op() {
+ case OpCreate:
+ return (&BoardingRecordCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdate:
+ return (&BoardingRecordUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdateOne:
+ return (&BoardingRecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpDelete, OpDeleteOne:
+ return (&BoardingRecordDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+ default:
+ return nil, fmt.Errorf("ent: unknown BoardingRecord mutation op: %q", m.Op())
+ }
+}
+
+// BusClient is a client for the Bus schema.
+type BusClient struct {
+ config
+}
+
+// NewBusClient returns a client for the Bus from the given config.
+func NewBusClient(c config) *BusClient {
+ return &BusClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `bus.Hooks(f(g(h())))`.
+func (c *BusClient) Use(hooks ...Hook) {
+ c.hooks.Bus = append(c.hooks.Bus, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `bus.Intercept(f(g(h())))`.
+func (c *BusClient) Intercept(interceptors ...Interceptor) {
+ c.inters.Bus = append(c.inters.Bus, interceptors...)
+}
+
+// Create returns a builder for creating a Bus entity.
+func (c *BusClient) Create() *BusCreate {
+ mutation := newBusMutation(c.config, OpCreate)
+ return &BusCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of Bus entities.
+func (c *BusClient) CreateBulk(builders ...*BusCreate) *BusCreateBulk {
+ return &BusCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *BusClient) MapCreateBulk(slice any, setFunc func(*BusCreate, int)) *BusCreateBulk {
+ rv := reflect.ValueOf(slice)
+ if rv.Kind() != reflect.Slice {
+ return &BusCreateBulk{err: fmt.Errorf("calling to BusClient.MapCreateBulk with wrong type %T, need slice", slice)}
+ }
+ builders := make([]*BusCreate, rv.Len())
+ for i := 0; i < rv.Len(); i++ {
+ builders[i] = c.Create()
+ setFunc(builders[i], i)
+ }
+ return &BusCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for Bus.
+func (c *BusClient) Update() *BusUpdate {
+ mutation := newBusMutation(c.config, OpUpdate)
+ return &BusUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *BusClient) UpdateOne(b *Bus) *BusUpdateOne {
+ mutation := newBusMutation(c.config, OpUpdateOne, withBus(b))
+ return &BusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *BusClient) UpdateOneID(id uuid.UUID) *BusUpdateOne {
+ mutation := newBusMutation(c.config, OpUpdateOne, withBusID(id))
+ return &BusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for Bus.
+func (c *BusClient) Delete() *BusDelete {
+ mutation := newBusMutation(c.config, OpDelete)
+ return &BusDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *BusClient) DeleteOne(b *Bus) *BusDeleteOne {
+ return c.DeleteOneID(b.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *BusClient) DeleteOneID(id uuid.UUID) *BusDeleteOne {
+ builder := c.Delete().Where(bus.ID(id))
+ builder.mutation.id = &id
+ builder.mutation.op = OpDeleteOne
+ return &BusDeleteOne{builder}
+}
+
+// Query returns a query builder for Bus.
+func (c *BusClient) Query() *BusQuery {
+ return &BusQuery{
+ config: c.config,
+ ctx: &QueryContext{Type: TypeBus},
+ inters: c.Interceptors(),
+ }
+}
+
+// Get returns a Bus entity by its id.
+func (c *BusClient) Get(ctx context.Context, id uuid.UUID) (*Bus, error) {
+ return c.Query().Where(bus.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *BusClient) GetX(ctx context.Context, id uuid.UUID) *Bus {
+ obj, err := c.Get(ctx, id)
+ if err != nil {
+ panic(err)
+ }
+ return obj
+}
+
+// QueryNursery queries the nursery edge of a Bus.
+func (c *BusClient) QueryNursery(b *Bus) *NurseryQuery {
+ query := (&NurseryClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := b.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(bus.Table, bus.FieldID, id),
+ sqlgraph.To(nursery.Table, nursery.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, bus.NurseryTable, bus.NurseryColumn),
+ )
+ fromV = sqlgraph.Neighbors(b.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryBoardingRecords queries the boarding_records edge of a Bus.
+func (c *BusClient) QueryBoardingRecords(b *Bus) *BoardingRecordQuery {
+ query := (&BoardingRecordClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := b.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(bus.Table, bus.FieldID, id),
+ sqlgraph.To(boardingrecord.Table, boardingrecord.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, bus.BoardingRecordsTable, bus.BoardingRecordsColumn),
+ )
+ fromV = sqlgraph.Neighbors(b.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryNextStation queries the next_station edge of a Bus.
+func (c *BusClient) QueryNextStation(b *Bus) *StationQuery {
+ query := (&StationClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := b.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(bus.Table, bus.FieldID, id),
+ sqlgraph.To(station.Table, station.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, bus.NextStationTable, bus.NextStationColumn),
+ )
+ fromV = sqlgraph.Neighbors(b.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryBusRoute queries the bus_route edge of a Bus.
+func (c *BusClient) QueryBusRoute(b *Bus) *BusRouteQuery {
+ query := (&BusRouteClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := b.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(bus.Table, bus.FieldID, id),
+ sqlgraph.To(busroute.Table, busroute.FieldID),
+ sqlgraph.Edge(sqlgraph.M2M, true, bus.BusRouteTable, bus.BusRoutePrimaryKey...),
+ )
+ fromV = sqlgraph.Neighbors(b.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryLatestMorningRoute queries the latest_morning_route edge of a Bus.
+func (c *BusClient) QueryLatestMorningRoute(b *Bus) *BusRouteQuery {
+ query := (&BusRouteClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := b.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(bus.Table, bus.FieldID, id),
+ sqlgraph.To(busroute.Table, busroute.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, bus.LatestMorningRouteTable, bus.LatestMorningRouteColumn),
+ )
+ fromV = sqlgraph.Neighbors(b.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryLatestEveningRoute queries the latest_evening_route edge of a Bus.
+func (c *BusClient) QueryLatestEveningRoute(b *Bus) *BusRouteQuery {
+ query := (&BusRouteClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := b.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(bus.Table, bus.FieldID, id),
+ sqlgraph.To(busroute.Table, busroute.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, bus.LatestEveningRouteTable, bus.LatestEveningRouteColumn),
+ )
+ fromV = sqlgraph.Neighbors(b.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// Hooks returns the client hooks.
+func (c *BusClient) Hooks() []Hook {
+ return c.hooks.Bus
+}
+
+// Interceptors returns the client interceptors.
+func (c *BusClient) Interceptors() []Interceptor {
+ return c.inters.Bus
+}
+
+func (c *BusClient) mutate(ctx context.Context, m *BusMutation) (Value, error) {
+ switch m.Op() {
+ case OpCreate:
+ return (&BusCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdate:
+ return (&BusUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdateOne:
+ return (&BusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpDelete, OpDeleteOne:
+ return (&BusDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+ default:
+ return nil, fmt.Errorf("ent: unknown Bus mutation op: %q", m.Op())
+ }
+}
+
+// BusRouteClient is a client for the BusRoute schema.
+type BusRouteClient struct {
+ config
+}
+
+// NewBusRouteClient returns a client for the BusRoute from the given config.
+func NewBusRouteClient(c config) *BusRouteClient {
+ return &BusRouteClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `busroute.Hooks(f(g(h())))`.
+func (c *BusRouteClient) Use(hooks ...Hook) {
+ c.hooks.BusRoute = append(c.hooks.BusRoute, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `busroute.Intercept(f(g(h())))`.
+func (c *BusRouteClient) Intercept(interceptors ...Interceptor) {
+ c.inters.BusRoute = append(c.inters.BusRoute, interceptors...)
+}
+
+// Create returns a builder for creating a BusRoute entity.
+func (c *BusRouteClient) Create() *BusRouteCreate {
+ mutation := newBusRouteMutation(c.config, OpCreate)
+ return &BusRouteCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of BusRoute entities.
+func (c *BusRouteClient) CreateBulk(builders ...*BusRouteCreate) *BusRouteCreateBulk {
+ return &BusRouteCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *BusRouteClient) MapCreateBulk(slice any, setFunc func(*BusRouteCreate, int)) *BusRouteCreateBulk {
+ rv := reflect.ValueOf(slice)
+ if rv.Kind() != reflect.Slice {
+ return &BusRouteCreateBulk{err: fmt.Errorf("calling to BusRouteClient.MapCreateBulk with wrong type %T, need slice", slice)}
+ }
+ builders := make([]*BusRouteCreate, rv.Len())
+ for i := 0; i < rv.Len(); i++ {
+ builders[i] = c.Create()
+ setFunc(builders[i], i)
+ }
+ return &BusRouteCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for BusRoute.
+func (c *BusRouteClient) Update() *BusRouteUpdate {
+ mutation := newBusRouteMutation(c.config, OpUpdate)
+ return &BusRouteUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *BusRouteClient) UpdateOne(br *BusRoute) *BusRouteUpdateOne {
+ mutation := newBusRouteMutation(c.config, OpUpdateOne, withBusRoute(br))
+ return &BusRouteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *BusRouteClient) UpdateOneID(id uuid.UUID) *BusRouteUpdateOne {
+ mutation := newBusRouteMutation(c.config, OpUpdateOne, withBusRouteID(id))
+ return &BusRouteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for BusRoute.
+func (c *BusRouteClient) Delete() *BusRouteDelete {
+ mutation := newBusRouteMutation(c.config, OpDelete)
+ return &BusRouteDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *BusRouteClient) DeleteOne(br *BusRoute) *BusRouteDeleteOne {
+ return c.DeleteOneID(br.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *BusRouteClient) DeleteOneID(id uuid.UUID) *BusRouteDeleteOne {
+ builder := c.Delete().Where(busroute.ID(id))
+ builder.mutation.id = &id
+ builder.mutation.op = OpDeleteOne
+ return &BusRouteDeleteOne{builder}
+}
+
+// Query returns a query builder for BusRoute.
+func (c *BusRouteClient) Query() *BusRouteQuery {
+ return &BusRouteQuery{
+ config: c.config,
+ ctx: &QueryContext{Type: TypeBusRoute},
+ inters: c.Interceptors(),
+ }
+}
+
+// Get returns a BusRoute entity by its id.
+func (c *BusRouteClient) Get(ctx context.Context, id uuid.UUID) (*BusRoute, error) {
+ return c.Query().Where(busroute.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *BusRouteClient) GetX(ctx context.Context, id uuid.UUID) *BusRoute {
+ obj, err := c.Get(ctx, id)
+ if err != nil {
+ panic(err)
+ }
+ return obj
+}
+
+// QueryBus queries the bus edge of a BusRoute.
+func (c *BusRouteClient) QueryBus(br *BusRoute) *BusQuery {
+ query := (&BusClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := br.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(busroute.Table, busroute.FieldID, id),
+ sqlgraph.To(bus.Table, bus.FieldID),
+ sqlgraph.Edge(sqlgraph.M2M, false, busroute.BusTable, busroute.BusPrimaryKey...),
+ )
+ fromV = sqlgraph.Neighbors(br.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryChildBusAssociations queries the childBusAssociations edge of a BusRoute.
+func (c *BusRouteClient) QueryChildBusAssociations(br *BusRoute) *ChildBusAssociationQuery {
+ query := (&ChildBusAssociationClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := br.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(busroute.Table, busroute.FieldID, id),
+ sqlgraph.To(childbusassociation.Table, childbusassociation.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, busroute.ChildBusAssociationsTable, busroute.ChildBusAssociationsColumn),
+ )
+ fromV = sqlgraph.Neighbors(br.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryBusRouteAssociations queries the busRouteAssociations edge of a BusRoute.
+func (c *BusRouteClient) QueryBusRouteAssociations(br *BusRoute) *BusRouteAssociationQuery {
+ query := (&BusRouteAssociationClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := br.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(busroute.Table, busroute.FieldID, id),
+ sqlgraph.To(busrouteassociation.Table, busrouteassociation.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, busroute.BusRouteAssociationsTable, busroute.BusRouteAssociationsColumn),
+ )
+ fromV = sqlgraph.Neighbors(br.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryMorningBuses queries the morning_buses edge of a BusRoute.
+func (c *BusRouteClient) QueryMorningBuses(br *BusRoute) *BusQuery {
+ query := (&BusClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := br.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(busroute.Table, busroute.FieldID, id),
+ sqlgraph.To(bus.Table, bus.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, busroute.MorningBusesTable, busroute.MorningBusesColumn),
+ )
+ fromV = sqlgraph.Neighbors(br.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryEveningBuses queries the evening_buses edge of a BusRoute.
+func (c *BusRouteClient) QueryEveningBuses(br *BusRoute) *BusQuery {
+ query := (&BusClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := br.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(busroute.Table, busroute.FieldID, id),
+ sqlgraph.To(bus.Table, bus.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, busroute.EveningBusesTable, busroute.EveningBusesColumn),
+ )
+ fromV = sqlgraph.Neighbors(br.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// Hooks returns the client hooks.
+func (c *BusRouteClient) Hooks() []Hook {
+ return c.hooks.BusRoute
+}
+
+// Interceptors returns the client interceptors.
+func (c *BusRouteClient) Interceptors() []Interceptor {
+ return c.inters.BusRoute
+}
+
+func (c *BusRouteClient) mutate(ctx context.Context, m *BusRouteMutation) (Value, error) {
+ switch m.Op() {
+ case OpCreate:
+ return (&BusRouteCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdate:
+ return (&BusRouteUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdateOne:
+ return (&BusRouteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpDelete, OpDeleteOne:
+ return (&BusRouteDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+ default:
+ return nil, fmt.Errorf("ent: unknown BusRoute mutation op: %q", m.Op())
+ }
+}
+
+// BusRouteAssociationClient is a client for the BusRouteAssociation schema.
+type BusRouteAssociationClient struct {
+ config
+}
+
+// NewBusRouteAssociationClient returns a client for the BusRouteAssociation from the given config.
+func NewBusRouteAssociationClient(c config) *BusRouteAssociationClient {
+ return &BusRouteAssociationClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `busrouteassociation.Hooks(f(g(h())))`.
+func (c *BusRouteAssociationClient) Use(hooks ...Hook) {
+ c.hooks.BusRouteAssociation = append(c.hooks.BusRouteAssociation, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `busrouteassociation.Intercept(f(g(h())))`.
+func (c *BusRouteAssociationClient) Intercept(interceptors ...Interceptor) {
+ c.inters.BusRouteAssociation = append(c.inters.BusRouteAssociation, interceptors...)
+}
+
+// Create returns a builder for creating a BusRouteAssociation entity.
+func (c *BusRouteAssociationClient) Create() *BusRouteAssociationCreate {
+ mutation := newBusRouteAssociationMutation(c.config, OpCreate)
+ return &BusRouteAssociationCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of BusRouteAssociation entities.
+func (c *BusRouteAssociationClient) CreateBulk(builders ...*BusRouteAssociationCreate) *BusRouteAssociationCreateBulk {
+ return &BusRouteAssociationCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *BusRouteAssociationClient) MapCreateBulk(slice any, setFunc func(*BusRouteAssociationCreate, int)) *BusRouteAssociationCreateBulk {
+ rv := reflect.ValueOf(slice)
+ if rv.Kind() != reflect.Slice {
+ return &BusRouteAssociationCreateBulk{err: fmt.Errorf("calling to BusRouteAssociationClient.MapCreateBulk with wrong type %T, need slice", slice)}
+ }
+ builders := make([]*BusRouteAssociationCreate, rv.Len())
+ for i := 0; i < rv.Len(); i++ {
+ builders[i] = c.Create()
+ setFunc(builders[i], i)
+ }
+ return &BusRouteAssociationCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for BusRouteAssociation.
+func (c *BusRouteAssociationClient) Update() *BusRouteAssociationUpdate {
+ mutation := newBusRouteAssociationMutation(c.config, OpUpdate)
+ return &BusRouteAssociationUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *BusRouteAssociationClient) UpdateOne(bra *BusRouteAssociation) *BusRouteAssociationUpdateOne {
+ mutation := newBusRouteAssociationMutation(c.config, OpUpdateOne, withBusRouteAssociation(bra))
+ return &BusRouteAssociationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *BusRouteAssociationClient) UpdateOneID(id int) *BusRouteAssociationUpdateOne {
+ mutation := newBusRouteAssociationMutation(c.config, OpUpdateOne, withBusRouteAssociationID(id))
+ return &BusRouteAssociationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for BusRouteAssociation.
+func (c *BusRouteAssociationClient) Delete() *BusRouteAssociationDelete {
+ mutation := newBusRouteAssociationMutation(c.config, OpDelete)
+ return &BusRouteAssociationDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *BusRouteAssociationClient) DeleteOne(bra *BusRouteAssociation) *BusRouteAssociationDeleteOne {
+ return c.DeleteOneID(bra.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *BusRouteAssociationClient) DeleteOneID(id int) *BusRouteAssociationDeleteOne {
+ builder := c.Delete().Where(busrouteassociation.ID(id))
+ builder.mutation.id = &id
+ builder.mutation.op = OpDeleteOne
+ return &BusRouteAssociationDeleteOne{builder}
+}
+
+// Query returns a query builder for BusRouteAssociation.
+func (c *BusRouteAssociationClient) Query() *BusRouteAssociationQuery {
+ return &BusRouteAssociationQuery{
+ config: c.config,
+ ctx: &QueryContext{Type: TypeBusRouteAssociation},
+ inters: c.Interceptors(),
+ }
+}
+
+// Get returns a BusRouteAssociation entity by its id.
+func (c *BusRouteAssociationClient) Get(ctx context.Context, id int) (*BusRouteAssociation, error) {
+ return c.Query().Where(busrouteassociation.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *BusRouteAssociationClient) GetX(ctx context.Context, id int) *BusRouteAssociation {
+ obj, err := c.Get(ctx, id)
+ if err != nil {
+ panic(err)
+ }
+ return obj
+}
+
+// QueryStation queries the station edge of a BusRouteAssociation.
+func (c *BusRouteAssociationClient) QueryStation(bra *BusRouteAssociation) *StationQuery {
+ query := (&StationClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := bra.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(busrouteassociation.Table, busrouteassociation.FieldID, id),
+ sqlgraph.To(station.Table, station.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, busrouteassociation.StationTable, busrouteassociation.StationColumn),
+ )
+ fromV = sqlgraph.Neighbors(bra.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryBusRoute queries the busRoute edge of a BusRouteAssociation.
+func (c *BusRouteAssociationClient) QueryBusRoute(bra *BusRouteAssociation) *BusRouteQuery {
+ query := (&BusRouteClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := bra.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(busrouteassociation.Table, busrouteassociation.FieldID, id),
+ sqlgraph.To(busroute.Table, busroute.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, busrouteassociation.BusRouteTable, busrouteassociation.BusRouteColumn),
+ )
+ fromV = sqlgraph.Neighbors(bra.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// Hooks returns the client hooks.
+func (c *BusRouteAssociationClient) Hooks() []Hook {
+ return c.hooks.BusRouteAssociation
+}
+
+// Interceptors returns the client interceptors.
+func (c *BusRouteAssociationClient) Interceptors() []Interceptor {
+ return c.inters.BusRouteAssociation
+}
+
+func (c *BusRouteAssociationClient) mutate(ctx context.Context, m *BusRouteAssociationMutation) (Value, error) {
+ switch m.Op() {
+ case OpCreate:
+ return (&BusRouteAssociationCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdate:
+ return (&BusRouteAssociationUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdateOne:
+ return (&BusRouteAssociationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpDelete, OpDeleteOne:
+ return (&BusRouteAssociationDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+ default:
+ return nil, fmt.Errorf("ent: unknown BusRouteAssociation mutation op: %q", m.Op())
+ }
+}
+
+// ChildClient is a client for the Child schema.
+type ChildClient struct {
+ config
+}
+
+// NewChildClient returns a client for the Child from the given config.
+func NewChildClient(c config) *ChildClient {
+ return &ChildClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `child.Hooks(f(g(h())))`.
+func (c *ChildClient) Use(hooks ...Hook) {
+ c.hooks.Child = append(c.hooks.Child, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `child.Intercept(f(g(h())))`.
+func (c *ChildClient) Intercept(interceptors ...Interceptor) {
+ c.inters.Child = append(c.inters.Child, interceptors...)
+}
+
+// Create returns a builder for creating a Child entity.
+func (c *ChildClient) Create() *ChildCreate {
+ mutation := newChildMutation(c.config, OpCreate)
+ return &ChildCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of Child entities.
+func (c *ChildClient) CreateBulk(builders ...*ChildCreate) *ChildCreateBulk {
+ return &ChildCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *ChildClient) MapCreateBulk(slice any, setFunc func(*ChildCreate, int)) *ChildCreateBulk {
+ rv := reflect.ValueOf(slice)
+ if rv.Kind() != reflect.Slice {
+ return &ChildCreateBulk{err: fmt.Errorf("calling to ChildClient.MapCreateBulk with wrong type %T, need slice", slice)}
+ }
+ builders := make([]*ChildCreate, rv.Len())
+ for i := 0; i < rv.Len(); i++ {
+ builders[i] = c.Create()
+ setFunc(builders[i], i)
+ }
+ return &ChildCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for Child.
+func (c *ChildClient) Update() *ChildUpdate {
+ mutation := newChildMutation(c.config, OpUpdate)
+ return &ChildUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *ChildClient) UpdateOne(ch *Child) *ChildUpdateOne {
+ mutation := newChildMutation(c.config, OpUpdateOne, withChild(ch))
+ return &ChildUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *ChildClient) UpdateOneID(id uuid.UUID) *ChildUpdateOne {
+ mutation := newChildMutation(c.config, OpUpdateOne, withChildID(id))
+ return &ChildUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for Child.
+func (c *ChildClient) Delete() *ChildDelete {
+ mutation := newChildMutation(c.config, OpDelete)
+ return &ChildDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *ChildClient) DeleteOne(ch *Child) *ChildDeleteOne {
+ return c.DeleteOneID(ch.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *ChildClient) DeleteOneID(id uuid.UUID) *ChildDeleteOne {
+ builder := c.Delete().Where(child.ID(id))
+ builder.mutation.id = &id
+ builder.mutation.op = OpDeleteOne
+ return &ChildDeleteOne{builder}
+}
+
+// Query returns a query builder for Child.
+func (c *ChildClient) Query() *ChildQuery {
+ return &ChildQuery{
+ config: c.config,
+ ctx: &QueryContext{Type: TypeChild},
+ inters: c.Interceptors(),
+ }
+}
+
+// Get returns a Child entity by its id.
+func (c *ChildClient) Get(ctx context.Context, id uuid.UUID) (*Child, error) {
+ return c.Query().Where(child.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *ChildClient) GetX(ctx context.Context, id uuid.UUID) *Child {
+ obj, err := c.Get(ctx, id)
+ if err != nil {
+ panic(err)
+ }
+ return obj
+}
+
+// QueryGuardian queries the guardian edge of a Child.
+func (c *ChildClient) QueryGuardian(ch *Child) *GuardianQuery {
+ query := (&GuardianClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := ch.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(child.Table, child.FieldID, id),
+ sqlgraph.To(guardian.Table, guardian.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, child.GuardianTable, child.GuardianColumn),
+ )
+ fromV = sqlgraph.Neighbors(ch.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryChildBusAssociations queries the childBusAssociations edge of a Child.
+func (c *ChildClient) QueryChildBusAssociations(ch *Child) *ChildBusAssociationQuery {
+ query := (&ChildBusAssociationClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := ch.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(child.Table, child.FieldID, id),
+ sqlgraph.To(childbusassociation.Table, childbusassociation.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, child.ChildBusAssociationsTable, child.ChildBusAssociationsColumn),
+ )
+ fromV = sqlgraph.Neighbors(ch.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryBoardingRecord queries the boarding_record edge of a Child.
+func (c *ChildClient) QueryBoardingRecord(ch *Child) *BoardingRecordQuery {
+ query := (&BoardingRecordClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := ch.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(child.Table, child.FieldID, id),
+ sqlgraph.To(boardingrecord.Table, boardingrecord.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, child.BoardingRecordTable, child.BoardingRecordColumn),
+ )
+ fromV = sqlgraph.Neighbors(ch.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryPhotos queries the photos edge of a Child.
+func (c *ChildClient) QueryPhotos(ch *Child) *ChildPhotoQuery {
+ query := (&ChildPhotoClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := ch.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(child.Table, child.FieldID, id),
+ sqlgraph.To(childphoto.Table, childphoto.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, child.PhotosTable, child.PhotosColumn),
+ )
+ fromV = sqlgraph.Neighbors(ch.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// Hooks returns the client hooks.
+func (c *ChildClient) Hooks() []Hook {
+ return c.hooks.Child
+}
+
+// Interceptors returns the client interceptors.
+func (c *ChildClient) Interceptors() []Interceptor {
+ return c.inters.Child
+}
+
+func (c *ChildClient) mutate(ctx context.Context, m *ChildMutation) (Value, error) {
+ switch m.Op() {
+ case OpCreate:
+ return (&ChildCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdate:
+ return (&ChildUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdateOne:
+ return (&ChildUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpDelete, OpDeleteOne:
+ return (&ChildDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+ default:
+ return nil, fmt.Errorf("ent: unknown Child mutation op: %q", m.Op())
+ }
+}
+
+// ChildBusAssociationClient is a client for the ChildBusAssociation schema.
+type ChildBusAssociationClient struct {
+ config
+}
+
+// NewChildBusAssociationClient returns a client for the ChildBusAssociation from the given config.
+func NewChildBusAssociationClient(c config) *ChildBusAssociationClient {
+ return &ChildBusAssociationClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `childbusassociation.Hooks(f(g(h())))`.
+func (c *ChildBusAssociationClient) Use(hooks ...Hook) {
+ c.hooks.ChildBusAssociation = append(c.hooks.ChildBusAssociation, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `childbusassociation.Intercept(f(g(h())))`.
+func (c *ChildBusAssociationClient) Intercept(interceptors ...Interceptor) {
+ c.inters.ChildBusAssociation = append(c.inters.ChildBusAssociation, interceptors...)
+}
+
+// Create returns a builder for creating a ChildBusAssociation entity.
+func (c *ChildBusAssociationClient) Create() *ChildBusAssociationCreate {
+ mutation := newChildBusAssociationMutation(c.config, OpCreate)
+ return &ChildBusAssociationCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of ChildBusAssociation entities.
+func (c *ChildBusAssociationClient) CreateBulk(builders ...*ChildBusAssociationCreate) *ChildBusAssociationCreateBulk {
+ return &ChildBusAssociationCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *ChildBusAssociationClient) MapCreateBulk(slice any, setFunc func(*ChildBusAssociationCreate, int)) *ChildBusAssociationCreateBulk {
+ rv := reflect.ValueOf(slice)
+ if rv.Kind() != reflect.Slice {
+ return &ChildBusAssociationCreateBulk{err: fmt.Errorf("calling to ChildBusAssociationClient.MapCreateBulk with wrong type %T, need slice", slice)}
+ }
+ builders := make([]*ChildBusAssociationCreate, rv.Len())
+ for i := 0; i < rv.Len(); i++ {
+ builders[i] = c.Create()
+ setFunc(builders[i], i)
+ }
+ return &ChildBusAssociationCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for ChildBusAssociation.
+func (c *ChildBusAssociationClient) Update() *ChildBusAssociationUpdate {
+ mutation := newChildBusAssociationMutation(c.config, OpUpdate)
+ return &ChildBusAssociationUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *ChildBusAssociationClient) UpdateOne(cba *ChildBusAssociation) *ChildBusAssociationUpdateOne {
+ mutation := newChildBusAssociationMutation(c.config, OpUpdateOne, withChildBusAssociation(cba))
+ return &ChildBusAssociationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *ChildBusAssociationClient) UpdateOneID(id int) *ChildBusAssociationUpdateOne {
+ mutation := newChildBusAssociationMutation(c.config, OpUpdateOne, withChildBusAssociationID(id))
+ return &ChildBusAssociationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for ChildBusAssociation.
+func (c *ChildBusAssociationClient) Delete() *ChildBusAssociationDelete {
+ mutation := newChildBusAssociationMutation(c.config, OpDelete)
+ return &ChildBusAssociationDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *ChildBusAssociationClient) DeleteOne(cba *ChildBusAssociation) *ChildBusAssociationDeleteOne {
+ return c.DeleteOneID(cba.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *ChildBusAssociationClient) DeleteOneID(id int) *ChildBusAssociationDeleteOne {
+ builder := c.Delete().Where(childbusassociation.ID(id))
+ builder.mutation.id = &id
+ builder.mutation.op = OpDeleteOne
+ return &ChildBusAssociationDeleteOne{builder}
+}
+
+// Query returns a query builder for ChildBusAssociation.
+func (c *ChildBusAssociationClient) Query() *ChildBusAssociationQuery {
+ return &ChildBusAssociationQuery{
+ config: c.config,
+ ctx: &QueryContext{Type: TypeChildBusAssociation},
+ inters: c.Interceptors(),
+ }
+}
+
+// Get returns a ChildBusAssociation entity by its id.
+func (c *ChildBusAssociationClient) Get(ctx context.Context, id int) (*ChildBusAssociation, error) {
+ return c.Query().Where(childbusassociation.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *ChildBusAssociationClient) GetX(ctx context.Context, id int) *ChildBusAssociation {
+ obj, err := c.Get(ctx, id)
+ if err != nil {
+ panic(err)
+ }
+ return obj
+}
+
+// QueryChild queries the child edge of a ChildBusAssociation.
+func (c *ChildBusAssociationClient) QueryChild(cba *ChildBusAssociation) *ChildQuery {
+ query := (&ChildClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := cba.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(childbusassociation.Table, childbusassociation.FieldID, id),
+ sqlgraph.To(child.Table, child.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, childbusassociation.ChildTable, childbusassociation.ChildColumn),
+ )
+ fromV = sqlgraph.Neighbors(cba.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryBusRoute queries the bus_route edge of a ChildBusAssociation.
+func (c *ChildBusAssociationClient) QueryBusRoute(cba *ChildBusAssociation) *BusRouteQuery {
+ query := (&BusRouteClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := cba.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(childbusassociation.Table, childbusassociation.FieldID, id),
+ sqlgraph.To(busroute.Table, busroute.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, childbusassociation.BusRouteTable, childbusassociation.BusRouteColumn),
+ )
+ fromV = sqlgraph.Neighbors(cba.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// Hooks returns the client hooks.
+func (c *ChildBusAssociationClient) Hooks() []Hook {
+ return c.hooks.ChildBusAssociation
+}
+
+// Interceptors returns the client interceptors.
+func (c *ChildBusAssociationClient) Interceptors() []Interceptor {
+ return c.inters.ChildBusAssociation
+}
+
+func (c *ChildBusAssociationClient) mutate(ctx context.Context, m *ChildBusAssociationMutation) (Value, error) {
+ switch m.Op() {
+ case OpCreate:
+ return (&ChildBusAssociationCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdate:
+ return (&ChildBusAssociationUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdateOne:
+ return (&ChildBusAssociationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpDelete, OpDeleteOne:
+ return (&ChildBusAssociationDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+ default:
+ return nil, fmt.Errorf("ent: unknown ChildBusAssociation mutation op: %q", m.Op())
+ }
+}
+
+// ChildPhotoClient is a client for the ChildPhoto schema.
+type ChildPhotoClient struct {
+ config
+}
+
+// NewChildPhotoClient returns a client for the ChildPhoto from the given config.
+func NewChildPhotoClient(c config) *ChildPhotoClient {
+ return &ChildPhotoClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `childphoto.Hooks(f(g(h())))`.
+func (c *ChildPhotoClient) Use(hooks ...Hook) {
+ c.hooks.ChildPhoto = append(c.hooks.ChildPhoto, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `childphoto.Intercept(f(g(h())))`.
+func (c *ChildPhotoClient) Intercept(interceptors ...Interceptor) {
+ c.inters.ChildPhoto = append(c.inters.ChildPhoto, interceptors...)
+}
+
+// Create returns a builder for creating a ChildPhoto entity.
+func (c *ChildPhotoClient) Create() *ChildPhotoCreate {
+ mutation := newChildPhotoMutation(c.config, OpCreate)
+ return &ChildPhotoCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of ChildPhoto entities.
+func (c *ChildPhotoClient) CreateBulk(builders ...*ChildPhotoCreate) *ChildPhotoCreateBulk {
+ return &ChildPhotoCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *ChildPhotoClient) MapCreateBulk(slice any, setFunc func(*ChildPhotoCreate, int)) *ChildPhotoCreateBulk {
+ rv := reflect.ValueOf(slice)
+ if rv.Kind() != reflect.Slice {
+ return &ChildPhotoCreateBulk{err: fmt.Errorf("calling to ChildPhotoClient.MapCreateBulk with wrong type %T, need slice", slice)}
+ }
+ builders := make([]*ChildPhotoCreate, rv.Len())
+ for i := 0; i < rv.Len(); i++ {
+ builders[i] = c.Create()
+ setFunc(builders[i], i)
+ }
+ return &ChildPhotoCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for ChildPhoto.
+func (c *ChildPhotoClient) Update() *ChildPhotoUpdate {
+ mutation := newChildPhotoMutation(c.config, OpUpdate)
+ return &ChildPhotoUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *ChildPhotoClient) UpdateOne(cp *ChildPhoto) *ChildPhotoUpdateOne {
+ mutation := newChildPhotoMutation(c.config, OpUpdateOne, withChildPhoto(cp))
+ return &ChildPhotoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *ChildPhotoClient) UpdateOneID(id uuid.UUID) *ChildPhotoUpdateOne {
+ mutation := newChildPhotoMutation(c.config, OpUpdateOne, withChildPhotoID(id))
+ return &ChildPhotoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for ChildPhoto.
+func (c *ChildPhotoClient) Delete() *ChildPhotoDelete {
+ mutation := newChildPhotoMutation(c.config, OpDelete)
+ return &ChildPhotoDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *ChildPhotoClient) DeleteOne(cp *ChildPhoto) *ChildPhotoDeleteOne {
+ return c.DeleteOneID(cp.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *ChildPhotoClient) DeleteOneID(id uuid.UUID) *ChildPhotoDeleteOne {
+ builder := c.Delete().Where(childphoto.ID(id))
+ builder.mutation.id = &id
+ builder.mutation.op = OpDeleteOne
+ return &ChildPhotoDeleteOne{builder}
+}
+
+// Query returns a query builder for ChildPhoto.
+func (c *ChildPhotoClient) Query() *ChildPhotoQuery {
+ return &ChildPhotoQuery{
+ config: c.config,
+ ctx: &QueryContext{Type: TypeChildPhoto},
+ inters: c.Interceptors(),
+ }
+}
+
+// Get returns a ChildPhoto entity by its id.
+func (c *ChildPhotoClient) Get(ctx context.Context, id uuid.UUID) (*ChildPhoto, error) {
+ return c.Query().Where(childphoto.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *ChildPhotoClient) GetX(ctx context.Context, id uuid.UUID) *ChildPhoto {
+ obj, err := c.Get(ctx, id)
+ if err != nil {
+ panic(err)
+ }
+ return obj
+}
+
+// QueryChild queries the child edge of a ChildPhoto.
+func (c *ChildPhotoClient) QueryChild(cp *ChildPhoto) *ChildQuery {
+ query := (&ChildClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := cp.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(childphoto.Table, childphoto.FieldID, id),
+ sqlgraph.To(child.Table, child.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, true, childphoto.ChildTable, childphoto.ChildColumn),
+ )
+ fromV = sqlgraph.Neighbors(cp.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// Hooks returns the client hooks.
+func (c *ChildPhotoClient) Hooks() []Hook {
+ return c.hooks.ChildPhoto
+}
+
+// Interceptors returns the client interceptors.
+func (c *ChildPhotoClient) Interceptors() []Interceptor {
+ return c.inters.ChildPhoto
+}
+
+func (c *ChildPhotoClient) mutate(ctx context.Context, m *ChildPhotoMutation) (Value, error) {
+ switch m.Op() {
+ case OpCreate:
+ return (&ChildPhotoCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdate:
+ return (&ChildPhotoUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdateOne:
+ return (&ChildPhotoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpDelete, OpDeleteOne:
+ return (&ChildPhotoDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+ default:
+ return nil, fmt.Errorf("ent: unknown ChildPhoto mutation op: %q", m.Op())
+ }
+}
+
+// GuardianClient is a client for the Guardian schema.
+type GuardianClient struct {
+ config
+}
+
+// NewGuardianClient returns a client for the Guardian from the given config.
+func NewGuardianClient(c config) *GuardianClient {
+ return &GuardianClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `guardian.Hooks(f(g(h())))`.
+func (c *GuardianClient) Use(hooks ...Hook) {
+ c.hooks.Guardian = append(c.hooks.Guardian, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `guardian.Intercept(f(g(h())))`.
+func (c *GuardianClient) Intercept(interceptors ...Interceptor) {
+ c.inters.Guardian = append(c.inters.Guardian, interceptors...)
+}
+
+// Create returns a builder for creating a Guardian entity.
+func (c *GuardianClient) Create() *GuardianCreate {
+ mutation := newGuardianMutation(c.config, OpCreate)
+ return &GuardianCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of Guardian entities.
+func (c *GuardianClient) CreateBulk(builders ...*GuardianCreate) *GuardianCreateBulk {
+ return &GuardianCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *GuardianClient) MapCreateBulk(slice any, setFunc func(*GuardianCreate, int)) *GuardianCreateBulk {
+ rv := reflect.ValueOf(slice)
+ if rv.Kind() != reflect.Slice {
+ return &GuardianCreateBulk{err: fmt.Errorf("calling to GuardianClient.MapCreateBulk with wrong type %T, need slice", slice)}
+ }
+ builders := make([]*GuardianCreate, rv.Len())
+ for i := 0; i < rv.Len(); i++ {
+ builders[i] = c.Create()
+ setFunc(builders[i], i)
+ }
+ return &GuardianCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for Guardian.
+func (c *GuardianClient) Update() *GuardianUpdate {
+ mutation := newGuardianMutation(c.config, OpUpdate)
+ return &GuardianUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *GuardianClient) UpdateOne(gu *Guardian) *GuardianUpdateOne {
+ mutation := newGuardianMutation(c.config, OpUpdateOne, withGuardian(gu))
+ return &GuardianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *GuardianClient) UpdateOneID(id uuid.UUID) *GuardianUpdateOne {
+ mutation := newGuardianMutation(c.config, OpUpdateOne, withGuardianID(id))
+ return &GuardianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for Guardian.
+func (c *GuardianClient) Delete() *GuardianDelete {
+ mutation := newGuardianMutation(c.config, OpDelete)
+ return &GuardianDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *GuardianClient) DeleteOne(gu *Guardian) *GuardianDeleteOne {
+ return c.DeleteOneID(gu.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *GuardianClient) DeleteOneID(id uuid.UUID) *GuardianDeleteOne {
+ builder := c.Delete().Where(guardian.ID(id))
+ builder.mutation.id = &id
+ builder.mutation.op = OpDeleteOne
+ return &GuardianDeleteOne{builder}
+}
+
+// Query returns a query builder for Guardian.
+func (c *GuardianClient) Query() *GuardianQuery {
+ return &GuardianQuery{
+ config: c.config,
+ ctx: &QueryContext{Type: TypeGuardian},
+ inters: c.Interceptors(),
+ }
+}
+
+// Get returns a Guardian entity by its id.
+func (c *GuardianClient) Get(ctx context.Context, id uuid.UUID) (*Guardian, error) {
+ return c.Query().Where(guardian.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *GuardianClient) GetX(ctx context.Context, id uuid.UUID) *Guardian {
+ obj, err := c.Get(ctx, id)
+ if err != nil {
+ panic(err)
+ }
+ return obj
+}
+
+// QueryChildren queries the children edge of a Guardian.
+func (c *GuardianClient) QueryChildren(gu *Guardian) *ChildQuery {
+ query := (&ChildClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := gu.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(guardian.Table, guardian.FieldID, id),
+ sqlgraph.To(child.Table, child.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, guardian.ChildrenTable, guardian.ChildrenColumn),
+ )
+ fromV = sqlgraph.Neighbors(gu.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryNursery queries the nursery edge of a Guardian.
+func (c *GuardianClient) QueryNursery(gu *Guardian) *NurseryQuery {
+ query := (&NurseryClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := gu.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(guardian.Table, guardian.FieldID, id),
+ sqlgraph.To(nursery.Table, nursery.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, guardian.NurseryTable, guardian.NurseryColumn),
+ )
+ fromV = sqlgraph.Neighbors(gu.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryStation queries the station edge of a Guardian.
+func (c *GuardianClient) QueryStation(gu *Guardian) *StationQuery {
+ query := (&StationClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := gu.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(guardian.Table, guardian.FieldID, id),
+ sqlgraph.To(station.Table, station.FieldID),
+ sqlgraph.Edge(sqlgraph.O2O, false, guardian.StationTable, guardian.StationColumn),
+ )
+ fromV = sqlgraph.Neighbors(gu.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// Hooks returns the client hooks.
+func (c *GuardianClient) Hooks() []Hook {
+ return c.hooks.Guardian
+}
+
+// Interceptors returns the client interceptors.
+func (c *GuardianClient) Interceptors() []Interceptor {
+ return c.inters.Guardian
+}
+
+func (c *GuardianClient) mutate(ctx context.Context, m *GuardianMutation) (Value, error) {
+ switch m.Op() {
+ case OpCreate:
+ return (&GuardianCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdate:
+ return (&GuardianUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdateOne:
+ return (&GuardianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpDelete, OpDeleteOne:
+ return (&GuardianDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+ default:
+ return nil, fmt.Errorf("ent: unknown Guardian mutation op: %q", m.Op())
+ }
+}
+
+// NurseryClient is a client for the Nursery schema.
+type NurseryClient struct {
+ config
+}
+
+// NewNurseryClient returns a client for the Nursery from the given config.
+func NewNurseryClient(c config) *NurseryClient {
+ return &NurseryClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `nursery.Hooks(f(g(h())))`.
+func (c *NurseryClient) Use(hooks ...Hook) {
+ c.hooks.Nursery = append(c.hooks.Nursery, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `nursery.Intercept(f(g(h())))`.
+func (c *NurseryClient) Intercept(interceptors ...Interceptor) {
+ c.inters.Nursery = append(c.inters.Nursery, interceptors...)
+}
+
+// Create returns a builder for creating a Nursery entity.
+func (c *NurseryClient) Create() *NurseryCreate {
+ mutation := newNurseryMutation(c.config, OpCreate)
+ return &NurseryCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of Nursery entities.
+func (c *NurseryClient) CreateBulk(builders ...*NurseryCreate) *NurseryCreateBulk {
+ return &NurseryCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *NurseryClient) MapCreateBulk(slice any, setFunc func(*NurseryCreate, int)) *NurseryCreateBulk {
+ rv := reflect.ValueOf(slice)
+ if rv.Kind() != reflect.Slice {
+ return &NurseryCreateBulk{err: fmt.Errorf("calling to NurseryClient.MapCreateBulk with wrong type %T, need slice", slice)}
+ }
+ builders := make([]*NurseryCreate, rv.Len())
+ for i := 0; i < rv.Len(); i++ {
+ builders[i] = c.Create()
+ setFunc(builders[i], i)
+ }
+ return &NurseryCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for Nursery.
+func (c *NurseryClient) Update() *NurseryUpdate {
+ mutation := newNurseryMutation(c.config, OpUpdate)
+ return &NurseryUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *NurseryClient) UpdateOne(n *Nursery) *NurseryUpdateOne {
+ mutation := newNurseryMutation(c.config, OpUpdateOne, withNursery(n))
+ return &NurseryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *NurseryClient) UpdateOneID(id uuid.UUID) *NurseryUpdateOne {
+ mutation := newNurseryMutation(c.config, OpUpdateOne, withNurseryID(id))
+ return &NurseryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for Nursery.
+func (c *NurseryClient) Delete() *NurseryDelete {
+ mutation := newNurseryMutation(c.config, OpDelete)
+ return &NurseryDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *NurseryClient) DeleteOne(n *Nursery) *NurseryDeleteOne {
+ return c.DeleteOneID(n.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *NurseryClient) DeleteOneID(id uuid.UUID) *NurseryDeleteOne {
+ builder := c.Delete().Where(nursery.ID(id))
+ builder.mutation.id = &id
+ builder.mutation.op = OpDeleteOne
+ return &NurseryDeleteOne{builder}
+}
+
+// Query returns a query builder for Nursery.
+func (c *NurseryClient) Query() *NurseryQuery {
+ return &NurseryQuery{
+ config: c.config,
+ ctx: &QueryContext{Type: TypeNursery},
+ inters: c.Interceptors(),
+ }
+}
+
+// Get returns a Nursery entity by its id.
+func (c *NurseryClient) Get(ctx context.Context, id uuid.UUID) (*Nursery, error) {
+ return c.Query().Where(nursery.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *NurseryClient) GetX(ctx context.Context, id uuid.UUID) *Nursery {
+ obj, err := c.Get(ctx, id)
+ if err != nil {
+ panic(err)
+ }
+ return obj
+}
+
+// QueryGuardians queries the guardians edge of a Nursery.
+func (c *NurseryClient) QueryGuardians(n *Nursery) *GuardianQuery {
+ query := (&GuardianClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := n.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(nursery.Table, nursery.FieldID, id),
+ sqlgraph.To(guardian.Table, guardian.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, nursery.GuardiansTable, nursery.GuardiansColumn),
+ )
+ fromV = sqlgraph.Neighbors(n.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryBuses queries the buses edge of a Nursery.
+func (c *NurseryClient) QueryBuses(n *Nursery) *BusQuery {
+ query := (&BusClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := n.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(nursery.Table, nursery.FieldID, id),
+ sqlgraph.To(bus.Table, bus.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, nursery.BusesTable, nursery.BusesColumn),
+ )
+ fromV = sqlgraph.Neighbors(n.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// Hooks returns the client hooks.
+func (c *NurseryClient) Hooks() []Hook {
+ return c.hooks.Nursery
+}
+
+// Interceptors returns the client interceptors.
+func (c *NurseryClient) Interceptors() []Interceptor {
+ return c.inters.Nursery
+}
+
+func (c *NurseryClient) mutate(ctx context.Context, m *NurseryMutation) (Value, error) {
+ switch m.Op() {
+ case OpCreate:
+ return (&NurseryCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdate:
+ return (&NurseryUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdateOne:
+ return (&NurseryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpDelete, OpDeleteOne:
+ return (&NurseryDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+ default:
+ return nil, fmt.Errorf("ent: unknown Nursery mutation op: %q", m.Op())
+ }
+}
+
+// StationClient is a client for the Station schema.
+type StationClient struct {
+ config
+}
+
+// NewStationClient returns a client for the Station from the given config.
+func NewStationClient(c config) *StationClient {
+ return &StationClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `station.Hooks(f(g(h())))`.
+func (c *StationClient) Use(hooks ...Hook) {
+ c.hooks.Station = append(c.hooks.Station, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `station.Intercept(f(g(h())))`.
+func (c *StationClient) Intercept(interceptors ...Interceptor) {
+ c.inters.Station = append(c.inters.Station, interceptors...)
+}
+
+// Create returns a builder for creating a Station entity.
+func (c *StationClient) Create() *StationCreate {
+ mutation := newStationMutation(c.config, OpCreate)
+ return &StationCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of Station entities.
+func (c *StationClient) CreateBulk(builders ...*StationCreate) *StationCreateBulk {
+ return &StationCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *StationClient) MapCreateBulk(slice any, setFunc func(*StationCreate, int)) *StationCreateBulk {
+ rv := reflect.ValueOf(slice)
+ if rv.Kind() != reflect.Slice {
+ return &StationCreateBulk{err: fmt.Errorf("calling to StationClient.MapCreateBulk with wrong type %T, need slice", slice)}
+ }
+ builders := make([]*StationCreate, rv.Len())
+ for i := 0; i < rv.Len(); i++ {
+ builders[i] = c.Create()
+ setFunc(builders[i], i)
+ }
+ return &StationCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for Station.
+func (c *StationClient) Update() *StationUpdate {
+ mutation := newStationMutation(c.config, OpUpdate)
+ return &StationUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *StationClient) UpdateOne(s *Station) *StationUpdateOne {
+ mutation := newStationMutation(c.config, OpUpdateOne, withStation(s))
+ return &StationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *StationClient) UpdateOneID(id uuid.UUID) *StationUpdateOne {
+ mutation := newStationMutation(c.config, OpUpdateOne, withStationID(id))
+ return &StationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for Station.
+func (c *StationClient) Delete() *StationDelete {
+ mutation := newStationMutation(c.config, OpDelete)
+ return &StationDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *StationClient) DeleteOne(s *Station) *StationDeleteOne {
+ return c.DeleteOneID(s.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *StationClient) DeleteOneID(id uuid.UUID) *StationDeleteOne {
+ builder := c.Delete().Where(station.ID(id))
+ builder.mutation.id = &id
+ builder.mutation.op = OpDeleteOne
+ return &StationDeleteOne{builder}
+}
+
+// Query returns a query builder for Station.
+func (c *StationClient) Query() *StationQuery {
+ return &StationQuery{
+ config: c.config,
+ ctx: &QueryContext{Type: TypeStation},
+ inters: c.Interceptors(),
+ }
+}
+
+// Get returns a Station entity by its id.
+func (c *StationClient) Get(ctx context.Context, id uuid.UUID) (*Station, error) {
+ return c.Query().Where(station.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *StationClient) GetX(ctx context.Context, id uuid.UUID) *Station {
+ obj, err := c.Get(ctx, id)
+ if err != nil {
+ panic(err)
+ }
+ return obj
+}
+
+// QueryGuardian queries the guardian edge of a Station.
+func (c *StationClient) QueryGuardian(s *Station) *GuardianQuery {
+ query := (&GuardianClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := s.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(station.Table, station.FieldID, id),
+ sqlgraph.To(guardian.Table, guardian.FieldID),
+ sqlgraph.Edge(sqlgraph.O2O, true, station.GuardianTable, station.GuardianColumn),
+ )
+ fromV = sqlgraph.Neighbors(s.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryNextForBuses queries the next_for_buses edge of a Station.
+func (c *StationClient) QueryNextForBuses(s *Station) *BusQuery {
+ query := (&BusClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := s.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(station.Table, station.FieldID, id),
+ sqlgraph.To(bus.Table, bus.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, station.NextForBusesTable, station.NextForBusesColumn),
+ )
+ fromV = sqlgraph.Neighbors(s.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// QueryBusRouteAssociations queries the busRouteAssociations edge of a Station.
+func (c *StationClient) QueryBusRouteAssociations(s *Station) *BusRouteAssociationQuery {
+ query := (&BusRouteAssociationClient{config: c.config}).Query()
+ query.path = func(context.Context) (fromV *sql.Selector, _ error) {
+ id := s.ID
+ step := sqlgraph.NewStep(
+ sqlgraph.From(station.Table, station.FieldID, id),
+ sqlgraph.To(busrouteassociation.Table, busrouteassociation.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, station.BusRouteAssociationsTable, station.BusRouteAssociationsColumn),
+ )
+ fromV = sqlgraph.Neighbors(s.driver.Dialect(), step)
+ return fromV, nil
+ }
+ return query
+}
+
+// Hooks returns the client hooks.
+func (c *StationClient) Hooks() []Hook {
+ return c.hooks.Station
+}
+
+// Interceptors returns the client interceptors.
+func (c *StationClient) Interceptors() []Interceptor {
+ return c.inters.Station
+}
+
+func (c *StationClient) mutate(ctx context.Context, m *StationMutation) (Value, error) {
+ switch m.Op() {
+ case OpCreate:
+ return (&StationCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdate:
+ return (&StationUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdateOne:
+ return (&StationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpDelete, OpDeleteOne:
+ return (&StationDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+ default:
+ return nil, fmt.Errorf("ent: unknown Station mutation op: %q", m.Op())
+ }
+}
+
+// hooks and interceptors per client, for fast access.
+type (
+ hooks struct {
+ BoardingRecord, Bus, BusRoute, BusRouteAssociation, Child, ChildBusAssociation,
+ ChildPhoto, Guardian, Nursery, Station []ent.Hook
+ }
+ inters struct {
+ BoardingRecord, Bus, BusRoute, BusRouteAssociation, Child, ChildBusAssociation,
+ ChildPhoto, Guardian, Nursery, Station []ent.Interceptor
+ }
+)
diff --git a/backend/domain/repository/ent/ent.go b/backend/domain/repository/ent/ent.go
new file mode 100644
index 00000000..1145e6c8
--- /dev/null
+++ b/backend/domain/repository/ent/ent.go
@@ -0,0 +1,626 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "reflect"
+ "sync"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busrouteassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childbusassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childphoto"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+)
+
+// ent aliases to avoid import conflicts in user's code.
+type (
+ Op = ent.Op
+ Hook = ent.Hook
+ Value = ent.Value
+ Query = ent.Query
+ QueryContext = ent.QueryContext
+ Querier = ent.Querier
+ QuerierFunc = ent.QuerierFunc
+ Interceptor = ent.Interceptor
+ InterceptFunc = ent.InterceptFunc
+ Traverser = ent.Traverser
+ TraverseFunc = ent.TraverseFunc
+ Policy = ent.Policy
+ Mutator = ent.Mutator
+ Mutation = ent.Mutation
+ MutateFunc = ent.MutateFunc
+)
+
+type clientCtxKey struct{}
+
+// FromContext returns a Client stored inside a context, or nil if there isn't one.
+func FromContext(ctx context.Context) *Client {
+ c, _ := ctx.Value(clientCtxKey{}).(*Client)
+ return c
+}
+
+// NewContext returns a new context with the given Client attached.
+func NewContext(parent context.Context, c *Client) context.Context {
+ return context.WithValue(parent, clientCtxKey{}, c)
+}
+
+type txCtxKey struct{}
+
+// TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
+func TxFromContext(ctx context.Context) *Tx {
+ tx, _ := ctx.Value(txCtxKey{}).(*Tx)
+ return tx
+}
+
+// NewTxContext returns a new context with the given Tx attached.
+func NewTxContext(parent context.Context, tx *Tx) context.Context {
+ return context.WithValue(parent, txCtxKey{}, tx)
+}
+
+// OrderFunc applies an ordering on the sql selector.
+// Deprecated: Use Asc/Desc functions or the package builders instead.
+type OrderFunc func(*sql.Selector)
+
+var (
+ initCheck sync.Once
+ columnCheck sql.ColumnCheck
+)
+
+// columnChecker checks if the column exists in the given table.
+func checkColumn(table, column string) error {
+ initCheck.Do(func() {
+ columnCheck = sql.NewColumnCheck(map[string]func(string) bool{
+ boardingrecord.Table: boardingrecord.ValidColumn,
+ bus.Table: bus.ValidColumn,
+ busroute.Table: busroute.ValidColumn,
+ busrouteassociation.Table: busrouteassociation.ValidColumn,
+ child.Table: child.ValidColumn,
+ childbusassociation.Table: childbusassociation.ValidColumn,
+ childphoto.Table: childphoto.ValidColumn,
+ guardian.Table: guardian.ValidColumn,
+ nursery.Table: nursery.ValidColumn,
+ station.Table: station.ValidColumn,
+ })
+ })
+ return columnCheck(table, column)
+}
+
+// Asc applies the given fields in ASC order.
+func Asc(fields ...string) func(*sql.Selector) {
+ return func(s *sql.Selector) {
+ for _, f := range fields {
+ if err := checkColumn(s.TableName(), f); err != nil {
+ s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)})
+ }
+ s.OrderBy(sql.Asc(s.C(f)))
+ }
+ }
+}
+
+// Desc applies the given fields in DESC order.
+func Desc(fields ...string) func(*sql.Selector) {
+ return func(s *sql.Selector) {
+ for _, f := range fields {
+ if err := checkColumn(s.TableName(), f); err != nil {
+ s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)})
+ }
+ s.OrderBy(sql.Desc(s.C(f)))
+ }
+ }
+}
+
+// AggregateFunc applies an aggregation step on the group-by traversal/selector.
+type AggregateFunc func(*sql.Selector) string
+
+// As is a pseudo aggregation function for renaming another other functions with custom names. For example:
+//
+// GroupBy(field1, field2).
+// Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
+// Scan(ctx, &v)
+func As(fn AggregateFunc, end string) AggregateFunc {
+ return func(s *sql.Selector) string {
+ return sql.As(fn(s), end)
+ }
+}
+
+// Count applies the "count" aggregation function on each group.
+func Count() AggregateFunc {
+ return func(s *sql.Selector) string {
+ return sql.Count("*")
+ }
+}
+
+// Max applies the "max" aggregation function on the given field of each group.
+func Max(field string) AggregateFunc {
+ return func(s *sql.Selector) string {
+ if err := checkColumn(s.TableName(), field); err != nil {
+ s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
+ return ""
+ }
+ return sql.Max(s.C(field))
+ }
+}
+
+// Mean applies the "mean" aggregation function on the given field of each group.
+func Mean(field string) AggregateFunc {
+ return func(s *sql.Selector) string {
+ if err := checkColumn(s.TableName(), field); err != nil {
+ s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
+ return ""
+ }
+ return sql.Avg(s.C(field))
+ }
+}
+
+// Min applies the "min" aggregation function on the given field of each group.
+func Min(field string) AggregateFunc {
+ return func(s *sql.Selector) string {
+ if err := checkColumn(s.TableName(), field); err != nil {
+ s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
+ return ""
+ }
+ return sql.Min(s.C(field))
+ }
+}
+
+// Sum applies the "sum" aggregation function on the given field of each group.
+func Sum(field string) AggregateFunc {
+ return func(s *sql.Selector) string {
+ if err := checkColumn(s.TableName(), field); err != nil {
+ s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
+ return ""
+ }
+ return sql.Sum(s.C(field))
+ }
+}
+
+// ValidationError returns when validating a field or edge fails.
+type ValidationError struct {
+ Name string // Field or edge name.
+ err error
+}
+
+// Error implements the error interface.
+func (e *ValidationError) Error() string {
+ return e.err.Error()
+}
+
+// Unwrap implements the errors.Wrapper interface.
+func (e *ValidationError) Unwrap() error {
+ return e.err
+}
+
+// IsValidationError returns a boolean indicating whether the error is a validation error.
+func IsValidationError(err error) bool {
+ if err == nil {
+ return false
+ }
+ var e *ValidationError
+ return errors.As(err, &e)
+}
+
+// NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
+type NotFoundError struct {
+ label string
+}
+
+// Error implements the error interface.
+func (e *NotFoundError) Error() string {
+ return "ent: " + e.label + " not found"
+}
+
+// IsNotFound returns a boolean indicating whether the error is a not found error.
+func IsNotFound(err error) bool {
+ if err == nil {
+ return false
+ }
+ var e *NotFoundError
+ return errors.As(err, &e)
+}
+
+// MaskNotFound masks not found error.
+func MaskNotFound(err error) error {
+ if IsNotFound(err) {
+ return nil
+ }
+ return err
+}
+
+// NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
+type NotSingularError struct {
+ label string
+}
+
+// Error implements the error interface.
+func (e *NotSingularError) Error() string {
+ return "ent: " + e.label + " not singular"
+}
+
+// IsNotSingular returns a boolean indicating whether the error is a not singular error.
+func IsNotSingular(err error) bool {
+ if err == nil {
+ return false
+ }
+ var e *NotSingularError
+ return errors.As(err, &e)
+}
+
+// NotLoadedError returns when trying to get a node that was not loaded by the query.
+type NotLoadedError struct {
+ edge string
+}
+
+// Error implements the error interface.
+func (e *NotLoadedError) Error() string {
+ return "ent: " + e.edge + " edge was not loaded"
+}
+
+// IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
+func IsNotLoaded(err error) bool {
+ if err == nil {
+ return false
+ }
+ var e *NotLoadedError
+ return errors.As(err, &e)
+}
+
+// ConstraintError returns when trying to create/update one or more entities and
+// one or more of their constraints failed. For example, violation of edge or
+// field uniqueness.
+type ConstraintError struct {
+ msg string
+ wrap error
+}
+
+// Error implements the error interface.
+func (e ConstraintError) Error() string {
+ return "ent: constraint failed: " + e.msg
+}
+
+// Unwrap implements the errors.Wrapper interface.
+func (e *ConstraintError) Unwrap() error {
+ return e.wrap
+}
+
+// IsConstraintError returns a boolean indicating whether the error is a constraint failure.
+func IsConstraintError(err error) bool {
+ if err == nil {
+ return false
+ }
+ var e *ConstraintError
+ return errors.As(err, &e)
+}
+
+// selector embedded by the different Select/GroupBy builders.
+type selector struct {
+ label string
+ flds *[]string
+ fns []AggregateFunc
+ scan func(context.Context, any) error
+}
+
+// ScanX is like Scan, but panics if an error occurs.
+func (s *selector) ScanX(ctx context.Context, v any) {
+ if err := s.scan(ctx, v); err != nil {
+ panic(err)
+ }
+}
+
+// Strings returns list of strings from a selector. It is only allowed when selecting one field.
+func (s *selector) Strings(ctx context.Context) ([]string, error) {
+ if len(*s.flds) > 1 {
+ return nil, errors.New("ent: Strings is not achievable when selecting more than 1 field")
+ }
+ var v []string
+ if err := s.scan(ctx, &v); err != nil {
+ return nil, err
+ }
+ return v, nil
+}
+
+// StringsX is like Strings, but panics if an error occurs.
+func (s *selector) StringsX(ctx context.Context) []string {
+ v, err := s.Strings(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// String returns a single string from a selector. It is only allowed when selecting one field.
+func (s *selector) String(ctx context.Context) (_ string, err error) {
+ var v []string
+ if v, err = s.Strings(ctx); err != nil {
+ return
+ }
+ switch len(v) {
+ case 1:
+ return v[0], nil
+ case 0:
+ err = &NotFoundError{s.label}
+ default:
+ err = fmt.Errorf("ent: Strings returned %d results when one was expected", len(v))
+ }
+ return
+}
+
+// StringX is like String, but panics if an error occurs.
+func (s *selector) StringX(ctx context.Context) string {
+ v, err := s.String(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Ints returns list of ints from a selector. It is only allowed when selecting one field.
+func (s *selector) Ints(ctx context.Context) ([]int, error) {
+ if len(*s.flds) > 1 {
+ return nil, errors.New("ent: Ints is not achievable when selecting more than 1 field")
+ }
+ var v []int
+ if err := s.scan(ctx, &v); err != nil {
+ return nil, err
+ }
+ return v, nil
+}
+
+// IntsX is like Ints, but panics if an error occurs.
+func (s *selector) IntsX(ctx context.Context) []int {
+ v, err := s.Ints(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Int returns a single int from a selector. It is only allowed when selecting one field.
+func (s *selector) Int(ctx context.Context) (_ int, err error) {
+ var v []int
+ if v, err = s.Ints(ctx); err != nil {
+ return
+ }
+ switch len(v) {
+ case 1:
+ return v[0], nil
+ case 0:
+ err = &NotFoundError{s.label}
+ default:
+ err = fmt.Errorf("ent: Ints returned %d results when one was expected", len(v))
+ }
+ return
+}
+
+// IntX is like Int, but panics if an error occurs.
+func (s *selector) IntX(ctx context.Context) int {
+ v, err := s.Int(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
+func (s *selector) Float64s(ctx context.Context) ([]float64, error) {
+ if len(*s.flds) > 1 {
+ return nil, errors.New("ent: Float64s is not achievable when selecting more than 1 field")
+ }
+ var v []float64
+ if err := s.scan(ctx, &v); err != nil {
+ return nil, err
+ }
+ return v, nil
+}
+
+// Float64sX is like Float64s, but panics if an error occurs.
+func (s *selector) Float64sX(ctx context.Context) []float64 {
+ v, err := s.Float64s(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
+func (s *selector) Float64(ctx context.Context) (_ float64, err error) {
+ var v []float64
+ if v, err = s.Float64s(ctx); err != nil {
+ return
+ }
+ switch len(v) {
+ case 1:
+ return v[0], nil
+ case 0:
+ err = &NotFoundError{s.label}
+ default:
+ err = fmt.Errorf("ent: Float64s returned %d results when one was expected", len(v))
+ }
+ return
+}
+
+// Float64X is like Float64, but panics if an error occurs.
+func (s *selector) Float64X(ctx context.Context) float64 {
+ v, err := s.Float64(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Bools returns list of bools from a selector. It is only allowed when selecting one field.
+func (s *selector) Bools(ctx context.Context) ([]bool, error) {
+ if len(*s.flds) > 1 {
+ return nil, errors.New("ent: Bools is not achievable when selecting more than 1 field")
+ }
+ var v []bool
+ if err := s.scan(ctx, &v); err != nil {
+ return nil, err
+ }
+ return v, nil
+}
+
+// BoolsX is like Bools, but panics if an error occurs.
+func (s *selector) BoolsX(ctx context.Context) []bool {
+ v, err := s.Bools(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Bool returns a single bool from a selector. It is only allowed when selecting one field.
+func (s *selector) Bool(ctx context.Context) (_ bool, err error) {
+ var v []bool
+ if v, err = s.Bools(ctx); err != nil {
+ return
+ }
+ switch len(v) {
+ case 1:
+ return v[0], nil
+ case 0:
+ err = &NotFoundError{s.label}
+ default:
+ err = fmt.Errorf("ent: Bools returned %d results when one was expected", len(v))
+ }
+ return
+}
+
+// BoolX is like Bool, but panics if an error occurs.
+func (s *selector) BoolX(ctx context.Context) bool {
+ v, err := s.Bool(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// withHooks invokes the builder operation with the given hooks, if any.
+func withHooks[V Value, M any, PM interface {
+ *M
+ Mutation
+}](ctx context.Context, exec func(context.Context) (V, error), mutation PM, hooks []Hook) (value V, err error) {
+ if len(hooks) == 0 {
+ return exec(ctx)
+ }
+ var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+ mutationT, ok := any(m).(PM)
+ if !ok {
+ return nil, fmt.Errorf("unexpected mutation type %T", m)
+ }
+ // Set the mutation to the builder.
+ *mutation = *mutationT
+ return exec(ctx)
+ })
+ for i := len(hooks) - 1; i >= 0; i-- {
+ if hooks[i] == nil {
+ return value, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
+ }
+ mut = hooks[i](mut)
+ }
+ v, err := mut.Mutate(ctx, mutation)
+ if err != nil {
+ return value, err
+ }
+ nv, ok := v.(V)
+ if !ok {
+ return value, fmt.Errorf("unexpected node type %T returned from %T", v, mutation)
+ }
+ return nv, nil
+}
+
+// setContextOp returns a new context with the given QueryContext attached (including its op) in case it does not exist.
+func setContextOp(ctx context.Context, qc *QueryContext, op string) context.Context {
+ if ent.QueryFromContext(ctx) == nil {
+ qc.Op = op
+ ctx = ent.NewQueryContext(ctx, qc)
+ }
+ return ctx
+}
+
+func querierAll[V Value, Q interface {
+ sqlAll(context.Context, ...queryHook) (V, error)
+}]() Querier {
+ return QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
+ query, ok := q.(Q)
+ if !ok {
+ return nil, fmt.Errorf("unexpected query type %T", q)
+ }
+ return query.sqlAll(ctx)
+ })
+}
+
+func querierCount[Q interface {
+ sqlCount(context.Context) (int, error)
+}]() Querier {
+ return QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
+ query, ok := q.(Q)
+ if !ok {
+ return nil, fmt.Errorf("unexpected query type %T", q)
+ }
+ return query.sqlCount(ctx)
+ })
+}
+
+func withInterceptors[V Value](ctx context.Context, q Query, qr Querier, inters []Interceptor) (v V, err error) {
+ for i := len(inters) - 1; i >= 0; i-- {
+ qr = inters[i].Intercept(qr)
+ }
+ rv, err := qr.Query(ctx, q)
+ if err != nil {
+ return v, err
+ }
+ vt, ok := rv.(V)
+ if !ok {
+ return v, fmt.Errorf("unexpected type %T returned from %T. expected type: %T", vt, q, v)
+ }
+ return vt, nil
+}
+
+func scanWithInterceptors[Q1 ent.Query, Q2 interface {
+ sqlScan(context.Context, Q1, any) error
+}](ctx context.Context, rootQuery Q1, selectOrGroup Q2, inters []Interceptor, v any) error {
+ rv := reflect.ValueOf(v)
+ var qr Querier = QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
+ query, ok := q.(Q1)
+ if !ok {
+ return nil, fmt.Errorf("unexpected query type %T", q)
+ }
+ if err := selectOrGroup.sqlScan(ctx, query, v); err != nil {
+ return nil, err
+ }
+ if k := rv.Kind(); k == reflect.Pointer && rv.Elem().CanInterface() {
+ return rv.Elem().Interface(), nil
+ }
+ return v, nil
+ })
+ for i := len(inters) - 1; i >= 0; i-- {
+ qr = inters[i].Intercept(qr)
+ }
+ vv, err := qr.Query(ctx, rootQuery)
+ if err != nil {
+ return err
+ }
+ switch rv2 := reflect.ValueOf(vv); {
+ case rv.IsNil(), rv2.IsNil(), rv.Kind() != reflect.Pointer:
+ case rv.Type() == rv2.Type():
+ rv.Elem().Set(rv2.Elem())
+ case rv.Elem().Type() == rv2.Type():
+ rv.Elem().Set(rv2)
+ }
+ return nil
+}
+
+// queryHook describes an internal hook for the different sqlAll methods.
+type queryHook func(context.Context, *sqlgraph.QuerySpec)
diff --git a/backend/domain/repository/ent/enttest/enttest.go b/backend/domain/repository/ent/enttest/enttest.go
new file mode 100644
index 00000000..338d4ca4
--- /dev/null
+++ b/backend/domain/repository/ent/enttest/enttest.go
@@ -0,0 +1,84 @@
+// Code generated by ent, DO NOT EDIT.
+
+package enttest
+
+import (
+ "context"
+
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent"
+ // required by schema hooks.
+ _ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/runtime"
+
+ "entgo.io/ent/dialect/sql/schema"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/migrate"
+)
+
+type (
+ // TestingT is the interface that is shared between
+ // testing.T and testing.B and used by enttest.
+ TestingT interface {
+ FailNow()
+ Error(...any)
+ }
+
+ // Option configures client creation.
+ Option func(*options)
+
+ options struct {
+ opts []ent.Option
+ migrateOpts []schema.MigrateOption
+ }
+)
+
+// WithOptions forwards options to client creation.
+func WithOptions(opts ...ent.Option) Option {
+ return func(o *options) {
+ o.opts = append(o.opts, opts...)
+ }
+}
+
+// WithMigrateOptions forwards options to auto migration.
+func WithMigrateOptions(opts ...schema.MigrateOption) Option {
+ return func(o *options) {
+ o.migrateOpts = append(o.migrateOpts, opts...)
+ }
+}
+
+func newOptions(opts []Option) *options {
+ o := &options{}
+ for _, opt := range opts {
+ opt(o)
+ }
+ return o
+}
+
+// Open calls ent.Open and auto-run migration.
+func Open(t TestingT, driverName, dataSourceName string, opts ...Option) *ent.Client {
+ o := newOptions(opts)
+ c, err := ent.Open(driverName, dataSourceName, o.opts...)
+ if err != nil {
+ t.Error(err)
+ t.FailNow()
+ }
+ migrateSchema(t, c, o)
+ return c
+}
+
+// NewClient calls ent.NewClient and auto-run migration.
+func NewClient(t TestingT, opts ...Option) *ent.Client {
+ o := newOptions(opts)
+ c := ent.NewClient(o.opts...)
+ migrateSchema(t, c, o)
+ return c
+}
+func migrateSchema(t TestingT, c *ent.Client, o *options) {
+ tables, err := schema.CopyTables(migrate.Tables)
+ if err != nil {
+ t.Error(err)
+ t.FailNow()
+ }
+ if err := migrate.Create(context.Background(), c.Schema, tables, o.migrateOpts...); err != nil {
+ t.Error(err)
+ t.FailNow()
+ }
+}
diff --git a/backend/domain/repository/ent/generate.go b/backend/domain/repository/ent/generate.go
new file mode 100644
index 00000000..8d3fdfdc
--- /dev/null
+++ b/backend/domain/repository/ent/generate.go
@@ -0,0 +1,3 @@
+package ent
+
+//go:generate go run -mod=mod entgo.io/ent/cmd/ent generate ./schema
diff --git a/backend/domain/repository/ent/guardian.go b/backend/domain/repository/ent/guardian.go
new file mode 100644
index 00000000..13a341d4
--- /dev/null
+++ b/backend/domain/repository/ent/guardian.go
@@ -0,0 +1,264 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "fmt"
+ "strings"
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/sql"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// Guardian is the model entity for the Guardian schema.
+type Guardian struct {
+ config `json:"-"`
+ // ID of the ent.
+ ID uuid.UUID `json:"id,omitempty"`
+ // Email holds the value of the "email" field.
+ Email string `json:"email,omitempty"`
+ // HashedPassword holds the value of the "hashed_password" field.
+ HashedPassword string `json:"hashed_password,omitempty"`
+ // Name holds the value of the "name" field.
+ Name string `json:"name,omitempty"`
+ // PhoneNumber holds the value of the "phone_number" field.
+ PhoneNumber string `json:"phone_number,omitempty"`
+ // バスを利用するかどうか
+ IsUseMorningBus bool `json:"is_use_morning_bus,omitempty"`
+ // バスを利用するかどうか
+ IsUseEveningBus bool `json:"is_use_evening_bus,omitempty"`
+ // CreatedAt holds the value of the "created_at" field.
+ CreatedAt time.Time `json:"created_at,omitempty"`
+ // UpdatedAt holds the value of the "updated_at" field.
+ UpdatedAt time.Time `json:"updated_at,omitempty"`
+ // Edges holds the relations/edges for other nodes in the graph.
+ // The values are being populated by the GuardianQuery when eager-loading is set.
+ Edges GuardianEdges `json:"edges"`
+ guardian_nursery *uuid.UUID
+ selectValues sql.SelectValues
+}
+
+// GuardianEdges holds the relations/edges for other nodes in the graph.
+type GuardianEdges struct {
+ // Children holds the value of the children edge.
+ Children []*Child `json:"children,omitempty"`
+ // Nursery holds the value of the nursery edge.
+ Nursery *Nursery `json:"nursery,omitempty"`
+ // Station holds the value of the station edge.
+ Station *Station `json:"station,omitempty"`
+ // loadedTypes holds the information for reporting if a
+ // type was loaded (or requested) in eager-loading or not.
+ loadedTypes [3]bool
+}
+
+// ChildrenOrErr returns the Children value or an error if the edge
+// was not loaded in eager-loading.
+func (e GuardianEdges) ChildrenOrErr() ([]*Child, error) {
+ if e.loadedTypes[0] {
+ return e.Children, nil
+ }
+ return nil, &NotLoadedError{edge: "children"}
+}
+
+// NurseryOrErr returns the Nursery value or an error if the edge
+// was not loaded in eager-loading, or loaded but was not found.
+func (e GuardianEdges) NurseryOrErr() (*Nursery, error) {
+ if e.loadedTypes[1] {
+ if e.Nursery == nil {
+ // Edge was loaded but was not found.
+ return nil, &NotFoundError{label: nursery.Label}
+ }
+ return e.Nursery, nil
+ }
+ return nil, &NotLoadedError{edge: "nursery"}
+}
+
+// StationOrErr returns the Station value or an error if the edge
+// was not loaded in eager-loading, or loaded but was not found.
+func (e GuardianEdges) StationOrErr() (*Station, error) {
+ if e.loadedTypes[2] {
+ if e.Station == nil {
+ // Edge was loaded but was not found.
+ return nil, &NotFoundError{label: station.Label}
+ }
+ return e.Station, nil
+ }
+ return nil, &NotLoadedError{edge: "station"}
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*Guardian) scanValues(columns []string) ([]any, error) {
+ values := make([]any, len(columns))
+ for i := range columns {
+ switch columns[i] {
+ case guardian.FieldIsUseMorningBus, guardian.FieldIsUseEveningBus:
+ values[i] = new(sql.NullBool)
+ case guardian.FieldEmail, guardian.FieldHashedPassword, guardian.FieldName, guardian.FieldPhoneNumber:
+ values[i] = new(sql.NullString)
+ case guardian.FieldCreatedAt, guardian.FieldUpdatedAt:
+ values[i] = new(sql.NullTime)
+ case guardian.FieldID:
+ values[i] = new(uuid.UUID)
+ case guardian.ForeignKeys[0]: // guardian_nursery
+ values[i] = &sql.NullScanner{S: new(uuid.UUID)}
+ default:
+ values[i] = new(sql.UnknownType)
+ }
+ }
+ return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the Guardian fields.
+func (gu *Guardian) assignValues(columns []string, values []any) error {
+ if m, n := len(values), len(columns); m < n {
+ return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+ }
+ for i := range columns {
+ switch columns[i] {
+ case guardian.FieldID:
+ if value, ok := values[i].(*uuid.UUID); !ok {
+ return fmt.Errorf("unexpected type %T for field id", values[i])
+ } else if value != nil {
+ gu.ID = *value
+ }
+ case guardian.FieldEmail:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field email", values[i])
+ } else if value.Valid {
+ gu.Email = value.String
+ }
+ case guardian.FieldHashedPassword:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field hashed_password", values[i])
+ } else if value.Valid {
+ gu.HashedPassword = value.String
+ }
+ case guardian.FieldName:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field name", values[i])
+ } else if value.Valid {
+ gu.Name = value.String
+ }
+ case guardian.FieldPhoneNumber:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field phone_number", values[i])
+ } else if value.Valid {
+ gu.PhoneNumber = value.String
+ }
+ case guardian.FieldIsUseMorningBus:
+ if value, ok := values[i].(*sql.NullBool); !ok {
+ return fmt.Errorf("unexpected type %T for field is_use_morning_bus", values[i])
+ } else if value.Valid {
+ gu.IsUseMorningBus = value.Bool
+ }
+ case guardian.FieldIsUseEveningBus:
+ if value, ok := values[i].(*sql.NullBool); !ok {
+ return fmt.Errorf("unexpected type %T for field is_use_evening_bus", values[i])
+ } else if value.Valid {
+ gu.IsUseEveningBus = value.Bool
+ }
+ case guardian.FieldCreatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field created_at", values[i])
+ } else if value.Valid {
+ gu.CreatedAt = value.Time
+ }
+ case guardian.FieldUpdatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field updated_at", values[i])
+ } else if value.Valid {
+ gu.UpdatedAt = value.Time
+ }
+ case guardian.ForeignKeys[0]:
+ if value, ok := values[i].(*sql.NullScanner); !ok {
+ return fmt.Errorf("unexpected type %T for field guardian_nursery", values[i])
+ } else if value.Valid {
+ gu.guardian_nursery = new(uuid.UUID)
+ *gu.guardian_nursery = *value.S.(*uuid.UUID)
+ }
+ default:
+ gu.selectValues.Set(columns[i], values[i])
+ }
+ }
+ return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the Guardian.
+// This includes values selected through modifiers, order, etc.
+func (gu *Guardian) Value(name string) (ent.Value, error) {
+ return gu.selectValues.Get(name)
+}
+
+// QueryChildren queries the "children" edge of the Guardian entity.
+func (gu *Guardian) QueryChildren() *ChildQuery {
+ return NewGuardianClient(gu.config).QueryChildren(gu)
+}
+
+// QueryNursery queries the "nursery" edge of the Guardian entity.
+func (gu *Guardian) QueryNursery() *NurseryQuery {
+ return NewGuardianClient(gu.config).QueryNursery(gu)
+}
+
+// QueryStation queries the "station" edge of the Guardian entity.
+func (gu *Guardian) QueryStation() *StationQuery {
+ return NewGuardianClient(gu.config).QueryStation(gu)
+}
+
+// Update returns a builder for updating this Guardian.
+// Note that you need to call Guardian.Unwrap() before calling this method if this Guardian
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (gu *Guardian) Update() *GuardianUpdateOne {
+ return NewGuardianClient(gu.config).UpdateOne(gu)
+}
+
+// Unwrap unwraps the Guardian entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (gu *Guardian) Unwrap() *Guardian {
+ _tx, ok := gu.config.driver.(*txDriver)
+ if !ok {
+ panic("ent: Guardian is not a transactional entity")
+ }
+ gu.config.driver = _tx.drv
+ return gu
+}
+
+// String implements the fmt.Stringer.
+func (gu *Guardian) String() string {
+ var builder strings.Builder
+ builder.WriteString("Guardian(")
+ builder.WriteString(fmt.Sprintf("id=%v, ", gu.ID))
+ builder.WriteString("email=")
+ builder.WriteString(gu.Email)
+ builder.WriteString(", ")
+ builder.WriteString("hashed_password=")
+ builder.WriteString(gu.HashedPassword)
+ builder.WriteString(", ")
+ builder.WriteString("name=")
+ builder.WriteString(gu.Name)
+ builder.WriteString(", ")
+ builder.WriteString("phone_number=")
+ builder.WriteString(gu.PhoneNumber)
+ builder.WriteString(", ")
+ builder.WriteString("is_use_morning_bus=")
+ builder.WriteString(fmt.Sprintf("%v", gu.IsUseMorningBus))
+ builder.WriteString(", ")
+ builder.WriteString("is_use_evening_bus=")
+ builder.WriteString(fmt.Sprintf("%v", gu.IsUseEveningBus))
+ builder.WriteString(", ")
+ builder.WriteString("created_at=")
+ builder.WriteString(gu.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(", ")
+ builder.WriteString("updated_at=")
+ builder.WriteString(gu.UpdatedAt.Format(time.ANSIC))
+ builder.WriteByte(')')
+ return builder.String()
+}
+
+// Guardians is a parsable slice of Guardian.
+type Guardians []*Guardian
diff --git a/backend/domain/repository/ent/guardian/guardian.go b/backend/domain/repository/ent/guardian/guardian.go
new file mode 100644
index 00000000..1e94f531
--- /dev/null
+++ b/backend/domain/repository/ent/guardian/guardian.go
@@ -0,0 +1,209 @@
+// Code generated by ent, DO NOT EDIT.
+
+package guardian
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/google/uuid"
+)
+
+const (
+ // Label holds the string label denoting the guardian type in the database.
+ Label = "guardian"
+ // FieldID holds the string denoting the id field in the database.
+ FieldID = "id"
+ // FieldEmail holds the string denoting the email field in the database.
+ FieldEmail = "email"
+ // FieldHashedPassword holds the string denoting the hashed_password field in the database.
+ FieldHashedPassword = "hashed_password"
+ // FieldName holds the string denoting the name field in the database.
+ FieldName = "name"
+ // FieldPhoneNumber holds the string denoting the phone_number field in the database.
+ FieldPhoneNumber = "phone_number"
+ // FieldIsUseMorningBus holds the string denoting the is_use_morning_bus field in the database.
+ FieldIsUseMorningBus = "is_use_morning_bus"
+ // FieldIsUseEveningBus holds the string denoting the is_use_evening_bus field in the database.
+ FieldIsUseEveningBus = "is_use_evening_bus"
+ // FieldCreatedAt holds the string denoting the created_at field in the database.
+ FieldCreatedAt = "created_at"
+ // FieldUpdatedAt holds the string denoting the updated_at field in the database.
+ FieldUpdatedAt = "updated_at"
+ // EdgeChildren holds the string denoting the children edge name in mutations.
+ EdgeChildren = "children"
+ // EdgeNursery holds the string denoting the nursery edge name in mutations.
+ EdgeNursery = "nursery"
+ // EdgeStation holds the string denoting the station edge name in mutations.
+ EdgeStation = "station"
+ // Table holds the table name of the guardian in the database.
+ Table = "guardians"
+ // ChildrenTable is the table that holds the children relation/edge.
+ ChildrenTable = "childs"
+ // ChildrenInverseTable is the table name for the Child entity.
+ // It exists in this package in order to avoid circular dependency with the "child" package.
+ ChildrenInverseTable = "childs"
+ // ChildrenColumn is the table column denoting the children relation/edge.
+ ChildrenColumn = "guardian_children"
+ // NurseryTable is the table that holds the nursery relation/edge.
+ NurseryTable = "guardians"
+ // NurseryInverseTable is the table name for the Nursery entity.
+ // It exists in this package in order to avoid circular dependency with the "nursery" package.
+ NurseryInverseTable = "nurseries"
+ // NurseryColumn is the table column denoting the nursery relation/edge.
+ NurseryColumn = "guardian_nursery"
+ // StationTable is the table that holds the station relation/edge.
+ StationTable = "stations"
+ // StationInverseTable is the table name for the Station entity.
+ // It exists in this package in order to avoid circular dependency with the "station" package.
+ StationInverseTable = "stations"
+ // StationColumn is the table column denoting the station relation/edge.
+ StationColumn = "guardian_station"
+)
+
+// Columns holds all SQL columns for guardian fields.
+var Columns = []string{
+ FieldID,
+ FieldEmail,
+ FieldHashedPassword,
+ FieldName,
+ FieldPhoneNumber,
+ FieldIsUseMorningBus,
+ FieldIsUseEveningBus,
+ FieldCreatedAt,
+ FieldUpdatedAt,
+}
+
+// ForeignKeys holds the SQL foreign-keys that are owned by the "guardians"
+// table and are not defined as standalone fields in the schema.
+var ForeignKeys = []string{
+ "guardian_nursery",
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+ for i := range Columns {
+ if column == Columns[i] {
+ return true
+ }
+ }
+ for i := range ForeignKeys {
+ if column == ForeignKeys[i] {
+ return true
+ }
+ }
+ return false
+}
+
+var (
+ // DefaultIsUseMorningBus holds the default value on creation for the "is_use_morning_bus" field.
+ DefaultIsUseMorningBus bool
+ // DefaultIsUseEveningBus holds the default value on creation for the "is_use_evening_bus" field.
+ DefaultIsUseEveningBus bool
+ // DefaultCreatedAt holds the default value on creation for the "created_at" field.
+ DefaultCreatedAt func() time.Time
+ // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
+ DefaultUpdatedAt func() time.Time
+ // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
+ UpdateDefaultUpdatedAt func() time.Time
+ // DefaultID holds the default value on creation for the "id" field.
+ DefaultID func() uuid.UUID
+)
+
+// OrderOption defines the ordering options for the Guardian queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByEmail orders the results by the email field.
+func ByEmail(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldEmail, opts...).ToFunc()
+}
+
+// ByHashedPassword orders the results by the hashed_password field.
+func ByHashedPassword(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldHashedPassword, opts...).ToFunc()
+}
+
+// ByName orders the results by the name field.
+func ByName(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldName, opts...).ToFunc()
+}
+
+// ByPhoneNumber orders the results by the phone_number field.
+func ByPhoneNumber(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldPhoneNumber, opts...).ToFunc()
+}
+
+// ByIsUseMorningBus orders the results by the is_use_morning_bus field.
+func ByIsUseMorningBus(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldIsUseMorningBus, opts...).ToFunc()
+}
+
+// ByIsUseEveningBus orders the results by the is_use_evening_bus field.
+func ByIsUseEveningBus(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldIsUseEveningBus, opts...).ToFunc()
+}
+
+// ByCreatedAt orders the results by the created_at field.
+func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
+}
+
+// ByUpdatedAt orders the results by the updated_at field.
+func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
+}
+
+// ByChildrenCount orders the results by children count.
+func ByChildrenCount(opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborsCount(s, newChildrenStep(), opts...)
+ }
+}
+
+// ByChildren orders the results by children terms.
+func ByChildren(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newChildrenStep(), append([]sql.OrderTerm{term}, terms...)...)
+ }
+}
+
+// ByNurseryField orders the results by nursery field.
+func ByNurseryField(field string, opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newNurseryStep(), sql.OrderByField(field, opts...))
+ }
+}
+
+// ByStationField orders the results by station field.
+func ByStationField(field string, opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newStationStep(), sql.OrderByField(field, opts...))
+ }
+}
+func newChildrenStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(ChildrenInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, ChildrenTable, ChildrenColumn),
+ )
+}
+func newNurseryStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(NurseryInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, NurseryTable, NurseryColumn),
+ )
+}
+func newStationStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(StationInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.O2O, false, StationTable, StationColumn),
+ )
+}
diff --git a/backend/domain/repository/ent/guardian/where.go b/backend/domain/repository/ent/guardian/where.go
new file mode 100644
index 00000000..0661a617
--- /dev/null
+++ b/backend/domain/repository/ent/guardian/where.go
@@ -0,0 +1,551 @@
+// Code generated by ent, DO NOT EDIT.
+
+package guardian
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id uuid.UUID) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id uuid.UUID) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id uuid.UUID) predicate.Guardian {
+ return predicate.Guardian(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...uuid.UUID) predicate.Guardian {
+ return predicate.Guardian(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...uuid.UUID) predicate.Guardian {
+ return predicate.Guardian(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id uuid.UUID) predicate.Guardian {
+ return predicate.Guardian(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id uuid.UUID) predicate.Guardian {
+ return predicate.Guardian(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id uuid.UUID) predicate.Guardian {
+ return predicate.Guardian(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id uuid.UUID) predicate.Guardian {
+ return predicate.Guardian(sql.FieldLTE(FieldID, id))
+}
+
+// Email applies equality check predicate on the "email" field. It's identical to EmailEQ.
+func Email(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldEmail, v))
+}
+
+// HashedPassword applies equality check predicate on the "hashed_password" field. It's identical to HashedPasswordEQ.
+func HashedPassword(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldHashedPassword, v))
+}
+
+// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
+func Name(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldName, v))
+}
+
+// PhoneNumber applies equality check predicate on the "phone_number" field. It's identical to PhoneNumberEQ.
+func PhoneNumber(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldPhoneNumber, v))
+}
+
+// IsUseMorningBus applies equality check predicate on the "is_use_morning_bus" field. It's identical to IsUseMorningBusEQ.
+func IsUseMorningBus(v bool) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldIsUseMorningBus, v))
+}
+
+// IsUseEveningBus applies equality check predicate on the "is_use_evening_bus" field. It's identical to IsUseEveningBusEQ.
+func IsUseEveningBus(v bool) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldIsUseEveningBus, v))
+}
+
+// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
+func UpdatedAt(v time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// EmailEQ applies the EQ predicate on the "email" field.
+func EmailEQ(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldEmail, v))
+}
+
+// EmailNEQ applies the NEQ predicate on the "email" field.
+func EmailNEQ(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldNEQ(FieldEmail, v))
+}
+
+// EmailIn applies the In predicate on the "email" field.
+func EmailIn(vs ...string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldIn(FieldEmail, vs...))
+}
+
+// EmailNotIn applies the NotIn predicate on the "email" field.
+func EmailNotIn(vs ...string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldNotIn(FieldEmail, vs...))
+}
+
+// EmailGT applies the GT predicate on the "email" field.
+func EmailGT(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldGT(FieldEmail, v))
+}
+
+// EmailGTE applies the GTE predicate on the "email" field.
+func EmailGTE(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldGTE(FieldEmail, v))
+}
+
+// EmailLT applies the LT predicate on the "email" field.
+func EmailLT(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldLT(FieldEmail, v))
+}
+
+// EmailLTE applies the LTE predicate on the "email" field.
+func EmailLTE(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldLTE(FieldEmail, v))
+}
+
+// EmailContains applies the Contains predicate on the "email" field.
+func EmailContains(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldContains(FieldEmail, v))
+}
+
+// EmailHasPrefix applies the HasPrefix predicate on the "email" field.
+func EmailHasPrefix(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldHasPrefix(FieldEmail, v))
+}
+
+// EmailHasSuffix applies the HasSuffix predicate on the "email" field.
+func EmailHasSuffix(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldHasSuffix(FieldEmail, v))
+}
+
+// EmailEqualFold applies the EqualFold predicate on the "email" field.
+func EmailEqualFold(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEqualFold(FieldEmail, v))
+}
+
+// EmailContainsFold applies the ContainsFold predicate on the "email" field.
+func EmailContainsFold(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldContainsFold(FieldEmail, v))
+}
+
+// HashedPasswordEQ applies the EQ predicate on the "hashed_password" field.
+func HashedPasswordEQ(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldHashedPassword, v))
+}
+
+// HashedPasswordNEQ applies the NEQ predicate on the "hashed_password" field.
+func HashedPasswordNEQ(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldNEQ(FieldHashedPassword, v))
+}
+
+// HashedPasswordIn applies the In predicate on the "hashed_password" field.
+func HashedPasswordIn(vs ...string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldIn(FieldHashedPassword, vs...))
+}
+
+// HashedPasswordNotIn applies the NotIn predicate on the "hashed_password" field.
+func HashedPasswordNotIn(vs ...string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldNotIn(FieldHashedPassword, vs...))
+}
+
+// HashedPasswordGT applies the GT predicate on the "hashed_password" field.
+func HashedPasswordGT(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldGT(FieldHashedPassword, v))
+}
+
+// HashedPasswordGTE applies the GTE predicate on the "hashed_password" field.
+func HashedPasswordGTE(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldGTE(FieldHashedPassword, v))
+}
+
+// HashedPasswordLT applies the LT predicate on the "hashed_password" field.
+func HashedPasswordLT(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldLT(FieldHashedPassword, v))
+}
+
+// HashedPasswordLTE applies the LTE predicate on the "hashed_password" field.
+func HashedPasswordLTE(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldLTE(FieldHashedPassword, v))
+}
+
+// HashedPasswordContains applies the Contains predicate on the "hashed_password" field.
+func HashedPasswordContains(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldContains(FieldHashedPassword, v))
+}
+
+// HashedPasswordHasPrefix applies the HasPrefix predicate on the "hashed_password" field.
+func HashedPasswordHasPrefix(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldHasPrefix(FieldHashedPassword, v))
+}
+
+// HashedPasswordHasSuffix applies the HasSuffix predicate on the "hashed_password" field.
+func HashedPasswordHasSuffix(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldHasSuffix(FieldHashedPassword, v))
+}
+
+// HashedPasswordEqualFold applies the EqualFold predicate on the "hashed_password" field.
+func HashedPasswordEqualFold(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEqualFold(FieldHashedPassword, v))
+}
+
+// HashedPasswordContainsFold applies the ContainsFold predicate on the "hashed_password" field.
+func HashedPasswordContainsFold(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldContainsFold(FieldHashedPassword, v))
+}
+
+// NameEQ applies the EQ predicate on the "name" field.
+func NameEQ(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldName, v))
+}
+
+// NameNEQ applies the NEQ predicate on the "name" field.
+func NameNEQ(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldNEQ(FieldName, v))
+}
+
+// NameIn applies the In predicate on the "name" field.
+func NameIn(vs ...string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldIn(FieldName, vs...))
+}
+
+// NameNotIn applies the NotIn predicate on the "name" field.
+func NameNotIn(vs ...string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldNotIn(FieldName, vs...))
+}
+
+// NameGT applies the GT predicate on the "name" field.
+func NameGT(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldGT(FieldName, v))
+}
+
+// NameGTE applies the GTE predicate on the "name" field.
+func NameGTE(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldGTE(FieldName, v))
+}
+
+// NameLT applies the LT predicate on the "name" field.
+func NameLT(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldLT(FieldName, v))
+}
+
+// NameLTE applies the LTE predicate on the "name" field.
+func NameLTE(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldLTE(FieldName, v))
+}
+
+// NameContains applies the Contains predicate on the "name" field.
+func NameContains(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldContains(FieldName, v))
+}
+
+// NameHasPrefix applies the HasPrefix predicate on the "name" field.
+func NameHasPrefix(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldHasPrefix(FieldName, v))
+}
+
+// NameHasSuffix applies the HasSuffix predicate on the "name" field.
+func NameHasSuffix(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldHasSuffix(FieldName, v))
+}
+
+// NameEqualFold applies the EqualFold predicate on the "name" field.
+func NameEqualFold(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEqualFold(FieldName, v))
+}
+
+// NameContainsFold applies the ContainsFold predicate on the "name" field.
+func NameContainsFold(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldContainsFold(FieldName, v))
+}
+
+// PhoneNumberEQ applies the EQ predicate on the "phone_number" field.
+func PhoneNumberEQ(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldPhoneNumber, v))
+}
+
+// PhoneNumberNEQ applies the NEQ predicate on the "phone_number" field.
+func PhoneNumberNEQ(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldNEQ(FieldPhoneNumber, v))
+}
+
+// PhoneNumberIn applies the In predicate on the "phone_number" field.
+func PhoneNumberIn(vs ...string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldIn(FieldPhoneNumber, vs...))
+}
+
+// PhoneNumberNotIn applies the NotIn predicate on the "phone_number" field.
+func PhoneNumberNotIn(vs ...string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldNotIn(FieldPhoneNumber, vs...))
+}
+
+// PhoneNumberGT applies the GT predicate on the "phone_number" field.
+func PhoneNumberGT(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldGT(FieldPhoneNumber, v))
+}
+
+// PhoneNumberGTE applies the GTE predicate on the "phone_number" field.
+func PhoneNumberGTE(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldGTE(FieldPhoneNumber, v))
+}
+
+// PhoneNumberLT applies the LT predicate on the "phone_number" field.
+func PhoneNumberLT(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldLT(FieldPhoneNumber, v))
+}
+
+// PhoneNumberLTE applies the LTE predicate on the "phone_number" field.
+func PhoneNumberLTE(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldLTE(FieldPhoneNumber, v))
+}
+
+// PhoneNumberContains applies the Contains predicate on the "phone_number" field.
+func PhoneNumberContains(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldContains(FieldPhoneNumber, v))
+}
+
+// PhoneNumberHasPrefix applies the HasPrefix predicate on the "phone_number" field.
+func PhoneNumberHasPrefix(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldHasPrefix(FieldPhoneNumber, v))
+}
+
+// PhoneNumberHasSuffix applies the HasSuffix predicate on the "phone_number" field.
+func PhoneNumberHasSuffix(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldHasSuffix(FieldPhoneNumber, v))
+}
+
+// PhoneNumberIsNil applies the IsNil predicate on the "phone_number" field.
+func PhoneNumberIsNil() predicate.Guardian {
+ return predicate.Guardian(sql.FieldIsNull(FieldPhoneNumber))
+}
+
+// PhoneNumberNotNil applies the NotNil predicate on the "phone_number" field.
+func PhoneNumberNotNil() predicate.Guardian {
+ return predicate.Guardian(sql.FieldNotNull(FieldPhoneNumber))
+}
+
+// PhoneNumberEqualFold applies the EqualFold predicate on the "phone_number" field.
+func PhoneNumberEqualFold(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEqualFold(FieldPhoneNumber, v))
+}
+
+// PhoneNumberContainsFold applies the ContainsFold predicate on the "phone_number" field.
+func PhoneNumberContainsFold(v string) predicate.Guardian {
+ return predicate.Guardian(sql.FieldContainsFold(FieldPhoneNumber, v))
+}
+
+// IsUseMorningBusEQ applies the EQ predicate on the "is_use_morning_bus" field.
+func IsUseMorningBusEQ(v bool) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldIsUseMorningBus, v))
+}
+
+// IsUseMorningBusNEQ applies the NEQ predicate on the "is_use_morning_bus" field.
+func IsUseMorningBusNEQ(v bool) predicate.Guardian {
+ return predicate.Guardian(sql.FieldNEQ(FieldIsUseMorningBus, v))
+}
+
+// IsUseEveningBusEQ applies the EQ predicate on the "is_use_evening_bus" field.
+func IsUseEveningBusEQ(v bool) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldIsUseEveningBus, v))
+}
+
+// IsUseEveningBusNEQ applies the NEQ predicate on the "is_use_evening_bus" field.
+func IsUseEveningBusNEQ(v bool) predicate.Guardian {
+ return predicate.Guardian(sql.FieldNEQ(FieldIsUseEveningBus, v))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
+func UpdatedAtEQ(v time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
+func UpdatedAtNEQ(v time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldNEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtIn applies the In predicate on the "updated_at" field.
+func UpdatedAtIn(vs ...time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
+func UpdatedAtNotIn(vs ...time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldNotIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtGT applies the GT predicate on the "updated_at" field.
+func UpdatedAtGT(v time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldGT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
+func UpdatedAtGTE(v time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldGTE(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLT applies the LT predicate on the "updated_at" field.
+func UpdatedAtLT(v time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldLT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
+func UpdatedAtLTE(v time.Time) predicate.Guardian {
+ return predicate.Guardian(sql.FieldLTE(FieldUpdatedAt, v))
+}
+
+// HasChildren applies the HasEdge predicate on the "children" edge.
+func HasChildren() predicate.Guardian {
+ return predicate.Guardian(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, ChildrenTable, ChildrenColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasChildrenWith applies the HasEdge predicate on the "children" edge with a given conditions (other predicates).
+func HasChildrenWith(preds ...predicate.Child) predicate.Guardian {
+ return predicate.Guardian(func(s *sql.Selector) {
+ step := newChildrenStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasNursery applies the HasEdge predicate on the "nursery" edge.
+func HasNursery() predicate.Guardian {
+ return predicate.Guardian(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, NurseryTable, NurseryColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasNurseryWith applies the HasEdge predicate on the "nursery" edge with a given conditions (other predicates).
+func HasNurseryWith(preds ...predicate.Nursery) predicate.Guardian {
+ return predicate.Guardian(func(s *sql.Selector) {
+ step := newNurseryStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasStation applies the HasEdge predicate on the "station" edge.
+func HasStation() predicate.Guardian {
+ return predicate.Guardian(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.O2O, false, StationTable, StationColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasStationWith applies the HasEdge predicate on the "station" edge with a given conditions (other predicates).
+func HasStationWith(preds ...predicate.Station) predicate.Guardian {
+ return predicate.Guardian(func(s *sql.Selector) {
+ step := newStationStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.Guardian) predicate.Guardian {
+ return predicate.Guardian(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.Guardian) predicate.Guardian {
+ return predicate.Guardian(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.Guardian) predicate.Guardian {
+ return predicate.Guardian(sql.NotPredicates(p))
+}
diff --git a/backend/domain/repository/ent/guardian_create.go b/backend/domain/repository/ent/guardian_create.go
new file mode 100644
index 00000000..377ca850
--- /dev/null
+++ b/backend/domain/repository/ent/guardian_create.go
@@ -0,0 +1,463 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// GuardianCreate is the builder for creating a Guardian entity.
+type GuardianCreate struct {
+ config
+ mutation *GuardianMutation
+ hooks []Hook
+}
+
+// SetEmail sets the "email" field.
+func (gc *GuardianCreate) SetEmail(s string) *GuardianCreate {
+ gc.mutation.SetEmail(s)
+ return gc
+}
+
+// SetHashedPassword sets the "hashed_password" field.
+func (gc *GuardianCreate) SetHashedPassword(s string) *GuardianCreate {
+ gc.mutation.SetHashedPassword(s)
+ return gc
+}
+
+// SetName sets the "name" field.
+func (gc *GuardianCreate) SetName(s string) *GuardianCreate {
+ gc.mutation.SetName(s)
+ return gc
+}
+
+// SetPhoneNumber sets the "phone_number" field.
+func (gc *GuardianCreate) SetPhoneNumber(s string) *GuardianCreate {
+ gc.mutation.SetPhoneNumber(s)
+ return gc
+}
+
+// SetNillablePhoneNumber sets the "phone_number" field if the given value is not nil.
+func (gc *GuardianCreate) SetNillablePhoneNumber(s *string) *GuardianCreate {
+ if s != nil {
+ gc.SetPhoneNumber(*s)
+ }
+ return gc
+}
+
+// SetIsUseMorningBus sets the "is_use_morning_bus" field.
+func (gc *GuardianCreate) SetIsUseMorningBus(b bool) *GuardianCreate {
+ gc.mutation.SetIsUseMorningBus(b)
+ return gc
+}
+
+// SetNillableIsUseMorningBus sets the "is_use_morning_bus" field if the given value is not nil.
+func (gc *GuardianCreate) SetNillableIsUseMorningBus(b *bool) *GuardianCreate {
+ if b != nil {
+ gc.SetIsUseMorningBus(*b)
+ }
+ return gc
+}
+
+// SetIsUseEveningBus sets the "is_use_evening_bus" field.
+func (gc *GuardianCreate) SetIsUseEveningBus(b bool) *GuardianCreate {
+ gc.mutation.SetIsUseEveningBus(b)
+ return gc
+}
+
+// SetNillableIsUseEveningBus sets the "is_use_evening_bus" field if the given value is not nil.
+func (gc *GuardianCreate) SetNillableIsUseEveningBus(b *bool) *GuardianCreate {
+ if b != nil {
+ gc.SetIsUseEveningBus(*b)
+ }
+ return gc
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (gc *GuardianCreate) SetCreatedAt(t time.Time) *GuardianCreate {
+ gc.mutation.SetCreatedAt(t)
+ return gc
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (gc *GuardianCreate) SetNillableCreatedAt(t *time.Time) *GuardianCreate {
+ if t != nil {
+ gc.SetCreatedAt(*t)
+ }
+ return gc
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (gc *GuardianCreate) SetUpdatedAt(t time.Time) *GuardianCreate {
+ gc.mutation.SetUpdatedAt(t)
+ return gc
+}
+
+// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
+func (gc *GuardianCreate) SetNillableUpdatedAt(t *time.Time) *GuardianCreate {
+ if t != nil {
+ gc.SetUpdatedAt(*t)
+ }
+ return gc
+}
+
+// SetID sets the "id" field.
+func (gc *GuardianCreate) SetID(u uuid.UUID) *GuardianCreate {
+ gc.mutation.SetID(u)
+ return gc
+}
+
+// SetNillableID sets the "id" field if the given value is not nil.
+func (gc *GuardianCreate) SetNillableID(u *uuid.UUID) *GuardianCreate {
+ if u != nil {
+ gc.SetID(*u)
+ }
+ return gc
+}
+
+// AddChildIDs adds the "children" edge to the Child entity by IDs.
+func (gc *GuardianCreate) AddChildIDs(ids ...uuid.UUID) *GuardianCreate {
+ gc.mutation.AddChildIDs(ids...)
+ return gc
+}
+
+// AddChildren adds the "children" edges to the Child entity.
+func (gc *GuardianCreate) AddChildren(c ...*Child) *GuardianCreate {
+ ids := make([]uuid.UUID, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return gc.AddChildIDs(ids...)
+}
+
+// SetNurseryID sets the "nursery" edge to the Nursery entity by ID.
+func (gc *GuardianCreate) SetNurseryID(id uuid.UUID) *GuardianCreate {
+ gc.mutation.SetNurseryID(id)
+ return gc
+}
+
+// SetNillableNurseryID sets the "nursery" edge to the Nursery entity by ID if the given value is not nil.
+func (gc *GuardianCreate) SetNillableNurseryID(id *uuid.UUID) *GuardianCreate {
+ if id != nil {
+ gc = gc.SetNurseryID(*id)
+ }
+ return gc
+}
+
+// SetNursery sets the "nursery" edge to the Nursery entity.
+func (gc *GuardianCreate) SetNursery(n *Nursery) *GuardianCreate {
+ return gc.SetNurseryID(n.ID)
+}
+
+// SetStationID sets the "station" edge to the Station entity by ID.
+func (gc *GuardianCreate) SetStationID(id uuid.UUID) *GuardianCreate {
+ gc.mutation.SetStationID(id)
+ return gc
+}
+
+// SetNillableStationID sets the "station" edge to the Station entity by ID if the given value is not nil.
+func (gc *GuardianCreate) SetNillableStationID(id *uuid.UUID) *GuardianCreate {
+ if id != nil {
+ gc = gc.SetStationID(*id)
+ }
+ return gc
+}
+
+// SetStation sets the "station" edge to the Station entity.
+func (gc *GuardianCreate) SetStation(s *Station) *GuardianCreate {
+ return gc.SetStationID(s.ID)
+}
+
+// Mutation returns the GuardianMutation object of the builder.
+func (gc *GuardianCreate) Mutation() *GuardianMutation {
+ return gc.mutation
+}
+
+// Save creates the Guardian in the database.
+func (gc *GuardianCreate) Save(ctx context.Context) (*Guardian, error) {
+ gc.defaults()
+ return withHooks(ctx, gc.sqlSave, gc.mutation, gc.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (gc *GuardianCreate) SaveX(ctx context.Context) *Guardian {
+ v, err := gc.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (gc *GuardianCreate) Exec(ctx context.Context) error {
+ _, err := gc.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (gc *GuardianCreate) ExecX(ctx context.Context) {
+ if err := gc.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (gc *GuardianCreate) defaults() {
+ if _, ok := gc.mutation.IsUseMorningBus(); !ok {
+ v := guardian.DefaultIsUseMorningBus
+ gc.mutation.SetIsUseMorningBus(v)
+ }
+ if _, ok := gc.mutation.IsUseEveningBus(); !ok {
+ v := guardian.DefaultIsUseEveningBus
+ gc.mutation.SetIsUseEveningBus(v)
+ }
+ if _, ok := gc.mutation.CreatedAt(); !ok {
+ v := guardian.DefaultCreatedAt()
+ gc.mutation.SetCreatedAt(v)
+ }
+ if _, ok := gc.mutation.UpdatedAt(); !ok {
+ v := guardian.DefaultUpdatedAt()
+ gc.mutation.SetUpdatedAt(v)
+ }
+ if _, ok := gc.mutation.ID(); !ok {
+ v := guardian.DefaultID()
+ gc.mutation.SetID(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (gc *GuardianCreate) check() error {
+ if _, ok := gc.mutation.Email(); !ok {
+ return &ValidationError{Name: "email", err: errors.New(`ent: missing required field "Guardian.email"`)}
+ }
+ if _, ok := gc.mutation.HashedPassword(); !ok {
+ return &ValidationError{Name: "hashed_password", err: errors.New(`ent: missing required field "Guardian.hashed_password"`)}
+ }
+ if _, ok := gc.mutation.Name(); !ok {
+ return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Guardian.name"`)}
+ }
+ if _, ok := gc.mutation.IsUseMorningBus(); !ok {
+ return &ValidationError{Name: "is_use_morning_bus", err: errors.New(`ent: missing required field "Guardian.is_use_morning_bus"`)}
+ }
+ if _, ok := gc.mutation.IsUseEveningBus(); !ok {
+ return &ValidationError{Name: "is_use_evening_bus", err: errors.New(`ent: missing required field "Guardian.is_use_evening_bus"`)}
+ }
+ if _, ok := gc.mutation.CreatedAt(); !ok {
+ return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Guardian.created_at"`)}
+ }
+ if _, ok := gc.mutation.UpdatedAt(); !ok {
+ return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Guardian.updated_at"`)}
+ }
+ return nil
+}
+
+func (gc *GuardianCreate) sqlSave(ctx context.Context) (*Guardian, error) {
+ if err := gc.check(); err != nil {
+ return nil, err
+ }
+ _node, _spec := gc.createSpec()
+ if err := sqlgraph.CreateNode(ctx, gc.driver, _spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ if _spec.ID.Value != nil {
+ if id, ok := _spec.ID.Value.(*uuid.UUID); ok {
+ _node.ID = *id
+ } else if err := _node.ID.Scan(_spec.ID.Value); err != nil {
+ return nil, err
+ }
+ }
+ gc.mutation.id = &_node.ID
+ gc.mutation.done = true
+ return _node, nil
+}
+
+func (gc *GuardianCreate) createSpec() (*Guardian, *sqlgraph.CreateSpec) {
+ var (
+ _node = &Guardian{config: gc.config}
+ _spec = sqlgraph.NewCreateSpec(guardian.Table, sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID))
+ )
+ if id, ok := gc.mutation.ID(); ok {
+ _node.ID = id
+ _spec.ID.Value = &id
+ }
+ if value, ok := gc.mutation.Email(); ok {
+ _spec.SetField(guardian.FieldEmail, field.TypeString, value)
+ _node.Email = value
+ }
+ if value, ok := gc.mutation.HashedPassword(); ok {
+ _spec.SetField(guardian.FieldHashedPassword, field.TypeString, value)
+ _node.HashedPassword = value
+ }
+ if value, ok := gc.mutation.Name(); ok {
+ _spec.SetField(guardian.FieldName, field.TypeString, value)
+ _node.Name = value
+ }
+ if value, ok := gc.mutation.PhoneNumber(); ok {
+ _spec.SetField(guardian.FieldPhoneNumber, field.TypeString, value)
+ _node.PhoneNumber = value
+ }
+ if value, ok := gc.mutation.IsUseMorningBus(); ok {
+ _spec.SetField(guardian.FieldIsUseMorningBus, field.TypeBool, value)
+ _node.IsUseMorningBus = value
+ }
+ if value, ok := gc.mutation.IsUseEveningBus(); ok {
+ _spec.SetField(guardian.FieldIsUseEveningBus, field.TypeBool, value)
+ _node.IsUseEveningBus = value
+ }
+ if value, ok := gc.mutation.CreatedAt(); ok {
+ _spec.SetField(guardian.FieldCreatedAt, field.TypeTime, value)
+ _node.CreatedAt = value
+ }
+ if value, ok := gc.mutation.UpdatedAt(); ok {
+ _spec.SetField(guardian.FieldUpdatedAt, field.TypeTime, value)
+ _node.UpdatedAt = value
+ }
+ if nodes := gc.mutation.ChildrenIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: guardian.ChildrenTable,
+ Columns: []string{guardian.ChildrenColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := gc.mutation.NurseryIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: guardian.NurseryTable,
+ Columns: []string{guardian.NurseryColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(nursery.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _node.guardian_nursery = &nodes[0]
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := gc.mutation.StationIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2O,
+ Inverse: false,
+ Table: guardian.StationTable,
+ Columns: []string{guardian.StationColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ return _node, _spec
+}
+
+// GuardianCreateBulk is the builder for creating many Guardian entities in bulk.
+type GuardianCreateBulk struct {
+ config
+ err error
+ builders []*GuardianCreate
+}
+
+// Save creates the Guardian entities in the database.
+func (gcb *GuardianCreateBulk) Save(ctx context.Context) ([]*Guardian, error) {
+ if gcb.err != nil {
+ return nil, gcb.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(gcb.builders))
+ nodes := make([]*Guardian, len(gcb.builders))
+ mutators := make([]Mutator, len(gcb.builders))
+ for i := range gcb.builders {
+ func(i int, root context.Context) {
+ builder := gcb.builders[i]
+ builder.defaults()
+ var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+ mutation, ok := m.(*GuardianMutation)
+ if !ok {
+ return nil, fmt.Errorf("unexpected mutation type %T", m)
+ }
+ if err := builder.check(); err != nil {
+ return nil, err
+ }
+ builder.mutation = mutation
+ var err error
+ nodes[i], specs[i] = builder.createSpec()
+ if i < len(mutators)-1 {
+ _, err = mutators[i+1].Mutate(root, gcb.builders[i+1].mutation)
+ } else {
+ spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+ // Invoke the actual operation on the latest mutation in the chain.
+ if err = sqlgraph.BatchCreate(ctx, gcb.driver, spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ }
+ }
+ if err != nil {
+ return nil, err
+ }
+ mutation.id = &nodes[i].ID
+ mutation.done = true
+ return nodes[i], nil
+ })
+ for i := len(builder.hooks) - 1; i >= 0; i-- {
+ mut = builder.hooks[i](mut)
+ }
+ mutators[i] = mut
+ }(i, ctx)
+ }
+ if len(mutators) > 0 {
+ if _, err := mutators[0].Mutate(ctx, gcb.builders[0].mutation); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (gcb *GuardianCreateBulk) SaveX(ctx context.Context) []*Guardian {
+ v, err := gcb.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (gcb *GuardianCreateBulk) Exec(ctx context.Context) error {
+ _, err := gcb.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (gcb *GuardianCreateBulk) ExecX(ctx context.Context) {
+ if err := gcb.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/guardian_delete.go b/backend/domain/repository/ent/guardian_delete.go
new file mode 100644
index 00000000..c3f62535
--- /dev/null
+++ b/backend/domain/repository/ent/guardian_delete.go
@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+)
+
+// GuardianDelete is the builder for deleting a Guardian entity.
+type GuardianDelete struct {
+ config
+ hooks []Hook
+ mutation *GuardianMutation
+}
+
+// Where appends a list predicates to the GuardianDelete builder.
+func (gd *GuardianDelete) Where(ps ...predicate.Guardian) *GuardianDelete {
+ gd.mutation.Where(ps...)
+ return gd
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (gd *GuardianDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, gd.sqlExec, gd.mutation, gd.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (gd *GuardianDelete) ExecX(ctx context.Context) int {
+ n, err := gd.Exec(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return n
+}
+
+func (gd *GuardianDelete) sqlExec(ctx context.Context) (int, error) {
+ _spec := sqlgraph.NewDeleteSpec(guardian.Table, sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID))
+ if ps := gd.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ affected, err := sqlgraph.DeleteNodes(ctx, gd.driver, _spec)
+ if err != nil && sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ gd.mutation.done = true
+ return affected, err
+}
+
+// GuardianDeleteOne is the builder for deleting a single Guardian entity.
+type GuardianDeleteOne struct {
+ gd *GuardianDelete
+}
+
+// Where appends a list predicates to the GuardianDelete builder.
+func (gdo *GuardianDeleteOne) Where(ps ...predicate.Guardian) *GuardianDeleteOne {
+ gdo.gd.mutation.Where(ps...)
+ return gdo
+}
+
+// Exec executes the deletion query.
+func (gdo *GuardianDeleteOne) Exec(ctx context.Context) error {
+ n, err := gdo.gd.Exec(ctx)
+ switch {
+ case err != nil:
+ return err
+ case n == 0:
+ return &NotFoundError{guardian.Label}
+ default:
+ return nil
+ }
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (gdo *GuardianDeleteOne) ExecX(ctx context.Context) {
+ if err := gdo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/guardian_query.go b/backend/domain/repository/ent/guardian_query.go
new file mode 100644
index 00000000..2993b517
--- /dev/null
+++ b/backend/domain/repository/ent/guardian_query.go
@@ -0,0 +1,761 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "database/sql/driver"
+ "fmt"
+ "math"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// GuardianQuery is the builder for querying Guardian entities.
+type GuardianQuery struct {
+ config
+ ctx *QueryContext
+ order []guardian.OrderOption
+ inters []Interceptor
+ predicates []predicate.Guardian
+ withChildren *ChildQuery
+ withNursery *NurseryQuery
+ withStation *StationQuery
+ withFKs bool
+ // intermediate query (i.e. traversal path).
+ sql *sql.Selector
+ path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the GuardianQuery builder.
+func (gq *GuardianQuery) Where(ps ...predicate.Guardian) *GuardianQuery {
+ gq.predicates = append(gq.predicates, ps...)
+ return gq
+}
+
+// Limit the number of records to be returned by this query.
+func (gq *GuardianQuery) Limit(limit int) *GuardianQuery {
+ gq.ctx.Limit = &limit
+ return gq
+}
+
+// Offset to start from.
+func (gq *GuardianQuery) Offset(offset int) *GuardianQuery {
+ gq.ctx.Offset = &offset
+ return gq
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (gq *GuardianQuery) Unique(unique bool) *GuardianQuery {
+ gq.ctx.Unique = &unique
+ return gq
+}
+
+// Order specifies how the records should be ordered.
+func (gq *GuardianQuery) Order(o ...guardian.OrderOption) *GuardianQuery {
+ gq.order = append(gq.order, o...)
+ return gq
+}
+
+// QueryChildren chains the current query on the "children" edge.
+func (gq *GuardianQuery) QueryChildren() *ChildQuery {
+ query := (&ChildClient{config: gq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := gq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := gq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(guardian.Table, guardian.FieldID, selector),
+ sqlgraph.To(child.Table, child.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, guardian.ChildrenTable, guardian.ChildrenColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(gq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryNursery chains the current query on the "nursery" edge.
+func (gq *GuardianQuery) QueryNursery() *NurseryQuery {
+ query := (&NurseryClient{config: gq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := gq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := gq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(guardian.Table, guardian.FieldID, selector),
+ sqlgraph.To(nursery.Table, nursery.FieldID),
+ sqlgraph.Edge(sqlgraph.M2O, false, guardian.NurseryTable, guardian.NurseryColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(gq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryStation chains the current query on the "station" edge.
+func (gq *GuardianQuery) QueryStation() *StationQuery {
+ query := (&StationClient{config: gq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := gq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := gq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(guardian.Table, guardian.FieldID, selector),
+ sqlgraph.To(station.Table, station.FieldID),
+ sqlgraph.Edge(sqlgraph.O2O, false, guardian.StationTable, guardian.StationColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(gq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// First returns the first Guardian entity from the query.
+// Returns a *NotFoundError when no Guardian was found.
+func (gq *GuardianQuery) First(ctx context.Context) (*Guardian, error) {
+ nodes, err := gq.Limit(1).All(setContextOp(ctx, gq.ctx, "First"))
+ if err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nil, &NotFoundError{guardian.Label}
+ }
+ return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (gq *GuardianQuery) FirstX(ctx context.Context) *Guardian {
+ node, err := gq.First(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return node
+}
+
+// FirstID returns the first Guardian ID from the query.
+// Returns a *NotFoundError when no Guardian ID was found.
+func (gq *GuardianQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+ var ids []uuid.UUID
+ if ids, err = gq.Limit(1).IDs(setContextOp(ctx, gq.ctx, "FirstID")); err != nil {
+ return
+ }
+ if len(ids) == 0 {
+ err = &NotFoundError{guardian.Label}
+ return
+ }
+ return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (gq *GuardianQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := gq.FirstID(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return id
+}
+
+// Only returns a single Guardian entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one Guardian entity is found.
+// Returns a *NotFoundError when no Guardian entities are found.
+func (gq *GuardianQuery) Only(ctx context.Context) (*Guardian, error) {
+ nodes, err := gq.Limit(2).All(setContextOp(ctx, gq.ctx, "Only"))
+ if err != nil {
+ return nil, err
+ }
+ switch len(nodes) {
+ case 1:
+ return nodes[0], nil
+ case 0:
+ return nil, &NotFoundError{guardian.Label}
+ default:
+ return nil, &NotSingularError{guardian.Label}
+ }
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (gq *GuardianQuery) OnlyX(ctx context.Context) *Guardian {
+ node, err := gq.Only(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// OnlyID is like Only, but returns the only Guardian ID in the query.
+// Returns a *NotSingularError when more than one Guardian ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (gq *GuardianQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+ var ids []uuid.UUID
+ if ids, err = gq.Limit(2).IDs(setContextOp(ctx, gq.ctx, "OnlyID")); err != nil {
+ return
+ }
+ switch len(ids) {
+ case 1:
+ id = ids[0]
+ case 0:
+ err = &NotFoundError{guardian.Label}
+ default:
+ err = &NotSingularError{guardian.Label}
+ }
+ return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (gq *GuardianQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := gq.OnlyID(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// All executes the query and returns a list of Guardians.
+func (gq *GuardianQuery) All(ctx context.Context) ([]*Guardian, error) {
+ ctx = setContextOp(ctx, gq.ctx, "All")
+ if err := gq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ qr := querierAll[[]*Guardian, *GuardianQuery]()
+ return withInterceptors[[]*Guardian](ctx, gq, qr, gq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (gq *GuardianQuery) AllX(ctx context.Context) []*Guardian {
+ nodes, err := gq.All(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return nodes
+}
+
+// IDs executes the query and returns a list of Guardian IDs.
+func (gq *GuardianQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if gq.ctx.Unique == nil && gq.path != nil {
+ gq.Unique(true)
+ }
+ ctx = setContextOp(ctx, gq.ctx, "IDs")
+ if err = gq.Select(guardian.FieldID).Scan(ctx, &ids); err != nil {
+ return nil, err
+ }
+ return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (gq *GuardianQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := gq.IDs(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return ids
+}
+
+// Count returns the count of the given query.
+func (gq *GuardianQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, gq.ctx, "Count")
+ if err := gq.prepareQuery(ctx); err != nil {
+ return 0, err
+ }
+ return withInterceptors[int](ctx, gq, querierCount[*GuardianQuery](), gq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (gq *GuardianQuery) CountX(ctx context.Context) int {
+ count, err := gq.Count(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (gq *GuardianQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, gq.ctx, "Exist")
+ switch _, err := gq.FirstID(ctx); {
+ case IsNotFound(err):
+ return false, nil
+ case err != nil:
+ return false, fmt.Errorf("ent: check existence: %w", err)
+ default:
+ return true, nil
+ }
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (gq *GuardianQuery) ExistX(ctx context.Context) bool {
+ exist, err := gq.Exist(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return exist
+}
+
+// Clone returns a duplicate of the GuardianQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (gq *GuardianQuery) Clone() *GuardianQuery {
+ if gq == nil {
+ return nil
+ }
+ return &GuardianQuery{
+ config: gq.config,
+ ctx: gq.ctx.Clone(),
+ order: append([]guardian.OrderOption{}, gq.order...),
+ inters: append([]Interceptor{}, gq.inters...),
+ predicates: append([]predicate.Guardian{}, gq.predicates...),
+ withChildren: gq.withChildren.Clone(),
+ withNursery: gq.withNursery.Clone(),
+ withStation: gq.withStation.Clone(),
+ // clone intermediate query.
+ sql: gq.sql.Clone(),
+ path: gq.path,
+ }
+}
+
+// WithChildren tells the query-builder to eager-load the nodes that are connected to
+// the "children" edge. The optional arguments are used to configure the query builder of the edge.
+func (gq *GuardianQuery) WithChildren(opts ...func(*ChildQuery)) *GuardianQuery {
+ query := (&ChildClient{config: gq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ gq.withChildren = query
+ return gq
+}
+
+// WithNursery tells the query-builder to eager-load the nodes that are connected to
+// the "nursery" edge. The optional arguments are used to configure the query builder of the edge.
+func (gq *GuardianQuery) WithNursery(opts ...func(*NurseryQuery)) *GuardianQuery {
+ query := (&NurseryClient{config: gq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ gq.withNursery = query
+ return gq
+}
+
+// WithStation tells the query-builder to eager-load the nodes that are connected to
+// the "station" edge. The optional arguments are used to configure the query builder of the edge.
+func (gq *GuardianQuery) WithStation(opts ...func(*StationQuery)) *GuardianQuery {
+ query := (&StationClient{config: gq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ gq.withStation = query
+ return gq
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+// var v []struct {
+// Email string `json:"email,omitempty"`
+// Count int `json:"count,omitempty"`
+// }
+//
+// client.Guardian.Query().
+// GroupBy(guardian.FieldEmail).
+// Aggregate(ent.Count()).
+// Scan(ctx, &v)
+func (gq *GuardianQuery) GroupBy(field string, fields ...string) *GuardianGroupBy {
+ gq.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &GuardianGroupBy{build: gq}
+ grbuild.flds = &gq.ctx.Fields
+ grbuild.label = guardian.Label
+ grbuild.scan = grbuild.Scan
+ return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+// var v []struct {
+// Email string `json:"email,omitempty"`
+// }
+//
+// client.Guardian.Query().
+// Select(guardian.FieldEmail).
+// Scan(ctx, &v)
+func (gq *GuardianQuery) Select(fields ...string) *GuardianSelect {
+ gq.ctx.Fields = append(gq.ctx.Fields, fields...)
+ sbuild := &GuardianSelect{GuardianQuery: gq}
+ sbuild.label = guardian.Label
+ sbuild.flds, sbuild.scan = &gq.ctx.Fields, sbuild.Scan
+ return sbuild
+}
+
+// Aggregate returns a GuardianSelect configured with the given aggregations.
+func (gq *GuardianQuery) Aggregate(fns ...AggregateFunc) *GuardianSelect {
+ return gq.Select().Aggregate(fns...)
+}
+
+func (gq *GuardianQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range gq.inters {
+ if inter == nil {
+ return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+ }
+ if trv, ok := inter.(Traverser); ok {
+ if err := trv.Traverse(ctx, gq); err != nil {
+ return err
+ }
+ }
+ }
+ for _, f := range gq.ctx.Fields {
+ if !guardian.ValidColumn(f) {
+ return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ }
+ if gq.path != nil {
+ prev, err := gq.path(ctx)
+ if err != nil {
+ return err
+ }
+ gq.sql = prev
+ }
+ return nil
+}
+
+func (gq *GuardianQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Guardian, error) {
+ var (
+ nodes = []*Guardian{}
+ withFKs = gq.withFKs
+ _spec = gq.querySpec()
+ loadedTypes = [3]bool{
+ gq.withChildren != nil,
+ gq.withNursery != nil,
+ gq.withStation != nil,
+ }
+ )
+ if gq.withNursery != nil {
+ withFKs = true
+ }
+ if withFKs {
+ _spec.Node.Columns = append(_spec.Node.Columns, guardian.ForeignKeys...)
+ }
+ _spec.ScanValues = func(columns []string) ([]any, error) {
+ return (*Guardian).scanValues(nil, columns)
+ }
+ _spec.Assign = func(columns []string, values []any) error {
+ node := &Guardian{config: gq.config}
+ nodes = append(nodes, node)
+ node.Edges.loadedTypes = loadedTypes
+ return node.assignValues(columns, values)
+ }
+ for i := range hooks {
+ hooks[i](ctx, _spec)
+ }
+ if err := sqlgraph.QueryNodes(ctx, gq.driver, _spec); err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nodes, nil
+ }
+ if query := gq.withChildren; query != nil {
+ if err := gq.loadChildren(ctx, query, nodes,
+ func(n *Guardian) { n.Edges.Children = []*Child{} },
+ func(n *Guardian, e *Child) { n.Edges.Children = append(n.Edges.Children, e) }); err != nil {
+ return nil, err
+ }
+ }
+ if query := gq.withNursery; query != nil {
+ if err := gq.loadNursery(ctx, query, nodes, nil,
+ func(n *Guardian, e *Nursery) { n.Edges.Nursery = e }); err != nil {
+ return nil, err
+ }
+ }
+ if query := gq.withStation; query != nil {
+ if err := gq.loadStation(ctx, query, nodes, nil,
+ func(n *Guardian, e *Station) { n.Edges.Station = e }); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+func (gq *GuardianQuery) loadChildren(ctx context.Context, query *ChildQuery, nodes []*Guardian, init func(*Guardian), assign func(*Guardian, *Child)) error {
+ fks := make([]driver.Value, 0, len(nodes))
+ nodeids := make(map[uuid.UUID]*Guardian)
+ for i := range nodes {
+ fks = append(fks, nodes[i].ID)
+ nodeids[nodes[i].ID] = nodes[i]
+ if init != nil {
+ init(nodes[i])
+ }
+ }
+ query.withFKs = true
+ query.Where(predicate.Child(func(s *sql.Selector) {
+ s.Where(sql.InValues(s.C(guardian.ChildrenColumn), fks...))
+ }))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ fk := n.guardian_children
+ if fk == nil {
+ return fmt.Errorf(`foreign-key "guardian_children" is nil for node %v`, n.ID)
+ }
+ node, ok := nodeids[*fk]
+ if !ok {
+ return fmt.Errorf(`unexpected referenced foreign-key "guardian_children" returned %v for node %v`, *fk, n.ID)
+ }
+ assign(node, n)
+ }
+ return nil
+}
+func (gq *GuardianQuery) loadNursery(ctx context.Context, query *NurseryQuery, nodes []*Guardian, init func(*Guardian), assign func(*Guardian, *Nursery)) error {
+ ids := make([]uuid.UUID, 0, len(nodes))
+ nodeids := make(map[uuid.UUID][]*Guardian)
+ for i := range nodes {
+ if nodes[i].guardian_nursery == nil {
+ continue
+ }
+ fk := *nodes[i].guardian_nursery
+ if _, ok := nodeids[fk]; !ok {
+ ids = append(ids, fk)
+ }
+ nodeids[fk] = append(nodeids[fk], nodes[i])
+ }
+ if len(ids) == 0 {
+ return nil
+ }
+ query.Where(nursery.IDIn(ids...))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ nodes, ok := nodeids[n.ID]
+ if !ok {
+ return fmt.Errorf(`unexpected foreign-key "guardian_nursery" returned %v`, n.ID)
+ }
+ for i := range nodes {
+ assign(nodes[i], n)
+ }
+ }
+ return nil
+}
+func (gq *GuardianQuery) loadStation(ctx context.Context, query *StationQuery, nodes []*Guardian, init func(*Guardian), assign func(*Guardian, *Station)) error {
+ fks := make([]driver.Value, 0, len(nodes))
+ nodeids := make(map[uuid.UUID]*Guardian)
+ for i := range nodes {
+ fks = append(fks, nodes[i].ID)
+ nodeids[nodes[i].ID] = nodes[i]
+ }
+ query.withFKs = true
+ query.Where(predicate.Station(func(s *sql.Selector) {
+ s.Where(sql.InValues(s.C(guardian.StationColumn), fks...))
+ }))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ fk := n.guardian_station
+ if fk == nil {
+ return fmt.Errorf(`foreign-key "guardian_station" is nil for node %v`, n.ID)
+ }
+ node, ok := nodeids[*fk]
+ if !ok {
+ return fmt.Errorf(`unexpected referenced foreign-key "guardian_station" returned %v for node %v`, *fk, n.ID)
+ }
+ assign(node, n)
+ }
+ return nil
+}
+
+func (gq *GuardianQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := gq.querySpec()
+ _spec.Node.Columns = gq.ctx.Fields
+ if len(gq.ctx.Fields) > 0 {
+ _spec.Unique = gq.ctx.Unique != nil && *gq.ctx.Unique
+ }
+ return sqlgraph.CountNodes(ctx, gq.driver, _spec)
+}
+
+func (gq *GuardianQuery) querySpec() *sqlgraph.QuerySpec {
+ _spec := sqlgraph.NewQuerySpec(guardian.Table, guardian.Columns, sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID))
+ _spec.From = gq.sql
+ if unique := gq.ctx.Unique; unique != nil {
+ _spec.Unique = *unique
+ } else if gq.path != nil {
+ _spec.Unique = true
+ }
+ if fields := gq.ctx.Fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, guardian.FieldID)
+ for i := range fields {
+ if fields[i] != guardian.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+ }
+ }
+ }
+ if ps := gq.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if limit := gq.ctx.Limit; limit != nil {
+ _spec.Limit = *limit
+ }
+ if offset := gq.ctx.Offset; offset != nil {
+ _spec.Offset = *offset
+ }
+ if ps := gq.order; len(ps) > 0 {
+ _spec.Order = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ return _spec
+}
+
+func (gq *GuardianQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(gq.driver.Dialect())
+ t1 := builder.Table(guardian.Table)
+ columns := gq.ctx.Fields
+ if len(columns) == 0 {
+ columns = guardian.Columns
+ }
+ selector := builder.Select(t1.Columns(columns...)...).From(t1)
+ if gq.sql != nil {
+ selector = gq.sql
+ selector.Select(selector.Columns(columns...)...)
+ }
+ if gq.ctx.Unique != nil && *gq.ctx.Unique {
+ selector.Distinct()
+ }
+ for _, p := range gq.predicates {
+ p(selector)
+ }
+ for _, p := range gq.order {
+ p(selector)
+ }
+ if offset := gq.ctx.Offset; offset != nil {
+ // limit is mandatory for offset clause. We start
+ // with default value, and override it below if needed.
+ selector.Offset(*offset).Limit(math.MaxInt32)
+ }
+ if limit := gq.ctx.Limit; limit != nil {
+ selector.Limit(*limit)
+ }
+ return selector
+}
+
+// GuardianGroupBy is the group-by builder for Guardian entities.
+type GuardianGroupBy struct {
+ selector
+ build *GuardianQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (ggb *GuardianGroupBy) Aggregate(fns ...AggregateFunc) *GuardianGroupBy {
+ ggb.fns = append(ggb.fns, fns...)
+ return ggb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (ggb *GuardianGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, ggb.build.ctx, "GroupBy")
+ if err := ggb.build.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*GuardianQuery, *GuardianGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v)
+}
+
+func (ggb *GuardianGroupBy) sqlScan(ctx context.Context, root *GuardianQuery, v any) error {
+ selector := root.sqlQuery(ctx).Select()
+ aggregation := make([]string, 0, len(ggb.fns))
+ for _, fn := range ggb.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ if len(selector.SelectedColumns()) == 0 {
+ columns := make([]string, 0, len(*ggb.flds)+len(ggb.fns))
+ for _, f := range *ggb.flds {
+ columns = append(columns, selector.C(f))
+ }
+ columns = append(columns, aggregation...)
+ selector.Select(columns...)
+ }
+ selector.GroupBy(selector.Columns(*ggb.flds...)...)
+ if err := selector.Err(); err != nil {
+ return err
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := ggb.build.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
+
+// GuardianSelect is the builder for selecting fields of Guardian entities.
+type GuardianSelect struct {
+ *GuardianQuery
+ selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (gs *GuardianSelect) Aggregate(fns ...AggregateFunc) *GuardianSelect {
+ gs.fns = append(gs.fns, fns...)
+ return gs
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (gs *GuardianSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, gs.ctx, "Select")
+ if err := gs.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*GuardianQuery, *GuardianSelect](ctx, gs.GuardianQuery, gs, gs.inters, v)
+}
+
+func (gs *GuardianSelect) sqlScan(ctx context.Context, root *GuardianQuery, v any) error {
+ selector := root.sqlQuery(ctx)
+ aggregation := make([]string, 0, len(gs.fns))
+ for _, fn := range gs.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ switch n := len(*gs.selector.flds); {
+ case n == 0 && len(aggregation) > 0:
+ selector.Select(aggregation...)
+ case n != 0 && len(aggregation) > 0:
+ selector.AppendSelect(aggregation...)
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := gs.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
diff --git a/backend/domain/repository/ent/guardian_update.go b/backend/domain/repository/ent/guardian_update.go
new file mode 100644
index 00000000..2db1ee88
--- /dev/null
+++ b/backend/domain/repository/ent/guardian_update.go
@@ -0,0 +1,850 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// GuardianUpdate is the builder for updating Guardian entities.
+type GuardianUpdate struct {
+ config
+ hooks []Hook
+ mutation *GuardianMutation
+}
+
+// Where appends a list predicates to the GuardianUpdate builder.
+func (gu *GuardianUpdate) Where(ps ...predicate.Guardian) *GuardianUpdate {
+ gu.mutation.Where(ps...)
+ return gu
+}
+
+// SetEmail sets the "email" field.
+func (gu *GuardianUpdate) SetEmail(s string) *GuardianUpdate {
+ gu.mutation.SetEmail(s)
+ return gu
+}
+
+// SetNillableEmail sets the "email" field if the given value is not nil.
+func (gu *GuardianUpdate) SetNillableEmail(s *string) *GuardianUpdate {
+ if s != nil {
+ gu.SetEmail(*s)
+ }
+ return gu
+}
+
+// SetHashedPassword sets the "hashed_password" field.
+func (gu *GuardianUpdate) SetHashedPassword(s string) *GuardianUpdate {
+ gu.mutation.SetHashedPassword(s)
+ return gu
+}
+
+// SetNillableHashedPassword sets the "hashed_password" field if the given value is not nil.
+func (gu *GuardianUpdate) SetNillableHashedPassword(s *string) *GuardianUpdate {
+ if s != nil {
+ gu.SetHashedPassword(*s)
+ }
+ return gu
+}
+
+// SetName sets the "name" field.
+func (gu *GuardianUpdate) SetName(s string) *GuardianUpdate {
+ gu.mutation.SetName(s)
+ return gu
+}
+
+// SetNillableName sets the "name" field if the given value is not nil.
+func (gu *GuardianUpdate) SetNillableName(s *string) *GuardianUpdate {
+ if s != nil {
+ gu.SetName(*s)
+ }
+ return gu
+}
+
+// SetPhoneNumber sets the "phone_number" field.
+func (gu *GuardianUpdate) SetPhoneNumber(s string) *GuardianUpdate {
+ gu.mutation.SetPhoneNumber(s)
+ return gu
+}
+
+// SetNillablePhoneNumber sets the "phone_number" field if the given value is not nil.
+func (gu *GuardianUpdate) SetNillablePhoneNumber(s *string) *GuardianUpdate {
+ if s != nil {
+ gu.SetPhoneNumber(*s)
+ }
+ return gu
+}
+
+// ClearPhoneNumber clears the value of the "phone_number" field.
+func (gu *GuardianUpdate) ClearPhoneNumber() *GuardianUpdate {
+ gu.mutation.ClearPhoneNumber()
+ return gu
+}
+
+// SetIsUseMorningBus sets the "is_use_morning_bus" field.
+func (gu *GuardianUpdate) SetIsUseMorningBus(b bool) *GuardianUpdate {
+ gu.mutation.SetIsUseMorningBus(b)
+ return gu
+}
+
+// SetNillableIsUseMorningBus sets the "is_use_morning_bus" field if the given value is not nil.
+func (gu *GuardianUpdate) SetNillableIsUseMorningBus(b *bool) *GuardianUpdate {
+ if b != nil {
+ gu.SetIsUseMorningBus(*b)
+ }
+ return gu
+}
+
+// SetIsUseEveningBus sets the "is_use_evening_bus" field.
+func (gu *GuardianUpdate) SetIsUseEveningBus(b bool) *GuardianUpdate {
+ gu.mutation.SetIsUseEveningBus(b)
+ return gu
+}
+
+// SetNillableIsUseEveningBus sets the "is_use_evening_bus" field if the given value is not nil.
+func (gu *GuardianUpdate) SetNillableIsUseEveningBus(b *bool) *GuardianUpdate {
+ if b != nil {
+ gu.SetIsUseEveningBus(*b)
+ }
+ return gu
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (gu *GuardianUpdate) SetCreatedAt(t time.Time) *GuardianUpdate {
+ gu.mutation.SetCreatedAt(t)
+ return gu
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (gu *GuardianUpdate) SetNillableCreatedAt(t *time.Time) *GuardianUpdate {
+ if t != nil {
+ gu.SetCreatedAt(*t)
+ }
+ return gu
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (gu *GuardianUpdate) SetUpdatedAt(t time.Time) *GuardianUpdate {
+ gu.mutation.SetUpdatedAt(t)
+ return gu
+}
+
+// AddChildIDs adds the "children" edge to the Child entity by IDs.
+func (gu *GuardianUpdate) AddChildIDs(ids ...uuid.UUID) *GuardianUpdate {
+ gu.mutation.AddChildIDs(ids...)
+ return gu
+}
+
+// AddChildren adds the "children" edges to the Child entity.
+func (gu *GuardianUpdate) AddChildren(c ...*Child) *GuardianUpdate {
+ ids := make([]uuid.UUID, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return gu.AddChildIDs(ids...)
+}
+
+// SetNurseryID sets the "nursery" edge to the Nursery entity by ID.
+func (gu *GuardianUpdate) SetNurseryID(id uuid.UUID) *GuardianUpdate {
+ gu.mutation.SetNurseryID(id)
+ return gu
+}
+
+// SetNillableNurseryID sets the "nursery" edge to the Nursery entity by ID if the given value is not nil.
+func (gu *GuardianUpdate) SetNillableNurseryID(id *uuid.UUID) *GuardianUpdate {
+ if id != nil {
+ gu = gu.SetNurseryID(*id)
+ }
+ return gu
+}
+
+// SetNursery sets the "nursery" edge to the Nursery entity.
+func (gu *GuardianUpdate) SetNursery(n *Nursery) *GuardianUpdate {
+ return gu.SetNurseryID(n.ID)
+}
+
+// SetStationID sets the "station" edge to the Station entity by ID.
+func (gu *GuardianUpdate) SetStationID(id uuid.UUID) *GuardianUpdate {
+ gu.mutation.SetStationID(id)
+ return gu
+}
+
+// SetNillableStationID sets the "station" edge to the Station entity by ID if the given value is not nil.
+func (gu *GuardianUpdate) SetNillableStationID(id *uuid.UUID) *GuardianUpdate {
+ if id != nil {
+ gu = gu.SetStationID(*id)
+ }
+ return gu
+}
+
+// SetStation sets the "station" edge to the Station entity.
+func (gu *GuardianUpdate) SetStation(s *Station) *GuardianUpdate {
+ return gu.SetStationID(s.ID)
+}
+
+// Mutation returns the GuardianMutation object of the builder.
+func (gu *GuardianUpdate) Mutation() *GuardianMutation {
+ return gu.mutation
+}
+
+// ClearChildren clears all "children" edges to the Child entity.
+func (gu *GuardianUpdate) ClearChildren() *GuardianUpdate {
+ gu.mutation.ClearChildren()
+ return gu
+}
+
+// RemoveChildIDs removes the "children" edge to Child entities by IDs.
+func (gu *GuardianUpdate) RemoveChildIDs(ids ...uuid.UUID) *GuardianUpdate {
+ gu.mutation.RemoveChildIDs(ids...)
+ return gu
+}
+
+// RemoveChildren removes "children" edges to Child entities.
+func (gu *GuardianUpdate) RemoveChildren(c ...*Child) *GuardianUpdate {
+ ids := make([]uuid.UUID, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return gu.RemoveChildIDs(ids...)
+}
+
+// ClearNursery clears the "nursery" edge to the Nursery entity.
+func (gu *GuardianUpdate) ClearNursery() *GuardianUpdate {
+ gu.mutation.ClearNursery()
+ return gu
+}
+
+// ClearStation clears the "station" edge to the Station entity.
+func (gu *GuardianUpdate) ClearStation() *GuardianUpdate {
+ gu.mutation.ClearStation()
+ return gu
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (gu *GuardianUpdate) Save(ctx context.Context) (int, error) {
+ gu.defaults()
+ return withHooks(ctx, gu.sqlSave, gu.mutation, gu.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (gu *GuardianUpdate) SaveX(ctx context.Context) int {
+ affected, err := gu.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return affected
+}
+
+// Exec executes the query.
+func (gu *GuardianUpdate) Exec(ctx context.Context) error {
+ _, err := gu.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (gu *GuardianUpdate) ExecX(ctx context.Context) {
+ if err := gu.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (gu *GuardianUpdate) defaults() {
+ if _, ok := gu.mutation.UpdatedAt(); !ok {
+ v := guardian.UpdateDefaultUpdatedAt()
+ gu.mutation.SetUpdatedAt(v)
+ }
+}
+
+func (gu *GuardianUpdate) sqlSave(ctx context.Context) (n int, err error) {
+ _spec := sqlgraph.NewUpdateSpec(guardian.Table, guardian.Columns, sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID))
+ if ps := gu.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := gu.mutation.Email(); ok {
+ _spec.SetField(guardian.FieldEmail, field.TypeString, value)
+ }
+ if value, ok := gu.mutation.HashedPassword(); ok {
+ _spec.SetField(guardian.FieldHashedPassword, field.TypeString, value)
+ }
+ if value, ok := gu.mutation.Name(); ok {
+ _spec.SetField(guardian.FieldName, field.TypeString, value)
+ }
+ if value, ok := gu.mutation.PhoneNumber(); ok {
+ _spec.SetField(guardian.FieldPhoneNumber, field.TypeString, value)
+ }
+ if gu.mutation.PhoneNumberCleared() {
+ _spec.ClearField(guardian.FieldPhoneNumber, field.TypeString)
+ }
+ if value, ok := gu.mutation.IsUseMorningBus(); ok {
+ _spec.SetField(guardian.FieldIsUseMorningBus, field.TypeBool, value)
+ }
+ if value, ok := gu.mutation.IsUseEveningBus(); ok {
+ _spec.SetField(guardian.FieldIsUseEveningBus, field.TypeBool, value)
+ }
+ if value, ok := gu.mutation.CreatedAt(); ok {
+ _spec.SetField(guardian.FieldCreatedAt, field.TypeTime, value)
+ }
+ if value, ok := gu.mutation.UpdatedAt(); ok {
+ _spec.SetField(guardian.FieldUpdatedAt, field.TypeTime, value)
+ }
+ if gu.mutation.ChildrenCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: guardian.ChildrenTable,
+ Columns: []string{guardian.ChildrenColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := gu.mutation.RemovedChildrenIDs(); len(nodes) > 0 && !gu.mutation.ChildrenCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: guardian.ChildrenTable,
+ Columns: []string{guardian.ChildrenColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := gu.mutation.ChildrenIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: guardian.ChildrenTable,
+ Columns: []string{guardian.ChildrenColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if gu.mutation.NurseryCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: guardian.NurseryTable,
+ Columns: []string{guardian.NurseryColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(nursery.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := gu.mutation.NurseryIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: guardian.NurseryTable,
+ Columns: []string{guardian.NurseryColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(nursery.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if gu.mutation.StationCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2O,
+ Inverse: false,
+ Table: guardian.StationTable,
+ Columns: []string{guardian.StationColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := gu.mutation.StationIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2O,
+ Inverse: false,
+ Table: guardian.StationTable,
+ Columns: []string{guardian.StationColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if n, err = sqlgraph.UpdateNodes(ctx, gu.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{guardian.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return 0, err
+ }
+ gu.mutation.done = true
+ return n, nil
+}
+
+// GuardianUpdateOne is the builder for updating a single Guardian entity.
+type GuardianUpdateOne struct {
+ config
+ fields []string
+ hooks []Hook
+ mutation *GuardianMutation
+}
+
+// SetEmail sets the "email" field.
+func (guo *GuardianUpdateOne) SetEmail(s string) *GuardianUpdateOne {
+ guo.mutation.SetEmail(s)
+ return guo
+}
+
+// SetNillableEmail sets the "email" field if the given value is not nil.
+func (guo *GuardianUpdateOne) SetNillableEmail(s *string) *GuardianUpdateOne {
+ if s != nil {
+ guo.SetEmail(*s)
+ }
+ return guo
+}
+
+// SetHashedPassword sets the "hashed_password" field.
+func (guo *GuardianUpdateOne) SetHashedPassword(s string) *GuardianUpdateOne {
+ guo.mutation.SetHashedPassword(s)
+ return guo
+}
+
+// SetNillableHashedPassword sets the "hashed_password" field if the given value is not nil.
+func (guo *GuardianUpdateOne) SetNillableHashedPassword(s *string) *GuardianUpdateOne {
+ if s != nil {
+ guo.SetHashedPassword(*s)
+ }
+ return guo
+}
+
+// SetName sets the "name" field.
+func (guo *GuardianUpdateOne) SetName(s string) *GuardianUpdateOne {
+ guo.mutation.SetName(s)
+ return guo
+}
+
+// SetNillableName sets the "name" field if the given value is not nil.
+func (guo *GuardianUpdateOne) SetNillableName(s *string) *GuardianUpdateOne {
+ if s != nil {
+ guo.SetName(*s)
+ }
+ return guo
+}
+
+// SetPhoneNumber sets the "phone_number" field.
+func (guo *GuardianUpdateOne) SetPhoneNumber(s string) *GuardianUpdateOne {
+ guo.mutation.SetPhoneNumber(s)
+ return guo
+}
+
+// SetNillablePhoneNumber sets the "phone_number" field if the given value is not nil.
+func (guo *GuardianUpdateOne) SetNillablePhoneNumber(s *string) *GuardianUpdateOne {
+ if s != nil {
+ guo.SetPhoneNumber(*s)
+ }
+ return guo
+}
+
+// ClearPhoneNumber clears the value of the "phone_number" field.
+func (guo *GuardianUpdateOne) ClearPhoneNumber() *GuardianUpdateOne {
+ guo.mutation.ClearPhoneNumber()
+ return guo
+}
+
+// SetIsUseMorningBus sets the "is_use_morning_bus" field.
+func (guo *GuardianUpdateOne) SetIsUseMorningBus(b bool) *GuardianUpdateOne {
+ guo.mutation.SetIsUseMorningBus(b)
+ return guo
+}
+
+// SetNillableIsUseMorningBus sets the "is_use_morning_bus" field if the given value is not nil.
+func (guo *GuardianUpdateOne) SetNillableIsUseMorningBus(b *bool) *GuardianUpdateOne {
+ if b != nil {
+ guo.SetIsUseMorningBus(*b)
+ }
+ return guo
+}
+
+// SetIsUseEveningBus sets the "is_use_evening_bus" field.
+func (guo *GuardianUpdateOne) SetIsUseEveningBus(b bool) *GuardianUpdateOne {
+ guo.mutation.SetIsUseEveningBus(b)
+ return guo
+}
+
+// SetNillableIsUseEveningBus sets the "is_use_evening_bus" field if the given value is not nil.
+func (guo *GuardianUpdateOne) SetNillableIsUseEveningBus(b *bool) *GuardianUpdateOne {
+ if b != nil {
+ guo.SetIsUseEveningBus(*b)
+ }
+ return guo
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (guo *GuardianUpdateOne) SetCreatedAt(t time.Time) *GuardianUpdateOne {
+ guo.mutation.SetCreatedAt(t)
+ return guo
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (guo *GuardianUpdateOne) SetNillableCreatedAt(t *time.Time) *GuardianUpdateOne {
+ if t != nil {
+ guo.SetCreatedAt(*t)
+ }
+ return guo
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (guo *GuardianUpdateOne) SetUpdatedAt(t time.Time) *GuardianUpdateOne {
+ guo.mutation.SetUpdatedAt(t)
+ return guo
+}
+
+// AddChildIDs adds the "children" edge to the Child entity by IDs.
+func (guo *GuardianUpdateOne) AddChildIDs(ids ...uuid.UUID) *GuardianUpdateOne {
+ guo.mutation.AddChildIDs(ids...)
+ return guo
+}
+
+// AddChildren adds the "children" edges to the Child entity.
+func (guo *GuardianUpdateOne) AddChildren(c ...*Child) *GuardianUpdateOne {
+ ids := make([]uuid.UUID, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return guo.AddChildIDs(ids...)
+}
+
+// SetNurseryID sets the "nursery" edge to the Nursery entity by ID.
+func (guo *GuardianUpdateOne) SetNurseryID(id uuid.UUID) *GuardianUpdateOne {
+ guo.mutation.SetNurseryID(id)
+ return guo
+}
+
+// SetNillableNurseryID sets the "nursery" edge to the Nursery entity by ID if the given value is not nil.
+func (guo *GuardianUpdateOne) SetNillableNurseryID(id *uuid.UUID) *GuardianUpdateOne {
+ if id != nil {
+ guo = guo.SetNurseryID(*id)
+ }
+ return guo
+}
+
+// SetNursery sets the "nursery" edge to the Nursery entity.
+func (guo *GuardianUpdateOne) SetNursery(n *Nursery) *GuardianUpdateOne {
+ return guo.SetNurseryID(n.ID)
+}
+
+// SetStationID sets the "station" edge to the Station entity by ID.
+func (guo *GuardianUpdateOne) SetStationID(id uuid.UUID) *GuardianUpdateOne {
+ guo.mutation.SetStationID(id)
+ return guo
+}
+
+// SetNillableStationID sets the "station" edge to the Station entity by ID if the given value is not nil.
+func (guo *GuardianUpdateOne) SetNillableStationID(id *uuid.UUID) *GuardianUpdateOne {
+ if id != nil {
+ guo = guo.SetStationID(*id)
+ }
+ return guo
+}
+
+// SetStation sets the "station" edge to the Station entity.
+func (guo *GuardianUpdateOne) SetStation(s *Station) *GuardianUpdateOne {
+ return guo.SetStationID(s.ID)
+}
+
+// Mutation returns the GuardianMutation object of the builder.
+func (guo *GuardianUpdateOne) Mutation() *GuardianMutation {
+ return guo.mutation
+}
+
+// ClearChildren clears all "children" edges to the Child entity.
+func (guo *GuardianUpdateOne) ClearChildren() *GuardianUpdateOne {
+ guo.mutation.ClearChildren()
+ return guo
+}
+
+// RemoveChildIDs removes the "children" edge to Child entities by IDs.
+func (guo *GuardianUpdateOne) RemoveChildIDs(ids ...uuid.UUID) *GuardianUpdateOne {
+ guo.mutation.RemoveChildIDs(ids...)
+ return guo
+}
+
+// RemoveChildren removes "children" edges to Child entities.
+func (guo *GuardianUpdateOne) RemoveChildren(c ...*Child) *GuardianUpdateOne {
+ ids := make([]uuid.UUID, len(c))
+ for i := range c {
+ ids[i] = c[i].ID
+ }
+ return guo.RemoveChildIDs(ids...)
+}
+
+// ClearNursery clears the "nursery" edge to the Nursery entity.
+func (guo *GuardianUpdateOne) ClearNursery() *GuardianUpdateOne {
+ guo.mutation.ClearNursery()
+ return guo
+}
+
+// ClearStation clears the "station" edge to the Station entity.
+func (guo *GuardianUpdateOne) ClearStation() *GuardianUpdateOne {
+ guo.mutation.ClearStation()
+ return guo
+}
+
+// Where appends a list predicates to the GuardianUpdate builder.
+func (guo *GuardianUpdateOne) Where(ps ...predicate.Guardian) *GuardianUpdateOne {
+ guo.mutation.Where(ps...)
+ return guo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (guo *GuardianUpdateOne) Select(field string, fields ...string) *GuardianUpdateOne {
+ guo.fields = append([]string{field}, fields...)
+ return guo
+}
+
+// Save executes the query and returns the updated Guardian entity.
+func (guo *GuardianUpdateOne) Save(ctx context.Context) (*Guardian, error) {
+ guo.defaults()
+ return withHooks(ctx, guo.sqlSave, guo.mutation, guo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (guo *GuardianUpdateOne) SaveX(ctx context.Context) *Guardian {
+ node, err := guo.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// Exec executes the query on the entity.
+func (guo *GuardianUpdateOne) Exec(ctx context.Context) error {
+ _, err := guo.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (guo *GuardianUpdateOne) ExecX(ctx context.Context) {
+ if err := guo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (guo *GuardianUpdateOne) defaults() {
+ if _, ok := guo.mutation.UpdatedAt(); !ok {
+ v := guardian.UpdateDefaultUpdatedAt()
+ guo.mutation.SetUpdatedAt(v)
+ }
+}
+
+func (guo *GuardianUpdateOne) sqlSave(ctx context.Context) (_node *Guardian, err error) {
+ _spec := sqlgraph.NewUpdateSpec(guardian.Table, guardian.Columns, sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID))
+ id, ok := guo.mutation.ID()
+ if !ok {
+ return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Guardian.id" for update`)}
+ }
+ _spec.Node.ID.Value = id
+ if fields := guo.fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, guardian.FieldID)
+ for _, f := range fields {
+ if !guardian.ValidColumn(f) {
+ return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ if f != guardian.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, f)
+ }
+ }
+ }
+ if ps := guo.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := guo.mutation.Email(); ok {
+ _spec.SetField(guardian.FieldEmail, field.TypeString, value)
+ }
+ if value, ok := guo.mutation.HashedPassword(); ok {
+ _spec.SetField(guardian.FieldHashedPassword, field.TypeString, value)
+ }
+ if value, ok := guo.mutation.Name(); ok {
+ _spec.SetField(guardian.FieldName, field.TypeString, value)
+ }
+ if value, ok := guo.mutation.PhoneNumber(); ok {
+ _spec.SetField(guardian.FieldPhoneNumber, field.TypeString, value)
+ }
+ if guo.mutation.PhoneNumberCleared() {
+ _spec.ClearField(guardian.FieldPhoneNumber, field.TypeString)
+ }
+ if value, ok := guo.mutation.IsUseMorningBus(); ok {
+ _spec.SetField(guardian.FieldIsUseMorningBus, field.TypeBool, value)
+ }
+ if value, ok := guo.mutation.IsUseEveningBus(); ok {
+ _spec.SetField(guardian.FieldIsUseEveningBus, field.TypeBool, value)
+ }
+ if value, ok := guo.mutation.CreatedAt(); ok {
+ _spec.SetField(guardian.FieldCreatedAt, field.TypeTime, value)
+ }
+ if value, ok := guo.mutation.UpdatedAt(); ok {
+ _spec.SetField(guardian.FieldUpdatedAt, field.TypeTime, value)
+ }
+ if guo.mutation.ChildrenCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: guardian.ChildrenTable,
+ Columns: []string{guardian.ChildrenColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := guo.mutation.RemovedChildrenIDs(); len(nodes) > 0 && !guo.mutation.ChildrenCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: guardian.ChildrenTable,
+ Columns: []string{guardian.ChildrenColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := guo.mutation.ChildrenIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: guardian.ChildrenTable,
+ Columns: []string{guardian.ChildrenColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(child.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if guo.mutation.NurseryCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: guardian.NurseryTable,
+ Columns: []string{guardian.NurseryColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(nursery.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := guo.mutation.NurseryIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.M2O,
+ Inverse: false,
+ Table: guardian.NurseryTable,
+ Columns: []string{guardian.NurseryColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(nursery.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if guo.mutation.StationCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2O,
+ Inverse: false,
+ Table: guardian.StationTable,
+ Columns: []string{guardian.StationColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := guo.mutation.StationIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2O,
+ Inverse: false,
+ Table: guardian.StationTable,
+ Columns: []string{guardian.StationColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ _node = &Guardian{config: guo.config}
+ _spec.Assign = _node.assignValues
+ _spec.ScanValues = _node.scanValues
+ if err = sqlgraph.UpdateNode(ctx, guo.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{guardian.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ guo.mutation.done = true
+ return _node, nil
+}
diff --git a/backend/domain/repository/ent/hook/hook.go b/backend/domain/repository/ent/hook/hook.go
new file mode 100644
index 00000000..a1ac0b57
--- /dev/null
+++ b/backend/domain/repository/ent/hook/hook.go
@@ -0,0 +1,307 @@
+// Code generated by ent, DO NOT EDIT.
+
+package hook
+
+import (
+ "context"
+ "fmt"
+
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent"
+)
+
+// The BoardingRecordFunc type is an adapter to allow the use of ordinary
+// function as BoardingRecord mutator.
+type BoardingRecordFunc func(context.Context, *ent.BoardingRecordMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f BoardingRecordFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+ if mv, ok := m.(*ent.BoardingRecordMutation); ok {
+ return f(ctx, mv)
+ }
+ return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.BoardingRecordMutation", m)
+}
+
+// The BusFunc type is an adapter to allow the use of ordinary
+// function as Bus mutator.
+type BusFunc func(context.Context, *ent.BusMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f BusFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+ if mv, ok := m.(*ent.BusMutation); ok {
+ return f(ctx, mv)
+ }
+ return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.BusMutation", m)
+}
+
+// The BusRouteFunc type is an adapter to allow the use of ordinary
+// function as BusRoute mutator.
+type BusRouteFunc func(context.Context, *ent.BusRouteMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f BusRouteFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+ if mv, ok := m.(*ent.BusRouteMutation); ok {
+ return f(ctx, mv)
+ }
+ return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.BusRouteMutation", m)
+}
+
+// The BusRouteAssociationFunc type is an adapter to allow the use of ordinary
+// function as BusRouteAssociation mutator.
+type BusRouteAssociationFunc func(context.Context, *ent.BusRouteAssociationMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f BusRouteAssociationFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+ if mv, ok := m.(*ent.BusRouteAssociationMutation); ok {
+ return f(ctx, mv)
+ }
+ return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.BusRouteAssociationMutation", m)
+}
+
+// The ChildFunc type is an adapter to allow the use of ordinary
+// function as Child mutator.
+type ChildFunc func(context.Context, *ent.ChildMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f ChildFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+ if mv, ok := m.(*ent.ChildMutation); ok {
+ return f(ctx, mv)
+ }
+ return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.ChildMutation", m)
+}
+
+// The ChildBusAssociationFunc type is an adapter to allow the use of ordinary
+// function as ChildBusAssociation mutator.
+type ChildBusAssociationFunc func(context.Context, *ent.ChildBusAssociationMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f ChildBusAssociationFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+ if mv, ok := m.(*ent.ChildBusAssociationMutation); ok {
+ return f(ctx, mv)
+ }
+ return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.ChildBusAssociationMutation", m)
+}
+
+// The ChildPhotoFunc type is an adapter to allow the use of ordinary
+// function as ChildPhoto mutator.
+type ChildPhotoFunc func(context.Context, *ent.ChildPhotoMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f ChildPhotoFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+ if mv, ok := m.(*ent.ChildPhotoMutation); ok {
+ return f(ctx, mv)
+ }
+ return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.ChildPhotoMutation", m)
+}
+
+// The GuardianFunc type is an adapter to allow the use of ordinary
+// function as Guardian mutator.
+type GuardianFunc func(context.Context, *ent.GuardianMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f GuardianFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+ if mv, ok := m.(*ent.GuardianMutation); ok {
+ return f(ctx, mv)
+ }
+ return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.GuardianMutation", m)
+}
+
+// The NurseryFunc type is an adapter to allow the use of ordinary
+// function as Nursery mutator.
+type NurseryFunc func(context.Context, *ent.NurseryMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f NurseryFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+ if mv, ok := m.(*ent.NurseryMutation); ok {
+ return f(ctx, mv)
+ }
+ return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.NurseryMutation", m)
+}
+
+// The StationFunc type is an adapter to allow the use of ordinary
+// function as Station mutator.
+type StationFunc func(context.Context, *ent.StationMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f StationFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+ if mv, ok := m.(*ent.StationMutation); ok {
+ return f(ctx, mv)
+ }
+ return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.StationMutation", m)
+}
+
+// Condition is a hook condition function.
+type Condition func(context.Context, ent.Mutation) bool
+
+// And groups conditions with the AND operator.
+func And(first, second Condition, rest ...Condition) Condition {
+ return func(ctx context.Context, m ent.Mutation) bool {
+ if !first(ctx, m) || !second(ctx, m) {
+ return false
+ }
+ for _, cond := range rest {
+ if !cond(ctx, m) {
+ return false
+ }
+ }
+ return true
+ }
+}
+
+// Or groups conditions with the OR operator.
+func Or(first, second Condition, rest ...Condition) Condition {
+ return func(ctx context.Context, m ent.Mutation) bool {
+ if first(ctx, m) || second(ctx, m) {
+ return true
+ }
+ for _, cond := range rest {
+ if cond(ctx, m) {
+ return true
+ }
+ }
+ return false
+ }
+}
+
+// Not negates a given condition.
+func Not(cond Condition) Condition {
+ return func(ctx context.Context, m ent.Mutation) bool {
+ return !cond(ctx, m)
+ }
+}
+
+// HasOp is a condition testing mutation operation.
+func HasOp(op ent.Op) Condition {
+ return func(_ context.Context, m ent.Mutation) bool {
+ return m.Op().Is(op)
+ }
+}
+
+// HasAddedFields is a condition validating `.AddedField` on fields.
+func HasAddedFields(field string, fields ...string) Condition {
+ return func(_ context.Context, m ent.Mutation) bool {
+ if _, exists := m.AddedField(field); !exists {
+ return false
+ }
+ for _, field := range fields {
+ if _, exists := m.AddedField(field); !exists {
+ return false
+ }
+ }
+ return true
+ }
+}
+
+// HasClearedFields is a condition validating `.FieldCleared` on fields.
+func HasClearedFields(field string, fields ...string) Condition {
+ return func(_ context.Context, m ent.Mutation) bool {
+ if exists := m.FieldCleared(field); !exists {
+ return false
+ }
+ for _, field := range fields {
+ if exists := m.FieldCleared(field); !exists {
+ return false
+ }
+ }
+ return true
+ }
+}
+
+// HasFields is a condition validating `.Field` on fields.
+func HasFields(field string, fields ...string) Condition {
+ return func(_ context.Context, m ent.Mutation) bool {
+ if _, exists := m.Field(field); !exists {
+ return false
+ }
+ for _, field := range fields {
+ if _, exists := m.Field(field); !exists {
+ return false
+ }
+ }
+ return true
+ }
+}
+
+// If executes the given hook under condition.
+//
+// hook.If(ComputeAverage, And(HasFields(...), HasAddedFields(...)))
+func If(hk ent.Hook, cond Condition) ent.Hook {
+ return func(next ent.Mutator) ent.Mutator {
+ return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+ if cond(ctx, m) {
+ return hk(next).Mutate(ctx, m)
+ }
+ return next.Mutate(ctx, m)
+ })
+ }
+}
+
+// On executes the given hook only for the given operation.
+//
+// hook.On(Log, ent.Delete|ent.Create)
+func On(hk ent.Hook, op ent.Op) ent.Hook {
+ return If(hk, HasOp(op))
+}
+
+// Unless skips the given hook only for the given operation.
+//
+// hook.Unless(Log, ent.Update|ent.UpdateOne)
+func Unless(hk ent.Hook, op ent.Op) ent.Hook {
+ return If(hk, Not(HasOp(op)))
+}
+
+// FixedError is a hook returning a fixed error.
+func FixedError(err error) ent.Hook {
+ return func(ent.Mutator) ent.Mutator {
+ return ent.MutateFunc(func(context.Context, ent.Mutation) (ent.Value, error) {
+ return nil, err
+ })
+ }
+}
+
+// Reject returns a hook that rejects all operations that match op.
+//
+// func (T) Hooks() []ent.Hook {
+// return []ent.Hook{
+// Reject(ent.Delete|ent.Update),
+// }
+// }
+func Reject(op ent.Op) ent.Hook {
+ hk := FixedError(fmt.Errorf("%s operation is not allowed", op))
+ return On(hk, op)
+}
+
+// Chain acts as a list of hooks and is effectively immutable.
+// Once created, it will always hold the same set of hooks in the same order.
+type Chain struct {
+ hooks []ent.Hook
+}
+
+// NewChain creates a new chain of hooks.
+func NewChain(hooks ...ent.Hook) Chain {
+ return Chain{append([]ent.Hook(nil), hooks...)}
+}
+
+// Hook chains the list of hooks and returns the final hook.
+func (c Chain) Hook() ent.Hook {
+ return func(mutator ent.Mutator) ent.Mutator {
+ for i := len(c.hooks) - 1; i >= 0; i-- {
+ mutator = c.hooks[i](mutator)
+ }
+ return mutator
+ }
+}
+
+// Append extends a chain, adding the specified hook
+// as the last ones in the mutation flow.
+func (c Chain) Append(hooks ...ent.Hook) Chain {
+ newHooks := make([]ent.Hook, 0, len(c.hooks)+len(hooks))
+ newHooks = append(newHooks, c.hooks...)
+ newHooks = append(newHooks, hooks...)
+ return Chain{newHooks}
+}
+
+// Extend extends a chain, adding the specified chain
+// as the last ones in the mutation flow.
+func (c Chain) Extend(chain Chain) Chain {
+ return c.Append(chain.hooks...)
+}
diff --git a/backend/domain/repository/ent/migrate/migrate.go b/backend/domain/repository/ent/migrate/migrate.go
new file mode 100644
index 00000000..1956a6bf
--- /dev/null
+++ b/backend/domain/repository/ent/migrate/migrate.go
@@ -0,0 +1,64 @@
+// Code generated by ent, DO NOT EDIT.
+
+package migrate
+
+import (
+ "context"
+ "fmt"
+ "io"
+
+ "entgo.io/ent/dialect"
+ "entgo.io/ent/dialect/sql/schema"
+)
+
+var (
+ // WithGlobalUniqueID sets the universal ids options to the migration.
+ // If this option is enabled, ent migration will allocate a 1<<32 range
+ // for the ids of each entity (table).
+ // Note that this option cannot be applied on tables that already exist.
+ WithGlobalUniqueID = schema.WithGlobalUniqueID
+ // WithDropColumn sets the drop column option to the migration.
+ // If this option is enabled, ent migration will drop old columns
+ // that were used for both fields and edges. This defaults to false.
+ WithDropColumn = schema.WithDropColumn
+ // WithDropIndex sets the drop index option to the migration.
+ // If this option is enabled, ent migration will drop old indexes
+ // that were defined in the schema. This defaults to false.
+ // Note that unique constraints are defined using `UNIQUE INDEX`,
+ // and therefore, it's recommended to enable this option to get more
+ // flexibility in the schema changes.
+ WithDropIndex = schema.WithDropIndex
+ // WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true.
+ WithForeignKeys = schema.WithForeignKeys
+)
+
+// Schema is the API for creating, migrating and dropping a schema.
+type Schema struct {
+ drv dialect.Driver
+}
+
+// NewSchema creates a new schema client.
+func NewSchema(drv dialect.Driver) *Schema { return &Schema{drv: drv} }
+
+// Create creates all schema resources.
+func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error {
+ return Create(ctx, s, Tables, opts...)
+}
+
+// Create creates all table resources using the given schema driver.
+func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...schema.MigrateOption) error {
+ migrate, err := schema.NewMigrate(s.drv, opts...)
+ if err != nil {
+ return fmt.Errorf("ent/migrate: %w", err)
+ }
+ return migrate.Create(ctx, tables...)
+}
+
+// WriteTo writes the schema changes to w instead of running them against the database.
+//
+// if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
+// log.Fatal(err)
+// }
+func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error {
+ return Create(ctx, &Schema{drv: &schema.WriteDriver{Writer: w, Driver: s.drv}}, Tables, opts...)
+}
diff --git a/backend/domain/repository/ent/migrate/schema.go b/backend/domain/repository/ent/migrate/schema.go
new file mode 100644
index 00000000..1694f7c6
--- /dev/null
+++ b/backend/domain/repository/ent/migrate/schema.go
@@ -0,0 +1,330 @@
+// Code generated by ent, DO NOT EDIT.
+
+package migrate
+
+import (
+ "entgo.io/ent/dialect/sql/schema"
+ "entgo.io/ent/schema/field"
+)
+
+var (
+ // BoardingRecordsColumns holds the columns for the "boarding_records" table.
+ BoardingRecordsColumns = []*schema.Column{
+ {Name: "id", Type: field.TypeUUID, Unique: true},
+ {Name: "timestamp", Type: field.TypeTime},
+ {Name: "is_boarding", Type: field.TypeBool, Default: false},
+ {Name: "bus_boarding_records", Type: field.TypeUUID, Nullable: true},
+ {Name: "child_boarding_record", Type: field.TypeUUID, Nullable: true},
+ }
+ // BoardingRecordsTable holds the schema information for the "boarding_records" table.
+ BoardingRecordsTable = &schema.Table{
+ Name: "boarding_records",
+ Columns: BoardingRecordsColumns,
+ PrimaryKey: []*schema.Column{BoardingRecordsColumns[0]},
+ ForeignKeys: []*schema.ForeignKey{
+ {
+ Symbol: "boarding_records_bus_boarding_records",
+ Columns: []*schema.Column{BoardingRecordsColumns[3]},
+ RefColumns: []*schema.Column{BusColumns[0]},
+ OnDelete: schema.SetNull,
+ },
+ {
+ Symbol: "boarding_records_childs_boarding_record",
+ Columns: []*schema.Column{BoardingRecordsColumns[4]},
+ RefColumns: []*schema.Column{ChildsColumns[0]},
+ OnDelete: schema.SetNull,
+ },
+ },
+ }
+ // BusColumns holds the columns for the "bus" table.
+ BusColumns = []*schema.Column{
+ {Name: "id", Type: field.TypeUUID, Unique: true},
+ {Name: "name", Type: field.TypeString},
+ {Name: "plate_number", Type: field.TypeString, Nullable: true},
+ {Name: "latitude", Type: field.TypeFloat64, Nullable: true},
+ {Name: "longitude", Type: field.TypeFloat64, Nullable: true},
+ {Name: "status", Type: field.TypeEnum, Enums: []string{"stopped", "running", "maintenance"}, Default: "stopped"},
+ {Name: "enable_face_recognition", Type: field.TypeBool, Default: false},
+ {Name: "created_at", Type: field.TypeTime},
+ {Name: "updated_at", Type: field.TypeTime},
+ {Name: "bus_nursery", Type: field.TypeUUID, Nullable: true},
+ {Name: "bus_next_station", Type: field.TypeUUID, Nullable: true},
+ {Name: "bus_latest_morning_route", Type: field.TypeUUID, Nullable: true},
+ {Name: "bus_latest_evening_route", Type: field.TypeUUID, Nullable: true},
+ }
+ // BusTable holds the schema information for the "bus" table.
+ BusTable = &schema.Table{
+ Name: "bus",
+ Columns: BusColumns,
+ PrimaryKey: []*schema.Column{BusColumns[0]},
+ ForeignKeys: []*schema.ForeignKey{
+ {
+ Symbol: "bus_nurseries_nursery",
+ Columns: []*schema.Column{BusColumns[9]},
+ RefColumns: []*schema.Column{NurseriesColumns[0]},
+ OnDelete: schema.SetNull,
+ },
+ {
+ Symbol: "bus_stations_next_station",
+ Columns: []*schema.Column{BusColumns[10]},
+ RefColumns: []*schema.Column{StationsColumns[0]},
+ OnDelete: schema.SetNull,
+ },
+ {
+ Symbol: "bus_bus_routes_latest_morning_route",
+ Columns: []*schema.Column{BusColumns[11]},
+ RefColumns: []*schema.Column{BusRoutesColumns[0]},
+ OnDelete: schema.SetNull,
+ },
+ {
+ Symbol: "bus_bus_routes_latest_evening_route",
+ Columns: []*schema.Column{BusColumns[12]},
+ RefColumns: []*schema.Column{BusRoutesColumns[0]},
+ OnDelete: schema.SetNull,
+ },
+ },
+ }
+ // BusRoutesColumns holds the columns for the "bus_routes" table.
+ BusRoutesColumns = []*schema.Column{
+ {Name: "id", Type: field.TypeUUID, Unique: true},
+ {Name: "bus_type", Type: field.TypeEnum, Enums: []string{"morning", "evening"}},
+ {Name: "created_at", Type: field.TypeTime},
+ {Name: "updated_at", Type: field.TypeTime},
+ }
+ // BusRoutesTable holds the schema information for the "bus_routes" table.
+ BusRoutesTable = &schema.Table{
+ Name: "bus_routes",
+ Columns: BusRoutesColumns,
+ PrimaryKey: []*schema.Column{BusRoutesColumns[0]},
+ }
+ // BusRouteAssociationsColumns holds the columns for the "bus_route_associations" table.
+ BusRouteAssociationsColumns = []*schema.Column{
+ {Name: "id", Type: field.TypeInt, Increment: true},
+ {Name: "order", Type: field.TypeInt32},
+ {Name: "bus_route_id", Type: field.TypeUUID},
+ {Name: "station_id", Type: field.TypeUUID},
+ }
+ // BusRouteAssociationsTable holds the schema information for the "bus_route_associations" table.
+ BusRouteAssociationsTable = &schema.Table{
+ Name: "bus_route_associations",
+ Columns: BusRouteAssociationsColumns,
+ PrimaryKey: []*schema.Column{BusRouteAssociationsColumns[0]},
+ ForeignKeys: []*schema.ForeignKey{
+ {
+ Symbol: "bus_route_associations_bus_routes_busRouteAssociations",
+ Columns: []*schema.Column{BusRouteAssociationsColumns[2]},
+ RefColumns: []*schema.Column{BusRoutesColumns[0]},
+ OnDelete: schema.NoAction,
+ },
+ {
+ Symbol: "bus_route_associations_stations_busRouteAssociations",
+ Columns: []*schema.Column{BusRouteAssociationsColumns[3]},
+ RefColumns: []*schema.Column{StationsColumns[0]},
+ OnDelete: schema.NoAction,
+ },
+ },
+ }
+ // ChildsColumns holds the columns for the "childs" table.
+ ChildsColumns = []*schema.Column{
+ {Name: "id", Type: field.TypeUUID, Unique: true},
+ {Name: "name", Type: field.TypeString},
+ {Name: "age", Type: field.TypeInt},
+ {Name: "sex", Type: field.TypeEnum, Enums: []string{"man", "woman", "other"}},
+ {Name: "check_for_missing_items", Type: field.TypeBool, Default: false},
+ {Name: "has_bag", Type: field.TypeBool, Default: true},
+ {Name: "has_lunch_box", Type: field.TypeBool, Default: true},
+ {Name: "has_water_bottle", Type: field.TypeBool, Default: true},
+ {Name: "has_umbrella", Type: field.TypeBool, Default: true},
+ {Name: "has_other", Type: field.TypeBool, Default: true},
+ {Name: "created_at", Type: field.TypeTime},
+ {Name: "updated_at", Type: field.TypeTime},
+ {Name: "guardian_children", Type: field.TypeUUID, Nullable: true},
+ }
+ // ChildsTable holds the schema information for the "childs" table.
+ ChildsTable = &schema.Table{
+ Name: "childs",
+ Columns: ChildsColumns,
+ PrimaryKey: []*schema.Column{ChildsColumns[0]},
+ ForeignKeys: []*schema.ForeignKey{
+ {
+ Symbol: "childs_guardians_children",
+ Columns: []*schema.Column{ChildsColumns[12]},
+ RefColumns: []*schema.Column{GuardiansColumns[0]},
+ OnDelete: schema.SetNull,
+ },
+ },
+ }
+ // ChildBusAssociationsColumns holds the columns for the "child_bus_associations" table.
+ ChildBusAssociationsColumns = []*schema.Column{
+ {Name: "id", Type: field.TypeInt, Increment: true},
+ {Name: "bus_route_id", Type: field.TypeUUID},
+ {Name: "child_id", Type: field.TypeUUID},
+ }
+ // ChildBusAssociationsTable holds the schema information for the "child_bus_associations" table.
+ ChildBusAssociationsTable = &schema.Table{
+ Name: "child_bus_associations",
+ Columns: ChildBusAssociationsColumns,
+ PrimaryKey: []*schema.Column{ChildBusAssociationsColumns[0]},
+ ForeignKeys: []*schema.ForeignKey{
+ {
+ Symbol: "child_bus_associations_bus_routes_childBusAssociations",
+ Columns: []*schema.Column{ChildBusAssociationsColumns[1]},
+ RefColumns: []*schema.Column{BusRoutesColumns[0]},
+ OnDelete: schema.NoAction,
+ },
+ {
+ Symbol: "child_bus_associations_childs_childBusAssociations",
+ Columns: []*schema.Column{ChildBusAssociationsColumns[2]},
+ RefColumns: []*schema.Column{ChildsColumns[0]},
+ OnDelete: schema.NoAction,
+ },
+ },
+ }
+ // ChildPhotosColumns holds the columns for the "child_photos" table.
+ ChildPhotosColumns = []*schema.Column{
+ {Name: "id", Type: field.TypeUUID, Unique: true},
+ {Name: "created_at", Type: field.TypeTime},
+ {Name: "updated_at", Type: field.TypeTime},
+ {Name: "child_photos", Type: field.TypeUUID, Nullable: true},
+ }
+ // ChildPhotosTable holds the schema information for the "child_photos" table.
+ ChildPhotosTable = &schema.Table{
+ Name: "child_photos",
+ Columns: ChildPhotosColumns,
+ PrimaryKey: []*schema.Column{ChildPhotosColumns[0]},
+ ForeignKeys: []*schema.ForeignKey{
+ {
+ Symbol: "child_photos_childs_photos",
+ Columns: []*schema.Column{ChildPhotosColumns[3]},
+ RefColumns: []*schema.Column{ChildsColumns[0]},
+ OnDelete: schema.SetNull,
+ },
+ },
+ }
+ // GuardiansColumns holds the columns for the "guardians" table.
+ GuardiansColumns = []*schema.Column{
+ {Name: "id", Type: field.TypeUUID, Unique: true},
+ {Name: "email", Type: field.TypeString, Unique: true},
+ {Name: "hashed_password", Type: field.TypeString},
+ {Name: "name", Type: field.TypeString},
+ {Name: "phone_number", Type: field.TypeString, Nullable: true},
+ {Name: "is_use_morning_bus", Type: field.TypeBool, Default: true},
+ {Name: "is_use_evening_bus", Type: field.TypeBool, Default: true},
+ {Name: "created_at", Type: field.TypeTime},
+ {Name: "updated_at", Type: field.TypeTime},
+ {Name: "guardian_nursery", Type: field.TypeUUID, Nullable: true},
+ }
+ // GuardiansTable holds the schema information for the "guardians" table.
+ GuardiansTable = &schema.Table{
+ Name: "guardians",
+ Columns: GuardiansColumns,
+ PrimaryKey: []*schema.Column{GuardiansColumns[0]},
+ ForeignKeys: []*schema.ForeignKey{
+ {
+ Symbol: "guardians_nurseries_nursery",
+ Columns: []*schema.Column{GuardiansColumns[9]},
+ RefColumns: []*schema.Column{NurseriesColumns[0]},
+ OnDelete: schema.SetNull,
+ },
+ },
+ }
+ // NurseriesColumns holds the columns for the "nurseries" table.
+ NurseriesColumns = []*schema.Column{
+ {Name: "id", Type: field.TypeUUID, Unique: true},
+ {Name: "nursery_code", Type: field.TypeString, Unique: true},
+ {Name: "email", Type: field.TypeString, Unique: true},
+ {Name: "hashed_password", Type: field.TypeString},
+ {Name: "name", Type: field.TypeString},
+ {Name: "address", Type: field.TypeString, Nullable: true},
+ {Name: "phone_number", Type: field.TypeString, Nullable: true},
+ {Name: "created_at", Type: field.TypeTime},
+ {Name: "updated_at", Type: field.TypeTime},
+ }
+ // NurseriesTable holds the schema information for the "nurseries" table.
+ NurseriesTable = &schema.Table{
+ Name: "nurseries",
+ Columns: NurseriesColumns,
+ PrimaryKey: []*schema.Column{NurseriesColumns[0]},
+ }
+ // StationsColumns holds the columns for the "stations" table.
+ StationsColumns = []*schema.Column{
+ {Name: "id", Type: field.TypeUUID, Unique: true},
+ {Name: "latitude", Type: field.TypeFloat64, Nullable: true, Default: 0},
+ {Name: "longitude", Type: field.TypeFloat64, Nullable: true, Default: 0},
+ {Name: "created_at", Type: field.TypeTime},
+ {Name: "updated_at", Type: field.TypeTime},
+ {Name: "guardian_station", Type: field.TypeUUID, Unique: true, Nullable: true},
+ }
+ // StationsTable holds the schema information for the "stations" table.
+ StationsTable = &schema.Table{
+ Name: "stations",
+ Columns: StationsColumns,
+ PrimaryKey: []*schema.Column{StationsColumns[0]},
+ ForeignKeys: []*schema.ForeignKey{
+ {
+ Symbol: "stations_guardians_station",
+ Columns: []*schema.Column{StationsColumns[5]},
+ RefColumns: []*schema.Column{GuardiansColumns[0]},
+ OnDelete: schema.SetNull,
+ },
+ },
+ }
+ // BusRouteBusColumns holds the columns for the "bus_route_bus" table.
+ BusRouteBusColumns = []*schema.Column{
+ {Name: "bus_route_id", Type: field.TypeUUID},
+ {Name: "bus_id", Type: field.TypeUUID},
+ }
+ // BusRouteBusTable holds the schema information for the "bus_route_bus" table.
+ BusRouteBusTable = &schema.Table{
+ Name: "bus_route_bus",
+ Columns: BusRouteBusColumns,
+ PrimaryKey: []*schema.Column{BusRouteBusColumns[0], BusRouteBusColumns[1]},
+ ForeignKeys: []*schema.ForeignKey{
+ {
+ Symbol: "bus_route_bus_bus_route_id",
+ Columns: []*schema.Column{BusRouteBusColumns[0]},
+ RefColumns: []*schema.Column{BusRoutesColumns[0]},
+ OnDelete: schema.Cascade,
+ },
+ {
+ Symbol: "bus_route_bus_bus_id",
+ Columns: []*schema.Column{BusRouteBusColumns[1]},
+ RefColumns: []*schema.Column{BusColumns[0]},
+ OnDelete: schema.Cascade,
+ },
+ },
+ }
+ // Tables holds all the tables in the schema.
+ Tables = []*schema.Table{
+ BoardingRecordsTable,
+ BusTable,
+ BusRoutesTable,
+ BusRouteAssociationsTable,
+ ChildsTable,
+ ChildBusAssociationsTable,
+ ChildPhotosTable,
+ GuardiansTable,
+ NurseriesTable,
+ StationsTable,
+ BusRouteBusTable,
+ }
+)
+
+func init() {
+ BoardingRecordsTable.ForeignKeys[0].RefTable = BusTable
+ BoardingRecordsTable.ForeignKeys[1].RefTable = ChildsTable
+ BusTable.ForeignKeys[0].RefTable = NurseriesTable
+ BusTable.ForeignKeys[1].RefTable = StationsTable
+ BusTable.ForeignKeys[2].RefTable = BusRoutesTable
+ BusTable.ForeignKeys[3].RefTable = BusRoutesTable
+ BusRouteAssociationsTable.ForeignKeys[0].RefTable = BusRoutesTable
+ BusRouteAssociationsTable.ForeignKeys[1].RefTable = StationsTable
+ ChildsTable.ForeignKeys[0].RefTable = GuardiansTable
+ ChildBusAssociationsTable.ForeignKeys[0].RefTable = BusRoutesTable
+ ChildBusAssociationsTable.ForeignKeys[1].RefTable = ChildsTable
+ ChildPhotosTable.ForeignKeys[0].RefTable = ChildsTable
+ GuardiansTable.ForeignKeys[0].RefTable = NurseriesTable
+ StationsTable.ForeignKeys[0].RefTable = GuardiansTable
+ BusRouteBusTable.ForeignKeys[0].RefTable = BusRoutesTable
+ BusRouteBusTable.ForeignKeys[1].RefTable = BusTable
+}
diff --git a/backend/domain/repository/ent/mutation.go b/backend/domain/repository/ent/mutation.go
new file mode 100644
index 00000000..c8aede49
--- /dev/null
+++ b/backend/domain/repository/ent/mutation.go
@@ -0,0 +1,8117 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "sync"
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/sql"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busrouteassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childbusassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childphoto"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+const (
+ // Operation types.
+ OpCreate = ent.OpCreate
+ OpDelete = ent.OpDelete
+ OpDeleteOne = ent.OpDeleteOne
+ OpUpdate = ent.OpUpdate
+ OpUpdateOne = ent.OpUpdateOne
+
+ // Node types.
+ TypeBoardingRecord = "BoardingRecord"
+ TypeBus = "Bus"
+ TypeBusRoute = "BusRoute"
+ TypeBusRouteAssociation = "BusRouteAssociation"
+ TypeChild = "Child"
+ TypeChildBusAssociation = "ChildBusAssociation"
+ TypeChildPhoto = "ChildPhoto"
+ TypeGuardian = "Guardian"
+ TypeNursery = "Nursery"
+ TypeStation = "Station"
+)
+
+// BoardingRecordMutation represents an operation that mutates the BoardingRecord nodes in the graph.
+type BoardingRecordMutation struct {
+ config
+ op Op
+ typ string
+ id *uuid.UUID
+ timestamp *time.Time
+ is_boarding *bool
+ clearedFields map[string]struct{}
+ child *uuid.UUID
+ clearedchild bool
+ bus *uuid.UUID
+ clearedbus bool
+ done bool
+ oldValue func(context.Context) (*BoardingRecord, error)
+ predicates []predicate.BoardingRecord
+}
+
+var _ ent.Mutation = (*BoardingRecordMutation)(nil)
+
+// boardingrecordOption allows management of the mutation configuration using functional options.
+type boardingrecordOption func(*BoardingRecordMutation)
+
+// newBoardingRecordMutation creates new mutation for the BoardingRecord entity.
+func newBoardingRecordMutation(c config, op Op, opts ...boardingrecordOption) *BoardingRecordMutation {
+ m := &BoardingRecordMutation{
+ config: c,
+ op: op,
+ typ: TypeBoardingRecord,
+ clearedFields: make(map[string]struct{}),
+ }
+ for _, opt := range opts {
+ opt(m)
+ }
+ return m
+}
+
+// withBoardingRecordID sets the ID field of the mutation.
+func withBoardingRecordID(id uuid.UUID) boardingrecordOption {
+ return func(m *BoardingRecordMutation) {
+ var (
+ err error
+ once sync.Once
+ value *BoardingRecord
+ )
+ m.oldValue = func(ctx context.Context) (*BoardingRecord, error) {
+ once.Do(func() {
+ if m.done {
+ err = errors.New("querying old values post mutation is not allowed")
+ } else {
+ value, err = m.Client().BoardingRecord.Get(ctx, id)
+ }
+ })
+ return value, err
+ }
+ m.id = &id
+ }
+}
+
+// withBoardingRecord sets the old BoardingRecord of the mutation.
+func withBoardingRecord(node *BoardingRecord) boardingrecordOption {
+ return func(m *BoardingRecordMutation) {
+ m.oldValue = func(context.Context) (*BoardingRecord, error) {
+ return node, nil
+ }
+ m.id = &node.ID
+ }
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m BoardingRecordMutation) Client() *Client {
+ client := &Client{config: m.config}
+ client.init()
+ return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m BoardingRecordMutation) Tx() (*Tx, error) {
+ if _, ok := m.driver.(*txDriver); !ok {
+ return nil, errors.New("ent: mutation is not running in a transaction")
+ }
+ tx := &Tx{config: m.config}
+ tx.init()
+ return tx, nil
+}
+
+// SetID sets the value of the id field. Note that this
+// operation is only accepted on creation of BoardingRecord entities.
+func (m *BoardingRecordMutation) SetID(id uuid.UUID) {
+ m.id = &id
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *BoardingRecordMutation) ID() (id uuid.UUID, exists bool) {
+ if m.id == nil {
+ return
+ }
+ return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *BoardingRecordMutation) IDs(ctx context.Context) ([]uuid.UUID, error) {
+ switch {
+ case m.op.Is(OpUpdateOne | OpDeleteOne):
+ id, exists := m.ID()
+ if exists {
+ return []uuid.UUID{id}, nil
+ }
+ fallthrough
+ case m.op.Is(OpUpdate | OpDelete):
+ return m.Client().BoardingRecord.Query().Where(m.predicates...).IDs(ctx)
+ default:
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+ }
+}
+
+// SetTimestamp sets the "timestamp" field.
+func (m *BoardingRecordMutation) SetTimestamp(t time.Time) {
+ m.timestamp = &t
+}
+
+// Timestamp returns the value of the "timestamp" field in the mutation.
+func (m *BoardingRecordMutation) Timestamp() (r time.Time, exists bool) {
+ v := m.timestamp
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldTimestamp returns the old "timestamp" field's value of the BoardingRecord entity.
+// If the BoardingRecord 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 *BoardingRecordMutation) OldTimestamp(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldTimestamp is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldTimestamp requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldTimestamp: %w", err)
+ }
+ return oldValue.Timestamp, nil
+}
+
+// ResetTimestamp resets all changes to the "timestamp" field.
+func (m *BoardingRecordMutation) ResetTimestamp() {
+ m.timestamp = nil
+}
+
+// SetIsBoarding sets the "is_boarding" field.
+func (m *BoardingRecordMutation) SetIsBoarding(b bool) {
+ m.is_boarding = &b
+}
+
+// IsBoarding returns the value of the "is_boarding" field in the mutation.
+func (m *BoardingRecordMutation) IsBoarding() (r bool, exists bool) {
+ v := m.is_boarding
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldIsBoarding returns the old "is_boarding" field's value of the BoardingRecord entity.
+// If the BoardingRecord 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 *BoardingRecordMutation) OldIsBoarding(ctx context.Context) (v bool, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldIsBoarding is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldIsBoarding requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldIsBoarding: %w", err)
+ }
+ return oldValue.IsBoarding, nil
+}
+
+// ResetIsBoarding resets all changes to the "is_boarding" field.
+func (m *BoardingRecordMutation) ResetIsBoarding() {
+ m.is_boarding = nil
+}
+
+// SetChildID sets the "child" edge to the Child entity by id.
+func (m *BoardingRecordMutation) SetChildID(id uuid.UUID) {
+ m.child = &id
+}
+
+// ClearChild clears the "child" edge to the Child entity.
+func (m *BoardingRecordMutation) ClearChild() {
+ m.clearedchild = true
+}
+
+// ChildCleared reports if the "child" edge to the Child entity was cleared.
+func (m *BoardingRecordMutation) ChildCleared() bool {
+ return m.clearedchild
+}
+
+// ChildID returns the "child" edge ID in the mutation.
+func (m *BoardingRecordMutation) ChildID() (id uuid.UUID, exists bool) {
+ if m.child != nil {
+ return *m.child, true
+ }
+ return
+}
+
+// ChildIDs returns the "child" edge IDs in the mutation.
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
+// ChildID instead. It exists only for internal usage by the builders.
+func (m *BoardingRecordMutation) ChildIDs() (ids []uuid.UUID) {
+ if id := m.child; id != nil {
+ ids = append(ids, *id)
+ }
+ return
+}
+
+// ResetChild resets all changes to the "child" edge.
+func (m *BoardingRecordMutation) ResetChild() {
+ m.child = nil
+ m.clearedchild = false
+}
+
+// SetBusID sets the "bus" edge to the Bus entity by id.
+func (m *BoardingRecordMutation) SetBusID(id uuid.UUID) {
+ m.bus = &id
+}
+
+// ClearBus clears the "bus" edge to the Bus entity.
+func (m *BoardingRecordMutation) ClearBus() {
+ m.clearedbus = true
+}
+
+// BusCleared reports if the "bus" edge to the Bus entity was cleared.
+func (m *BoardingRecordMutation) BusCleared() bool {
+ return m.clearedbus
+}
+
+// BusID returns the "bus" edge ID in the mutation.
+func (m *BoardingRecordMutation) BusID() (id uuid.UUID, exists bool) {
+ if m.bus != nil {
+ return *m.bus, true
+ }
+ return
+}
+
+// BusIDs returns the "bus" edge IDs in the mutation.
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
+// BusID instead. It exists only for internal usage by the builders.
+func (m *BoardingRecordMutation) BusIDs() (ids []uuid.UUID) {
+ if id := m.bus; id != nil {
+ ids = append(ids, *id)
+ }
+ return
+}
+
+// ResetBus resets all changes to the "bus" edge.
+func (m *BoardingRecordMutation) ResetBus() {
+ m.bus = nil
+ m.clearedbus = false
+}
+
+// Where appends a list predicates to the BoardingRecordMutation builder.
+func (m *BoardingRecordMutation) Where(ps ...predicate.BoardingRecord) {
+ m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the BoardingRecordMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *BoardingRecordMutation) WhereP(ps ...func(*sql.Selector)) {
+ p := make([]predicate.BoardingRecord, len(ps))
+ for i := range ps {
+ p[i] = ps[i]
+ }
+ m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *BoardingRecordMutation) Op() Op {
+ return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *BoardingRecordMutation) SetOp(op Op) {
+ m.op = op
+}
+
+// Type returns the node type of this mutation (BoardingRecord).
+func (m *BoardingRecordMutation) Type() string {
+ return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *BoardingRecordMutation) Fields() []string {
+ fields := make([]string, 0, 2)
+ if m.timestamp != nil {
+ fields = append(fields, boardingrecord.FieldTimestamp)
+ }
+ if m.is_boarding != nil {
+ fields = append(fields, boardingrecord.FieldIsBoarding)
+ }
+ return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *BoardingRecordMutation) Field(name string) (ent.Value, bool) {
+ switch name {
+ case boardingrecord.FieldTimestamp:
+ return m.Timestamp()
+ case boardingrecord.FieldIsBoarding:
+ return m.IsBoarding()
+ }
+ return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *BoardingRecordMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+ switch name {
+ case boardingrecord.FieldTimestamp:
+ return m.OldTimestamp(ctx)
+ case boardingrecord.FieldIsBoarding:
+ return m.OldIsBoarding(ctx)
+ }
+ return nil, fmt.Errorf("unknown BoardingRecord field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *BoardingRecordMutation) SetField(name string, value ent.Value) error {
+ switch name {
+ case boardingrecord.FieldTimestamp:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetTimestamp(v)
+ return nil
+ case boardingrecord.FieldIsBoarding:
+ v, ok := value.(bool)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetIsBoarding(v)
+ return nil
+ }
+ return fmt.Errorf("unknown BoardingRecord field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *BoardingRecordMutation) AddedFields() []string {
+ return nil
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *BoardingRecordMutation) AddedField(name string) (ent.Value, bool) {
+ return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *BoardingRecordMutation) AddField(name string, value ent.Value) error {
+ switch name {
+ }
+ return fmt.Errorf("unknown BoardingRecord numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *BoardingRecordMutation) ClearedFields() []string {
+ return nil
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *BoardingRecordMutation) FieldCleared(name string) bool {
+ _, ok := m.clearedFields[name]
+ return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *BoardingRecordMutation) ClearField(name string) error {
+ return fmt.Errorf("unknown BoardingRecord nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *BoardingRecordMutation) ResetField(name string) error {
+ switch name {
+ case boardingrecord.FieldTimestamp:
+ m.ResetTimestamp()
+ return nil
+ case boardingrecord.FieldIsBoarding:
+ m.ResetIsBoarding()
+ return nil
+ }
+ return fmt.Errorf("unknown BoardingRecord field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *BoardingRecordMutation) AddedEdges() []string {
+ edges := make([]string, 0, 2)
+ if m.child != nil {
+ edges = append(edges, boardingrecord.EdgeChild)
+ }
+ if m.bus != nil {
+ edges = append(edges, boardingrecord.EdgeBus)
+ }
+ return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *BoardingRecordMutation) AddedIDs(name string) []ent.Value {
+ switch name {
+ case boardingrecord.EdgeChild:
+ if id := m.child; id != nil {
+ return []ent.Value{*id}
+ }
+ case boardingrecord.EdgeBus:
+ if id := m.bus; id != nil {
+ return []ent.Value{*id}
+ }
+ }
+ return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *BoardingRecordMutation) RemovedEdges() []string {
+ edges := make([]string, 0, 2)
+ return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *BoardingRecordMutation) RemovedIDs(name string) []ent.Value {
+ return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *BoardingRecordMutation) ClearedEdges() []string {
+ edges := make([]string, 0, 2)
+ if m.clearedchild {
+ edges = append(edges, boardingrecord.EdgeChild)
+ }
+ if m.clearedbus {
+ edges = append(edges, boardingrecord.EdgeBus)
+ }
+ return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *BoardingRecordMutation) EdgeCleared(name string) bool {
+ switch name {
+ case boardingrecord.EdgeChild:
+ return m.clearedchild
+ case boardingrecord.EdgeBus:
+ return m.clearedbus
+ }
+ return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *BoardingRecordMutation) ClearEdge(name string) error {
+ switch name {
+ case boardingrecord.EdgeChild:
+ m.ClearChild()
+ return nil
+ case boardingrecord.EdgeBus:
+ m.ClearBus()
+ return nil
+ }
+ return fmt.Errorf("unknown BoardingRecord unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *BoardingRecordMutation) ResetEdge(name string) error {
+ switch name {
+ case boardingrecord.EdgeChild:
+ m.ResetChild()
+ return nil
+ case boardingrecord.EdgeBus:
+ m.ResetBus()
+ return nil
+ }
+ return fmt.Errorf("unknown BoardingRecord edge %s", name)
+}
+
+// BusMutation represents an operation that mutates the Bus nodes in the graph.
+type BusMutation struct {
+ config
+ op Op
+ typ string
+ id *uuid.UUID
+ name *string
+ plate_number *string
+ latitude *float64
+ addlatitude *float64
+ longitude *float64
+ addlongitude *float64
+ status *bus.Status
+ enable_face_recognition *bool
+ created_at *time.Time
+ updated_at *time.Time
+ clearedFields map[string]struct{}
+ nursery *uuid.UUID
+ clearednursery bool
+ boarding_records map[uuid.UUID]struct{}
+ removedboarding_records map[uuid.UUID]struct{}
+ clearedboarding_records bool
+ next_station *uuid.UUID
+ clearednext_station bool
+ bus_route map[uuid.UUID]struct{}
+ removedbus_route map[uuid.UUID]struct{}
+ clearedbus_route bool
+ latest_morning_route *uuid.UUID
+ clearedlatest_morning_route bool
+ latest_evening_route *uuid.UUID
+ clearedlatest_evening_route bool
+ done bool
+ oldValue func(context.Context) (*Bus, error)
+ predicates []predicate.Bus
+}
+
+var _ ent.Mutation = (*BusMutation)(nil)
+
+// busOption allows management of the mutation configuration using functional options.
+type busOption func(*BusMutation)
+
+// newBusMutation creates new mutation for the Bus entity.
+func newBusMutation(c config, op Op, opts ...busOption) *BusMutation {
+ m := &BusMutation{
+ config: c,
+ op: op,
+ typ: TypeBus,
+ clearedFields: make(map[string]struct{}),
+ }
+ for _, opt := range opts {
+ opt(m)
+ }
+ return m
+}
+
+// withBusID sets the ID field of the mutation.
+func withBusID(id uuid.UUID) busOption {
+ return func(m *BusMutation) {
+ var (
+ err error
+ once sync.Once
+ value *Bus
+ )
+ m.oldValue = func(ctx context.Context) (*Bus, error) {
+ once.Do(func() {
+ if m.done {
+ err = errors.New("querying old values post mutation is not allowed")
+ } else {
+ value, err = m.Client().Bus.Get(ctx, id)
+ }
+ })
+ return value, err
+ }
+ m.id = &id
+ }
+}
+
+// withBus sets the old Bus of the mutation.
+func withBus(node *Bus) busOption {
+ return func(m *BusMutation) {
+ m.oldValue = func(context.Context) (*Bus, error) {
+ return node, nil
+ }
+ m.id = &node.ID
+ }
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m BusMutation) Client() *Client {
+ client := &Client{config: m.config}
+ client.init()
+ return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m BusMutation) Tx() (*Tx, error) {
+ if _, ok := m.driver.(*txDriver); !ok {
+ return nil, errors.New("ent: mutation is not running in a transaction")
+ }
+ tx := &Tx{config: m.config}
+ tx.init()
+ return tx, nil
+}
+
+// SetID sets the value of the id field. Note that this
+// operation is only accepted on creation of Bus entities.
+func (m *BusMutation) SetID(id uuid.UUID) {
+ m.id = &id
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *BusMutation) ID() (id uuid.UUID, exists bool) {
+ if m.id == nil {
+ return
+ }
+ return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *BusMutation) IDs(ctx context.Context) ([]uuid.UUID, error) {
+ switch {
+ case m.op.Is(OpUpdateOne | OpDeleteOne):
+ id, exists := m.ID()
+ if exists {
+ return []uuid.UUID{id}, nil
+ }
+ fallthrough
+ case m.op.Is(OpUpdate | OpDelete):
+ return m.Client().Bus.Query().Where(m.predicates...).IDs(ctx)
+ default:
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+ }
+}
+
+// SetName sets the "name" field.
+func (m *BusMutation) SetName(s string) {
+ m.name = &s
+}
+
+// Name returns the value of the "name" field in the mutation.
+func (m *BusMutation) Name() (r string, exists bool) {
+ v := m.name
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldName returns the old "name" field's value of the Bus entity.
+// If the Bus 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 *BusMutation) OldName(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldName is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldName requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldName: %w", err)
+ }
+ return oldValue.Name, nil
+}
+
+// ResetName resets all changes to the "name" field.
+func (m *BusMutation) ResetName() {
+ m.name = nil
+}
+
+// SetPlateNumber sets the "plate_number" field.
+func (m *BusMutation) SetPlateNumber(s string) {
+ m.plate_number = &s
+}
+
+// PlateNumber returns the value of the "plate_number" field in the mutation.
+func (m *BusMutation) PlateNumber() (r string, exists bool) {
+ v := m.plate_number
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldPlateNumber returns the old "plate_number" field's value of the Bus entity.
+// If the Bus 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 *BusMutation) OldPlateNumber(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldPlateNumber is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldPlateNumber requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldPlateNumber: %w", err)
+ }
+ return oldValue.PlateNumber, nil
+}
+
+// ClearPlateNumber clears the value of the "plate_number" field.
+func (m *BusMutation) ClearPlateNumber() {
+ m.plate_number = nil
+ m.clearedFields[bus.FieldPlateNumber] = struct{}{}
+}
+
+// PlateNumberCleared returns if the "plate_number" field was cleared in this mutation.
+func (m *BusMutation) PlateNumberCleared() bool {
+ _, ok := m.clearedFields[bus.FieldPlateNumber]
+ return ok
+}
+
+// ResetPlateNumber resets all changes to the "plate_number" field.
+func (m *BusMutation) ResetPlateNumber() {
+ m.plate_number = nil
+ delete(m.clearedFields, bus.FieldPlateNumber)
+}
+
+// SetLatitude sets the "latitude" field.
+func (m *BusMutation) SetLatitude(f float64) {
+ m.latitude = &f
+ m.addlatitude = nil
+}
+
+// Latitude returns the value of the "latitude" field in the mutation.
+func (m *BusMutation) Latitude() (r float64, exists bool) {
+ v := m.latitude
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldLatitude returns the old "latitude" field's value of the Bus entity.
+// If the Bus 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 *BusMutation) OldLatitude(ctx context.Context) (v float64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldLatitude is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldLatitude requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldLatitude: %w", err)
+ }
+ return oldValue.Latitude, nil
+}
+
+// AddLatitude adds f to the "latitude" field.
+func (m *BusMutation) AddLatitude(f float64) {
+ if m.addlatitude != nil {
+ *m.addlatitude += f
+ } else {
+ m.addlatitude = &f
+ }
+}
+
+// AddedLatitude returns the value that was added to the "latitude" field in this mutation.
+func (m *BusMutation) AddedLatitude() (r float64, exists bool) {
+ v := m.addlatitude
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ClearLatitude clears the value of the "latitude" field.
+func (m *BusMutation) ClearLatitude() {
+ m.latitude = nil
+ m.addlatitude = nil
+ m.clearedFields[bus.FieldLatitude] = struct{}{}
+}
+
+// LatitudeCleared returns if the "latitude" field was cleared in this mutation.
+func (m *BusMutation) LatitudeCleared() bool {
+ _, ok := m.clearedFields[bus.FieldLatitude]
+ return ok
+}
+
+// ResetLatitude resets all changes to the "latitude" field.
+func (m *BusMutation) ResetLatitude() {
+ m.latitude = nil
+ m.addlatitude = nil
+ delete(m.clearedFields, bus.FieldLatitude)
+}
+
+// SetLongitude sets the "longitude" field.
+func (m *BusMutation) SetLongitude(f float64) {
+ m.longitude = &f
+ m.addlongitude = nil
+}
+
+// Longitude returns the value of the "longitude" field in the mutation.
+func (m *BusMutation) Longitude() (r float64, exists bool) {
+ v := m.longitude
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldLongitude returns the old "longitude" field's value of the Bus entity.
+// If the Bus 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 *BusMutation) OldLongitude(ctx context.Context) (v float64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldLongitude is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldLongitude requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldLongitude: %w", err)
+ }
+ return oldValue.Longitude, nil
+}
+
+// AddLongitude adds f to the "longitude" field.
+func (m *BusMutation) AddLongitude(f float64) {
+ if m.addlongitude != nil {
+ *m.addlongitude += f
+ } else {
+ m.addlongitude = &f
+ }
+}
+
+// AddedLongitude returns the value that was added to the "longitude" field in this mutation.
+func (m *BusMutation) AddedLongitude() (r float64, exists bool) {
+ v := m.addlongitude
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ClearLongitude clears the value of the "longitude" field.
+func (m *BusMutation) ClearLongitude() {
+ m.longitude = nil
+ m.addlongitude = nil
+ m.clearedFields[bus.FieldLongitude] = struct{}{}
+}
+
+// LongitudeCleared returns if the "longitude" field was cleared in this mutation.
+func (m *BusMutation) LongitudeCleared() bool {
+ _, ok := m.clearedFields[bus.FieldLongitude]
+ return ok
+}
+
+// ResetLongitude resets all changes to the "longitude" field.
+func (m *BusMutation) ResetLongitude() {
+ m.longitude = nil
+ m.addlongitude = nil
+ delete(m.clearedFields, bus.FieldLongitude)
+}
+
+// SetStatus sets the "status" field.
+func (m *BusMutation) SetStatus(b bus.Status) {
+ m.status = &b
+}
+
+// Status returns the value of the "status" field in the mutation.
+func (m *BusMutation) Status() (r bus.Status, exists bool) {
+ v := m.status
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldStatus returns the old "status" field's value of the Bus entity.
+// If the Bus 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 *BusMutation) OldStatus(ctx context.Context) (v bus.Status, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldStatus is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldStatus requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldStatus: %w", err)
+ }
+ return oldValue.Status, nil
+}
+
+// ResetStatus resets all changes to the "status" field.
+func (m *BusMutation) ResetStatus() {
+ m.status = nil
+}
+
+// SetEnableFaceRecognition sets the "enable_face_recognition" field.
+func (m *BusMutation) SetEnableFaceRecognition(b bool) {
+ m.enable_face_recognition = &b
+}
+
+// EnableFaceRecognition returns the value of the "enable_face_recognition" field in the mutation.
+func (m *BusMutation) EnableFaceRecognition() (r bool, exists bool) {
+ v := m.enable_face_recognition
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldEnableFaceRecognition returns the old "enable_face_recognition" field's value of the Bus entity.
+// If the Bus 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 *BusMutation) OldEnableFaceRecognition(ctx context.Context) (v bool, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldEnableFaceRecognition is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldEnableFaceRecognition requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldEnableFaceRecognition: %w", err)
+ }
+ return oldValue.EnableFaceRecognition, nil
+}
+
+// ResetEnableFaceRecognition resets all changes to the "enable_face_recognition" field.
+func (m *BusMutation) ResetEnableFaceRecognition() {
+ m.enable_face_recognition = nil
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (m *BusMutation) SetCreatedAt(t time.Time) {
+ m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *BusMutation) CreatedAt() (r time.Time, exists bool) {
+ v := m.created_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldCreatedAt returns the old "created_at" field's value of the Bus entity.
+// If the Bus 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 *BusMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+ }
+ return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "created_at" field.
+func (m *BusMutation) ResetCreatedAt() {
+ m.created_at = nil
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (m *BusMutation) SetUpdatedAt(t time.Time) {
+ m.updated_at = &t
+}
+
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
+func (m *BusMutation) UpdatedAt() (r time.Time, exists bool) {
+ v := m.updated_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldUpdatedAt returns the old "updated_at" field's value of the Bus entity.
+// If the Bus 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 *BusMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
+ }
+ return oldValue.UpdatedAt, nil
+}
+
+// ResetUpdatedAt resets all changes to the "updated_at" field.
+func (m *BusMutation) ResetUpdatedAt() {
+ m.updated_at = nil
+}
+
+// SetNurseryID sets the "nursery" edge to the Nursery entity by id.
+func (m *BusMutation) SetNurseryID(id uuid.UUID) {
+ m.nursery = &id
+}
+
+// ClearNursery clears the "nursery" edge to the Nursery entity.
+func (m *BusMutation) ClearNursery() {
+ m.clearednursery = true
+}
+
+// NurseryCleared reports if the "nursery" edge to the Nursery entity was cleared.
+func (m *BusMutation) NurseryCleared() bool {
+ return m.clearednursery
+}
+
+// NurseryID returns the "nursery" edge ID in the mutation.
+func (m *BusMutation) NurseryID() (id uuid.UUID, exists bool) {
+ if m.nursery != nil {
+ return *m.nursery, true
+ }
+ return
+}
+
+// NurseryIDs returns the "nursery" edge IDs in the mutation.
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
+// NurseryID instead. It exists only for internal usage by the builders.
+func (m *BusMutation) NurseryIDs() (ids []uuid.UUID) {
+ if id := m.nursery; id != nil {
+ ids = append(ids, *id)
+ }
+ return
+}
+
+// ResetNursery resets all changes to the "nursery" edge.
+func (m *BusMutation) ResetNursery() {
+ m.nursery = nil
+ m.clearednursery = false
+}
+
+// AddBoardingRecordIDs adds the "boarding_records" edge to the BoardingRecord entity by ids.
+func (m *BusMutation) AddBoardingRecordIDs(ids ...uuid.UUID) {
+ if m.boarding_records == nil {
+ m.boarding_records = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ m.boarding_records[ids[i]] = struct{}{}
+ }
+}
+
+// ClearBoardingRecords clears the "boarding_records" edge to the BoardingRecord entity.
+func (m *BusMutation) ClearBoardingRecords() {
+ m.clearedboarding_records = true
+}
+
+// BoardingRecordsCleared reports if the "boarding_records" edge to the BoardingRecord entity was cleared.
+func (m *BusMutation) BoardingRecordsCleared() bool {
+ return m.clearedboarding_records
+}
+
+// RemoveBoardingRecordIDs removes the "boarding_records" edge to the BoardingRecord entity by IDs.
+func (m *BusMutation) RemoveBoardingRecordIDs(ids ...uuid.UUID) {
+ if m.removedboarding_records == nil {
+ m.removedboarding_records = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ delete(m.boarding_records, ids[i])
+ m.removedboarding_records[ids[i]] = struct{}{}
+ }
+}
+
+// RemovedBoardingRecords returns the removed IDs of the "boarding_records" edge to the BoardingRecord entity.
+func (m *BusMutation) RemovedBoardingRecordsIDs() (ids []uuid.UUID) {
+ for id := range m.removedboarding_records {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// BoardingRecordsIDs returns the "boarding_records" edge IDs in the mutation.
+func (m *BusMutation) BoardingRecordsIDs() (ids []uuid.UUID) {
+ for id := range m.boarding_records {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ResetBoardingRecords resets all changes to the "boarding_records" edge.
+func (m *BusMutation) ResetBoardingRecords() {
+ m.boarding_records = nil
+ m.clearedboarding_records = false
+ m.removedboarding_records = nil
+}
+
+// SetNextStationID sets the "next_station" edge to the Station entity by id.
+func (m *BusMutation) SetNextStationID(id uuid.UUID) {
+ m.next_station = &id
+}
+
+// ClearNextStation clears the "next_station" edge to the Station entity.
+func (m *BusMutation) ClearNextStation() {
+ m.clearednext_station = true
+}
+
+// NextStationCleared reports if the "next_station" edge to the Station entity was cleared.
+func (m *BusMutation) NextStationCleared() bool {
+ return m.clearednext_station
+}
+
+// NextStationID returns the "next_station" edge ID in the mutation.
+func (m *BusMutation) NextStationID() (id uuid.UUID, exists bool) {
+ if m.next_station != nil {
+ return *m.next_station, true
+ }
+ return
+}
+
+// NextStationIDs returns the "next_station" edge IDs in the mutation.
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
+// NextStationID instead. It exists only for internal usage by the builders.
+func (m *BusMutation) NextStationIDs() (ids []uuid.UUID) {
+ if id := m.next_station; id != nil {
+ ids = append(ids, *id)
+ }
+ return
+}
+
+// ResetNextStation resets all changes to the "next_station" edge.
+func (m *BusMutation) ResetNextStation() {
+ m.next_station = nil
+ m.clearednext_station = false
+}
+
+// AddBusRouteIDs adds the "bus_route" edge to the BusRoute entity by ids.
+func (m *BusMutation) AddBusRouteIDs(ids ...uuid.UUID) {
+ if m.bus_route == nil {
+ m.bus_route = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ m.bus_route[ids[i]] = struct{}{}
+ }
+}
+
+// ClearBusRoute clears the "bus_route" edge to the BusRoute entity.
+func (m *BusMutation) ClearBusRoute() {
+ m.clearedbus_route = true
+}
+
+// BusRouteCleared reports if the "bus_route" edge to the BusRoute entity was cleared.
+func (m *BusMutation) BusRouteCleared() bool {
+ return m.clearedbus_route
+}
+
+// RemoveBusRouteIDs removes the "bus_route" edge to the BusRoute entity by IDs.
+func (m *BusMutation) RemoveBusRouteIDs(ids ...uuid.UUID) {
+ if m.removedbus_route == nil {
+ m.removedbus_route = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ delete(m.bus_route, ids[i])
+ m.removedbus_route[ids[i]] = struct{}{}
+ }
+}
+
+// RemovedBusRoute returns the removed IDs of the "bus_route" edge to the BusRoute entity.
+func (m *BusMutation) RemovedBusRouteIDs() (ids []uuid.UUID) {
+ for id := range m.removedbus_route {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// BusRouteIDs returns the "bus_route" edge IDs in the mutation.
+func (m *BusMutation) BusRouteIDs() (ids []uuid.UUID) {
+ for id := range m.bus_route {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ResetBusRoute resets all changes to the "bus_route" edge.
+func (m *BusMutation) ResetBusRoute() {
+ m.bus_route = nil
+ m.clearedbus_route = false
+ m.removedbus_route = nil
+}
+
+// SetLatestMorningRouteID sets the "latest_morning_route" edge to the BusRoute entity by id.
+func (m *BusMutation) SetLatestMorningRouteID(id uuid.UUID) {
+ m.latest_morning_route = &id
+}
+
+// ClearLatestMorningRoute clears the "latest_morning_route" edge to the BusRoute entity.
+func (m *BusMutation) ClearLatestMorningRoute() {
+ m.clearedlatest_morning_route = true
+}
+
+// LatestMorningRouteCleared reports if the "latest_morning_route" edge to the BusRoute entity was cleared.
+func (m *BusMutation) LatestMorningRouteCleared() bool {
+ return m.clearedlatest_morning_route
+}
+
+// LatestMorningRouteID returns the "latest_morning_route" edge ID in the mutation.
+func (m *BusMutation) LatestMorningRouteID() (id uuid.UUID, exists bool) {
+ if m.latest_morning_route != nil {
+ return *m.latest_morning_route, true
+ }
+ return
+}
+
+// LatestMorningRouteIDs returns the "latest_morning_route" edge IDs in the mutation.
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
+// LatestMorningRouteID instead. It exists only for internal usage by the builders.
+func (m *BusMutation) LatestMorningRouteIDs() (ids []uuid.UUID) {
+ if id := m.latest_morning_route; id != nil {
+ ids = append(ids, *id)
+ }
+ return
+}
+
+// ResetLatestMorningRoute resets all changes to the "latest_morning_route" edge.
+func (m *BusMutation) ResetLatestMorningRoute() {
+ m.latest_morning_route = nil
+ m.clearedlatest_morning_route = false
+}
+
+// SetLatestEveningRouteID sets the "latest_evening_route" edge to the BusRoute entity by id.
+func (m *BusMutation) SetLatestEveningRouteID(id uuid.UUID) {
+ m.latest_evening_route = &id
+}
+
+// ClearLatestEveningRoute clears the "latest_evening_route" edge to the BusRoute entity.
+func (m *BusMutation) ClearLatestEveningRoute() {
+ m.clearedlatest_evening_route = true
+}
+
+// LatestEveningRouteCleared reports if the "latest_evening_route" edge to the BusRoute entity was cleared.
+func (m *BusMutation) LatestEveningRouteCleared() bool {
+ return m.clearedlatest_evening_route
+}
+
+// LatestEveningRouteID returns the "latest_evening_route" edge ID in the mutation.
+func (m *BusMutation) LatestEveningRouteID() (id uuid.UUID, exists bool) {
+ if m.latest_evening_route != nil {
+ return *m.latest_evening_route, true
+ }
+ return
+}
+
+// LatestEveningRouteIDs returns the "latest_evening_route" edge IDs in the mutation.
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
+// LatestEveningRouteID instead. It exists only for internal usage by the builders.
+func (m *BusMutation) LatestEveningRouteIDs() (ids []uuid.UUID) {
+ if id := m.latest_evening_route; id != nil {
+ ids = append(ids, *id)
+ }
+ return
+}
+
+// ResetLatestEveningRoute resets all changes to the "latest_evening_route" edge.
+func (m *BusMutation) ResetLatestEveningRoute() {
+ m.latest_evening_route = nil
+ m.clearedlatest_evening_route = false
+}
+
+// Where appends a list predicates to the BusMutation builder.
+func (m *BusMutation) Where(ps ...predicate.Bus) {
+ m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the BusMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *BusMutation) WhereP(ps ...func(*sql.Selector)) {
+ p := make([]predicate.Bus, len(ps))
+ for i := range ps {
+ p[i] = ps[i]
+ }
+ m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *BusMutation) Op() Op {
+ return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *BusMutation) SetOp(op Op) {
+ m.op = op
+}
+
+// Type returns the node type of this mutation (Bus).
+func (m *BusMutation) Type() string {
+ return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *BusMutation) Fields() []string {
+ fields := make([]string, 0, 8)
+ if m.name != nil {
+ fields = append(fields, bus.FieldName)
+ }
+ if m.plate_number != nil {
+ fields = append(fields, bus.FieldPlateNumber)
+ }
+ if m.latitude != nil {
+ fields = append(fields, bus.FieldLatitude)
+ }
+ if m.longitude != nil {
+ fields = append(fields, bus.FieldLongitude)
+ }
+ if m.status != nil {
+ fields = append(fields, bus.FieldStatus)
+ }
+ if m.enable_face_recognition != nil {
+ fields = append(fields, bus.FieldEnableFaceRecognition)
+ }
+ if m.created_at != nil {
+ fields = append(fields, bus.FieldCreatedAt)
+ }
+ if m.updated_at != nil {
+ fields = append(fields, bus.FieldUpdatedAt)
+ }
+ return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *BusMutation) Field(name string) (ent.Value, bool) {
+ switch name {
+ case bus.FieldName:
+ return m.Name()
+ case bus.FieldPlateNumber:
+ return m.PlateNumber()
+ case bus.FieldLatitude:
+ return m.Latitude()
+ case bus.FieldLongitude:
+ return m.Longitude()
+ case bus.FieldStatus:
+ return m.Status()
+ case bus.FieldEnableFaceRecognition:
+ return m.EnableFaceRecognition()
+ case bus.FieldCreatedAt:
+ return m.CreatedAt()
+ case bus.FieldUpdatedAt:
+ return m.UpdatedAt()
+ }
+ return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *BusMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+ switch name {
+ case bus.FieldName:
+ return m.OldName(ctx)
+ case bus.FieldPlateNumber:
+ return m.OldPlateNumber(ctx)
+ case bus.FieldLatitude:
+ return m.OldLatitude(ctx)
+ case bus.FieldLongitude:
+ return m.OldLongitude(ctx)
+ case bus.FieldStatus:
+ return m.OldStatus(ctx)
+ case bus.FieldEnableFaceRecognition:
+ return m.OldEnableFaceRecognition(ctx)
+ case bus.FieldCreatedAt:
+ return m.OldCreatedAt(ctx)
+ case bus.FieldUpdatedAt:
+ return m.OldUpdatedAt(ctx)
+ }
+ return nil, fmt.Errorf("unknown Bus field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *BusMutation) SetField(name string, value ent.Value) error {
+ switch name {
+ case bus.FieldName:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetName(v)
+ return nil
+ case bus.FieldPlateNumber:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetPlateNumber(v)
+ return nil
+ case bus.FieldLatitude:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetLatitude(v)
+ return nil
+ case bus.FieldLongitude:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetLongitude(v)
+ return nil
+ case bus.FieldStatus:
+ v, ok := value.(bus.Status)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetStatus(v)
+ return nil
+ case bus.FieldEnableFaceRecognition:
+ v, ok := value.(bool)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetEnableFaceRecognition(v)
+ return nil
+ case bus.FieldCreatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetCreatedAt(v)
+ return nil
+ case bus.FieldUpdatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetUpdatedAt(v)
+ return nil
+ }
+ return fmt.Errorf("unknown Bus field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *BusMutation) AddedFields() []string {
+ var fields []string
+ if m.addlatitude != nil {
+ fields = append(fields, bus.FieldLatitude)
+ }
+ if m.addlongitude != nil {
+ fields = append(fields, bus.FieldLongitude)
+ }
+ return fields
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *BusMutation) AddedField(name string) (ent.Value, bool) {
+ switch name {
+ case bus.FieldLatitude:
+ return m.AddedLatitude()
+ case bus.FieldLongitude:
+ return m.AddedLongitude()
+ }
+ return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *BusMutation) AddField(name string, value ent.Value) error {
+ switch name {
+ case bus.FieldLatitude:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddLatitude(v)
+ return nil
+ case bus.FieldLongitude:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddLongitude(v)
+ return nil
+ }
+ return fmt.Errorf("unknown Bus numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *BusMutation) ClearedFields() []string {
+ var fields []string
+ if m.FieldCleared(bus.FieldPlateNumber) {
+ fields = append(fields, bus.FieldPlateNumber)
+ }
+ if m.FieldCleared(bus.FieldLatitude) {
+ fields = append(fields, bus.FieldLatitude)
+ }
+ if m.FieldCleared(bus.FieldLongitude) {
+ fields = append(fields, bus.FieldLongitude)
+ }
+ return fields
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *BusMutation) FieldCleared(name string) bool {
+ _, ok := m.clearedFields[name]
+ return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *BusMutation) ClearField(name string) error {
+ switch name {
+ case bus.FieldPlateNumber:
+ m.ClearPlateNumber()
+ return nil
+ case bus.FieldLatitude:
+ m.ClearLatitude()
+ return nil
+ case bus.FieldLongitude:
+ m.ClearLongitude()
+ return nil
+ }
+ return fmt.Errorf("unknown Bus nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *BusMutation) ResetField(name string) error {
+ switch name {
+ case bus.FieldName:
+ m.ResetName()
+ return nil
+ case bus.FieldPlateNumber:
+ m.ResetPlateNumber()
+ return nil
+ case bus.FieldLatitude:
+ m.ResetLatitude()
+ return nil
+ case bus.FieldLongitude:
+ m.ResetLongitude()
+ return nil
+ case bus.FieldStatus:
+ m.ResetStatus()
+ return nil
+ case bus.FieldEnableFaceRecognition:
+ m.ResetEnableFaceRecognition()
+ return nil
+ case bus.FieldCreatedAt:
+ m.ResetCreatedAt()
+ return nil
+ case bus.FieldUpdatedAt:
+ m.ResetUpdatedAt()
+ return nil
+ }
+ return fmt.Errorf("unknown Bus field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *BusMutation) AddedEdges() []string {
+ edges := make([]string, 0, 6)
+ if m.nursery != nil {
+ edges = append(edges, bus.EdgeNursery)
+ }
+ if m.boarding_records != nil {
+ edges = append(edges, bus.EdgeBoardingRecords)
+ }
+ if m.next_station != nil {
+ edges = append(edges, bus.EdgeNextStation)
+ }
+ if m.bus_route != nil {
+ edges = append(edges, bus.EdgeBusRoute)
+ }
+ if m.latest_morning_route != nil {
+ edges = append(edges, bus.EdgeLatestMorningRoute)
+ }
+ if m.latest_evening_route != nil {
+ edges = append(edges, bus.EdgeLatestEveningRoute)
+ }
+ return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *BusMutation) AddedIDs(name string) []ent.Value {
+ switch name {
+ case bus.EdgeNursery:
+ if id := m.nursery; id != nil {
+ return []ent.Value{*id}
+ }
+ case bus.EdgeBoardingRecords:
+ ids := make([]ent.Value, 0, len(m.boarding_records))
+ for id := range m.boarding_records {
+ ids = append(ids, id)
+ }
+ return ids
+ case bus.EdgeNextStation:
+ if id := m.next_station; id != nil {
+ return []ent.Value{*id}
+ }
+ case bus.EdgeBusRoute:
+ ids := make([]ent.Value, 0, len(m.bus_route))
+ for id := range m.bus_route {
+ ids = append(ids, id)
+ }
+ return ids
+ case bus.EdgeLatestMorningRoute:
+ if id := m.latest_morning_route; id != nil {
+ return []ent.Value{*id}
+ }
+ case bus.EdgeLatestEveningRoute:
+ if id := m.latest_evening_route; id != nil {
+ return []ent.Value{*id}
+ }
+ }
+ return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *BusMutation) RemovedEdges() []string {
+ edges := make([]string, 0, 6)
+ if m.removedboarding_records != nil {
+ edges = append(edges, bus.EdgeBoardingRecords)
+ }
+ if m.removedbus_route != nil {
+ edges = append(edges, bus.EdgeBusRoute)
+ }
+ return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *BusMutation) RemovedIDs(name string) []ent.Value {
+ switch name {
+ case bus.EdgeBoardingRecords:
+ ids := make([]ent.Value, 0, len(m.removedboarding_records))
+ for id := range m.removedboarding_records {
+ ids = append(ids, id)
+ }
+ return ids
+ case bus.EdgeBusRoute:
+ ids := make([]ent.Value, 0, len(m.removedbus_route))
+ for id := range m.removedbus_route {
+ ids = append(ids, id)
+ }
+ return ids
+ }
+ return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *BusMutation) ClearedEdges() []string {
+ edges := make([]string, 0, 6)
+ if m.clearednursery {
+ edges = append(edges, bus.EdgeNursery)
+ }
+ if m.clearedboarding_records {
+ edges = append(edges, bus.EdgeBoardingRecords)
+ }
+ if m.clearednext_station {
+ edges = append(edges, bus.EdgeNextStation)
+ }
+ if m.clearedbus_route {
+ edges = append(edges, bus.EdgeBusRoute)
+ }
+ if m.clearedlatest_morning_route {
+ edges = append(edges, bus.EdgeLatestMorningRoute)
+ }
+ if m.clearedlatest_evening_route {
+ edges = append(edges, bus.EdgeLatestEveningRoute)
+ }
+ return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *BusMutation) EdgeCleared(name string) bool {
+ switch name {
+ case bus.EdgeNursery:
+ return m.clearednursery
+ case bus.EdgeBoardingRecords:
+ return m.clearedboarding_records
+ case bus.EdgeNextStation:
+ return m.clearednext_station
+ case bus.EdgeBusRoute:
+ return m.clearedbus_route
+ case bus.EdgeLatestMorningRoute:
+ return m.clearedlatest_morning_route
+ case bus.EdgeLatestEveningRoute:
+ return m.clearedlatest_evening_route
+ }
+ return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *BusMutation) ClearEdge(name string) error {
+ switch name {
+ case bus.EdgeNursery:
+ m.ClearNursery()
+ return nil
+ case bus.EdgeNextStation:
+ m.ClearNextStation()
+ return nil
+ case bus.EdgeLatestMorningRoute:
+ m.ClearLatestMorningRoute()
+ return nil
+ case bus.EdgeLatestEveningRoute:
+ m.ClearLatestEveningRoute()
+ return nil
+ }
+ return fmt.Errorf("unknown Bus unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *BusMutation) ResetEdge(name string) error {
+ switch name {
+ case bus.EdgeNursery:
+ m.ResetNursery()
+ return nil
+ case bus.EdgeBoardingRecords:
+ m.ResetBoardingRecords()
+ return nil
+ case bus.EdgeNextStation:
+ m.ResetNextStation()
+ return nil
+ case bus.EdgeBusRoute:
+ m.ResetBusRoute()
+ return nil
+ case bus.EdgeLatestMorningRoute:
+ m.ResetLatestMorningRoute()
+ return nil
+ case bus.EdgeLatestEveningRoute:
+ m.ResetLatestEveningRoute()
+ return nil
+ }
+ return fmt.Errorf("unknown Bus edge %s", name)
+}
+
+// BusRouteMutation represents an operation that mutates the BusRoute nodes in the graph.
+type BusRouteMutation struct {
+ config
+ op Op
+ typ string
+ id *uuid.UUID
+ bus_type *busroute.BusType
+ created_at *time.Time
+ updated_at *time.Time
+ clearedFields map[string]struct{}
+ bus map[uuid.UUID]struct{}
+ removedbus map[uuid.UUID]struct{}
+ clearedbus bool
+ childBusAssociations map[int]struct{}
+ removedchildBusAssociations map[int]struct{}
+ clearedchildBusAssociations bool
+ busRouteAssociations map[int]struct{}
+ removedbusRouteAssociations map[int]struct{}
+ clearedbusRouteAssociations bool
+ morning_buses map[uuid.UUID]struct{}
+ removedmorning_buses map[uuid.UUID]struct{}
+ clearedmorning_buses bool
+ evening_buses map[uuid.UUID]struct{}
+ removedevening_buses map[uuid.UUID]struct{}
+ clearedevening_buses bool
+ done bool
+ oldValue func(context.Context) (*BusRoute, error)
+ predicates []predicate.BusRoute
+}
+
+var _ ent.Mutation = (*BusRouteMutation)(nil)
+
+// busrouteOption allows management of the mutation configuration using functional options.
+type busrouteOption func(*BusRouteMutation)
+
+// newBusRouteMutation creates new mutation for the BusRoute entity.
+func newBusRouteMutation(c config, op Op, opts ...busrouteOption) *BusRouteMutation {
+ m := &BusRouteMutation{
+ config: c,
+ op: op,
+ typ: TypeBusRoute,
+ clearedFields: make(map[string]struct{}),
+ }
+ for _, opt := range opts {
+ opt(m)
+ }
+ return m
+}
+
+// withBusRouteID sets the ID field of the mutation.
+func withBusRouteID(id uuid.UUID) busrouteOption {
+ return func(m *BusRouteMutation) {
+ var (
+ err error
+ once sync.Once
+ value *BusRoute
+ )
+ m.oldValue = func(ctx context.Context) (*BusRoute, error) {
+ once.Do(func() {
+ if m.done {
+ err = errors.New("querying old values post mutation is not allowed")
+ } else {
+ value, err = m.Client().BusRoute.Get(ctx, id)
+ }
+ })
+ return value, err
+ }
+ m.id = &id
+ }
+}
+
+// withBusRoute sets the old BusRoute of the mutation.
+func withBusRoute(node *BusRoute) busrouteOption {
+ return func(m *BusRouteMutation) {
+ m.oldValue = func(context.Context) (*BusRoute, error) {
+ return node, nil
+ }
+ m.id = &node.ID
+ }
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m BusRouteMutation) Client() *Client {
+ client := &Client{config: m.config}
+ client.init()
+ return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m BusRouteMutation) Tx() (*Tx, error) {
+ if _, ok := m.driver.(*txDriver); !ok {
+ return nil, errors.New("ent: mutation is not running in a transaction")
+ }
+ tx := &Tx{config: m.config}
+ tx.init()
+ return tx, nil
+}
+
+// SetID sets the value of the id field. Note that this
+// operation is only accepted on creation of BusRoute entities.
+func (m *BusRouteMutation) SetID(id uuid.UUID) {
+ m.id = &id
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *BusRouteMutation) ID() (id uuid.UUID, exists bool) {
+ if m.id == nil {
+ return
+ }
+ return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *BusRouteMutation) IDs(ctx context.Context) ([]uuid.UUID, error) {
+ switch {
+ case m.op.Is(OpUpdateOne | OpDeleteOne):
+ id, exists := m.ID()
+ if exists {
+ return []uuid.UUID{id}, nil
+ }
+ fallthrough
+ case m.op.Is(OpUpdate | OpDelete):
+ return m.Client().BusRoute.Query().Where(m.predicates...).IDs(ctx)
+ default:
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+ }
+}
+
+// SetBusType sets the "bus_type" field.
+func (m *BusRouteMutation) SetBusType(bt busroute.BusType) {
+ m.bus_type = &bt
+}
+
+// BusType returns the value of the "bus_type" field in the mutation.
+func (m *BusRouteMutation) BusType() (r busroute.BusType, exists bool) {
+ v := m.bus_type
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldBusType returns the old "bus_type" field's value of the BusRoute entity.
+// If the BusRoute 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 *BusRouteMutation) OldBusType(ctx context.Context) (v busroute.BusType, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldBusType is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldBusType requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldBusType: %w", err)
+ }
+ return oldValue.BusType, nil
+}
+
+// ResetBusType resets all changes to the "bus_type" field.
+func (m *BusRouteMutation) ResetBusType() {
+ m.bus_type = nil
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (m *BusRouteMutation) SetCreatedAt(t time.Time) {
+ m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *BusRouteMutation) CreatedAt() (r time.Time, exists bool) {
+ v := m.created_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldCreatedAt returns the old "created_at" field's value of the BusRoute entity.
+// If the BusRoute 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 *BusRouteMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+ }
+ return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "created_at" field.
+func (m *BusRouteMutation) ResetCreatedAt() {
+ m.created_at = nil
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (m *BusRouteMutation) SetUpdatedAt(t time.Time) {
+ m.updated_at = &t
+}
+
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
+func (m *BusRouteMutation) UpdatedAt() (r time.Time, exists bool) {
+ v := m.updated_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldUpdatedAt returns the old "updated_at" field's value of the BusRoute entity.
+// If the BusRoute 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 *BusRouteMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
+ }
+ return oldValue.UpdatedAt, nil
+}
+
+// ResetUpdatedAt resets all changes to the "updated_at" field.
+func (m *BusRouteMutation) ResetUpdatedAt() {
+ m.updated_at = nil
+}
+
+// AddBuIDs adds the "bus" edge to the Bus entity by ids.
+func (m *BusRouteMutation) AddBuIDs(ids ...uuid.UUID) {
+ if m.bus == nil {
+ m.bus = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ m.bus[ids[i]] = struct{}{}
+ }
+}
+
+// ClearBus clears the "bus" edge to the Bus entity.
+func (m *BusRouteMutation) ClearBus() {
+ m.clearedbus = true
+}
+
+// BusCleared reports if the "bus" edge to the Bus entity was cleared.
+func (m *BusRouteMutation) BusCleared() bool {
+ return m.clearedbus
+}
+
+// RemoveBuIDs removes the "bus" edge to the Bus entity by IDs.
+func (m *BusRouteMutation) RemoveBuIDs(ids ...uuid.UUID) {
+ if m.removedbus == nil {
+ m.removedbus = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ delete(m.bus, ids[i])
+ m.removedbus[ids[i]] = struct{}{}
+ }
+}
+
+// RemovedBus returns the removed IDs of the "bus" edge to the Bus entity.
+func (m *BusRouteMutation) RemovedBusIDs() (ids []uuid.UUID) {
+ for id := range m.removedbus {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// BusIDs returns the "bus" edge IDs in the mutation.
+func (m *BusRouteMutation) BusIDs() (ids []uuid.UUID) {
+ for id := range m.bus {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ResetBus resets all changes to the "bus" edge.
+func (m *BusRouteMutation) ResetBus() {
+ m.bus = nil
+ m.clearedbus = false
+ m.removedbus = nil
+}
+
+// AddChildBusAssociationIDs adds the "childBusAssociations" edge to the ChildBusAssociation entity by ids.
+func (m *BusRouteMutation) AddChildBusAssociationIDs(ids ...int) {
+ if m.childBusAssociations == nil {
+ m.childBusAssociations = make(map[int]struct{})
+ }
+ for i := range ids {
+ m.childBusAssociations[ids[i]] = struct{}{}
+ }
+}
+
+// ClearChildBusAssociations clears the "childBusAssociations" edge to the ChildBusAssociation entity.
+func (m *BusRouteMutation) ClearChildBusAssociations() {
+ m.clearedchildBusAssociations = true
+}
+
+// ChildBusAssociationsCleared reports if the "childBusAssociations" edge to the ChildBusAssociation entity was cleared.
+func (m *BusRouteMutation) ChildBusAssociationsCleared() bool {
+ return m.clearedchildBusAssociations
+}
+
+// RemoveChildBusAssociationIDs removes the "childBusAssociations" edge to the ChildBusAssociation entity by IDs.
+func (m *BusRouteMutation) RemoveChildBusAssociationIDs(ids ...int) {
+ if m.removedchildBusAssociations == nil {
+ m.removedchildBusAssociations = make(map[int]struct{})
+ }
+ for i := range ids {
+ delete(m.childBusAssociations, ids[i])
+ m.removedchildBusAssociations[ids[i]] = struct{}{}
+ }
+}
+
+// RemovedChildBusAssociations returns the removed IDs of the "childBusAssociations" edge to the ChildBusAssociation entity.
+func (m *BusRouteMutation) RemovedChildBusAssociationsIDs() (ids []int) {
+ for id := range m.removedchildBusAssociations {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ChildBusAssociationsIDs returns the "childBusAssociations" edge IDs in the mutation.
+func (m *BusRouteMutation) ChildBusAssociationsIDs() (ids []int) {
+ for id := range m.childBusAssociations {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ResetChildBusAssociations resets all changes to the "childBusAssociations" edge.
+func (m *BusRouteMutation) ResetChildBusAssociations() {
+ m.childBusAssociations = nil
+ m.clearedchildBusAssociations = false
+ m.removedchildBusAssociations = nil
+}
+
+// AddBusRouteAssociationIDs adds the "busRouteAssociations" edge to the BusRouteAssociation entity by ids.
+func (m *BusRouteMutation) AddBusRouteAssociationIDs(ids ...int) {
+ if m.busRouteAssociations == nil {
+ m.busRouteAssociations = make(map[int]struct{})
+ }
+ for i := range ids {
+ m.busRouteAssociations[ids[i]] = struct{}{}
+ }
+}
+
+// ClearBusRouteAssociations clears the "busRouteAssociations" edge to the BusRouteAssociation entity.
+func (m *BusRouteMutation) ClearBusRouteAssociations() {
+ m.clearedbusRouteAssociations = true
+}
+
+// BusRouteAssociationsCleared reports if the "busRouteAssociations" edge to the BusRouteAssociation entity was cleared.
+func (m *BusRouteMutation) BusRouteAssociationsCleared() bool {
+ return m.clearedbusRouteAssociations
+}
+
+// RemoveBusRouteAssociationIDs removes the "busRouteAssociations" edge to the BusRouteAssociation entity by IDs.
+func (m *BusRouteMutation) RemoveBusRouteAssociationIDs(ids ...int) {
+ if m.removedbusRouteAssociations == nil {
+ m.removedbusRouteAssociations = make(map[int]struct{})
+ }
+ for i := range ids {
+ delete(m.busRouteAssociations, ids[i])
+ m.removedbusRouteAssociations[ids[i]] = struct{}{}
+ }
+}
+
+// RemovedBusRouteAssociations returns the removed IDs of the "busRouteAssociations" edge to the BusRouteAssociation entity.
+func (m *BusRouteMutation) RemovedBusRouteAssociationsIDs() (ids []int) {
+ for id := range m.removedbusRouteAssociations {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// BusRouteAssociationsIDs returns the "busRouteAssociations" edge IDs in the mutation.
+func (m *BusRouteMutation) BusRouteAssociationsIDs() (ids []int) {
+ for id := range m.busRouteAssociations {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ResetBusRouteAssociations resets all changes to the "busRouteAssociations" edge.
+func (m *BusRouteMutation) ResetBusRouteAssociations() {
+ m.busRouteAssociations = nil
+ m.clearedbusRouteAssociations = false
+ m.removedbusRouteAssociations = nil
+}
+
+// AddMorningBusIDs adds the "morning_buses" edge to the Bus entity by ids.
+func (m *BusRouteMutation) AddMorningBusIDs(ids ...uuid.UUID) {
+ if m.morning_buses == nil {
+ m.morning_buses = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ m.morning_buses[ids[i]] = struct{}{}
+ }
+}
+
+// ClearMorningBuses clears the "morning_buses" edge to the Bus entity.
+func (m *BusRouteMutation) ClearMorningBuses() {
+ m.clearedmorning_buses = true
+}
+
+// MorningBusesCleared reports if the "morning_buses" edge to the Bus entity was cleared.
+func (m *BusRouteMutation) MorningBusesCleared() bool {
+ return m.clearedmorning_buses
+}
+
+// RemoveMorningBusIDs removes the "morning_buses" edge to the Bus entity by IDs.
+func (m *BusRouteMutation) RemoveMorningBusIDs(ids ...uuid.UUID) {
+ if m.removedmorning_buses == nil {
+ m.removedmorning_buses = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ delete(m.morning_buses, ids[i])
+ m.removedmorning_buses[ids[i]] = struct{}{}
+ }
+}
+
+// RemovedMorningBuses returns the removed IDs of the "morning_buses" edge to the Bus entity.
+func (m *BusRouteMutation) RemovedMorningBusesIDs() (ids []uuid.UUID) {
+ for id := range m.removedmorning_buses {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// MorningBusesIDs returns the "morning_buses" edge IDs in the mutation.
+func (m *BusRouteMutation) MorningBusesIDs() (ids []uuid.UUID) {
+ for id := range m.morning_buses {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ResetMorningBuses resets all changes to the "morning_buses" edge.
+func (m *BusRouteMutation) ResetMorningBuses() {
+ m.morning_buses = nil
+ m.clearedmorning_buses = false
+ m.removedmorning_buses = nil
+}
+
+// AddEveningBusIDs adds the "evening_buses" edge to the Bus entity by ids.
+func (m *BusRouteMutation) AddEveningBusIDs(ids ...uuid.UUID) {
+ if m.evening_buses == nil {
+ m.evening_buses = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ m.evening_buses[ids[i]] = struct{}{}
+ }
+}
+
+// ClearEveningBuses clears the "evening_buses" edge to the Bus entity.
+func (m *BusRouteMutation) ClearEveningBuses() {
+ m.clearedevening_buses = true
+}
+
+// EveningBusesCleared reports if the "evening_buses" edge to the Bus entity was cleared.
+func (m *BusRouteMutation) EveningBusesCleared() bool {
+ return m.clearedevening_buses
+}
+
+// RemoveEveningBusIDs removes the "evening_buses" edge to the Bus entity by IDs.
+func (m *BusRouteMutation) RemoveEveningBusIDs(ids ...uuid.UUID) {
+ if m.removedevening_buses == nil {
+ m.removedevening_buses = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ delete(m.evening_buses, ids[i])
+ m.removedevening_buses[ids[i]] = struct{}{}
+ }
+}
+
+// RemovedEveningBuses returns the removed IDs of the "evening_buses" edge to the Bus entity.
+func (m *BusRouteMutation) RemovedEveningBusesIDs() (ids []uuid.UUID) {
+ for id := range m.removedevening_buses {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// EveningBusesIDs returns the "evening_buses" edge IDs in the mutation.
+func (m *BusRouteMutation) EveningBusesIDs() (ids []uuid.UUID) {
+ for id := range m.evening_buses {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ResetEveningBuses resets all changes to the "evening_buses" edge.
+func (m *BusRouteMutation) ResetEveningBuses() {
+ m.evening_buses = nil
+ m.clearedevening_buses = false
+ m.removedevening_buses = nil
+}
+
+// Where appends a list predicates to the BusRouteMutation builder.
+func (m *BusRouteMutation) Where(ps ...predicate.BusRoute) {
+ m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the BusRouteMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *BusRouteMutation) WhereP(ps ...func(*sql.Selector)) {
+ p := make([]predicate.BusRoute, len(ps))
+ for i := range ps {
+ p[i] = ps[i]
+ }
+ m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *BusRouteMutation) Op() Op {
+ return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *BusRouteMutation) SetOp(op Op) {
+ m.op = op
+}
+
+// Type returns the node type of this mutation (BusRoute).
+func (m *BusRouteMutation) Type() string {
+ return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *BusRouteMutation) Fields() []string {
+ fields := make([]string, 0, 3)
+ if m.bus_type != nil {
+ fields = append(fields, busroute.FieldBusType)
+ }
+ if m.created_at != nil {
+ fields = append(fields, busroute.FieldCreatedAt)
+ }
+ if m.updated_at != nil {
+ fields = append(fields, busroute.FieldUpdatedAt)
+ }
+ return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *BusRouteMutation) Field(name string) (ent.Value, bool) {
+ switch name {
+ case busroute.FieldBusType:
+ return m.BusType()
+ case busroute.FieldCreatedAt:
+ return m.CreatedAt()
+ case busroute.FieldUpdatedAt:
+ return m.UpdatedAt()
+ }
+ return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *BusRouteMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+ switch name {
+ case busroute.FieldBusType:
+ return m.OldBusType(ctx)
+ case busroute.FieldCreatedAt:
+ return m.OldCreatedAt(ctx)
+ case busroute.FieldUpdatedAt:
+ return m.OldUpdatedAt(ctx)
+ }
+ return nil, fmt.Errorf("unknown BusRoute field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *BusRouteMutation) SetField(name string, value ent.Value) error {
+ switch name {
+ case busroute.FieldBusType:
+ v, ok := value.(busroute.BusType)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetBusType(v)
+ return nil
+ case busroute.FieldCreatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetCreatedAt(v)
+ return nil
+ case busroute.FieldUpdatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetUpdatedAt(v)
+ return nil
+ }
+ return fmt.Errorf("unknown BusRoute field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *BusRouteMutation) AddedFields() []string {
+ return nil
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *BusRouteMutation) AddedField(name string) (ent.Value, bool) {
+ return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *BusRouteMutation) AddField(name string, value ent.Value) error {
+ switch name {
+ }
+ return fmt.Errorf("unknown BusRoute numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *BusRouteMutation) ClearedFields() []string {
+ return nil
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *BusRouteMutation) FieldCleared(name string) bool {
+ _, ok := m.clearedFields[name]
+ return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *BusRouteMutation) ClearField(name string) error {
+ return fmt.Errorf("unknown BusRoute nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *BusRouteMutation) ResetField(name string) error {
+ switch name {
+ case busroute.FieldBusType:
+ m.ResetBusType()
+ return nil
+ case busroute.FieldCreatedAt:
+ m.ResetCreatedAt()
+ return nil
+ case busroute.FieldUpdatedAt:
+ m.ResetUpdatedAt()
+ return nil
+ }
+ return fmt.Errorf("unknown BusRoute field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *BusRouteMutation) AddedEdges() []string {
+ edges := make([]string, 0, 5)
+ if m.bus != nil {
+ edges = append(edges, busroute.EdgeBus)
+ }
+ if m.childBusAssociations != nil {
+ edges = append(edges, busroute.EdgeChildBusAssociations)
+ }
+ if m.busRouteAssociations != nil {
+ edges = append(edges, busroute.EdgeBusRouteAssociations)
+ }
+ if m.morning_buses != nil {
+ edges = append(edges, busroute.EdgeMorningBuses)
+ }
+ if m.evening_buses != nil {
+ edges = append(edges, busroute.EdgeEveningBuses)
+ }
+ return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *BusRouteMutation) AddedIDs(name string) []ent.Value {
+ switch name {
+ case busroute.EdgeBus:
+ ids := make([]ent.Value, 0, len(m.bus))
+ for id := range m.bus {
+ ids = append(ids, id)
+ }
+ return ids
+ case busroute.EdgeChildBusAssociations:
+ ids := make([]ent.Value, 0, len(m.childBusAssociations))
+ for id := range m.childBusAssociations {
+ ids = append(ids, id)
+ }
+ return ids
+ case busroute.EdgeBusRouteAssociations:
+ ids := make([]ent.Value, 0, len(m.busRouteAssociations))
+ for id := range m.busRouteAssociations {
+ ids = append(ids, id)
+ }
+ return ids
+ case busroute.EdgeMorningBuses:
+ ids := make([]ent.Value, 0, len(m.morning_buses))
+ for id := range m.morning_buses {
+ ids = append(ids, id)
+ }
+ return ids
+ case busroute.EdgeEveningBuses:
+ ids := make([]ent.Value, 0, len(m.evening_buses))
+ for id := range m.evening_buses {
+ ids = append(ids, id)
+ }
+ return ids
+ }
+ return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *BusRouteMutation) RemovedEdges() []string {
+ edges := make([]string, 0, 5)
+ if m.removedbus != nil {
+ edges = append(edges, busroute.EdgeBus)
+ }
+ if m.removedchildBusAssociations != nil {
+ edges = append(edges, busroute.EdgeChildBusAssociations)
+ }
+ if m.removedbusRouteAssociations != nil {
+ edges = append(edges, busroute.EdgeBusRouteAssociations)
+ }
+ if m.removedmorning_buses != nil {
+ edges = append(edges, busroute.EdgeMorningBuses)
+ }
+ if m.removedevening_buses != nil {
+ edges = append(edges, busroute.EdgeEveningBuses)
+ }
+ return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *BusRouteMutation) RemovedIDs(name string) []ent.Value {
+ switch name {
+ case busroute.EdgeBus:
+ ids := make([]ent.Value, 0, len(m.removedbus))
+ for id := range m.removedbus {
+ ids = append(ids, id)
+ }
+ return ids
+ case busroute.EdgeChildBusAssociations:
+ ids := make([]ent.Value, 0, len(m.removedchildBusAssociations))
+ for id := range m.removedchildBusAssociations {
+ ids = append(ids, id)
+ }
+ return ids
+ case busroute.EdgeBusRouteAssociations:
+ ids := make([]ent.Value, 0, len(m.removedbusRouteAssociations))
+ for id := range m.removedbusRouteAssociations {
+ ids = append(ids, id)
+ }
+ return ids
+ case busroute.EdgeMorningBuses:
+ ids := make([]ent.Value, 0, len(m.removedmorning_buses))
+ for id := range m.removedmorning_buses {
+ ids = append(ids, id)
+ }
+ return ids
+ case busroute.EdgeEveningBuses:
+ ids := make([]ent.Value, 0, len(m.removedevening_buses))
+ for id := range m.removedevening_buses {
+ ids = append(ids, id)
+ }
+ return ids
+ }
+ return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *BusRouteMutation) ClearedEdges() []string {
+ edges := make([]string, 0, 5)
+ if m.clearedbus {
+ edges = append(edges, busroute.EdgeBus)
+ }
+ if m.clearedchildBusAssociations {
+ edges = append(edges, busroute.EdgeChildBusAssociations)
+ }
+ if m.clearedbusRouteAssociations {
+ edges = append(edges, busroute.EdgeBusRouteAssociations)
+ }
+ if m.clearedmorning_buses {
+ edges = append(edges, busroute.EdgeMorningBuses)
+ }
+ if m.clearedevening_buses {
+ edges = append(edges, busroute.EdgeEveningBuses)
+ }
+ return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *BusRouteMutation) EdgeCleared(name string) bool {
+ switch name {
+ case busroute.EdgeBus:
+ return m.clearedbus
+ case busroute.EdgeChildBusAssociations:
+ return m.clearedchildBusAssociations
+ case busroute.EdgeBusRouteAssociations:
+ return m.clearedbusRouteAssociations
+ case busroute.EdgeMorningBuses:
+ return m.clearedmorning_buses
+ case busroute.EdgeEveningBuses:
+ return m.clearedevening_buses
+ }
+ return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *BusRouteMutation) ClearEdge(name string) error {
+ switch name {
+ }
+ return fmt.Errorf("unknown BusRoute unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *BusRouteMutation) ResetEdge(name string) error {
+ switch name {
+ case busroute.EdgeBus:
+ m.ResetBus()
+ return nil
+ case busroute.EdgeChildBusAssociations:
+ m.ResetChildBusAssociations()
+ return nil
+ case busroute.EdgeBusRouteAssociations:
+ m.ResetBusRouteAssociations()
+ return nil
+ case busroute.EdgeMorningBuses:
+ m.ResetMorningBuses()
+ return nil
+ case busroute.EdgeEveningBuses:
+ m.ResetEveningBuses()
+ return nil
+ }
+ return fmt.Errorf("unknown BusRoute edge %s", name)
+}
+
+// BusRouteAssociationMutation represents an operation that mutates the BusRouteAssociation nodes in the graph.
+type BusRouteAssociationMutation struct {
+ config
+ op Op
+ typ string
+ id *int
+ _order *int32
+ add_order *int32
+ clearedFields map[string]struct{}
+ station *uuid.UUID
+ clearedstation bool
+ busRoute *uuid.UUID
+ clearedbusRoute bool
+ done bool
+ oldValue func(context.Context) (*BusRouteAssociation, error)
+ predicates []predicate.BusRouteAssociation
+}
+
+var _ ent.Mutation = (*BusRouteAssociationMutation)(nil)
+
+// busrouteassociationOption allows management of the mutation configuration using functional options.
+type busrouteassociationOption func(*BusRouteAssociationMutation)
+
+// newBusRouteAssociationMutation creates new mutation for the BusRouteAssociation entity.
+func newBusRouteAssociationMutation(c config, op Op, opts ...busrouteassociationOption) *BusRouteAssociationMutation {
+ m := &BusRouteAssociationMutation{
+ config: c,
+ op: op,
+ typ: TypeBusRouteAssociation,
+ clearedFields: make(map[string]struct{}),
+ }
+ for _, opt := range opts {
+ opt(m)
+ }
+ return m
+}
+
+// withBusRouteAssociationID sets the ID field of the mutation.
+func withBusRouteAssociationID(id int) busrouteassociationOption {
+ return func(m *BusRouteAssociationMutation) {
+ var (
+ err error
+ once sync.Once
+ value *BusRouteAssociation
+ )
+ m.oldValue = func(ctx context.Context) (*BusRouteAssociation, error) {
+ once.Do(func() {
+ if m.done {
+ err = errors.New("querying old values post mutation is not allowed")
+ } else {
+ value, err = m.Client().BusRouteAssociation.Get(ctx, id)
+ }
+ })
+ return value, err
+ }
+ m.id = &id
+ }
+}
+
+// withBusRouteAssociation sets the old BusRouteAssociation of the mutation.
+func withBusRouteAssociation(node *BusRouteAssociation) busrouteassociationOption {
+ return func(m *BusRouteAssociationMutation) {
+ m.oldValue = func(context.Context) (*BusRouteAssociation, error) {
+ return node, nil
+ }
+ m.id = &node.ID
+ }
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m BusRouteAssociationMutation) Client() *Client {
+ client := &Client{config: m.config}
+ client.init()
+ return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m BusRouteAssociationMutation) Tx() (*Tx, error) {
+ if _, ok := m.driver.(*txDriver); !ok {
+ return nil, errors.New("ent: mutation is not running in a transaction")
+ }
+ tx := &Tx{config: m.config}
+ tx.init()
+ return tx, nil
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *BusRouteAssociationMutation) ID() (id int, exists bool) {
+ if m.id == nil {
+ return
+ }
+ return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *BusRouteAssociationMutation) IDs(ctx context.Context) ([]int, error) {
+ switch {
+ case m.op.Is(OpUpdateOne | OpDeleteOne):
+ id, exists := m.ID()
+ if exists {
+ return []int{id}, nil
+ }
+ fallthrough
+ case m.op.Is(OpUpdate | OpDelete):
+ return m.Client().BusRouteAssociation.Query().Where(m.predicates...).IDs(ctx)
+ default:
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+ }
+}
+
+// SetStationID sets the "station_id" field.
+func (m *BusRouteAssociationMutation) SetStationID(u uuid.UUID) {
+ m.station = &u
+}
+
+// StationID returns the value of the "station_id" field in the mutation.
+func (m *BusRouteAssociationMutation) StationID() (r uuid.UUID, exists bool) {
+ v := m.station
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldStationID returns the old "station_id" field's value of the BusRouteAssociation entity.
+// If the BusRouteAssociation 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 *BusRouteAssociationMutation) OldStationID(ctx context.Context) (v uuid.UUID, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldStationID is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldStationID requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldStationID: %w", err)
+ }
+ return oldValue.StationID, nil
+}
+
+// ResetStationID resets all changes to the "station_id" field.
+func (m *BusRouteAssociationMutation) ResetStationID() {
+ m.station = nil
+}
+
+// SetBusRouteID sets the "bus_route_id" field.
+func (m *BusRouteAssociationMutation) SetBusRouteID(u uuid.UUID) {
+ m.busRoute = &u
+}
+
+// BusRouteID returns the value of the "bus_route_id" field in the mutation.
+func (m *BusRouteAssociationMutation) BusRouteID() (r uuid.UUID, exists bool) {
+ v := m.busRoute
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldBusRouteID returns the old "bus_route_id" field's value of the BusRouteAssociation entity.
+// If the BusRouteAssociation 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 *BusRouteAssociationMutation) OldBusRouteID(ctx context.Context) (v uuid.UUID, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldBusRouteID is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldBusRouteID requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldBusRouteID: %w", err)
+ }
+ return oldValue.BusRouteID, nil
+}
+
+// ResetBusRouteID resets all changes to the "bus_route_id" field.
+func (m *BusRouteAssociationMutation) ResetBusRouteID() {
+ m.busRoute = nil
+}
+
+// SetOrder sets the "order" field.
+func (m *BusRouteAssociationMutation) SetOrder(i int32) {
+ m._order = &i
+ m.add_order = nil
+}
+
+// Order returns the value of the "order" field in the mutation.
+func (m *BusRouteAssociationMutation) Order() (r int32, exists bool) {
+ v := m._order
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldOrder returns the old "order" field's value of the BusRouteAssociation entity.
+// If the BusRouteAssociation 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 *BusRouteAssociationMutation) OldOrder(ctx context.Context) (v int32, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldOrder is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldOrder requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldOrder: %w", err)
+ }
+ return oldValue.Order, nil
+}
+
+// AddOrder adds i to the "order" field.
+func (m *BusRouteAssociationMutation) AddOrder(i int32) {
+ if m.add_order != nil {
+ *m.add_order += i
+ } else {
+ m.add_order = &i
+ }
+}
+
+// AddedOrder returns the value that was added to the "order" field in this mutation.
+func (m *BusRouteAssociationMutation) AddedOrder() (r int32, exists bool) {
+ v := m.add_order
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetOrder resets all changes to the "order" field.
+func (m *BusRouteAssociationMutation) ResetOrder() {
+ m._order = nil
+ m.add_order = nil
+}
+
+// ClearStation clears the "station" edge to the Station entity.
+func (m *BusRouteAssociationMutation) ClearStation() {
+ m.clearedstation = true
+ m.clearedFields[busrouteassociation.FieldStationID] = struct{}{}
+}
+
+// StationCleared reports if the "station" edge to the Station entity was cleared.
+func (m *BusRouteAssociationMutation) StationCleared() bool {
+ return m.clearedstation
+}
+
+// StationIDs returns the "station" edge IDs in the mutation.
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
+// StationID instead. It exists only for internal usage by the builders.
+func (m *BusRouteAssociationMutation) StationIDs() (ids []uuid.UUID) {
+ if id := m.station; id != nil {
+ ids = append(ids, *id)
+ }
+ return
+}
+
+// ResetStation resets all changes to the "station" edge.
+func (m *BusRouteAssociationMutation) ResetStation() {
+ m.station = nil
+ m.clearedstation = false
+}
+
+// ClearBusRoute clears the "busRoute" edge to the BusRoute entity.
+func (m *BusRouteAssociationMutation) ClearBusRoute() {
+ m.clearedbusRoute = true
+ m.clearedFields[busrouteassociation.FieldBusRouteID] = struct{}{}
+}
+
+// BusRouteCleared reports if the "busRoute" edge to the BusRoute entity was cleared.
+func (m *BusRouteAssociationMutation) BusRouteCleared() bool {
+ return m.clearedbusRoute
+}
+
+// BusRouteIDs returns the "busRoute" edge IDs in the mutation.
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
+// BusRouteID instead. It exists only for internal usage by the builders.
+func (m *BusRouteAssociationMutation) BusRouteIDs() (ids []uuid.UUID) {
+ if id := m.busRoute; id != nil {
+ ids = append(ids, *id)
+ }
+ return
+}
+
+// ResetBusRoute resets all changes to the "busRoute" edge.
+func (m *BusRouteAssociationMutation) ResetBusRoute() {
+ m.busRoute = nil
+ m.clearedbusRoute = false
+}
+
+// Where appends a list predicates to the BusRouteAssociationMutation builder.
+func (m *BusRouteAssociationMutation) Where(ps ...predicate.BusRouteAssociation) {
+ m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the BusRouteAssociationMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *BusRouteAssociationMutation) WhereP(ps ...func(*sql.Selector)) {
+ p := make([]predicate.BusRouteAssociation, len(ps))
+ for i := range ps {
+ p[i] = ps[i]
+ }
+ m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *BusRouteAssociationMutation) Op() Op {
+ return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *BusRouteAssociationMutation) SetOp(op Op) {
+ m.op = op
+}
+
+// Type returns the node type of this mutation (BusRouteAssociation).
+func (m *BusRouteAssociationMutation) Type() string {
+ return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *BusRouteAssociationMutation) Fields() []string {
+ fields := make([]string, 0, 3)
+ if m.station != nil {
+ fields = append(fields, busrouteassociation.FieldStationID)
+ }
+ if m.busRoute != nil {
+ fields = append(fields, busrouteassociation.FieldBusRouteID)
+ }
+ if m._order != nil {
+ fields = append(fields, busrouteassociation.FieldOrder)
+ }
+ return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *BusRouteAssociationMutation) Field(name string) (ent.Value, bool) {
+ switch name {
+ case busrouteassociation.FieldStationID:
+ return m.StationID()
+ case busrouteassociation.FieldBusRouteID:
+ return m.BusRouteID()
+ case busrouteassociation.FieldOrder:
+ return m.Order()
+ }
+ return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *BusRouteAssociationMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+ switch name {
+ case busrouteassociation.FieldStationID:
+ return m.OldStationID(ctx)
+ case busrouteassociation.FieldBusRouteID:
+ return m.OldBusRouteID(ctx)
+ case busrouteassociation.FieldOrder:
+ return m.OldOrder(ctx)
+ }
+ return nil, fmt.Errorf("unknown BusRouteAssociation field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *BusRouteAssociationMutation) SetField(name string, value ent.Value) error {
+ switch name {
+ case busrouteassociation.FieldStationID:
+ v, ok := value.(uuid.UUID)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetStationID(v)
+ return nil
+ case busrouteassociation.FieldBusRouteID:
+ v, ok := value.(uuid.UUID)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetBusRouteID(v)
+ return nil
+ case busrouteassociation.FieldOrder:
+ v, ok := value.(int32)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetOrder(v)
+ return nil
+ }
+ return fmt.Errorf("unknown BusRouteAssociation field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *BusRouteAssociationMutation) AddedFields() []string {
+ var fields []string
+ if m.add_order != nil {
+ fields = append(fields, busrouteassociation.FieldOrder)
+ }
+ return fields
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *BusRouteAssociationMutation) AddedField(name string) (ent.Value, bool) {
+ switch name {
+ case busrouteassociation.FieldOrder:
+ return m.AddedOrder()
+ }
+ return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *BusRouteAssociationMutation) AddField(name string, value ent.Value) error {
+ switch name {
+ case busrouteassociation.FieldOrder:
+ v, ok := value.(int32)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddOrder(v)
+ return nil
+ }
+ return fmt.Errorf("unknown BusRouteAssociation numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *BusRouteAssociationMutation) ClearedFields() []string {
+ return nil
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *BusRouteAssociationMutation) FieldCleared(name string) bool {
+ _, ok := m.clearedFields[name]
+ return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *BusRouteAssociationMutation) ClearField(name string) error {
+ return fmt.Errorf("unknown BusRouteAssociation nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *BusRouteAssociationMutation) ResetField(name string) error {
+ switch name {
+ case busrouteassociation.FieldStationID:
+ m.ResetStationID()
+ return nil
+ case busrouteassociation.FieldBusRouteID:
+ m.ResetBusRouteID()
+ return nil
+ case busrouteassociation.FieldOrder:
+ m.ResetOrder()
+ return nil
+ }
+ return fmt.Errorf("unknown BusRouteAssociation field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *BusRouteAssociationMutation) AddedEdges() []string {
+ edges := make([]string, 0, 2)
+ if m.station != nil {
+ edges = append(edges, busrouteassociation.EdgeStation)
+ }
+ if m.busRoute != nil {
+ edges = append(edges, busrouteassociation.EdgeBusRoute)
+ }
+ return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *BusRouteAssociationMutation) AddedIDs(name string) []ent.Value {
+ switch name {
+ case busrouteassociation.EdgeStation:
+ if id := m.station; id != nil {
+ return []ent.Value{*id}
+ }
+ case busrouteassociation.EdgeBusRoute:
+ if id := m.busRoute; id != nil {
+ return []ent.Value{*id}
+ }
+ }
+ return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *BusRouteAssociationMutation) RemovedEdges() []string {
+ edges := make([]string, 0, 2)
+ return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *BusRouteAssociationMutation) RemovedIDs(name string) []ent.Value {
+ return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *BusRouteAssociationMutation) ClearedEdges() []string {
+ edges := make([]string, 0, 2)
+ if m.clearedstation {
+ edges = append(edges, busrouteassociation.EdgeStation)
+ }
+ if m.clearedbusRoute {
+ edges = append(edges, busrouteassociation.EdgeBusRoute)
+ }
+ return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *BusRouteAssociationMutation) EdgeCleared(name string) bool {
+ switch name {
+ case busrouteassociation.EdgeStation:
+ return m.clearedstation
+ case busrouteassociation.EdgeBusRoute:
+ return m.clearedbusRoute
+ }
+ return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *BusRouteAssociationMutation) ClearEdge(name string) error {
+ switch name {
+ case busrouteassociation.EdgeStation:
+ m.ClearStation()
+ return nil
+ case busrouteassociation.EdgeBusRoute:
+ m.ClearBusRoute()
+ return nil
+ }
+ return fmt.Errorf("unknown BusRouteAssociation unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *BusRouteAssociationMutation) ResetEdge(name string) error {
+ switch name {
+ case busrouteassociation.EdgeStation:
+ m.ResetStation()
+ return nil
+ case busrouteassociation.EdgeBusRoute:
+ m.ResetBusRoute()
+ return nil
+ }
+ return fmt.Errorf("unknown BusRouteAssociation edge %s", name)
+}
+
+// ChildMutation represents an operation that mutates the Child nodes in the graph.
+type ChildMutation struct {
+ config
+ op Op
+ typ string
+ id *uuid.UUID
+ name *string
+ age *int
+ addage *int
+ sex *child.Sex
+ check_for_missing_items *bool
+ has_bag *bool
+ has_lunch_box *bool
+ has_water_bottle *bool
+ has_umbrella *bool
+ has_other *bool
+ created_at *time.Time
+ updated_at *time.Time
+ clearedFields map[string]struct{}
+ guardian *uuid.UUID
+ clearedguardian bool
+ childBusAssociations map[int]struct{}
+ removedchildBusAssociations map[int]struct{}
+ clearedchildBusAssociations bool
+ boarding_record map[uuid.UUID]struct{}
+ removedboarding_record map[uuid.UUID]struct{}
+ clearedboarding_record bool
+ photos map[uuid.UUID]struct{}
+ removedphotos map[uuid.UUID]struct{}
+ clearedphotos bool
+ done bool
+ oldValue func(context.Context) (*Child, error)
+ predicates []predicate.Child
+}
+
+var _ ent.Mutation = (*ChildMutation)(nil)
+
+// childOption allows management of the mutation configuration using functional options.
+type childOption func(*ChildMutation)
+
+// newChildMutation creates new mutation for the Child entity.
+func newChildMutation(c config, op Op, opts ...childOption) *ChildMutation {
+ m := &ChildMutation{
+ config: c,
+ op: op,
+ typ: TypeChild,
+ clearedFields: make(map[string]struct{}),
+ }
+ for _, opt := range opts {
+ opt(m)
+ }
+ return m
+}
+
+// withChildID sets the ID field of the mutation.
+func withChildID(id uuid.UUID) childOption {
+ return func(m *ChildMutation) {
+ var (
+ err error
+ once sync.Once
+ value *Child
+ )
+ m.oldValue = func(ctx context.Context) (*Child, error) {
+ once.Do(func() {
+ if m.done {
+ err = errors.New("querying old values post mutation is not allowed")
+ } else {
+ value, err = m.Client().Child.Get(ctx, id)
+ }
+ })
+ return value, err
+ }
+ m.id = &id
+ }
+}
+
+// withChild sets the old Child of the mutation.
+func withChild(node *Child) childOption {
+ return func(m *ChildMutation) {
+ m.oldValue = func(context.Context) (*Child, error) {
+ return node, nil
+ }
+ m.id = &node.ID
+ }
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m ChildMutation) Client() *Client {
+ client := &Client{config: m.config}
+ client.init()
+ return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m ChildMutation) Tx() (*Tx, error) {
+ if _, ok := m.driver.(*txDriver); !ok {
+ return nil, errors.New("ent: mutation is not running in a transaction")
+ }
+ tx := &Tx{config: m.config}
+ tx.init()
+ return tx, nil
+}
+
+// SetID sets the value of the id field. Note that this
+// operation is only accepted on creation of Child entities.
+func (m *ChildMutation) SetID(id uuid.UUID) {
+ m.id = &id
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *ChildMutation) ID() (id uuid.UUID, exists bool) {
+ if m.id == nil {
+ return
+ }
+ return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *ChildMutation) IDs(ctx context.Context) ([]uuid.UUID, error) {
+ switch {
+ case m.op.Is(OpUpdateOne | OpDeleteOne):
+ id, exists := m.ID()
+ if exists {
+ return []uuid.UUID{id}, nil
+ }
+ fallthrough
+ case m.op.Is(OpUpdate | OpDelete):
+ return m.Client().Child.Query().Where(m.predicates...).IDs(ctx)
+ default:
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+ }
+}
+
+// SetName sets the "name" field.
+func (m *ChildMutation) SetName(s string) {
+ m.name = &s
+}
+
+// Name returns the value of the "name" field in the mutation.
+func (m *ChildMutation) Name() (r string, exists bool) {
+ v := m.name
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldName returns the old "name" field's value of the Child entity.
+// If the Child 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 *ChildMutation) OldName(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldName is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldName requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldName: %w", err)
+ }
+ return oldValue.Name, nil
+}
+
+// ResetName resets all changes to the "name" field.
+func (m *ChildMutation) ResetName() {
+ m.name = nil
+}
+
+// SetAge sets the "age" field.
+func (m *ChildMutation) SetAge(i int) {
+ m.age = &i
+ m.addage = nil
+}
+
+// Age returns the value of the "age" field in the mutation.
+func (m *ChildMutation) Age() (r int, exists bool) {
+ v := m.age
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldAge returns the old "age" field's value of the Child entity.
+// If the Child 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 *ChildMutation) OldAge(ctx context.Context) (v int, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldAge is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldAge requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldAge: %w", err)
+ }
+ return oldValue.Age, nil
+}
+
+// AddAge adds i to the "age" field.
+func (m *ChildMutation) AddAge(i int) {
+ if m.addage != nil {
+ *m.addage += i
+ } else {
+ m.addage = &i
+ }
+}
+
+// AddedAge returns the value that was added to the "age" field in this mutation.
+func (m *ChildMutation) AddedAge() (r int, exists bool) {
+ v := m.addage
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetAge resets all changes to the "age" field.
+func (m *ChildMutation) ResetAge() {
+ m.age = nil
+ m.addage = nil
+}
+
+// SetSex sets the "sex" field.
+func (m *ChildMutation) SetSex(c child.Sex) {
+ m.sex = &c
+}
+
+// Sex returns the value of the "sex" field in the mutation.
+func (m *ChildMutation) Sex() (r child.Sex, exists bool) {
+ v := m.sex
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldSex returns the old "sex" field's value of the Child entity.
+// If the Child 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 *ChildMutation) OldSex(ctx context.Context) (v child.Sex, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldSex is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldSex requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldSex: %w", err)
+ }
+ return oldValue.Sex, nil
+}
+
+// ResetSex resets all changes to the "sex" field.
+func (m *ChildMutation) ResetSex() {
+ m.sex = nil
+}
+
+// SetCheckForMissingItems sets the "check_for_missing_items" field.
+func (m *ChildMutation) SetCheckForMissingItems(b bool) {
+ m.check_for_missing_items = &b
+}
+
+// CheckForMissingItems returns the value of the "check_for_missing_items" field in the mutation.
+func (m *ChildMutation) CheckForMissingItems() (r bool, exists bool) {
+ v := m.check_for_missing_items
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldCheckForMissingItems returns the old "check_for_missing_items" field's value of the Child entity.
+// If the Child 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 *ChildMutation) OldCheckForMissingItems(ctx context.Context) (v bool, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldCheckForMissingItems is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldCheckForMissingItems requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldCheckForMissingItems: %w", err)
+ }
+ return oldValue.CheckForMissingItems, nil
+}
+
+// ResetCheckForMissingItems resets all changes to the "check_for_missing_items" field.
+func (m *ChildMutation) ResetCheckForMissingItems() {
+ m.check_for_missing_items = nil
+}
+
+// SetHasBag sets the "has_bag" field.
+func (m *ChildMutation) SetHasBag(b bool) {
+ m.has_bag = &b
+}
+
+// HasBag returns the value of the "has_bag" field in the mutation.
+func (m *ChildMutation) HasBag() (r bool, exists bool) {
+ v := m.has_bag
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldHasBag returns the old "has_bag" field's value of the Child entity.
+// If the Child 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 *ChildMutation) OldHasBag(ctx context.Context) (v bool, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldHasBag is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldHasBag requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldHasBag: %w", err)
+ }
+ return oldValue.HasBag, nil
+}
+
+// ResetHasBag resets all changes to the "has_bag" field.
+func (m *ChildMutation) ResetHasBag() {
+ m.has_bag = nil
+}
+
+// SetHasLunchBox sets the "has_lunch_box" field.
+func (m *ChildMutation) SetHasLunchBox(b bool) {
+ m.has_lunch_box = &b
+}
+
+// HasLunchBox returns the value of the "has_lunch_box" field in the mutation.
+func (m *ChildMutation) HasLunchBox() (r bool, exists bool) {
+ v := m.has_lunch_box
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldHasLunchBox returns the old "has_lunch_box" field's value of the Child entity.
+// If the Child 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 *ChildMutation) OldHasLunchBox(ctx context.Context) (v bool, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldHasLunchBox is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldHasLunchBox requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldHasLunchBox: %w", err)
+ }
+ return oldValue.HasLunchBox, nil
+}
+
+// ResetHasLunchBox resets all changes to the "has_lunch_box" field.
+func (m *ChildMutation) ResetHasLunchBox() {
+ m.has_lunch_box = nil
+}
+
+// SetHasWaterBottle sets the "has_water_bottle" field.
+func (m *ChildMutation) SetHasWaterBottle(b bool) {
+ m.has_water_bottle = &b
+}
+
+// HasWaterBottle returns the value of the "has_water_bottle" field in the mutation.
+func (m *ChildMutation) HasWaterBottle() (r bool, exists bool) {
+ v := m.has_water_bottle
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldHasWaterBottle returns the old "has_water_bottle" field's value of the Child entity.
+// If the Child 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 *ChildMutation) OldHasWaterBottle(ctx context.Context) (v bool, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldHasWaterBottle is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldHasWaterBottle requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldHasWaterBottle: %w", err)
+ }
+ return oldValue.HasWaterBottle, nil
+}
+
+// ResetHasWaterBottle resets all changes to the "has_water_bottle" field.
+func (m *ChildMutation) ResetHasWaterBottle() {
+ m.has_water_bottle = nil
+}
+
+// SetHasUmbrella sets the "has_umbrella" field.
+func (m *ChildMutation) SetHasUmbrella(b bool) {
+ m.has_umbrella = &b
+}
+
+// HasUmbrella returns the value of the "has_umbrella" field in the mutation.
+func (m *ChildMutation) HasUmbrella() (r bool, exists bool) {
+ v := m.has_umbrella
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldHasUmbrella returns the old "has_umbrella" field's value of the Child entity.
+// If the Child 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 *ChildMutation) OldHasUmbrella(ctx context.Context) (v bool, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldHasUmbrella is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldHasUmbrella requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldHasUmbrella: %w", err)
+ }
+ return oldValue.HasUmbrella, nil
+}
+
+// ResetHasUmbrella resets all changes to the "has_umbrella" field.
+func (m *ChildMutation) ResetHasUmbrella() {
+ m.has_umbrella = nil
+}
+
+// SetHasOther sets the "has_other" field.
+func (m *ChildMutation) SetHasOther(b bool) {
+ m.has_other = &b
+}
+
+// HasOther returns the value of the "has_other" field in the mutation.
+func (m *ChildMutation) HasOther() (r bool, exists bool) {
+ v := m.has_other
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldHasOther returns the old "has_other" field's value of the Child entity.
+// If the Child 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 *ChildMutation) OldHasOther(ctx context.Context) (v bool, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldHasOther is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldHasOther requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldHasOther: %w", err)
+ }
+ return oldValue.HasOther, nil
+}
+
+// ResetHasOther resets all changes to the "has_other" field.
+func (m *ChildMutation) ResetHasOther() {
+ m.has_other = nil
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (m *ChildMutation) SetCreatedAt(t time.Time) {
+ m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *ChildMutation) CreatedAt() (r time.Time, exists bool) {
+ v := m.created_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldCreatedAt returns the old "created_at" field's value of the Child entity.
+// If the Child 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 *ChildMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+ }
+ return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "created_at" field.
+func (m *ChildMutation) ResetCreatedAt() {
+ m.created_at = nil
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (m *ChildMutation) SetUpdatedAt(t time.Time) {
+ m.updated_at = &t
+}
+
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
+func (m *ChildMutation) UpdatedAt() (r time.Time, exists bool) {
+ v := m.updated_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldUpdatedAt returns the old "updated_at" field's value of the Child entity.
+// If the Child 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 *ChildMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
+ }
+ return oldValue.UpdatedAt, nil
+}
+
+// ResetUpdatedAt resets all changes to the "updated_at" field.
+func (m *ChildMutation) ResetUpdatedAt() {
+ m.updated_at = nil
+}
+
+// SetGuardianID sets the "guardian" edge to the Guardian entity by id.
+func (m *ChildMutation) SetGuardianID(id uuid.UUID) {
+ m.guardian = &id
+}
+
+// ClearGuardian clears the "guardian" edge to the Guardian entity.
+func (m *ChildMutation) ClearGuardian() {
+ m.clearedguardian = true
+}
+
+// GuardianCleared reports if the "guardian" edge to the Guardian entity was cleared.
+func (m *ChildMutation) GuardianCleared() bool {
+ return m.clearedguardian
+}
+
+// GuardianID returns the "guardian" edge ID in the mutation.
+func (m *ChildMutation) GuardianID() (id uuid.UUID, exists bool) {
+ if m.guardian != nil {
+ return *m.guardian, true
+ }
+ return
+}
+
+// GuardianIDs returns the "guardian" edge IDs in the mutation.
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
+// GuardianID instead. It exists only for internal usage by the builders.
+func (m *ChildMutation) GuardianIDs() (ids []uuid.UUID) {
+ if id := m.guardian; id != nil {
+ ids = append(ids, *id)
+ }
+ return
+}
+
+// ResetGuardian resets all changes to the "guardian" edge.
+func (m *ChildMutation) ResetGuardian() {
+ m.guardian = nil
+ m.clearedguardian = false
+}
+
+// AddChildBusAssociationIDs adds the "childBusAssociations" edge to the ChildBusAssociation entity by ids.
+func (m *ChildMutation) AddChildBusAssociationIDs(ids ...int) {
+ if m.childBusAssociations == nil {
+ m.childBusAssociations = make(map[int]struct{})
+ }
+ for i := range ids {
+ m.childBusAssociations[ids[i]] = struct{}{}
+ }
+}
+
+// ClearChildBusAssociations clears the "childBusAssociations" edge to the ChildBusAssociation entity.
+func (m *ChildMutation) ClearChildBusAssociations() {
+ m.clearedchildBusAssociations = true
+}
+
+// ChildBusAssociationsCleared reports if the "childBusAssociations" edge to the ChildBusAssociation entity was cleared.
+func (m *ChildMutation) ChildBusAssociationsCleared() bool {
+ return m.clearedchildBusAssociations
+}
+
+// RemoveChildBusAssociationIDs removes the "childBusAssociations" edge to the ChildBusAssociation entity by IDs.
+func (m *ChildMutation) RemoveChildBusAssociationIDs(ids ...int) {
+ if m.removedchildBusAssociations == nil {
+ m.removedchildBusAssociations = make(map[int]struct{})
+ }
+ for i := range ids {
+ delete(m.childBusAssociations, ids[i])
+ m.removedchildBusAssociations[ids[i]] = struct{}{}
+ }
+}
+
+// RemovedChildBusAssociations returns the removed IDs of the "childBusAssociations" edge to the ChildBusAssociation entity.
+func (m *ChildMutation) RemovedChildBusAssociationsIDs() (ids []int) {
+ for id := range m.removedchildBusAssociations {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ChildBusAssociationsIDs returns the "childBusAssociations" edge IDs in the mutation.
+func (m *ChildMutation) ChildBusAssociationsIDs() (ids []int) {
+ for id := range m.childBusAssociations {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ResetChildBusAssociations resets all changes to the "childBusAssociations" edge.
+func (m *ChildMutation) ResetChildBusAssociations() {
+ m.childBusAssociations = nil
+ m.clearedchildBusAssociations = false
+ m.removedchildBusAssociations = nil
+}
+
+// AddBoardingRecordIDs adds the "boarding_record" edge to the BoardingRecord entity by ids.
+func (m *ChildMutation) AddBoardingRecordIDs(ids ...uuid.UUID) {
+ if m.boarding_record == nil {
+ m.boarding_record = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ m.boarding_record[ids[i]] = struct{}{}
+ }
+}
+
+// ClearBoardingRecord clears the "boarding_record" edge to the BoardingRecord entity.
+func (m *ChildMutation) ClearBoardingRecord() {
+ m.clearedboarding_record = true
+}
+
+// BoardingRecordCleared reports if the "boarding_record" edge to the BoardingRecord entity was cleared.
+func (m *ChildMutation) BoardingRecordCleared() bool {
+ return m.clearedboarding_record
+}
+
+// RemoveBoardingRecordIDs removes the "boarding_record" edge to the BoardingRecord entity by IDs.
+func (m *ChildMutation) RemoveBoardingRecordIDs(ids ...uuid.UUID) {
+ if m.removedboarding_record == nil {
+ m.removedboarding_record = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ delete(m.boarding_record, ids[i])
+ m.removedboarding_record[ids[i]] = struct{}{}
+ }
+}
+
+// RemovedBoardingRecord returns the removed IDs of the "boarding_record" edge to the BoardingRecord entity.
+func (m *ChildMutation) RemovedBoardingRecordIDs() (ids []uuid.UUID) {
+ for id := range m.removedboarding_record {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// BoardingRecordIDs returns the "boarding_record" edge IDs in the mutation.
+func (m *ChildMutation) BoardingRecordIDs() (ids []uuid.UUID) {
+ for id := range m.boarding_record {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ResetBoardingRecord resets all changes to the "boarding_record" edge.
+func (m *ChildMutation) ResetBoardingRecord() {
+ m.boarding_record = nil
+ m.clearedboarding_record = false
+ m.removedboarding_record = nil
+}
+
+// AddPhotoIDs adds the "photos" edge to the ChildPhoto entity by ids.
+func (m *ChildMutation) AddPhotoIDs(ids ...uuid.UUID) {
+ if m.photos == nil {
+ m.photos = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ m.photos[ids[i]] = struct{}{}
+ }
+}
+
+// ClearPhotos clears the "photos" edge to the ChildPhoto entity.
+func (m *ChildMutation) ClearPhotos() {
+ m.clearedphotos = true
+}
+
+// PhotosCleared reports if the "photos" edge to the ChildPhoto entity was cleared.
+func (m *ChildMutation) PhotosCleared() bool {
+ return m.clearedphotos
+}
+
+// RemovePhotoIDs removes the "photos" edge to the ChildPhoto entity by IDs.
+func (m *ChildMutation) RemovePhotoIDs(ids ...uuid.UUID) {
+ if m.removedphotos == nil {
+ m.removedphotos = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ delete(m.photos, ids[i])
+ m.removedphotos[ids[i]] = struct{}{}
+ }
+}
+
+// RemovedPhotos returns the removed IDs of the "photos" edge to the ChildPhoto entity.
+func (m *ChildMutation) RemovedPhotosIDs() (ids []uuid.UUID) {
+ for id := range m.removedphotos {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// PhotosIDs returns the "photos" edge IDs in the mutation.
+func (m *ChildMutation) PhotosIDs() (ids []uuid.UUID) {
+ for id := range m.photos {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ResetPhotos resets all changes to the "photos" edge.
+func (m *ChildMutation) ResetPhotos() {
+ m.photos = nil
+ m.clearedphotos = false
+ m.removedphotos = nil
+}
+
+// Where appends a list predicates to the ChildMutation builder.
+func (m *ChildMutation) Where(ps ...predicate.Child) {
+ m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the ChildMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *ChildMutation) WhereP(ps ...func(*sql.Selector)) {
+ p := make([]predicate.Child, len(ps))
+ for i := range ps {
+ p[i] = ps[i]
+ }
+ m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *ChildMutation) Op() Op {
+ return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *ChildMutation) SetOp(op Op) {
+ m.op = op
+}
+
+// Type returns the node type of this mutation (Child).
+func (m *ChildMutation) Type() string {
+ return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *ChildMutation) Fields() []string {
+ fields := make([]string, 0, 11)
+ if m.name != nil {
+ fields = append(fields, child.FieldName)
+ }
+ if m.age != nil {
+ fields = append(fields, child.FieldAge)
+ }
+ if m.sex != nil {
+ fields = append(fields, child.FieldSex)
+ }
+ if m.check_for_missing_items != nil {
+ fields = append(fields, child.FieldCheckForMissingItems)
+ }
+ if m.has_bag != nil {
+ fields = append(fields, child.FieldHasBag)
+ }
+ if m.has_lunch_box != nil {
+ fields = append(fields, child.FieldHasLunchBox)
+ }
+ if m.has_water_bottle != nil {
+ fields = append(fields, child.FieldHasWaterBottle)
+ }
+ if m.has_umbrella != nil {
+ fields = append(fields, child.FieldHasUmbrella)
+ }
+ if m.has_other != nil {
+ fields = append(fields, child.FieldHasOther)
+ }
+ if m.created_at != nil {
+ fields = append(fields, child.FieldCreatedAt)
+ }
+ if m.updated_at != nil {
+ fields = append(fields, child.FieldUpdatedAt)
+ }
+ return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *ChildMutation) Field(name string) (ent.Value, bool) {
+ switch name {
+ case child.FieldName:
+ return m.Name()
+ case child.FieldAge:
+ return m.Age()
+ case child.FieldSex:
+ return m.Sex()
+ case child.FieldCheckForMissingItems:
+ return m.CheckForMissingItems()
+ case child.FieldHasBag:
+ return m.HasBag()
+ case child.FieldHasLunchBox:
+ return m.HasLunchBox()
+ case child.FieldHasWaterBottle:
+ return m.HasWaterBottle()
+ case child.FieldHasUmbrella:
+ return m.HasUmbrella()
+ case child.FieldHasOther:
+ return m.HasOther()
+ case child.FieldCreatedAt:
+ return m.CreatedAt()
+ case child.FieldUpdatedAt:
+ return m.UpdatedAt()
+ }
+ return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *ChildMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+ switch name {
+ case child.FieldName:
+ return m.OldName(ctx)
+ case child.FieldAge:
+ return m.OldAge(ctx)
+ case child.FieldSex:
+ return m.OldSex(ctx)
+ case child.FieldCheckForMissingItems:
+ return m.OldCheckForMissingItems(ctx)
+ case child.FieldHasBag:
+ return m.OldHasBag(ctx)
+ case child.FieldHasLunchBox:
+ return m.OldHasLunchBox(ctx)
+ case child.FieldHasWaterBottle:
+ return m.OldHasWaterBottle(ctx)
+ case child.FieldHasUmbrella:
+ return m.OldHasUmbrella(ctx)
+ case child.FieldHasOther:
+ return m.OldHasOther(ctx)
+ case child.FieldCreatedAt:
+ return m.OldCreatedAt(ctx)
+ case child.FieldUpdatedAt:
+ return m.OldUpdatedAt(ctx)
+ }
+ return nil, fmt.Errorf("unknown Child field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *ChildMutation) SetField(name string, value ent.Value) error {
+ switch name {
+ case child.FieldName:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetName(v)
+ return nil
+ case child.FieldAge:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetAge(v)
+ return nil
+ case child.FieldSex:
+ v, ok := value.(child.Sex)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetSex(v)
+ return nil
+ case child.FieldCheckForMissingItems:
+ v, ok := value.(bool)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetCheckForMissingItems(v)
+ return nil
+ case child.FieldHasBag:
+ v, ok := value.(bool)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetHasBag(v)
+ return nil
+ case child.FieldHasLunchBox:
+ v, ok := value.(bool)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetHasLunchBox(v)
+ return nil
+ case child.FieldHasWaterBottle:
+ v, ok := value.(bool)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetHasWaterBottle(v)
+ return nil
+ case child.FieldHasUmbrella:
+ v, ok := value.(bool)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetHasUmbrella(v)
+ return nil
+ case child.FieldHasOther:
+ v, ok := value.(bool)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetHasOther(v)
+ return nil
+ case child.FieldCreatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetCreatedAt(v)
+ return nil
+ case child.FieldUpdatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetUpdatedAt(v)
+ return nil
+ }
+ return fmt.Errorf("unknown Child field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *ChildMutation) AddedFields() []string {
+ var fields []string
+ if m.addage != nil {
+ fields = append(fields, child.FieldAge)
+ }
+ return fields
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *ChildMutation) AddedField(name string) (ent.Value, bool) {
+ switch name {
+ case child.FieldAge:
+ return m.AddedAge()
+ }
+ return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *ChildMutation) AddField(name string, value ent.Value) error {
+ switch name {
+ case child.FieldAge:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddAge(v)
+ return nil
+ }
+ return fmt.Errorf("unknown Child numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *ChildMutation) ClearedFields() []string {
+ return nil
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *ChildMutation) FieldCleared(name string) bool {
+ _, ok := m.clearedFields[name]
+ return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *ChildMutation) ClearField(name string) error {
+ return fmt.Errorf("unknown Child nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *ChildMutation) ResetField(name string) error {
+ switch name {
+ case child.FieldName:
+ m.ResetName()
+ return nil
+ case child.FieldAge:
+ m.ResetAge()
+ return nil
+ case child.FieldSex:
+ m.ResetSex()
+ return nil
+ case child.FieldCheckForMissingItems:
+ m.ResetCheckForMissingItems()
+ return nil
+ case child.FieldHasBag:
+ m.ResetHasBag()
+ return nil
+ case child.FieldHasLunchBox:
+ m.ResetHasLunchBox()
+ return nil
+ case child.FieldHasWaterBottle:
+ m.ResetHasWaterBottle()
+ return nil
+ case child.FieldHasUmbrella:
+ m.ResetHasUmbrella()
+ return nil
+ case child.FieldHasOther:
+ m.ResetHasOther()
+ return nil
+ case child.FieldCreatedAt:
+ m.ResetCreatedAt()
+ return nil
+ case child.FieldUpdatedAt:
+ m.ResetUpdatedAt()
+ return nil
+ }
+ return fmt.Errorf("unknown Child field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *ChildMutation) AddedEdges() []string {
+ edges := make([]string, 0, 4)
+ if m.guardian != nil {
+ edges = append(edges, child.EdgeGuardian)
+ }
+ if m.childBusAssociations != nil {
+ edges = append(edges, child.EdgeChildBusAssociations)
+ }
+ if m.boarding_record != nil {
+ edges = append(edges, child.EdgeBoardingRecord)
+ }
+ if m.photos != nil {
+ edges = append(edges, child.EdgePhotos)
+ }
+ return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *ChildMutation) AddedIDs(name string) []ent.Value {
+ switch name {
+ case child.EdgeGuardian:
+ if id := m.guardian; id != nil {
+ return []ent.Value{*id}
+ }
+ case child.EdgeChildBusAssociations:
+ ids := make([]ent.Value, 0, len(m.childBusAssociations))
+ for id := range m.childBusAssociations {
+ ids = append(ids, id)
+ }
+ return ids
+ case child.EdgeBoardingRecord:
+ ids := make([]ent.Value, 0, len(m.boarding_record))
+ for id := range m.boarding_record {
+ ids = append(ids, id)
+ }
+ return ids
+ case child.EdgePhotos:
+ ids := make([]ent.Value, 0, len(m.photos))
+ for id := range m.photos {
+ ids = append(ids, id)
+ }
+ return ids
+ }
+ return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *ChildMutation) RemovedEdges() []string {
+ edges := make([]string, 0, 4)
+ if m.removedchildBusAssociations != nil {
+ edges = append(edges, child.EdgeChildBusAssociations)
+ }
+ if m.removedboarding_record != nil {
+ edges = append(edges, child.EdgeBoardingRecord)
+ }
+ if m.removedphotos != nil {
+ edges = append(edges, child.EdgePhotos)
+ }
+ return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *ChildMutation) RemovedIDs(name string) []ent.Value {
+ switch name {
+ case child.EdgeChildBusAssociations:
+ ids := make([]ent.Value, 0, len(m.removedchildBusAssociations))
+ for id := range m.removedchildBusAssociations {
+ ids = append(ids, id)
+ }
+ return ids
+ case child.EdgeBoardingRecord:
+ ids := make([]ent.Value, 0, len(m.removedboarding_record))
+ for id := range m.removedboarding_record {
+ ids = append(ids, id)
+ }
+ return ids
+ case child.EdgePhotos:
+ ids := make([]ent.Value, 0, len(m.removedphotos))
+ for id := range m.removedphotos {
+ ids = append(ids, id)
+ }
+ return ids
+ }
+ return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *ChildMutation) ClearedEdges() []string {
+ edges := make([]string, 0, 4)
+ if m.clearedguardian {
+ edges = append(edges, child.EdgeGuardian)
+ }
+ if m.clearedchildBusAssociations {
+ edges = append(edges, child.EdgeChildBusAssociations)
+ }
+ if m.clearedboarding_record {
+ edges = append(edges, child.EdgeBoardingRecord)
+ }
+ if m.clearedphotos {
+ edges = append(edges, child.EdgePhotos)
+ }
+ return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *ChildMutation) EdgeCleared(name string) bool {
+ switch name {
+ case child.EdgeGuardian:
+ return m.clearedguardian
+ case child.EdgeChildBusAssociations:
+ return m.clearedchildBusAssociations
+ case child.EdgeBoardingRecord:
+ return m.clearedboarding_record
+ case child.EdgePhotos:
+ return m.clearedphotos
+ }
+ return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *ChildMutation) ClearEdge(name string) error {
+ switch name {
+ case child.EdgeGuardian:
+ m.ClearGuardian()
+ return nil
+ }
+ return fmt.Errorf("unknown Child unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *ChildMutation) ResetEdge(name string) error {
+ switch name {
+ case child.EdgeGuardian:
+ m.ResetGuardian()
+ return nil
+ case child.EdgeChildBusAssociations:
+ m.ResetChildBusAssociations()
+ return nil
+ case child.EdgeBoardingRecord:
+ m.ResetBoardingRecord()
+ return nil
+ case child.EdgePhotos:
+ m.ResetPhotos()
+ return nil
+ }
+ return fmt.Errorf("unknown Child edge %s", name)
+}
+
+// ChildBusAssociationMutation represents an operation that mutates the ChildBusAssociation nodes in the graph.
+type ChildBusAssociationMutation struct {
+ config
+ op Op
+ typ string
+ id *int
+ clearedFields map[string]struct{}
+ child *uuid.UUID
+ clearedchild bool
+ bus_route *uuid.UUID
+ clearedbus_route bool
+ done bool
+ oldValue func(context.Context) (*ChildBusAssociation, error)
+ predicates []predicate.ChildBusAssociation
+}
+
+var _ ent.Mutation = (*ChildBusAssociationMutation)(nil)
+
+// childbusassociationOption allows management of the mutation configuration using functional options.
+type childbusassociationOption func(*ChildBusAssociationMutation)
+
+// newChildBusAssociationMutation creates new mutation for the ChildBusAssociation entity.
+func newChildBusAssociationMutation(c config, op Op, opts ...childbusassociationOption) *ChildBusAssociationMutation {
+ m := &ChildBusAssociationMutation{
+ config: c,
+ op: op,
+ typ: TypeChildBusAssociation,
+ clearedFields: make(map[string]struct{}),
+ }
+ for _, opt := range opts {
+ opt(m)
+ }
+ return m
+}
+
+// withChildBusAssociationID sets the ID field of the mutation.
+func withChildBusAssociationID(id int) childbusassociationOption {
+ return func(m *ChildBusAssociationMutation) {
+ var (
+ err error
+ once sync.Once
+ value *ChildBusAssociation
+ )
+ m.oldValue = func(ctx context.Context) (*ChildBusAssociation, error) {
+ once.Do(func() {
+ if m.done {
+ err = errors.New("querying old values post mutation is not allowed")
+ } else {
+ value, err = m.Client().ChildBusAssociation.Get(ctx, id)
+ }
+ })
+ return value, err
+ }
+ m.id = &id
+ }
+}
+
+// withChildBusAssociation sets the old ChildBusAssociation of the mutation.
+func withChildBusAssociation(node *ChildBusAssociation) childbusassociationOption {
+ return func(m *ChildBusAssociationMutation) {
+ m.oldValue = func(context.Context) (*ChildBusAssociation, error) {
+ return node, nil
+ }
+ m.id = &node.ID
+ }
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m ChildBusAssociationMutation) Client() *Client {
+ client := &Client{config: m.config}
+ client.init()
+ return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m ChildBusAssociationMutation) Tx() (*Tx, error) {
+ if _, ok := m.driver.(*txDriver); !ok {
+ return nil, errors.New("ent: mutation is not running in a transaction")
+ }
+ tx := &Tx{config: m.config}
+ tx.init()
+ return tx, nil
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *ChildBusAssociationMutation) ID() (id int, exists bool) {
+ if m.id == nil {
+ return
+ }
+ return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *ChildBusAssociationMutation) IDs(ctx context.Context) ([]int, error) {
+ switch {
+ case m.op.Is(OpUpdateOne | OpDeleteOne):
+ id, exists := m.ID()
+ if exists {
+ return []int{id}, nil
+ }
+ fallthrough
+ case m.op.Is(OpUpdate | OpDelete):
+ return m.Client().ChildBusAssociation.Query().Where(m.predicates...).IDs(ctx)
+ default:
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+ }
+}
+
+// SetChildID sets the "child_id" field.
+func (m *ChildBusAssociationMutation) SetChildID(u uuid.UUID) {
+ m.child = &u
+}
+
+// ChildID returns the value of the "child_id" field in the mutation.
+func (m *ChildBusAssociationMutation) ChildID() (r uuid.UUID, exists bool) {
+ v := m.child
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldChildID returns the old "child_id" field's value of the ChildBusAssociation entity.
+// If the ChildBusAssociation 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 *ChildBusAssociationMutation) OldChildID(ctx context.Context) (v uuid.UUID, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldChildID is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldChildID requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldChildID: %w", err)
+ }
+ return oldValue.ChildID, nil
+}
+
+// ResetChildID resets all changes to the "child_id" field.
+func (m *ChildBusAssociationMutation) ResetChildID() {
+ m.child = nil
+}
+
+// SetBusRouteID sets the "bus_route_id" field.
+func (m *ChildBusAssociationMutation) SetBusRouteID(u uuid.UUID) {
+ m.bus_route = &u
+}
+
+// BusRouteID returns the value of the "bus_route_id" field in the mutation.
+func (m *ChildBusAssociationMutation) BusRouteID() (r uuid.UUID, exists bool) {
+ v := m.bus_route
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldBusRouteID returns the old "bus_route_id" field's value of the ChildBusAssociation entity.
+// If the ChildBusAssociation 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 *ChildBusAssociationMutation) OldBusRouteID(ctx context.Context) (v uuid.UUID, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldBusRouteID is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldBusRouteID requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldBusRouteID: %w", err)
+ }
+ return oldValue.BusRouteID, nil
+}
+
+// ResetBusRouteID resets all changes to the "bus_route_id" field.
+func (m *ChildBusAssociationMutation) ResetBusRouteID() {
+ m.bus_route = nil
+}
+
+// ClearChild clears the "child" edge to the Child entity.
+func (m *ChildBusAssociationMutation) ClearChild() {
+ m.clearedchild = true
+ m.clearedFields[childbusassociation.FieldChildID] = struct{}{}
+}
+
+// ChildCleared reports if the "child" edge to the Child entity was cleared.
+func (m *ChildBusAssociationMutation) ChildCleared() bool {
+ return m.clearedchild
+}
+
+// ChildIDs returns the "child" edge IDs in the mutation.
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
+// ChildID instead. It exists only for internal usage by the builders.
+func (m *ChildBusAssociationMutation) ChildIDs() (ids []uuid.UUID) {
+ if id := m.child; id != nil {
+ ids = append(ids, *id)
+ }
+ return
+}
+
+// ResetChild resets all changes to the "child" edge.
+func (m *ChildBusAssociationMutation) ResetChild() {
+ m.child = nil
+ m.clearedchild = false
+}
+
+// ClearBusRoute clears the "bus_route" edge to the BusRoute entity.
+func (m *ChildBusAssociationMutation) ClearBusRoute() {
+ m.clearedbus_route = true
+ m.clearedFields[childbusassociation.FieldBusRouteID] = struct{}{}
+}
+
+// BusRouteCleared reports if the "bus_route" edge to the BusRoute entity was cleared.
+func (m *ChildBusAssociationMutation) BusRouteCleared() bool {
+ return m.clearedbus_route
+}
+
+// BusRouteIDs returns the "bus_route" edge IDs in the mutation.
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
+// BusRouteID instead. It exists only for internal usage by the builders.
+func (m *ChildBusAssociationMutation) BusRouteIDs() (ids []uuid.UUID) {
+ if id := m.bus_route; id != nil {
+ ids = append(ids, *id)
+ }
+ return
+}
+
+// ResetBusRoute resets all changes to the "bus_route" edge.
+func (m *ChildBusAssociationMutation) ResetBusRoute() {
+ m.bus_route = nil
+ m.clearedbus_route = false
+}
+
+// Where appends a list predicates to the ChildBusAssociationMutation builder.
+func (m *ChildBusAssociationMutation) Where(ps ...predicate.ChildBusAssociation) {
+ m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the ChildBusAssociationMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *ChildBusAssociationMutation) WhereP(ps ...func(*sql.Selector)) {
+ p := make([]predicate.ChildBusAssociation, len(ps))
+ for i := range ps {
+ p[i] = ps[i]
+ }
+ m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *ChildBusAssociationMutation) Op() Op {
+ return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *ChildBusAssociationMutation) SetOp(op Op) {
+ m.op = op
+}
+
+// Type returns the node type of this mutation (ChildBusAssociation).
+func (m *ChildBusAssociationMutation) Type() string {
+ return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *ChildBusAssociationMutation) Fields() []string {
+ fields := make([]string, 0, 2)
+ if m.child != nil {
+ fields = append(fields, childbusassociation.FieldChildID)
+ }
+ if m.bus_route != nil {
+ fields = append(fields, childbusassociation.FieldBusRouteID)
+ }
+ return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *ChildBusAssociationMutation) Field(name string) (ent.Value, bool) {
+ switch name {
+ case childbusassociation.FieldChildID:
+ return m.ChildID()
+ case childbusassociation.FieldBusRouteID:
+ return m.BusRouteID()
+ }
+ return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *ChildBusAssociationMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+ switch name {
+ case childbusassociation.FieldChildID:
+ return m.OldChildID(ctx)
+ case childbusassociation.FieldBusRouteID:
+ return m.OldBusRouteID(ctx)
+ }
+ return nil, fmt.Errorf("unknown ChildBusAssociation field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *ChildBusAssociationMutation) SetField(name string, value ent.Value) error {
+ switch name {
+ case childbusassociation.FieldChildID:
+ v, ok := value.(uuid.UUID)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetChildID(v)
+ return nil
+ case childbusassociation.FieldBusRouteID:
+ v, ok := value.(uuid.UUID)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetBusRouteID(v)
+ return nil
+ }
+ return fmt.Errorf("unknown ChildBusAssociation field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *ChildBusAssociationMutation) AddedFields() []string {
+ return nil
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *ChildBusAssociationMutation) AddedField(name string) (ent.Value, bool) {
+ return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *ChildBusAssociationMutation) AddField(name string, value ent.Value) error {
+ switch name {
+ }
+ return fmt.Errorf("unknown ChildBusAssociation numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *ChildBusAssociationMutation) ClearedFields() []string {
+ return nil
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *ChildBusAssociationMutation) FieldCleared(name string) bool {
+ _, ok := m.clearedFields[name]
+ return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *ChildBusAssociationMutation) ClearField(name string) error {
+ return fmt.Errorf("unknown ChildBusAssociation nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *ChildBusAssociationMutation) ResetField(name string) error {
+ switch name {
+ case childbusassociation.FieldChildID:
+ m.ResetChildID()
+ return nil
+ case childbusassociation.FieldBusRouteID:
+ m.ResetBusRouteID()
+ return nil
+ }
+ return fmt.Errorf("unknown ChildBusAssociation field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *ChildBusAssociationMutation) AddedEdges() []string {
+ edges := make([]string, 0, 2)
+ if m.child != nil {
+ edges = append(edges, childbusassociation.EdgeChild)
+ }
+ if m.bus_route != nil {
+ edges = append(edges, childbusassociation.EdgeBusRoute)
+ }
+ return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *ChildBusAssociationMutation) AddedIDs(name string) []ent.Value {
+ switch name {
+ case childbusassociation.EdgeChild:
+ if id := m.child; id != nil {
+ return []ent.Value{*id}
+ }
+ case childbusassociation.EdgeBusRoute:
+ if id := m.bus_route; id != nil {
+ return []ent.Value{*id}
+ }
+ }
+ return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *ChildBusAssociationMutation) RemovedEdges() []string {
+ edges := make([]string, 0, 2)
+ return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *ChildBusAssociationMutation) RemovedIDs(name string) []ent.Value {
+ return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *ChildBusAssociationMutation) ClearedEdges() []string {
+ edges := make([]string, 0, 2)
+ if m.clearedchild {
+ edges = append(edges, childbusassociation.EdgeChild)
+ }
+ if m.clearedbus_route {
+ edges = append(edges, childbusassociation.EdgeBusRoute)
+ }
+ return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *ChildBusAssociationMutation) EdgeCleared(name string) bool {
+ switch name {
+ case childbusassociation.EdgeChild:
+ return m.clearedchild
+ case childbusassociation.EdgeBusRoute:
+ return m.clearedbus_route
+ }
+ return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *ChildBusAssociationMutation) ClearEdge(name string) error {
+ switch name {
+ case childbusassociation.EdgeChild:
+ m.ClearChild()
+ return nil
+ case childbusassociation.EdgeBusRoute:
+ m.ClearBusRoute()
+ return nil
+ }
+ return fmt.Errorf("unknown ChildBusAssociation unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *ChildBusAssociationMutation) ResetEdge(name string) error {
+ switch name {
+ case childbusassociation.EdgeChild:
+ m.ResetChild()
+ return nil
+ case childbusassociation.EdgeBusRoute:
+ m.ResetBusRoute()
+ return nil
+ }
+ return fmt.Errorf("unknown ChildBusAssociation edge %s", name)
+}
+
+// ChildPhotoMutation represents an operation that mutates the ChildPhoto nodes in the graph.
+type ChildPhotoMutation struct {
+ config
+ op Op
+ typ string
+ id *uuid.UUID
+ created_at *time.Time
+ updated_at *time.Time
+ clearedFields map[string]struct{}
+ child *uuid.UUID
+ clearedchild bool
+ done bool
+ oldValue func(context.Context) (*ChildPhoto, error)
+ predicates []predicate.ChildPhoto
+}
+
+var _ ent.Mutation = (*ChildPhotoMutation)(nil)
+
+// childphotoOption allows management of the mutation configuration using functional options.
+type childphotoOption func(*ChildPhotoMutation)
+
+// newChildPhotoMutation creates new mutation for the ChildPhoto entity.
+func newChildPhotoMutation(c config, op Op, opts ...childphotoOption) *ChildPhotoMutation {
+ m := &ChildPhotoMutation{
+ config: c,
+ op: op,
+ typ: TypeChildPhoto,
+ clearedFields: make(map[string]struct{}),
+ }
+ for _, opt := range opts {
+ opt(m)
+ }
+ return m
+}
+
+// withChildPhotoID sets the ID field of the mutation.
+func withChildPhotoID(id uuid.UUID) childphotoOption {
+ return func(m *ChildPhotoMutation) {
+ var (
+ err error
+ once sync.Once
+ value *ChildPhoto
+ )
+ m.oldValue = func(ctx context.Context) (*ChildPhoto, error) {
+ once.Do(func() {
+ if m.done {
+ err = errors.New("querying old values post mutation is not allowed")
+ } else {
+ value, err = m.Client().ChildPhoto.Get(ctx, id)
+ }
+ })
+ return value, err
+ }
+ m.id = &id
+ }
+}
+
+// withChildPhoto sets the old ChildPhoto of the mutation.
+func withChildPhoto(node *ChildPhoto) childphotoOption {
+ return func(m *ChildPhotoMutation) {
+ m.oldValue = func(context.Context) (*ChildPhoto, error) {
+ return node, nil
+ }
+ m.id = &node.ID
+ }
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m ChildPhotoMutation) Client() *Client {
+ client := &Client{config: m.config}
+ client.init()
+ return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m ChildPhotoMutation) Tx() (*Tx, error) {
+ if _, ok := m.driver.(*txDriver); !ok {
+ return nil, errors.New("ent: mutation is not running in a transaction")
+ }
+ tx := &Tx{config: m.config}
+ tx.init()
+ return tx, nil
+}
+
+// SetID sets the value of the id field. Note that this
+// operation is only accepted on creation of ChildPhoto entities.
+func (m *ChildPhotoMutation) SetID(id uuid.UUID) {
+ m.id = &id
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *ChildPhotoMutation) ID() (id uuid.UUID, exists bool) {
+ if m.id == nil {
+ return
+ }
+ return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *ChildPhotoMutation) IDs(ctx context.Context) ([]uuid.UUID, error) {
+ switch {
+ case m.op.Is(OpUpdateOne | OpDeleteOne):
+ id, exists := m.ID()
+ if exists {
+ return []uuid.UUID{id}, nil
+ }
+ fallthrough
+ case m.op.Is(OpUpdate | OpDelete):
+ return m.Client().ChildPhoto.Query().Where(m.predicates...).IDs(ctx)
+ default:
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+ }
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (m *ChildPhotoMutation) SetCreatedAt(t time.Time) {
+ m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *ChildPhotoMutation) CreatedAt() (r time.Time, exists bool) {
+ v := m.created_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldCreatedAt returns the old "created_at" field's value of the ChildPhoto entity.
+// If the ChildPhoto 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 *ChildPhotoMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+ }
+ return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "created_at" field.
+func (m *ChildPhotoMutation) ResetCreatedAt() {
+ m.created_at = nil
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (m *ChildPhotoMutation) SetUpdatedAt(t time.Time) {
+ m.updated_at = &t
+}
+
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
+func (m *ChildPhotoMutation) UpdatedAt() (r time.Time, exists bool) {
+ v := m.updated_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldUpdatedAt returns the old "updated_at" field's value of the ChildPhoto entity.
+// If the ChildPhoto 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 *ChildPhotoMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
+ }
+ return oldValue.UpdatedAt, nil
+}
+
+// ResetUpdatedAt resets all changes to the "updated_at" field.
+func (m *ChildPhotoMutation) ResetUpdatedAt() {
+ m.updated_at = nil
+}
+
+// SetChildID sets the "child" edge to the Child entity by id.
+func (m *ChildPhotoMutation) SetChildID(id uuid.UUID) {
+ m.child = &id
+}
+
+// ClearChild clears the "child" edge to the Child entity.
+func (m *ChildPhotoMutation) ClearChild() {
+ m.clearedchild = true
+}
+
+// ChildCleared reports if the "child" edge to the Child entity was cleared.
+func (m *ChildPhotoMutation) ChildCleared() bool {
+ return m.clearedchild
+}
+
+// ChildID returns the "child" edge ID in the mutation.
+func (m *ChildPhotoMutation) ChildID() (id uuid.UUID, exists bool) {
+ if m.child != nil {
+ return *m.child, true
+ }
+ return
+}
+
+// ChildIDs returns the "child" edge IDs in the mutation.
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
+// ChildID instead. It exists only for internal usage by the builders.
+func (m *ChildPhotoMutation) ChildIDs() (ids []uuid.UUID) {
+ if id := m.child; id != nil {
+ ids = append(ids, *id)
+ }
+ return
+}
+
+// ResetChild resets all changes to the "child" edge.
+func (m *ChildPhotoMutation) ResetChild() {
+ m.child = nil
+ m.clearedchild = false
+}
+
+// Where appends a list predicates to the ChildPhotoMutation builder.
+func (m *ChildPhotoMutation) Where(ps ...predicate.ChildPhoto) {
+ m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the ChildPhotoMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *ChildPhotoMutation) WhereP(ps ...func(*sql.Selector)) {
+ p := make([]predicate.ChildPhoto, len(ps))
+ for i := range ps {
+ p[i] = ps[i]
+ }
+ m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *ChildPhotoMutation) Op() Op {
+ return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *ChildPhotoMutation) SetOp(op Op) {
+ m.op = op
+}
+
+// Type returns the node type of this mutation (ChildPhoto).
+func (m *ChildPhotoMutation) Type() string {
+ return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *ChildPhotoMutation) Fields() []string {
+ fields := make([]string, 0, 2)
+ if m.created_at != nil {
+ fields = append(fields, childphoto.FieldCreatedAt)
+ }
+ if m.updated_at != nil {
+ fields = append(fields, childphoto.FieldUpdatedAt)
+ }
+ return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *ChildPhotoMutation) Field(name string) (ent.Value, bool) {
+ switch name {
+ case childphoto.FieldCreatedAt:
+ return m.CreatedAt()
+ case childphoto.FieldUpdatedAt:
+ return m.UpdatedAt()
+ }
+ return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *ChildPhotoMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+ switch name {
+ case childphoto.FieldCreatedAt:
+ return m.OldCreatedAt(ctx)
+ case childphoto.FieldUpdatedAt:
+ return m.OldUpdatedAt(ctx)
+ }
+ return nil, fmt.Errorf("unknown ChildPhoto field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *ChildPhotoMutation) SetField(name string, value ent.Value) error {
+ switch name {
+ case childphoto.FieldCreatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetCreatedAt(v)
+ return nil
+ case childphoto.FieldUpdatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetUpdatedAt(v)
+ return nil
+ }
+ return fmt.Errorf("unknown ChildPhoto field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *ChildPhotoMutation) AddedFields() []string {
+ return nil
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *ChildPhotoMutation) AddedField(name string) (ent.Value, bool) {
+ return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *ChildPhotoMutation) AddField(name string, value ent.Value) error {
+ switch name {
+ }
+ return fmt.Errorf("unknown ChildPhoto numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *ChildPhotoMutation) ClearedFields() []string {
+ return nil
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *ChildPhotoMutation) FieldCleared(name string) bool {
+ _, ok := m.clearedFields[name]
+ return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *ChildPhotoMutation) ClearField(name string) error {
+ return fmt.Errorf("unknown ChildPhoto nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *ChildPhotoMutation) ResetField(name string) error {
+ switch name {
+ case childphoto.FieldCreatedAt:
+ m.ResetCreatedAt()
+ return nil
+ case childphoto.FieldUpdatedAt:
+ m.ResetUpdatedAt()
+ return nil
+ }
+ return fmt.Errorf("unknown ChildPhoto field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *ChildPhotoMutation) AddedEdges() []string {
+ edges := make([]string, 0, 1)
+ if m.child != nil {
+ edges = append(edges, childphoto.EdgeChild)
+ }
+ return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *ChildPhotoMutation) AddedIDs(name string) []ent.Value {
+ switch name {
+ case childphoto.EdgeChild:
+ if id := m.child; id != nil {
+ return []ent.Value{*id}
+ }
+ }
+ return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *ChildPhotoMutation) RemovedEdges() []string {
+ edges := make([]string, 0, 1)
+ return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *ChildPhotoMutation) RemovedIDs(name string) []ent.Value {
+ return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *ChildPhotoMutation) ClearedEdges() []string {
+ edges := make([]string, 0, 1)
+ if m.clearedchild {
+ edges = append(edges, childphoto.EdgeChild)
+ }
+ return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *ChildPhotoMutation) EdgeCleared(name string) bool {
+ switch name {
+ case childphoto.EdgeChild:
+ return m.clearedchild
+ }
+ return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *ChildPhotoMutation) ClearEdge(name string) error {
+ switch name {
+ case childphoto.EdgeChild:
+ m.ClearChild()
+ return nil
+ }
+ return fmt.Errorf("unknown ChildPhoto unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *ChildPhotoMutation) ResetEdge(name string) error {
+ switch name {
+ case childphoto.EdgeChild:
+ m.ResetChild()
+ return nil
+ }
+ return fmt.Errorf("unknown ChildPhoto edge %s", name)
+}
+
+// GuardianMutation represents an operation that mutates the Guardian nodes in the graph.
+type GuardianMutation struct {
+ config
+ op Op
+ typ string
+ id *uuid.UUID
+ email *string
+ hashed_password *string
+ name *string
+ phone_number *string
+ is_use_morning_bus *bool
+ is_use_evening_bus *bool
+ created_at *time.Time
+ updated_at *time.Time
+ clearedFields map[string]struct{}
+ children map[uuid.UUID]struct{}
+ removedchildren map[uuid.UUID]struct{}
+ clearedchildren bool
+ nursery *uuid.UUID
+ clearednursery bool
+ station *uuid.UUID
+ clearedstation bool
+ done bool
+ oldValue func(context.Context) (*Guardian, error)
+ predicates []predicate.Guardian
+}
+
+var _ ent.Mutation = (*GuardianMutation)(nil)
+
+// guardianOption allows management of the mutation configuration using functional options.
+type guardianOption func(*GuardianMutation)
+
+// newGuardianMutation creates new mutation for the Guardian entity.
+func newGuardianMutation(c config, op Op, opts ...guardianOption) *GuardianMutation {
+ m := &GuardianMutation{
+ config: c,
+ op: op,
+ typ: TypeGuardian,
+ clearedFields: make(map[string]struct{}),
+ }
+ for _, opt := range opts {
+ opt(m)
+ }
+ return m
+}
+
+// withGuardianID sets the ID field of the mutation.
+func withGuardianID(id uuid.UUID) guardianOption {
+ return func(m *GuardianMutation) {
+ var (
+ err error
+ once sync.Once
+ value *Guardian
+ )
+ m.oldValue = func(ctx context.Context) (*Guardian, error) {
+ once.Do(func() {
+ if m.done {
+ err = errors.New("querying old values post mutation is not allowed")
+ } else {
+ value, err = m.Client().Guardian.Get(ctx, id)
+ }
+ })
+ return value, err
+ }
+ m.id = &id
+ }
+}
+
+// withGuardian sets the old Guardian of the mutation.
+func withGuardian(node *Guardian) guardianOption {
+ return func(m *GuardianMutation) {
+ m.oldValue = func(context.Context) (*Guardian, error) {
+ return node, nil
+ }
+ m.id = &node.ID
+ }
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m GuardianMutation) Client() *Client {
+ client := &Client{config: m.config}
+ client.init()
+ return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m GuardianMutation) Tx() (*Tx, error) {
+ if _, ok := m.driver.(*txDriver); !ok {
+ return nil, errors.New("ent: mutation is not running in a transaction")
+ }
+ tx := &Tx{config: m.config}
+ tx.init()
+ return tx, nil
+}
+
+// SetID sets the value of the id field. Note that this
+// operation is only accepted on creation of Guardian entities.
+func (m *GuardianMutation) SetID(id uuid.UUID) {
+ m.id = &id
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *GuardianMutation) ID() (id uuid.UUID, exists bool) {
+ if m.id == nil {
+ return
+ }
+ return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *GuardianMutation) IDs(ctx context.Context) ([]uuid.UUID, error) {
+ switch {
+ case m.op.Is(OpUpdateOne | OpDeleteOne):
+ id, exists := m.ID()
+ if exists {
+ return []uuid.UUID{id}, nil
+ }
+ fallthrough
+ case m.op.Is(OpUpdate | OpDelete):
+ return m.Client().Guardian.Query().Where(m.predicates...).IDs(ctx)
+ default:
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+ }
+}
+
+// SetEmail sets the "email" field.
+func (m *GuardianMutation) SetEmail(s string) {
+ m.email = &s
+}
+
+// Email returns the value of the "email" field in the mutation.
+func (m *GuardianMutation) Email() (r string, exists bool) {
+ v := m.email
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldEmail returns the old "email" field's value of the Guardian entity.
+// If the Guardian 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 *GuardianMutation) OldEmail(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldEmail is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldEmail requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldEmail: %w", err)
+ }
+ return oldValue.Email, nil
+}
+
+// ResetEmail resets all changes to the "email" field.
+func (m *GuardianMutation) ResetEmail() {
+ m.email = nil
+}
+
+// SetHashedPassword sets the "hashed_password" field.
+func (m *GuardianMutation) SetHashedPassword(s string) {
+ m.hashed_password = &s
+}
+
+// HashedPassword returns the value of the "hashed_password" field in the mutation.
+func (m *GuardianMutation) HashedPassword() (r string, exists bool) {
+ v := m.hashed_password
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldHashedPassword returns the old "hashed_password" field's value of the Guardian entity.
+// If the Guardian 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 *GuardianMutation) OldHashedPassword(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldHashedPassword is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldHashedPassword requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldHashedPassword: %w", err)
+ }
+ return oldValue.HashedPassword, nil
+}
+
+// ResetHashedPassword resets all changes to the "hashed_password" field.
+func (m *GuardianMutation) ResetHashedPassword() {
+ m.hashed_password = nil
+}
+
+// SetName sets the "name" field.
+func (m *GuardianMutation) SetName(s string) {
+ m.name = &s
+}
+
+// Name returns the value of the "name" field in the mutation.
+func (m *GuardianMutation) Name() (r string, exists bool) {
+ v := m.name
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldName returns the old "name" field's value of the Guardian entity.
+// If the Guardian 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 *GuardianMutation) OldName(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldName is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldName requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldName: %w", err)
+ }
+ return oldValue.Name, nil
+}
+
+// ResetName resets all changes to the "name" field.
+func (m *GuardianMutation) ResetName() {
+ m.name = nil
+}
+
+// SetPhoneNumber sets the "phone_number" field.
+func (m *GuardianMutation) SetPhoneNumber(s string) {
+ m.phone_number = &s
+}
+
+// PhoneNumber returns the value of the "phone_number" field in the mutation.
+func (m *GuardianMutation) PhoneNumber() (r string, exists bool) {
+ v := m.phone_number
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldPhoneNumber returns the old "phone_number" field's value of the Guardian entity.
+// If the Guardian 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 *GuardianMutation) OldPhoneNumber(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldPhoneNumber is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldPhoneNumber requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldPhoneNumber: %w", err)
+ }
+ return oldValue.PhoneNumber, nil
+}
+
+// ClearPhoneNumber clears the value of the "phone_number" field.
+func (m *GuardianMutation) ClearPhoneNumber() {
+ m.phone_number = nil
+ m.clearedFields[guardian.FieldPhoneNumber] = struct{}{}
+}
+
+// PhoneNumberCleared returns if the "phone_number" field was cleared in this mutation.
+func (m *GuardianMutation) PhoneNumberCleared() bool {
+ _, ok := m.clearedFields[guardian.FieldPhoneNumber]
+ return ok
+}
+
+// ResetPhoneNumber resets all changes to the "phone_number" field.
+func (m *GuardianMutation) ResetPhoneNumber() {
+ m.phone_number = nil
+ delete(m.clearedFields, guardian.FieldPhoneNumber)
+}
+
+// SetIsUseMorningBus sets the "is_use_morning_bus" field.
+func (m *GuardianMutation) SetIsUseMorningBus(b bool) {
+ m.is_use_morning_bus = &b
+}
+
+// IsUseMorningBus returns the value of the "is_use_morning_bus" field in the mutation.
+func (m *GuardianMutation) IsUseMorningBus() (r bool, exists bool) {
+ v := m.is_use_morning_bus
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldIsUseMorningBus returns the old "is_use_morning_bus" field's value of the Guardian entity.
+// If the Guardian 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 *GuardianMutation) OldIsUseMorningBus(ctx context.Context) (v bool, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldIsUseMorningBus is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldIsUseMorningBus requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldIsUseMorningBus: %w", err)
+ }
+ return oldValue.IsUseMorningBus, nil
+}
+
+// ResetIsUseMorningBus resets all changes to the "is_use_morning_bus" field.
+func (m *GuardianMutation) ResetIsUseMorningBus() {
+ m.is_use_morning_bus = nil
+}
+
+// SetIsUseEveningBus sets the "is_use_evening_bus" field.
+func (m *GuardianMutation) SetIsUseEveningBus(b bool) {
+ m.is_use_evening_bus = &b
+}
+
+// IsUseEveningBus returns the value of the "is_use_evening_bus" field in the mutation.
+func (m *GuardianMutation) IsUseEveningBus() (r bool, exists bool) {
+ v := m.is_use_evening_bus
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldIsUseEveningBus returns the old "is_use_evening_bus" field's value of the Guardian entity.
+// If the Guardian 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 *GuardianMutation) OldIsUseEveningBus(ctx context.Context) (v bool, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldIsUseEveningBus is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldIsUseEveningBus requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldIsUseEveningBus: %w", err)
+ }
+ return oldValue.IsUseEveningBus, nil
+}
+
+// ResetIsUseEveningBus resets all changes to the "is_use_evening_bus" field.
+func (m *GuardianMutation) ResetIsUseEveningBus() {
+ m.is_use_evening_bus = nil
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (m *GuardianMutation) SetCreatedAt(t time.Time) {
+ m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *GuardianMutation) CreatedAt() (r time.Time, exists bool) {
+ v := m.created_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldCreatedAt returns the old "created_at" field's value of the Guardian entity.
+// If the Guardian 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 *GuardianMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+ }
+ return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "created_at" field.
+func (m *GuardianMutation) ResetCreatedAt() {
+ m.created_at = nil
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (m *GuardianMutation) SetUpdatedAt(t time.Time) {
+ m.updated_at = &t
+}
+
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
+func (m *GuardianMutation) UpdatedAt() (r time.Time, exists bool) {
+ v := m.updated_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldUpdatedAt returns the old "updated_at" field's value of the Guardian entity.
+// If the Guardian 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 *GuardianMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
+ }
+ return oldValue.UpdatedAt, nil
+}
+
+// ResetUpdatedAt resets all changes to the "updated_at" field.
+func (m *GuardianMutation) ResetUpdatedAt() {
+ m.updated_at = nil
+}
+
+// AddChildIDs adds the "children" edge to the Child entity by ids.
+func (m *GuardianMutation) AddChildIDs(ids ...uuid.UUID) {
+ if m.children == nil {
+ m.children = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ m.children[ids[i]] = struct{}{}
+ }
+}
+
+// ClearChildren clears the "children" edge to the Child entity.
+func (m *GuardianMutation) ClearChildren() {
+ m.clearedchildren = true
+}
+
+// ChildrenCleared reports if the "children" edge to the Child entity was cleared.
+func (m *GuardianMutation) ChildrenCleared() bool {
+ return m.clearedchildren
+}
+
+// RemoveChildIDs removes the "children" edge to the Child entity by IDs.
+func (m *GuardianMutation) RemoveChildIDs(ids ...uuid.UUID) {
+ if m.removedchildren == nil {
+ m.removedchildren = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ delete(m.children, ids[i])
+ m.removedchildren[ids[i]] = struct{}{}
+ }
+}
+
+// RemovedChildren returns the removed IDs of the "children" edge to the Child entity.
+func (m *GuardianMutation) RemovedChildrenIDs() (ids []uuid.UUID) {
+ for id := range m.removedchildren {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ChildrenIDs returns the "children" edge IDs in the mutation.
+func (m *GuardianMutation) ChildrenIDs() (ids []uuid.UUID) {
+ for id := range m.children {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ResetChildren resets all changes to the "children" edge.
+func (m *GuardianMutation) ResetChildren() {
+ m.children = nil
+ m.clearedchildren = false
+ m.removedchildren = nil
+}
+
+// SetNurseryID sets the "nursery" edge to the Nursery entity by id.
+func (m *GuardianMutation) SetNurseryID(id uuid.UUID) {
+ m.nursery = &id
+}
+
+// ClearNursery clears the "nursery" edge to the Nursery entity.
+func (m *GuardianMutation) ClearNursery() {
+ m.clearednursery = true
+}
+
+// NurseryCleared reports if the "nursery" edge to the Nursery entity was cleared.
+func (m *GuardianMutation) NurseryCleared() bool {
+ return m.clearednursery
+}
+
+// NurseryID returns the "nursery" edge ID in the mutation.
+func (m *GuardianMutation) NurseryID() (id uuid.UUID, exists bool) {
+ if m.nursery != nil {
+ return *m.nursery, true
+ }
+ return
+}
+
+// NurseryIDs returns the "nursery" edge IDs in the mutation.
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
+// NurseryID instead. It exists only for internal usage by the builders.
+func (m *GuardianMutation) NurseryIDs() (ids []uuid.UUID) {
+ if id := m.nursery; id != nil {
+ ids = append(ids, *id)
+ }
+ return
+}
+
+// ResetNursery resets all changes to the "nursery" edge.
+func (m *GuardianMutation) ResetNursery() {
+ m.nursery = nil
+ m.clearednursery = false
+}
+
+// SetStationID sets the "station" edge to the Station entity by id.
+func (m *GuardianMutation) SetStationID(id uuid.UUID) {
+ m.station = &id
+}
+
+// ClearStation clears the "station" edge to the Station entity.
+func (m *GuardianMutation) ClearStation() {
+ m.clearedstation = true
+}
+
+// StationCleared reports if the "station" edge to the Station entity was cleared.
+func (m *GuardianMutation) StationCleared() bool {
+ return m.clearedstation
+}
+
+// StationID returns the "station" edge ID in the mutation.
+func (m *GuardianMutation) StationID() (id uuid.UUID, exists bool) {
+ if m.station != nil {
+ return *m.station, true
+ }
+ return
+}
+
+// StationIDs returns the "station" edge IDs in the mutation.
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
+// StationID instead. It exists only for internal usage by the builders.
+func (m *GuardianMutation) StationIDs() (ids []uuid.UUID) {
+ if id := m.station; id != nil {
+ ids = append(ids, *id)
+ }
+ return
+}
+
+// ResetStation resets all changes to the "station" edge.
+func (m *GuardianMutation) ResetStation() {
+ m.station = nil
+ m.clearedstation = false
+}
+
+// Where appends a list predicates to the GuardianMutation builder.
+func (m *GuardianMutation) Where(ps ...predicate.Guardian) {
+ m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the GuardianMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *GuardianMutation) WhereP(ps ...func(*sql.Selector)) {
+ p := make([]predicate.Guardian, len(ps))
+ for i := range ps {
+ p[i] = ps[i]
+ }
+ m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *GuardianMutation) Op() Op {
+ return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *GuardianMutation) SetOp(op Op) {
+ m.op = op
+}
+
+// Type returns the node type of this mutation (Guardian).
+func (m *GuardianMutation) Type() string {
+ return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *GuardianMutation) Fields() []string {
+ fields := make([]string, 0, 8)
+ if m.email != nil {
+ fields = append(fields, guardian.FieldEmail)
+ }
+ if m.hashed_password != nil {
+ fields = append(fields, guardian.FieldHashedPassword)
+ }
+ if m.name != nil {
+ fields = append(fields, guardian.FieldName)
+ }
+ if m.phone_number != nil {
+ fields = append(fields, guardian.FieldPhoneNumber)
+ }
+ if m.is_use_morning_bus != nil {
+ fields = append(fields, guardian.FieldIsUseMorningBus)
+ }
+ if m.is_use_evening_bus != nil {
+ fields = append(fields, guardian.FieldIsUseEveningBus)
+ }
+ if m.created_at != nil {
+ fields = append(fields, guardian.FieldCreatedAt)
+ }
+ if m.updated_at != nil {
+ fields = append(fields, guardian.FieldUpdatedAt)
+ }
+ return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *GuardianMutation) Field(name string) (ent.Value, bool) {
+ switch name {
+ case guardian.FieldEmail:
+ return m.Email()
+ case guardian.FieldHashedPassword:
+ return m.HashedPassword()
+ case guardian.FieldName:
+ return m.Name()
+ case guardian.FieldPhoneNumber:
+ return m.PhoneNumber()
+ case guardian.FieldIsUseMorningBus:
+ return m.IsUseMorningBus()
+ case guardian.FieldIsUseEveningBus:
+ return m.IsUseEveningBus()
+ case guardian.FieldCreatedAt:
+ return m.CreatedAt()
+ case guardian.FieldUpdatedAt:
+ return m.UpdatedAt()
+ }
+ return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *GuardianMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+ switch name {
+ case guardian.FieldEmail:
+ return m.OldEmail(ctx)
+ case guardian.FieldHashedPassword:
+ return m.OldHashedPassword(ctx)
+ case guardian.FieldName:
+ return m.OldName(ctx)
+ case guardian.FieldPhoneNumber:
+ return m.OldPhoneNumber(ctx)
+ case guardian.FieldIsUseMorningBus:
+ return m.OldIsUseMorningBus(ctx)
+ case guardian.FieldIsUseEveningBus:
+ return m.OldIsUseEveningBus(ctx)
+ case guardian.FieldCreatedAt:
+ return m.OldCreatedAt(ctx)
+ case guardian.FieldUpdatedAt:
+ return m.OldUpdatedAt(ctx)
+ }
+ return nil, fmt.Errorf("unknown Guardian field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *GuardianMutation) SetField(name string, value ent.Value) error {
+ switch name {
+ case guardian.FieldEmail:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetEmail(v)
+ return nil
+ case guardian.FieldHashedPassword:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetHashedPassword(v)
+ return nil
+ case guardian.FieldName:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetName(v)
+ return nil
+ case guardian.FieldPhoneNumber:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetPhoneNumber(v)
+ return nil
+ case guardian.FieldIsUseMorningBus:
+ v, ok := value.(bool)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetIsUseMorningBus(v)
+ return nil
+ case guardian.FieldIsUseEveningBus:
+ v, ok := value.(bool)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetIsUseEveningBus(v)
+ return nil
+ case guardian.FieldCreatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetCreatedAt(v)
+ return nil
+ case guardian.FieldUpdatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetUpdatedAt(v)
+ return nil
+ }
+ return fmt.Errorf("unknown Guardian field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *GuardianMutation) AddedFields() []string {
+ return nil
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *GuardianMutation) AddedField(name string) (ent.Value, bool) {
+ return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *GuardianMutation) AddField(name string, value ent.Value) error {
+ switch name {
+ }
+ return fmt.Errorf("unknown Guardian numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *GuardianMutation) ClearedFields() []string {
+ var fields []string
+ if m.FieldCleared(guardian.FieldPhoneNumber) {
+ fields = append(fields, guardian.FieldPhoneNumber)
+ }
+ return fields
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *GuardianMutation) FieldCleared(name string) bool {
+ _, ok := m.clearedFields[name]
+ return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *GuardianMutation) ClearField(name string) error {
+ switch name {
+ case guardian.FieldPhoneNumber:
+ m.ClearPhoneNumber()
+ return nil
+ }
+ return fmt.Errorf("unknown Guardian nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *GuardianMutation) ResetField(name string) error {
+ switch name {
+ case guardian.FieldEmail:
+ m.ResetEmail()
+ return nil
+ case guardian.FieldHashedPassword:
+ m.ResetHashedPassword()
+ return nil
+ case guardian.FieldName:
+ m.ResetName()
+ return nil
+ case guardian.FieldPhoneNumber:
+ m.ResetPhoneNumber()
+ return nil
+ case guardian.FieldIsUseMorningBus:
+ m.ResetIsUseMorningBus()
+ return nil
+ case guardian.FieldIsUseEveningBus:
+ m.ResetIsUseEveningBus()
+ return nil
+ case guardian.FieldCreatedAt:
+ m.ResetCreatedAt()
+ return nil
+ case guardian.FieldUpdatedAt:
+ m.ResetUpdatedAt()
+ return nil
+ }
+ return fmt.Errorf("unknown Guardian field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *GuardianMutation) AddedEdges() []string {
+ edges := make([]string, 0, 3)
+ if m.children != nil {
+ edges = append(edges, guardian.EdgeChildren)
+ }
+ if m.nursery != nil {
+ edges = append(edges, guardian.EdgeNursery)
+ }
+ if m.station != nil {
+ edges = append(edges, guardian.EdgeStation)
+ }
+ return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *GuardianMutation) AddedIDs(name string) []ent.Value {
+ switch name {
+ case guardian.EdgeChildren:
+ ids := make([]ent.Value, 0, len(m.children))
+ for id := range m.children {
+ ids = append(ids, id)
+ }
+ return ids
+ case guardian.EdgeNursery:
+ if id := m.nursery; id != nil {
+ return []ent.Value{*id}
+ }
+ case guardian.EdgeStation:
+ if id := m.station; id != nil {
+ return []ent.Value{*id}
+ }
+ }
+ return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *GuardianMutation) RemovedEdges() []string {
+ edges := make([]string, 0, 3)
+ if m.removedchildren != nil {
+ edges = append(edges, guardian.EdgeChildren)
+ }
+ return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *GuardianMutation) RemovedIDs(name string) []ent.Value {
+ switch name {
+ case guardian.EdgeChildren:
+ ids := make([]ent.Value, 0, len(m.removedchildren))
+ for id := range m.removedchildren {
+ ids = append(ids, id)
+ }
+ return ids
+ }
+ return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *GuardianMutation) ClearedEdges() []string {
+ edges := make([]string, 0, 3)
+ if m.clearedchildren {
+ edges = append(edges, guardian.EdgeChildren)
+ }
+ if m.clearednursery {
+ edges = append(edges, guardian.EdgeNursery)
+ }
+ if m.clearedstation {
+ edges = append(edges, guardian.EdgeStation)
+ }
+ return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *GuardianMutation) EdgeCleared(name string) bool {
+ switch name {
+ case guardian.EdgeChildren:
+ return m.clearedchildren
+ case guardian.EdgeNursery:
+ return m.clearednursery
+ case guardian.EdgeStation:
+ return m.clearedstation
+ }
+ return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *GuardianMutation) ClearEdge(name string) error {
+ switch name {
+ case guardian.EdgeNursery:
+ m.ClearNursery()
+ return nil
+ case guardian.EdgeStation:
+ m.ClearStation()
+ return nil
+ }
+ return fmt.Errorf("unknown Guardian unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *GuardianMutation) ResetEdge(name string) error {
+ switch name {
+ case guardian.EdgeChildren:
+ m.ResetChildren()
+ return nil
+ case guardian.EdgeNursery:
+ m.ResetNursery()
+ return nil
+ case guardian.EdgeStation:
+ m.ResetStation()
+ return nil
+ }
+ return fmt.Errorf("unknown Guardian edge %s", name)
+}
+
+// NurseryMutation represents an operation that mutates the Nursery nodes in the graph.
+type NurseryMutation struct {
+ config
+ op Op
+ typ string
+ id *uuid.UUID
+ nursery_code *string
+ email *string
+ hashed_password *string
+ name *string
+ address *string
+ phone_number *string
+ created_at *time.Time
+ updated_at *time.Time
+ clearedFields map[string]struct{}
+ guardians map[uuid.UUID]struct{}
+ removedguardians map[uuid.UUID]struct{}
+ clearedguardians bool
+ buses map[uuid.UUID]struct{}
+ removedbuses map[uuid.UUID]struct{}
+ clearedbuses bool
+ done bool
+ oldValue func(context.Context) (*Nursery, error)
+ predicates []predicate.Nursery
+}
+
+var _ ent.Mutation = (*NurseryMutation)(nil)
+
+// nurseryOption allows management of the mutation configuration using functional options.
+type nurseryOption func(*NurseryMutation)
+
+// newNurseryMutation creates new mutation for the Nursery entity.
+func newNurseryMutation(c config, op Op, opts ...nurseryOption) *NurseryMutation {
+ m := &NurseryMutation{
+ config: c,
+ op: op,
+ typ: TypeNursery,
+ clearedFields: make(map[string]struct{}),
+ }
+ for _, opt := range opts {
+ opt(m)
+ }
+ return m
+}
+
+// withNurseryID sets the ID field of the mutation.
+func withNurseryID(id uuid.UUID) nurseryOption {
+ return func(m *NurseryMutation) {
+ var (
+ err error
+ once sync.Once
+ value *Nursery
+ )
+ m.oldValue = func(ctx context.Context) (*Nursery, error) {
+ once.Do(func() {
+ if m.done {
+ err = errors.New("querying old values post mutation is not allowed")
+ } else {
+ value, err = m.Client().Nursery.Get(ctx, id)
+ }
+ })
+ return value, err
+ }
+ m.id = &id
+ }
+}
+
+// withNursery sets the old Nursery of the mutation.
+func withNursery(node *Nursery) nurseryOption {
+ return func(m *NurseryMutation) {
+ m.oldValue = func(context.Context) (*Nursery, error) {
+ return node, nil
+ }
+ m.id = &node.ID
+ }
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m NurseryMutation) Client() *Client {
+ client := &Client{config: m.config}
+ client.init()
+ return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m NurseryMutation) Tx() (*Tx, error) {
+ if _, ok := m.driver.(*txDriver); !ok {
+ return nil, errors.New("ent: mutation is not running in a transaction")
+ }
+ tx := &Tx{config: m.config}
+ tx.init()
+ return tx, nil
+}
+
+// SetID sets the value of the id field. Note that this
+// operation is only accepted on creation of Nursery entities.
+func (m *NurseryMutation) SetID(id uuid.UUID) {
+ m.id = &id
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *NurseryMutation) ID() (id uuid.UUID, exists bool) {
+ if m.id == nil {
+ return
+ }
+ return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *NurseryMutation) IDs(ctx context.Context) ([]uuid.UUID, error) {
+ switch {
+ case m.op.Is(OpUpdateOne | OpDeleteOne):
+ id, exists := m.ID()
+ if exists {
+ return []uuid.UUID{id}, nil
+ }
+ fallthrough
+ case m.op.Is(OpUpdate | OpDelete):
+ return m.Client().Nursery.Query().Where(m.predicates...).IDs(ctx)
+ default:
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+ }
+}
+
+// SetNurseryCode sets the "nursery_code" field.
+func (m *NurseryMutation) SetNurseryCode(s string) {
+ m.nursery_code = &s
+}
+
+// NurseryCode returns the value of the "nursery_code" field in the mutation.
+func (m *NurseryMutation) NurseryCode() (r string, exists bool) {
+ v := m.nursery_code
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldNurseryCode returns the old "nursery_code" field's value of the Nursery entity.
+// If the Nursery 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 *NurseryMutation) OldNurseryCode(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldNurseryCode is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldNurseryCode requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldNurseryCode: %w", err)
+ }
+ return oldValue.NurseryCode, nil
+}
+
+// ResetNurseryCode resets all changes to the "nursery_code" field.
+func (m *NurseryMutation) ResetNurseryCode() {
+ m.nursery_code = nil
+}
+
+// SetEmail sets the "email" field.
+func (m *NurseryMutation) SetEmail(s string) {
+ m.email = &s
+}
+
+// Email returns the value of the "email" field in the mutation.
+func (m *NurseryMutation) Email() (r string, exists bool) {
+ v := m.email
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldEmail returns the old "email" field's value of the Nursery entity.
+// If the Nursery 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 *NurseryMutation) OldEmail(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldEmail is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldEmail requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldEmail: %w", err)
+ }
+ return oldValue.Email, nil
+}
+
+// ResetEmail resets all changes to the "email" field.
+func (m *NurseryMutation) ResetEmail() {
+ m.email = nil
+}
+
+// SetHashedPassword sets the "hashed_password" field.
+func (m *NurseryMutation) SetHashedPassword(s string) {
+ m.hashed_password = &s
+}
+
+// HashedPassword returns the value of the "hashed_password" field in the mutation.
+func (m *NurseryMutation) HashedPassword() (r string, exists bool) {
+ v := m.hashed_password
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldHashedPassword returns the old "hashed_password" field's value of the Nursery entity.
+// If the Nursery 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 *NurseryMutation) OldHashedPassword(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldHashedPassword is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldHashedPassword requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldHashedPassword: %w", err)
+ }
+ return oldValue.HashedPassword, nil
+}
+
+// ResetHashedPassword resets all changes to the "hashed_password" field.
+func (m *NurseryMutation) ResetHashedPassword() {
+ m.hashed_password = nil
+}
+
+// SetName sets the "name" field.
+func (m *NurseryMutation) SetName(s string) {
+ m.name = &s
+}
+
+// Name returns the value of the "name" field in the mutation.
+func (m *NurseryMutation) Name() (r string, exists bool) {
+ v := m.name
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldName returns the old "name" field's value of the Nursery entity.
+// If the Nursery 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 *NurseryMutation) OldName(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldName is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldName requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldName: %w", err)
+ }
+ return oldValue.Name, nil
+}
+
+// ResetName resets all changes to the "name" field.
+func (m *NurseryMutation) ResetName() {
+ m.name = nil
+}
+
+// SetAddress sets the "address" field.
+func (m *NurseryMutation) SetAddress(s string) {
+ m.address = &s
+}
+
+// Address returns the value of the "address" field in the mutation.
+func (m *NurseryMutation) Address() (r string, exists bool) {
+ v := m.address
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldAddress returns the old "address" field's value of the Nursery entity.
+// If the Nursery 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 *NurseryMutation) OldAddress(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldAddress is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldAddress requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldAddress: %w", err)
+ }
+ return oldValue.Address, nil
+}
+
+// ClearAddress clears the value of the "address" field.
+func (m *NurseryMutation) ClearAddress() {
+ m.address = nil
+ m.clearedFields[nursery.FieldAddress] = struct{}{}
+}
+
+// AddressCleared returns if the "address" field was cleared in this mutation.
+func (m *NurseryMutation) AddressCleared() bool {
+ _, ok := m.clearedFields[nursery.FieldAddress]
+ return ok
+}
+
+// ResetAddress resets all changes to the "address" field.
+func (m *NurseryMutation) ResetAddress() {
+ m.address = nil
+ delete(m.clearedFields, nursery.FieldAddress)
+}
+
+// SetPhoneNumber sets the "phone_number" field.
+func (m *NurseryMutation) SetPhoneNumber(s string) {
+ m.phone_number = &s
+}
+
+// PhoneNumber returns the value of the "phone_number" field in the mutation.
+func (m *NurseryMutation) PhoneNumber() (r string, exists bool) {
+ v := m.phone_number
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldPhoneNumber returns the old "phone_number" field's value of the Nursery entity.
+// If the Nursery 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 *NurseryMutation) OldPhoneNumber(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldPhoneNumber is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldPhoneNumber requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldPhoneNumber: %w", err)
+ }
+ return oldValue.PhoneNumber, nil
+}
+
+// ClearPhoneNumber clears the value of the "phone_number" field.
+func (m *NurseryMutation) ClearPhoneNumber() {
+ m.phone_number = nil
+ m.clearedFields[nursery.FieldPhoneNumber] = struct{}{}
+}
+
+// PhoneNumberCleared returns if the "phone_number" field was cleared in this mutation.
+func (m *NurseryMutation) PhoneNumberCleared() bool {
+ _, ok := m.clearedFields[nursery.FieldPhoneNumber]
+ return ok
+}
+
+// ResetPhoneNumber resets all changes to the "phone_number" field.
+func (m *NurseryMutation) ResetPhoneNumber() {
+ m.phone_number = nil
+ delete(m.clearedFields, nursery.FieldPhoneNumber)
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (m *NurseryMutation) SetCreatedAt(t time.Time) {
+ m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *NurseryMutation) CreatedAt() (r time.Time, exists bool) {
+ v := m.created_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldCreatedAt returns the old "created_at" field's value of the Nursery entity.
+// If the Nursery 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 *NurseryMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+ }
+ return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "created_at" field.
+func (m *NurseryMutation) ResetCreatedAt() {
+ m.created_at = nil
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (m *NurseryMutation) SetUpdatedAt(t time.Time) {
+ m.updated_at = &t
+}
+
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
+func (m *NurseryMutation) UpdatedAt() (r time.Time, exists bool) {
+ v := m.updated_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldUpdatedAt returns the old "updated_at" field's value of the Nursery entity.
+// If the Nursery 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 *NurseryMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
+ }
+ return oldValue.UpdatedAt, nil
+}
+
+// ResetUpdatedAt resets all changes to the "updated_at" field.
+func (m *NurseryMutation) ResetUpdatedAt() {
+ m.updated_at = nil
+}
+
+// AddGuardianIDs adds the "guardians" edge to the Guardian entity by ids.
+func (m *NurseryMutation) AddGuardianIDs(ids ...uuid.UUID) {
+ if m.guardians == nil {
+ m.guardians = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ m.guardians[ids[i]] = struct{}{}
+ }
+}
+
+// ClearGuardians clears the "guardians" edge to the Guardian entity.
+func (m *NurseryMutation) ClearGuardians() {
+ m.clearedguardians = true
+}
+
+// GuardiansCleared reports if the "guardians" edge to the Guardian entity was cleared.
+func (m *NurseryMutation) GuardiansCleared() bool {
+ return m.clearedguardians
+}
+
+// RemoveGuardianIDs removes the "guardians" edge to the Guardian entity by IDs.
+func (m *NurseryMutation) RemoveGuardianIDs(ids ...uuid.UUID) {
+ if m.removedguardians == nil {
+ m.removedguardians = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ delete(m.guardians, ids[i])
+ m.removedguardians[ids[i]] = struct{}{}
+ }
+}
+
+// RemovedGuardians returns the removed IDs of the "guardians" edge to the Guardian entity.
+func (m *NurseryMutation) RemovedGuardiansIDs() (ids []uuid.UUID) {
+ for id := range m.removedguardians {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// GuardiansIDs returns the "guardians" edge IDs in the mutation.
+func (m *NurseryMutation) GuardiansIDs() (ids []uuid.UUID) {
+ for id := range m.guardians {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ResetGuardians resets all changes to the "guardians" edge.
+func (m *NurseryMutation) ResetGuardians() {
+ m.guardians = nil
+ m.clearedguardians = false
+ m.removedguardians = nil
+}
+
+// AddBusIDs adds the "buses" edge to the Bus entity by ids.
+func (m *NurseryMutation) AddBusIDs(ids ...uuid.UUID) {
+ if m.buses == nil {
+ m.buses = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ m.buses[ids[i]] = struct{}{}
+ }
+}
+
+// ClearBuses clears the "buses" edge to the Bus entity.
+func (m *NurseryMutation) ClearBuses() {
+ m.clearedbuses = true
+}
+
+// BusesCleared reports if the "buses" edge to the Bus entity was cleared.
+func (m *NurseryMutation) BusesCleared() bool {
+ return m.clearedbuses
+}
+
+// RemoveBusIDs removes the "buses" edge to the Bus entity by IDs.
+func (m *NurseryMutation) RemoveBusIDs(ids ...uuid.UUID) {
+ if m.removedbuses == nil {
+ m.removedbuses = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ delete(m.buses, ids[i])
+ m.removedbuses[ids[i]] = struct{}{}
+ }
+}
+
+// RemovedBuses returns the removed IDs of the "buses" edge to the Bus entity.
+func (m *NurseryMutation) RemovedBusesIDs() (ids []uuid.UUID) {
+ for id := range m.removedbuses {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// BusesIDs returns the "buses" edge IDs in the mutation.
+func (m *NurseryMutation) BusesIDs() (ids []uuid.UUID) {
+ for id := range m.buses {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ResetBuses resets all changes to the "buses" edge.
+func (m *NurseryMutation) ResetBuses() {
+ m.buses = nil
+ m.clearedbuses = false
+ m.removedbuses = nil
+}
+
+// Where appends a list predicates to the NurseryMutation builder.
+func (m *NurseryMutation) Where(ps ...predicate.Nursery) {
+ m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the NurseryMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *NurseryMutation) WhereP(ps ...func(*sql.Selector)) {
+ p := make([]predicate.Nursery, len(ps))
+ for i := range ps {
+ p[i] = ps[i]
+ }
+ m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *NurseryMutation) Op() Op {
+ return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *NurseryMutation) SetOp(op Op) {
+ m.op = op
+}
+
+// Type returns the node type of this mutation (Nursery).
+func (m *NurseryMutation) Type() string {
+ return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *NurseryMutation) Fields() []string {
+ fields := make([]string, 0, 8)
+ if m.nursery_code != nil {
+ fields = append(fields, nursery.FieldNurseryCode)
+ }
+ if m.email != nil {
+ fields = append(fields, nursery.FieldEmail)
+ }
+ if m.hashed_password != nil {
+ fields = append(fields, nursery.FieldHashedPassword)
+ }
+ if m.name != nil {
+ fields = append(fields, nursery.FieldName)
+ }
+ if m.address != nil {
+ fields = append(fields, nursery.FieldAddress)
+ }
+ if m.phone_number != nil {
+ fields = append(fields, nursery.FieldPhoneNumber)
+ }
+ if m.created_at != nil {
+ fields = append(fields, nursery.FieldCreatedAt)
+ }
+ if m.updated_at != nil {
+ fields = append(fields, nursery.FieldUpdatedAt)
+ }
+ return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *NurseryMutation) Field(name string) (ent.Value, bool) {
+ switch name {
+ case nursery.FieldNurseryCode:
+ return m.NurseryCode()
+ case nursery.FieldEmail:
+ return m.Email()
+ case nursery.FieldHashedPassword:
+ return m.HashedPassword()
+ case nursery.FieldName:
+ return m.Name()
+ case nursery.FieldAddress:
+ return m.Address()
+ case nursery.FieldPhoneNumber:
+ return m.PhoneNumber()
+ case nursery.FieldCreatedAt:
+ return m.CreatedAt()
+ case nursery.FieldUpdatedAt:
+ return m.UpdatedAt()
+ }
+ return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *NurseryMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+ switch name {
+ case nursery.FieldNurseryCode:
+ return m.OldNurseryCode(ctx)
+ case nursery.FieldEmail:
+ return m.OldEmail(ctx)
+ case nursery.FieldHashedPassword:
+ return m.OldHashedPassword(ctx)
+ case nursery.FieldName:
+ return m.OldName(ctx)
+ case nursery.FieldAddress:
+ return m.OldAddress(ctx)
+ case nursery.FieldPhoneNumber:
+ return m.OldPhoneNumber(ctx)
+ case nursery.FieldCreatedAt:
+ return m.OldCreatedAt(ctx)
+ case nursery.FieldUpdatedAt:
+ return m.OldUpdatedAt(ctx)
+ }
+ return nil, fmt.Errorf("unknown Nursery field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *NurseryMutation) SetField(name string, value ent.Value) error {
+ switch name {
+ case nursery.FieldNurseryCode:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetNurseryCode(v)
+ return nil
+ case nursery.FieldEmail:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetEmail(v)
+ return nil
+ case nursery.FieldHashedPassword:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetHashedPassword(v)
+ return nil
+ case nursery.FieldName:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetName(v)
+ return nil
+ case nursery.FieldAddress:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetAddress(v)
+ return nil
+ case nursery.FieldPhoneNumber:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetPhoneNumber(v)
+ return nil
+ case nursery.FieldCreatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetCreatedAt(v)
+ return nil
+ case nursery.FieldUpdatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetUpdatedAt(v)
+ return nil
+ }
+ return fmt.Errorf("unknown Nursery field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *NurseryMutation) AddedFields() []string {
+ return nil
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *NurseryMutation) AddedField(name string) (ent.Value, bool) {
+ return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *NurseryMutation) AddField(name string, value ent.Value) error {
+ switch name {
+ }
+ return fmt.Errorf("unknown Nursery numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *NurseryMutation) ClearedFields() []string {
+ var fields []string
+ if m.FieldCleared(nursery.FieldAddress) {
+ fields = append(fields, nursery.FieldAddress)
+ }
+ if m.FieldCleared(nursery.FieldPhoneNumber) {
+ fields = append(fields, nursery.FieldPhoneNumber)
+ }
+ return fields
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *NurseryMutation) FieldCleared(name string) bool {
+ _, ok := m.clearedFields[name]
+ return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *NurseryMutation) ClearField(name string) error {
+ switch name {
+ case nursery.FieldAddress:
+ m.ClearAddress()
+ return nil
+ case nursery.FieldPhoneNumber:
+ m.ClearPhoneNumber()
+ return nil
+ }
+ return fmt.Errorf("unknown Nursery nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *NurseryMutation) ResetField(name string) error {
+ switch name {
+ case nursery.FieldNurseryCode:
+ m.ResetNurseryCode()
+ return nil
+ case nursery.FieldEmail:
+ m.ResetEmail()
+ return nil
+ case nursery.FieldHashedPassword:
+ m.ResetHashedPassword()
+ return nil
+ case nursery.FieldName:
+ m.ResetName()
+ return nil
+ case nursery.FieldAddress:
+ m.ResetAddress()
+ return nil
+ case nursery.FieldPhoneNumber:
+ m.ResetPhoneNumber()
+ return nil
+ case nursery.FieldCreatedAt:
+ m.ResetCreatedAt()
+ return nil
+ case nursery.FieldUpdatedAt:
+ m.ResetUpdatedAt()
+ return nil
+ }
+ return fmt.Errorf("unknown Nursery field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *NurseryMutation) AddedEdges() []string {
+ edges := make([]string, 0, 2)
+ if m.guardians != nil {
+ edges = append(edges, nursery.EdgeGuardians)
+ }
+ if m.buses != nil {
+ edges = append(edges, nursery.EdgeBuses)
+ }
+ return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *NurseryMutation) AddedIDs(name string) []ent.Value {
+ switch name {
+ case nursery.EdgeGuardians:
+ ids := make([]ent.Value, 0, len(m.guardians))
+ for id := range m.guardians {
+ ids = append(ids, id)
+ }
+ return ids
+ case nursery.EdgeBuses:
+ ids := make([]ent.Value, 0, len(m.buses))
+ for id := range m.buses {
+ ids = append(ids, id)
+ }
+ return ids
+ }
+ return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *NurseryMutation) RemovedEdges() []string {
+ edges := make([]string, 0, 2)
+ if m.removedguardians != nil {
+ edges = append(edges, nursery.EdgeGuardians)
+ }
+ if m.removedbuses != nil {
+ edges = append(edges, nursery.EdgeBuses)
+ }
+ return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *NurseryMutation) RemovedIDs(name string) []ent.Value {
+ switch name {
+ case nursery.EdgeGuardians:
+ ids := make([]ent.Value, 0, len(m.removedguardians))
+ for id := range m.removedguardians {
+ ids = append(ids, id)
+ }
+ return ids
+ case nursery.EdgeBuses:
+ ids := make([]ent.Value, 0, len(m.removedbuses))
+ for id := range m.removedbuses {
+ ids = append(ids, id)
+ }
+ return ids
+ }
+ return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *NurseryMutation) ClearedEdges() []string {
+ edges := make([]string, 0, 2)
+ if m.clearedguardians {
+ edges = append(edges, nursery.EdgeGuardians)
+ }
+ if m.clearedbuses {
+ edges = append(edges, nursery.EdgeBuses)
+ }
+ return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *NurseryMutation) EdgeCleared(name string) bool {
+ switch name {
+ case nursery.EdgeGuardians:
+ return m.clearedguardians
+ case nursery.EdgeBuses:
+ return m.clearedbuses
+ }
+ return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *NurseryMutation) ClearEdge(name string) error {
+ switch name {
+ }
+ return fmt.Errorf("unknown Nursery unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *NurseryMutation) ResetEdge(name string) error {
+ switch name {
+ case nursery.EdgeGuardians:
+ m.ResetGuardians()
+ return nil
+ case nursery.EdgeBuses:
+ m.ResetBuses()
+ return nil
+ }
+ return fmt.Errorf("unknown Nursery edge %s", name)
+}
+
+// StationMutation represents an operation that mutates the Station nodes in the graph.
+type StationMutation struct {
+ config
+ op Op
+ typ string
+ id *uuid.UUID
+ latitude *float64
+ addlatitude *float64
+ longitude *float64
+ addlongitude *float64
+ created_at *time.Time
+ updated_at *time.Time
+ clearedFields map[string]struct{}
+ guardian *uuid.UUID
+ clearedguardian bool
+ next_for_buses map[uuid.UUID]struct{}
+ removednext_for_buses map[uuid.UUID]struct{}
+ clearednext_for_buses bool
+ busRouteAssociations map[int]struct{}
+ removedbusRouteAssociations map[int]struct{}
+ clearedbusRouteAssociations bool
+ done bool
+ oldValue func(context.Context) (*Station, error)
+ predicates []predicate.Station
+}
+
+var _ ent.Mutation = (*StationMutation)(nil)
+
+// stationOption allows management of the mutation configuration using functional options.
+type stationOption func(*StationMutation)
+
+// newStationMutation creates new mutation for the Station entity.
+func newStationMutation(c config, op Op, opts ...stationOption) *StationMutation {
+ m := &StationMutation{
+ config: c,
+ op: op,
+ typ: TypeStation,
+ clearedFields: make(map[string]struct{}),
+ }
+ for _, opt := range opts {
+ opt(m)
+ }
+ return m
+}
+
+// withStationID sets the ID field of the mutation.
+func withStationID(id uuid.UUID) stationOption {
+ return func(m *StationMutation) {
+ var (
+ err error
+ once sync.Once
+ value *Station
+ )
+ m.oldValue = func(ctx context.Context) (*Station, error) {
+ once.Do(func() {
+ if m.done {
+ err = errors.New("querying old values post mutation is not allowed")
+ } else {
+ value, err = m.Client().Station.Get(ctx, id)
+ }
+ })
+ return value, err
+ }
+ m.id = &id
+ }
+}
+
+// withStation sets the old Station of the mutation.
+func withStation(node *Station) stationOption {
+ return func(m *StationMutation) {
+ m.oldValue = func(context.Context) (*Station, error) {
+ return node, nil
+ }
+ m.id = &node.ID
+ }
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m StationMutation) Client() *Client {
+ client := &Client{config: m.config}
+ client.init()
+ return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m StationMutation) Tx() (*Tx, error) {
+ if _, ok := m.driver.(*txDriver); !ok {
+ return nil, errors.New("ent: mutation is not running in a transaction")
+ }
+ tx := &Tx{config: m.config}
+ tx.init()
+ return tx, nil
+}
+
+// SetID sets the value of the id field. Note that this
+// operation is only accepted on creation of Station entities.
+func (m *StationMutation) SetID(id uuid.UUID) {
+ m.id = &id
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *StationMutation) ID() (id uuid.UUID, exists bool) {
+ if m.id == nil {
+ return
+ }
+ return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *StationMutation) IDs(ctx context.Context) ([]uuid.UUID, error) {
+ switch {
+ case m.op.Is(OpUpdateOne | OpDeleteOne):
+ id, exists := m.ID()
+ if exists {
+ return []uuid.UUID{id}, nil
+ }
+ fallthrough
+ case m.op.Is(OpUpdate | OpDelete):
+ return m.Client().Station.Query().Where(m.predicates...).IDs(ctx)
+ default:
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+ }
+}
+
+// SetLatitude sets the "latitude" field.
+func (m *StationMutation) SetLatitude(f float64) {
+ m.latitude = &f
+ m.addlatitude = nil
+}
+
+// Latitude returns the value of the "latitude" field in the mutation.
+func (m *StationMutation) Latitude() (r float64, exists bool) {
+ v := m.latitude
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldLatitude returns the old "latitude" field's value of the Station entity.
+// If the Station 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 *StationMutation) OldLatitude(ctx context.Context) (v float64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldLatitude is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldLatitude requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldLatitude: %w", err)
+ }
+ return oldValue.Latitude, nil
+}
+
+// AddLatitude adds f to the "latitude" field.
+func (m *StationMutation) AddLatitude(f float64) {
+ if m.addlatitude != nil {
+ *m.addlatitude += f
+ } else {
+ m.addlatitude = &f
+ }
+}
+
+// AddedLatitude returns the value that was added to the "latitude" field in this mutation.
+func (m *StationMutation) AddedLatitude() (r float64, exists bool) {
+ v := m.addlatitude
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ClearLatitude clears the value of the "latitude" field.
+func (m *StationMutation) ClearLatitude() {
+ m.latitude = nil
+ m.addlatitude = nil
+ m.clearedFields[station.FieldLatitude] = struct{}{}
+}
+
+// LatitudeCleared returns if the "latitude" field was cleared in this mutation.
+func (m *StationMutation) LatitudeCleared() bool {
+ _, ok := m.clearedFields[station.FieldLatitude]
+ return ok
+}
+
+// ResetLatitude resets all changes to the "latitude" field.
+func (m *StationMutation) ResetLatitude() {
+ m.latitude = nil
+ m.addlatitude = nil
+ delete(m.clearedFields, station.FieldLatitude)
+}
+
+// SetLongitude sets the "longitude" field.
+func (m *StationMutation) SetLongitude(f float64) {
+ m.longitude = &f
+ m.addlongitude = nil
+}
+
+// Longitude returns the value of the "longitude" field in the mutation.
+func (m *StationMutation) Longitude() (r float64, exists bool) {
+ v := m.longitude
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldLongitude returns the old "longitude" field's value of the Station entity.
+// If the Station 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 *StationMutation) OldLongitude(ctx context.Context) (v float64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldLongitude is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldLongitude requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldLongitude: %w", err)
+ }
+ return oldValue.Longitude, nil
+}
+
+// AddLongitude adds f to the "longitude" field.
+func (m *StationMutation) AddLongitude(f float64) {
+ if m.addlongitude != nil {
+ *m.addlongitude += f
+ } else {
+ m.addlongitude = &f
+ }
+}
+
+// AddedLongitude returns the value that was added to the "longitude" field in this mutation.
+func (m *StationMutation) AddedLongitude() (r float64, exists bool) {
+ v := m.addlongitude
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ClearLongitude clears the value of the "longitude" field.
+func (m *StationMutation) ClearLongitude() {
+ m.longitude = nil
+ m.addlongitude = nil
+ m.clearedFields[station.FieldLongitude] = struct{}{}
+}
+
+// LongitudeCleared returns if the "longitude" field was cleared in this mutation.
+func (m *StationMutation) LongitudeCleared() bool {
+ _, ok := m.clearedFields[station.FieldLongitude]
+ return ok
+}
+
+// ResetLongitude resets all changes to the "longitude" field.
+func (m *StationMutation) ResetLongitude() {
+ m.longitude = nil
+ m.addlongitude = nil
+ delete(m.clearedFields, station.FieldLongitude)
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (m *StationMutation) SetCreatedAt(t time.Time) {
+ m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *StationMutation) CreatedAt() (r time.Time, exists bool) {
+ v := m.created_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldCreatedAt returns the old "created_at" field's value of the Station entity.
+// If the Station 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 *StationMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+ }
+ return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "created_at" field.
+func (m *StationMutation) ResetCreatedAt() {
+ m.created_at = nil
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (m *StationMutation) SetUpdatedAt(t time.Time) {
+ m.updated_at = &t
+}
+
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
+func (m *StationMutation) UpdatedAt() (r time.Time, exists bool) {
+ v := m.updated_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldUpdatedAt returns the old "updated_at" field's value of the Station entity.
+// If the Station 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 *StationMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
+ }
+ return oldValue.UpdatedAt, nil
+}
+
+// ResetUpdatedAt resets all changes to the "updated_at" field.
+func (m *StationMutation) ResetUpdatedAt() {
+ m.updated_at = nil
+}
+
+// SetGuardianID sets the "guardian" edge to the Guardian entity by id.
+func (m *StationMutation) SetGuardianID(id uuid.UUID) {
+ m.guardian = &id
+}
+
+// ClearGuardian clears the "guardian" edge to the Guardian entity.
+func (m *StationMutation) ClearGuardian() {
+ m.clearedguardian = true
+}
+
+// GuardianCleared reports if the "guardian" edge to the Guardian entity was cleared.
+func (m *StationMutation) GuardianCleared() bool {
+ return m.clearedguardian
+}
+
+// GuardianID returns the "guardian" edge ID in the mutation.
+func (m *StationMutation) GuardianID() (id uuid.UUID, exists bool) {
+ if m.guardian != nil {
+ return *m.guardian, true
+ }
+ return
+}
+
+// GuardianIDs returns the "guardian" edge IDs in the mutation.
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
+// GuardianID instead. It exists only for internal usage by the builders.
+func (m *StationMutation) GuardianIDs() (ids []uuid.UUID) {
+ if id := m.guardian; id != nil {
+ ids = append(ids, *id)
+ }
+ return
+}
+
+// ResetGuardian resets all changes to the "guardian" edge.
+func (m *StationMutation) ResetGuardian() {
+ m.guardian = nil
+ m.clearedguardian = false
+}
+
+// AddNextForBusIDs adds the "next_for_buses" edge to the Bus entity by ids.
+func (m *StationMutation) AddNextForBusIDs(ids ...uuid.UUID) {
+ if m.next_for_buses == nil {
+ m.next_for_buses = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ m.next_for_buses[ids[i]] = struct{}{}
+ }
+}
+
+// ClearNextForBuses clears the "next_for_buses" edge to the Bus entity.
+func (m *StationMutation) ClearNextForBuses() {
+ m.clearednext_for_buses = true
+}
+
+// NextForBusesCleared reports if the "next_for_buses" edge to the Bus entity was cleared.
+func (m *StationMutation) NextForBusesCleared() bool {
+ return m.clearednext_for_buses
+}
+
+// RemoveNextForBusIDs removes the "next_for_buses" edge to the Bus entity by IDs.
+func (m *StationMutation) RemoveNextForBusIDs(ids ...uuid.UUID) {
+ if m.removednext_for_buses == nil {
+ m.removednext_for_buses = make(map[uuid.UUID]struct{})
+ }
+ for i := range ids {
+ delete(m.next_for_buses, ids[i])
+ m.removednext_for_buses[ids[i]] = struct{}{}
+ }
+}
+
+// RemovedNextForBuses returns the removed IDs of the "next_for_buses" edge to the Bus entity.
+func (m *StationMutation) RemovedNextForBusesIDs() (ids []uuid.UUID) {
+ for id := range m.removednext_for_buses {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// NextForBusesIDs returns the "next_for_buses" edge IDs in the mutation.
+func (m *StationMutation) NextForBusesIDs() (ids []uuid.UUID) {
+ for id := range m.next_for_buses {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ResetNextForBuses resets all changes to the "next_for_buses" edge.
+func (m *StationMutation) ResetNextForBuses() {
+ m.next_for_buses = nil
+ m.clearednext_for_buses = false
+ m.removednext_for_buses = nil
+}
+
+// AddBusRouteAssociationIDs adds the "busRouteAssociations" edge to the BusRouteAssociation entity by ids.
+func (m *StationMutation) AddBusRouteAssociationIDs(ids ...int) {
+ if m.busRouteAssociations == nil {
+ m.busRouteAssociations = make(map[int]struct{})
+ }
+ for i := range ids {
+ m.busRouteAssociations[ids[i]] = struct{}{}
+ }
+}
+
+// ClearBusRouteAssociations clears the "busRouteAssociations" edge to the BusRouteAssociation entity.
+func (m *StationMutation) ClearBusRouteAssociations() {
+ m.clearedbusRouteAssociations = true
+}
+
+// BusRouteAssociationsCleared reports if the "busRouteAssociations" edge to the BusRouteAssociation entity was cleared.
+func (m *StationMutation) BusRouteAssociationsCleared() bool {
+ return m.clearedbusRouteAssociations
+}
+
+// RemoveBusRouteAssociationIDs removes the "busRouteAssociations" edge to the BusRouteAssociation entity by IDs.
+func (m *StationMutation) RemoveBusRouteAssociationIDs(ids ...int) {
+ if m.removedbusRouteAssociations == nil {
+ m.removedbusRouteAssociations = make(map[int]struct{})
+ }
+ for i := range ids {
+ delete(m.busRouteAssociations, ids[i])
+ m.removedbusRouteAssociations[ids[i]] = struct{}{}
+ }
+}
+
+// RemovedBusRouteAssociations returns the removed IDs of the "busRouteAssociations" edge to the BusRouteAssociation entity.
+func (m *StationMutation) RemovedBusRouteAssociationsIDs() (ids []int) {
+ for id := range m.removedbusRouteAssociations {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// BusRouteAssociationsIDs returns the "busRouteAssociations" edge IDs in the mutation.
+func (m *StationMutation) BusRouteAssociationsIDs() (ids []int) {
+ for id := range m.busRouteAssociations {
+ ids = append(ids, id)
+ }
+ return
+}
+
+// ResetBusRouteAssociations resets all changes to the "busRouteAssociations" edge.
+func (m *StationMutation) ResetBusRouteAssociations() {
+ m.busRouteAssociations = nil
+ m.clearedbusRouteAssociations = false
+ m.removedbusRouteAssociations = nil
+}
+
+// Where appends a list predicates to the StationMutation builder.
+func (m *StationMutation) Where(ps ...predicate.Station) {
+ m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the StationMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *StationMutation) WhereP(ps ...func(*sql.Selector)) {
+ p := make([]predicate.Station, len(ps))
+ for i := range ps {
+ p[i] = ps[i]
+ }
+ m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *StationMutation) Op() Op {
+ return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *StationMutation) SetOp(op Op) {
+ m.op = op
+}
+
+// Type returns the node type of this mutation (Station).
+func (m *StationMutation) Type() string {
+ return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *StationMutation) Fields() []string {
+ fields := make([]string, 0, 4)
+ if m.latitude != nil {
+ fields = append(fields, station.FieldLatitude)
+ }
+ if m.longitude != nil {
+ fields = append(fields, station.FieldLongitude)
+ }
+ if m.created_at != nil {
+ fields = append(fields, station.FieldCreatedAt)
+ }
+ if m.updated_at != nil {
+ fields = append(fields, station.FieldUpdatedAt)
+ }
+ return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *StationMutation) Field(name string) (ent.Value, bool) {
+ switch name {
+ case station.FieldLatitude:
+ return m.Latitude()
+ case station.FieldLongitude:
+ return m.Longitude()
+ case station.FieldCreatedAt:
+ return m.CreatedAt()
+ case station.FieldUpdatedAt:
+ return m.UpdatedAt()
+ }
+ return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *StationMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+ switch name {
+ case station.FieldLatitude:
+ return m.OldLatitude(ctx)
+ case station.FieldLongitude:
+ return m.OldLongitude(ctx)
+ case station.FieldCreatedAt:
+ return m.OldCreatedAt(ctx)
+ case station.FieldUpdatedAt:
+ return m.OldUpdatedAt(ctx)
+ }
+ return nil, fmt.Errorf("unknown Station field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *StationMutation) SetField(name string, value ent.Value) error {
+ switch name {
+ case station.FieldLatitude:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetLatitude(v)
+ return nil
+ case station.FieldLongitude:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetLongitude(v)
+ return nil
+ case station.FieldCreatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetCreatedAt(v)
+ return nil
+ case station.FieldUpdatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetUpdatedAt(v)
+ return nil
+ }
+ return fmt.Errorf("unknown Station field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *StationMutation) AddedFields() []string {
+ var fields []string
+ if m.addlatitude != nil {
+ fields = append(fields, station.FieldLatitude)
+ }
+ if m.addlongitude != nil {
+ fields = append(fields, station.FieldLongitude)
+ }
+ return fields
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *StationMutation) AddedField(name string) (ent.Value, bool) {
+ switch name {
+ case station.FieldLatitude:
+ return m.AddedLatitude()
+ case station.FieldLongitude:
+ return m.AddedLongitude()
+ }
+ return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *StationMutation) AddField(name string, value ent.Value) error {
+ switch name {
+ case station.FieldLatitude:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddLatitude(v)
+ return nil
+ case station.FieldLongitude:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddLongitude(v)
+ return nil
+ }
+ return fmt.Errorf("unknown Station numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *StationMutation) ClearedFields() []string {
+ var fields []string
+ if m.FieldCleared(station.FieldLatitude) {
+ fields = append(fields, station.FieldLatitude)
+ }
+ if m.FieldCleared(station.FieldLongitude) {
+ fields = append(fields, station.FieldLongitude)
+ }
+ return fields
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *StationMutation) FieldCleared(name string) bool {
+ _, ok := m.clearedFields[name]
+ return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *StationMutation) ClearField(name string) error {
+ switch name {
+ case station.FieldLatitude:
+ m.ClearLatitude()
+ return nil
+ case station.FieldLongitude:
+ m.ClearLongitude()
+ return nil
+ }
+ return fmt.Errorf("unknown Station nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *StationMutation) ResetField(name string) error {
+ switch name {
+ case station.FieldLatitude:
+ m.ResetLatitude()
+ return nil
+ case station.FieldLongitude:
+ m.ResetLongitude()
+ return nil
+ case station.FieldCreatedAt:
+ m.ResetCreatedAt()
+ return nil
+ case station.FieldUpdatedAt:
+ m.ResetUpdatedAt()
+ return nil
+ }
+ return fmt.Errorf("unknown Station field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *StationMutation) AddedEdges() []string {
+ edges := make([]string, 0, 3)
+ if m.guardian != nil {
+ edges = append(edges, station.EdgeGuardian)
+ }
+ if m.next_for_buses != nil {
+ edges = append(edges, station.EdgeNextForBuses)
+ }
+ if m.busRouteAssociations != nil {
+ edges = append(edges, station.EdgeBusRouteAssociations)
+ }
+ return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *StationMutation) AddedIDs(name string) []ent.Value {
+ switch name {
+ case station.EdgeGuardian:
+ if id := m.guardian; id != nil {
+ return []ent.Value{*id}
+ }
+ case station.EdgeNextForBuses:
+ ids := make([]ent.Value, 0, len(m.next_for_buses))
+ for id := range m.next_for_buses {
+ ids = append(ids, id)
+ }
+ return ids
+ case station.EdgeBusRouteAssociations:
+ ids := make([]ent.Value, 0, len(m.busRouteAssociations))
+ for id := range m.busRouteAssociations {
+ ids = append(ids, id)
+ }
+ return ids
+ }
+ return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *StationMutation) RemovedEdges() []string {
+ edges := make([]string, 0, 3)
+ if m.removednext_for_buses != nil {
+ edges = append(edges, station.EdgeNextForBuses)
+ }
+ if m.removedbusRouteAssociations != nil {
+ edges = append(edges, station.EdgeBusRouteAssociations)
+ }
+ return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *StationMutation) RemovedIDs(name string) []ent.Value {
+ switch name {
+ case station.EdgeNextForBuses:
+ ids := make([]ent.Value, 0, len(m.removednext_for_buses))
+ for id := range m.removednext_for_buses {
+ ids = append(ids, id)
+ }
+ return ids
+ case station.EdgeBusRouteAssociations:
+ ids := make([]ent.Value, 0, len(m.removedbusRouteAssociations))
+ for id := range m.removedbusRouteAssociations {
+ ids = append(ids, id)
+ }
+ return ids
+ }
+ return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *StationMutation) ClearedEdges() []string {
+ edges := make([]string, 0, 3)
+ if m.clearedguardian {
+ edges = append(edges, station.EdgeGuardian)
+ }
+ if m.clearednext_for_buses {
+ edges = append(edges, station.EdgeNextForBuses)
+ }
+ if m.clearedbusRouteAssociations {
+ edges = append(edges, station.EdgeBusRouteAssociations)
+ }
+ return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *StationMutation) EdgeCleared(name string) bool {
+ switch name {
+ case station.EdgeGuardian:
+ return m.clearedguardian
+ case station.EdgeNextForBuses:
+ return m.clearednext_for_buses
+ case station.EdgeBusRouteAssociations:
+ return m.clearedbusRouteAssociations
+ }
+ return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *StationMutation) ClearEdge(name string) error {
+ switch name {
+ case station.EdgeGuardian:
+ m.ClearGuardian()
+ return nil
+ }
+ return fmt.Errorf("unknown Station unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *StationMutation) ResetEdge(name string) error {
+ switch name {
+ case station.EdgeGuardian:
+ m.ResetGuardian()
+ return nil
+ case station.EdgeNextForBuses:
+ m.ResetNextForBuses()
+ return nil
+ case station.EdgeBusRouteAssociations:
+ m.ResetBusRouteAssociations()
+ return nil
+ }
+ return fmt.Errorf("unknown Station edge %s", name)
+}
diff --git a/backend/domain/repository/ent/nursery.go b/backend/domain/repository/ent/nursery.go
new file mode 100644
index 00000000..ac4cbe5f
--- /dev/null
+++ b/backend/domain/repository/ent/nursery.go
@@ -0,0 +1,226 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "fmt"
+ "strings"
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/sql"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/google/uuid"
+)
+
+// Nursery is the model entity for the Nursery schema.
+type Nursery struct {
+ config `json:"-"`
+ // ID of the ent.
+ ID uuid.UUID `json:"id,omitempty"`
+ // ユニークな数字(文字列)のコード
+ NurseryCode string `json:"nursery_code,omitempty"`
+ // Email holds the value of the "email" field.
+ Email string `json:"email,omitempty"`
+ // HashedPassword holds the value of the "hashed_password" field.
+ HashedPassword string `json:"hashed_password,omitempty"`
+ // Name holds the value of the "name" field.
+ Name string `json:"name,omitempty"`
+ // Address holds the value of the "address" field.
+ Address string `json:"address,omitempty"`
+ // PhoneNumber holds the value of the "phone_number" field.
+ PhoneNumber string `json:"phone_number,omitempty"`
+ // CreatedAt holds the value of the "created_at" field.
+ CreatedAt time.Time `json:"created_at,omitempty"`
+ // UpdatedAt holds the value of the "updated_at" field.
+ UpdatedAt time.Time `json:"updated_at,omitempty"`
+ // Edges holds the relations/edges for other nodes in the graph.
+ // The values are being populated by the NurseryQuery when eager-loading is set.
+ Edges NurseryEdges `json:"edges"`
+ selectValues sql.SelectValues
+}
+
+// NurseryEdges holds the relations/edges for other nodes in the graph.
+type NurseryEdges struct {
+ // Guardians holds the value of the guardians edge.
+ Guardians []*Guardian `json:"guardians,omitempty"`
+ // Buses holds the value of the buses edge.
+ Buses []*Bus `json:"buses,omitempty"`
+ // loadedTypes holds the information for reporting if a
+ // type was loaded (or requested) in eager-loading or not.
+ loadedTypes [2]bool
+}
+
+// GuardiansOrErr returns the Guardians value or an error if the edge
+// was not loaded in eager-loading.
+func (e NurseryEdges) GuardiansOrErr() ([]*Guardian, error) {
+ if e.loadedTypes[0] {
+ return e.Guardians, nil
+ }
+ return nil, &NotLoadedError{edge: "guardians"}
+}
+
+// BusesOrErr returns the Buses value or an error if the edge
+// was not loaded in eager-loading.
+func (e NurseryEdges) BusesOrErr() ([]*Bus, error) {
+ if e.loadedTypes[1] {
+ return e.Buses, nil
+ }
+ return nil, &NotLoadedError{edge: "buses"}
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*Nursery) scanValues(columns []string) ([]any, error) {
+ values := make([]any, len(columns))
+ for i := range columns {
+ switch columns[i] {
+ case nursery.FieldNurseryCode, nursery.FieldEmail, nursery.FieldHashedPassword, nursery.FieldName, nursery.FieldAddress, nursery.FieldPhoneNumber:
+ values[i] = new(sql.NullString)
+ case nursery.FieldCreatedAt, nursery.FieldUpdatedAt:
+ values[i] = new(sql.NullTime)
+ case nursery.FieldID:
+ values[i] = new(uuid.UUID)
+ default:
+ values[i] = new(sql.UnknownType)
+ }
+ }
+ return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the Nursery fields.
+func (n *Nursery) assignValues(columns []string, values []any) error {
+ if m, n := len(values), len(columns); m < n {
+ return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+ }
+ for i := range columns {
+ switch columns[i] {
+ case nursery.FieldID:
+ if value, ok := values[i].(*uuid.UUID); !ok {
+ return fmt.Errorf("unexpected type %T for field id", values[i])
+ } else if value != nil {
+ n.ID = *value
+ }
+ case nursery.FieldNurseryCode:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field nursery_code", values[i])
+ } else if value.Valid {
+ n.NurseryCode = value.String
+ }
+ case nursery.FieldEmail:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field email", values[i])
+ } else if value.Valid {
+ n.Email = value.String
+ }
+ case nursery.FieldHashedPassword:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field hashed_password", values[i])
+ } else if value.Valid {
+ n.HashedPassword = value.String
+ }
+ case nursery.FieldName:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field name", values[i])
+ } else if value.Valid {
+ n.Name = value.String
+ }
+ case nursery.FieldAddress:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field address", values[i])
+ } else if value.Valid {
+ n.Address = value.String
+ }
+ case nursery.FieldPhoneNumber:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field phone_number", values[i])
+ } else if value.Valid {
+ n.PhoneNumber = value.String
+ }
+ case nursery.FieldCreatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field created_at", values[i])
+ } else if value.Valid {
+ n.CreatedAt = value.Time
+ }
+ case nursery.FieldUpdatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field updated_at", values[i])
+ } else if value.Valid {
+ n.UpdatedAt = value.Time
+ }
+ default:
+ n.selectValues.Set(columns[i], values[i])
+ }
+ }
+ return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the Nursery.
+// This includes values selected through modifiers, order, etc.
+func (n *Nursery) Value(name string) (ent.Value, error) {
+ return n.selectValues.Get(name)
+}
+
+// QueryGuardians queries the "guardians" edge of the Nursery entity.
+func (n *Nursery) QueryGuardians() *GuardianQuery {
+ return NewNurseryClient(n.config).QueryGuardians(n)
+}
+
+// QueryBuses queries the "buses" edge of the Nursery entity.
+func (n *Nursery) QueryBuses() *BusQuery {
+ return NewNurseryClient(n.config).QueryBuses(n)
+}
+
+// Update returns a builder for updating this Nursery.
+// Note that you need to call Nursery.Unwrap() before calling this method if this Nursery
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (n *Nursery) Update() *NurseryUpdateOne {
+ return NewNurseryClient(n.config).UpdateOne(n)
+}
+
+// Unwrap unwraps the Nursery entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (n *Nursery) Unwrap() *Nursery {
+ _tx, ok := n.config.driver.(*txDriver)
+ if !ok {
+ panic("ent: Nursery is not a transactional entity")
+ }
+ n.config.driver = _tx.drv
+ return n
+}
+
+// String implements the fmt.Stringer.
+func (n *Nursery) String() string {
+ var builder strings.Builder
+ builder.WriteString("Nursery(")
+ builder.WriteString(fmt.Sprintf("id=%v, ", n.ID))
+ builder.WriteString("nursery_code=")
+ builder.WriteString(n.NurseryCode)
+ builder.WriteString(", ")
+ builder.WriteString("email=")
+ builder.WriteString(n.Email)
+ builder.WriteString(", ")
+ builder.WriteString("hashed_password=")
+ builder.WriteString(n.HashedPassword)
+ builder.WriteString(", ")
+ builder.WriteString("name=")
+ builder.WriteString(n.Name)
+ builder.WriteString(", ")
+ builder.WriteString("address=")
+ builder.WriteString(n.Address)
+ builder.WriteString(", ")
+ builder.WriteString("phone_number=")
+ builder.WriteString(n.PhoneNumber)
+ builder.WriteString(", ")
+ builder.WriteString("created_at=")
+ builder.WriteString(n.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(", ")
+ builder.WriteString("updated_at=")
+ builder.WriteString(n.UpdatedAt.Format(time.ANSIC))
+ builder.WriteByte(')')
+ return builder.String()
+}
+
+// Nurseries is a parsable slice of Nursery.
+type Nurseries []*Nursery
diff --git a/backend/domain/repository/ent/nursery/nursery.go b/backend/domain/repository/ent/nursery/nursery.go
new file mode 100644
index 00000000..ad7609b6
--- /dev/null
+++ b/backend/domain/repository/ent/nursery/nursery.go
@@ -0,0 +1,178 @@
+// Code generated by ent, DO NOT EDIT.
+
+package nursery
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/google/uuid"
+)
+
+const (
+ // Label holds the string label denoting the nursery type in the database.
+ Label = "nursery"
+ // FieldID holds the string denoting the id field in the database.
+ FieldID = "id"
+ // FieldNurseryCode holds the string denoting the nursery_code field in the database.
+ FieldNurseryCode = "nursery_code"
+ // FieldEmail holds the string denoting the email field in the database.
+ FieldEmail = "email"
+ // FieldHashedPassword holds the string denoting the hashed_password field in the database.
+ FieldHashedPassword = "hashed_password"
+ // FieldName holds the string denoting the name field in the database.
+ FieldName = "name"
+ // FieldAddress holds the string denoting the address field in the database.
+ FieldAddress = "address"
+ // FieldPhoneNumber holds the string denoting the phone_number field in the database.
+ FieldPhoneNumber = "phone_number"
+ // FieldCreatedAt holds the string denoting the created_at field in the database.
+ FieldCreatedAt = "created_at"
+ // FieldUpdatedAt holds the string denoting the updated_at field in the database.
+ FieldUpdatedAt = "updated_at"
+ // EdgeGuardians holds the string denoting the guardians edge name in mutations.
+ EdgeGuardians = "guardians"
+ // EdgeBuses holds the string denoting the buses edge name in mutations.
+ EdgeBuses = "buses"
+ // Table holds the table name of the nursery in the database.
+ Table = "nurseries"
+ // GuardiansTable is the table that holds the guardians relation/edge.
+ GuardiansTable = "guardians"
+ // GuardiansInverseTable is the table name for the Guardian entity.
+ // It exists in this package in order to avoid circular dependency with the "guardian" package.
+ GuardiansInverseTable = "guardians"
+ // GuardiansColumn is the table column denoting the guardians relation/edge.
+ GuardiansColumn = "guardian_nursery"
+ // BusesTable is the table that holds the buses relation/edge.
+ BusesTable = "bus"
+ // BusesInverseTable is the table name for the Bus entity.
+ // It exists in this package in order to avoid circular dependency with the "bus" package.
+ BusesInverseTable = "bus"
+ // BusesColumn is the table column denoting the buses relation/edge.
+ BusesColumn = "bus_nursery"
+)
+
+// Columns holds all SQL columns for nursery fields.
+var Columns = []string{
+ FieldID,
+ FieldNurseryCode,
+ FieldEmail,
+ FieldHashedPassword,
+ FieldName,
+ FieldAddress,
+ FieldPhoneNumber,
+ FieldCreatedAt,
+ FieldUpdatedAt,
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+ for i := range Columns {
+ if column == Columns[i] {
+ return true
+ }
+ }
+ return false
+}
+
+var (
+ // DefaultCreatedAt holds the default value on creation for the "created_at" field.
+ DefaultCreatedAt func() time.Time
+ // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
+ DefaultUpdatedAt func() time.Time
+ // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
+ UpdateDefaultUpdatedAt func() time.Time
+ // DefaultID holds the default value on creation for the "id" field.
+ DefaultID func() uuid.UUID
+)
+
+// OrderOption defines the ordering options for the Nursery queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByNurseryCode orders the results by the nursery_code field.
+func ByNurseryCode(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldNurseryCode, opts...).ToFunc()
+}
+
+// ByEmail orders the results by the email field.
+func ByEmail(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldEmail, opts...).ToFunc()
+}
+
+// ByHashedPassword orders the results by the hashed_password field.
+func ByHashedPassword(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldHashedPassword, opts...).ToFunc()
+}
+
+// ByName orders the results by the name field.
+func ByName(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldName, opts...).ToFunc()
+}
+
+// ByAddress orders the results by the address field.
+func ByAddress(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldAddress, opts...).ToFunc()
+}
+
+// ByPhoneNumber orders the results by the phone_number field.
+func ByPhoneNumber(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldPhoneNumber, opts...).ToFunc()
+}
+
+// ByCreatedAt orders the results by the created_at field.
+func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
+}
+
+// ByUpdatedAt orders the results by the updated_at field.
+func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
+}
+
+// ByGuardiansCount orders the results by guardians count.
+func ByGuardiansCount(opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborsCount(s, newGuardiansStep(), opts...)
+ }
+}
+
+// ByGuardians orders the results by guardians terms.
+func ByGuardians(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newGuardiansStep(), append([]sql.OrderTerm{term}, terms...)...)
+ }
+}
+
+// ByBusesCount orders the results by buses count.
+func ByBusesCount(opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborsCount(s, newBusesStep(), opts...)
+ }
+}
+
+// ByBuses orders the results by buses terms.
+func ByBuses(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newBusesStep(), append([]sql.OrderTerm{term}, terms...)...)
+ }
+}
+func newGuardiansStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(GuardiansInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, GuardiansTable, GuardiansColumn),
+ )
+}
+func newBusesStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(BusesInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, BusesTable, BusesColumn),
+ )
+}
diff --git a/backend/domain/repository/ent/nursery/where.go b/backend/domain/repository/ent/nursery/where.go
new file mode 100644
index 00000000..5e1421cb
--- /dev/null
+++ b/backend/domain/repository/ent/nursery/where.go
@@ -0,0 +1,648 @@
+// Code generated by ent, DO NOT EDIT.
+
+package nursery
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id uuid.UUID) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id uuid.UUID) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id uuid.UUID) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...uuid.UUID) predicate.Nursery {
+ return predicate.Nursery(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...uuid.UUID) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id uuid.UUID) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id uuid.UUID) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id uuid.UUID) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id uuid.UUID) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLTE(FieldID, id))
+}
+
+// NurseryCode applies equality check predicate on the "nursery_code" field. It's identical to NurseryCodeEQ.
+func NurseryCode(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldNurseryCode, v))
+}
+
+// Email applies equality check predicate on the "email" field. It's identical to EmailEQ.
+func Email(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldEmail, v))
+}
+
+// HashedPassword applies equality check predicate on the "hashed_password" field. It's identical to HashedPasswordEQ.
+func HashedPassword(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldHashedPassword, v))
+}
+
+// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
+func Name(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldName, v))
+}
+
+// Address applies equality check predicate on the "address" field. It's identical to AddressEQ.
+func Address(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldAddress, v))
+}
+
+// PhoneNumber applies equality check predicate on the "phone_number" field. It's identical to PhoneNumberEQ.
+func PhoneNumber(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldPhoneNumber, v))
+}
+
+// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
+func UpdatedAt(v time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// NurseryCodeEQ applies the EQ predicate on the "nursery_code" field.
+func NurseryCodeEQ(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldNurseryCode, v))
+}
+
+// NurseryCodeNEQ applies the NEQ predicate on the "nursery_code" field.
+func NurseryCodeNEQ(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNEQ(FieldNurseryCode, v))
+}
+
+// NurseryCodeIn applies the In predicate on the "nursery_code" field.
+func NurseryCodeIn(vs ...string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldIn(FieldNurseryCode, vs...))
+}
+
+// NurseryCodeNotIn applies the NotIn predicate on the "nursery_code" field.
+func NurseryCodeNotIn(vs ...string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNotIn(FieldNurseryCode, vs...))
+}
+
+// NurseryCodeGT applies the GT predicate on the "nursery_code" field.
+func NurseryCodeGT(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGT(FieldNurseryCode, v))
+}
+
+// NurseryCodeGTE applies the GTE predicate on the "nursery_code" field.
+func NurseryCodeGTE(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGTE(FieldNurseryCode, v))
+}
+
+// NurseryCodeLT applies the LT predicate on the "nursery_code" field.
+func NurseryCodeLT(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLT(FieldNurseryCode, v))
+}
+
+// NurseryCodeLTE applies the LTE predicate on the "nursery_code" field.
+func NurseryCodeLTE(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLTE(FieldNurseryCode, v))
+}
+
+// NurseryCodeContains applies the Contains predicate on the "nursery_code" field.
+func NurseryCodeContains(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldContains(FieldNurseryCode, v))
+}
+
+// NurseryCodeHasPrefix applies the HasPrefix predicate on the "nursery_code" field.
+func NurseryCodeHasPrefix(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldHasPrefix(FieldNurseryCode, v))
+}
+
+// NurseryCodeHasSuffix applies the HasSuffix predicate on the "nursery_code" field.
+func NurseryCodeHasSuffix(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldHasSuffix(FieldNurseryCode, v))
+}
+
+// NurseryCodeEqualFold applies the EqualFold predicate on the "nursery_code" field.
+func NurseryCodeEqualFold(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEqualFold(FieldNurseryCode, v))
+}
+
+// NurseryCodeContainsFold applies the ContainsFold predicate on the "nursery_code" field.
+func NurseryCodeContainsFold(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldContainsFold(FieldNurseryCode, v))
+}
+
+// EmailEQ applies the EQ predicate on the "email" field.
+func EmailEQ(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldEmail, v))
+}
+
+// EmailNEQ applies the NEQ predicate on the "email" field.
+func EmailNEQ(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNEQ(FieldEmail, v))
+}
+
+// EmailIn applies the In predicate on the "email" field.
+func EmailIn(vs ...string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldIn(FieldEmail, vs...))
+}
+
+// EmailNotIn applies the NotIn predicate on the "email" field.
+func EmailNotIn(vs ...string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNotIn(FieldEmail, vs...))
+}
+
+// EmailGT applies the GT predicate on the "email" field.
+func EmailGT(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGT(FieldEmail, v))
+}
+
+// EmailGTE applies the GTE predicate on the "email" field.
+func EmailGTE(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGTE(FieldEmail, v))
+}
+
+// EmailLT applies the LT predicate on the "email" field.
+func EmailLT(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLT(FieldEmail, v))
+}
+
+// EmailLTE applies the LTE predicate on the "email" field.
+func EmailLTE(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLTE(FieldEmail, v))
+}
+
+// EmailContains applies the Contains predicate on the "email" field.
+func EmailContains(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldContains(FieldEmail, v))
+}
+
+// EmailHasPrefix applies the HasPrefix predicate on the "email" field.
+func EmailHasPrefix(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldHasPrefix(FieldEmail, v))
+}
+
+// EmailHasSuffix applies the HasSuffix predicate on the "email" field.
+func EmailHasSuffix(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldHasSuffix(FieldEmail, v))
+}
+
+// EmailEqualFold applies the EqualFold predicate on the "email" field.
+func EmailEqualFold(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEqualFold(FieldEmail, v))
+}
+
+// EmailContainsFold applies the ContainsFold predicate on the "email" field.
+func EmailContainsFold(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldContainsFold(FieldEmail, v))
+}
+
+// HashedPasswordEQ applies the EQ predicate on the "hashed_password" field.
+func HashedPasswordEQ(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldHashedPassword, v))
+}
+
+// HashedPasswordNEQ applies the NEQ predicate on the "hashed_password" field.
+func HashedPasswordNEQ(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNEQ(FieldHashedPassword, v))
+}
+
+// HashedPasswordIn applies the In predicate on the "hashed_password" field.
+func HashedPasswordIn(vs ...string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldIn(FieldHashedPassword, vs...))
+}
+
+// HashedPasswordNotIn applies the NotIn predicate on the "hashed_password" field.
+func HashedPasswordNotIn(vs ...string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNotIn(FieldHashedPassword, vs...))
+}
+
+// HashedPasswordGT applies the GT predicate on the "hashed_password" field.
+func HashedPasswordGT(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGT(FieldHashedPassword, v))
+}
+
+// HashedPasswordGTE applies the GTE predicate on the "hashed_password" field.
+func HashedPasswordGTE(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGTE(FieldHashedPassword, v))
+}
+
+// HashedPasswordLT applies the LT predicate on the "hashed_password" field.
+func HashedPasswordLT(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLT(FieldHashedPassword, v))
+}
+
+// HashedPasswordLTE applies the LTE predicate on the "hashed_password" field.
+func HashedPasswordLTE(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLTE(FieldHashedPassword, v))
+}
+
+// HashedPasswordContains applies the Contains predicate on the "hashed_password" field.
+func HashedPasswordContains(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldContains(FieldHashedPassword, v))
+}
+
+// HashedPasswordHasPrefix applies the HasPrefix predicate on the "hashed_password" field.
+func HashedPasswordHasPrefix(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldHasPrefix(FieldHashedPassword, v))
+}
+
+// HashedPasswordHasSuffix applies the HasSuffix predicate on the "hashed_password" field.
+func HashedPasswordHasSuffix(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldHasSuffix(FieldHashedPassword, v))
+}
+
+// HashedPasswordEqualFold applies the EqualFold predicate on the "hashed_password" field.
+func HashedPasswordEqualFold(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEqualFold(FieldHashedPassword, v))
+}
+
+// HashedPasswordContainsFold applies the ContainsFold predicate on the "hashed_password" field.
+func HashedPasswordContainsFold(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldContainsFold(FieldHashedPassword, v))
+}
+
+// NameEQ applies the EQ predicate on the "name" field.
+func NameEQ(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldName, v))
+}
+
+// NameNEQ applies the NEQ predicate on the "name" field.
+func NameNEQ(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNEQ(FieldName, v))
+}
+
+// NameIn applies the In predicate on the "name" field.
+func NameIn(vs ...string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldIn(FieldName, vs...))
+}
+
+// NameNotIn applies the NotIn predicate on the "name" field.
+func NameNotIn(vs ...string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNotIn(FieldName, vs...))
+}
+
+// NameGT applies the GT predicate on the "name" field.
+func NameGT(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGT(FieldName, v))
+}
+
+// NameGTE applies the GTE predicate on the "name" field.
+func NameGTE(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGTE(FieldName, v))
+}
+
+// NameLT applies the LT predicate on the "name" field.
+func NameLT(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLT(FieldName, v))
+}
+
+// NameLTE applies the LTE predicate on the "name" field.
+func NameLTE(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLTE(FieldName, v))
+}
+
+// NameContains applies the Contains predicate on the "name" field.
+func NameContains(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldContains(FieldName, v))
+}
+
+// NameHasPrefix applies the HasPrefix predicate on the "name" field.
+func NameHasPrefix(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldHasPrefix(FieldName, v))
+}
+
+// NameHasSuffix applies the HasSuffix predicate on the "name" field.
+func NameHasSuffix(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldHasSuffix(FieldName, v))
+}
+
+// NameEqualFold applies the EqualFold predicate on the "name" field.
+func NameEqualFold(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEqualFold(FieldName, v))
+}
+
+// NameContainsFold applies the ContainsFold predicate on the "name" field.
+func NameContainsFold(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldContainsFold(FieldName, v))
+}
+
+// AddressEQ applies the EQ predicate on the "address" field.
+func AddressEQ(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldAddress, v))
+}
+
+// AddressNEQ applies the NEQ predicate on the "address" field.
+func AddressNEQ(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNEQ(FieldAddress, v))
+}
+
+// AddressIn applies the In predicate on the "address" field.
+func AddressIn(vs ...string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldIn(FieldAddress, vs...))
+}
+
+// AddressNotIn applies the NotIn predicate on the "address" field.
+func AddressNotIn(vs ...string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNotIn(FieldAddress, vs...))
+}
+
+// AddressGT applies the GT predicate on the "address" field.
+func AddressGT(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGT(FieldAddress, v))
+}
+
+// AddressGTE applies the GTE predicate on the "address" field.
+func AddressGTE(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGTE(FieldAddress, v))
+}
+
+// AddressLT applies the LT predicate on the "address" field.
+func AddressLT(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLT(FieldAddress, v))
+}
+
+// AddressLTE applies the LTE predicate on the "address" field.
+func AddressLTE(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLTE(FieldAddress, v))
+}
+
+// AddressContains applies the Contains predicate on the "address" field.
+func AddressContains(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldContains(FieldAddress, v))
+}
+
+// AddressHasPrefix applies the HasPrefix predicate on the "address" field.
+func AddressHasPrefix(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldHasPrefix(FieldAddress, v))
+}
+
+// AddressHasSuffix applies the HasSuffix predicate on the "address" field.
+func AddressHasSuffix(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldHasSuffix(FieldAddress, v))
+}
+
+// AddressIsNil applies the IsNil predicate on the "address" field.
+func AddressIsNil() predicate.Nursery {
+ return predicate.Nursery(sql.FieldIsNull(FieldAddress))
+}
+
+// AddressNotNil applies the NotNil predicate on the "address" field.
+func AddressNotNil() predicate.Nursery {
+ return predicate.Nursery(sql.FieldNotNull(FieldAddress))
+}
+
+// AddressEqualFold applies the EqualFold predicate on the "address" field.
+func AddressEqualFold(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEqualFold(FieldAddress, v))
+}
+
+// AddressContainsFold applies the ContainsFold predicate on the "address" field.
+func AddressContainsFold(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldContainsFold(FieldAddress, v))
+}
+
+// PhoneNumberEQ applies the EQ predicate on the "phone_number" field.
+func PhoneNumberEQ(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldPhoneNumber, v))
+}
+
+// PhoneNumberNEQ applies the NEQ predicate on the "phone_number" field.
+func PhoneNumberNEQ(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNEQ(FieldPhoneNumber, v))
+}
+
+// PhoneNumberIn applies the In predicate on the "phone_number" field.
+func PhoneNumberIn(vs ...string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldIn(FieldPhoneNumber, vs...))
+}
+
+// PhoneNumberNotIn applies the NotIn predicate on the "phone_number" field.
+func PhoneNumberNotIn(vs ...string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNotIn(FieldPhoneNumber, vs...))
+}
+
+// PhoneNumberGT applies the GT predicate on the "phone_number" field.
+func PhoneNumberGT(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGT(FieldPhoneNumber, v))
+}
+
+// PhoneNumberGTE applies the GTE predicate on the "phone_number" field.
+func PhoneNumberGTE(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGTE(FieldPhoneNumber, v))
+}
+
+// PhoneNumberLT applies the LT predicate on the "phone_number" field.
+func PhoneNumberLT(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLT(FieldPhoneNumber, v))
+}
+
+// PhoneNumberLTE applies the LTE predicate on the "phone_number" field.
+func PhoneNumberLTE(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLTE(FieldPhoneNumber, v))
+}
+
+// PhoneNumberContains applies the Contains predicate on the "phone_number" field.
+func PhoneNumberContains(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldContains(FieldPhoneNumber, v))
+}
+
+// PhoneNumberHasPrefix applies the HasPrefix predicate on the "phone_number" field.
+func PhoneNumberHasPrefix(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldHasPrefix(FieldPhoneNumber, v))
+}
+
+// PhoneNumberHasSuffix applies the HasSuffix predicate on the "phone_number" field.
+func PhoneNumberHasSuffix(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldHasSuffix(FieldPhoneNumber, v))
+}
+
+// PhoneNumberIsNil applies the IsNil predicate on the "phone_number" field.
+func PhoneNumberIsNil() predicate.Nursery {
+ return predicate.Nursery(sql.FieldIsNull(FieldPhoneNumber))
+}
+
+// PhoneNumberNotNil applies the NotNil predicate on the "phone_number" field.
+func PhoneNumberNotNil() predicate.Nursery {
+ return predicate.Nursery(sql.FieldNotNull(FieldPhoneNumber))
+}
+
+// PhoneNumberEqualFold applies the EqualFold predicate on the "phone_number" field.
+func PhoneNumberEqualFold(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEqualFold(FieldPhoneNumber, v))
+}
+
+// PhoneNumberContainsFold applies the ContainsFold predicate on the "phone_number" field.
+func PhoneNumberContainsFold(v string) predicate.Nursery {
+ return predicate.Nursery(sql.FieldContainsFold(FieldPhoneNumber, v))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
+func UpdatedAtEQ(v time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
+func UpdatedAtNEQ(v time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtIn applies the In predicate on the "updated_at" field.
+func UpdatedAtIn(vs ...time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
+func UpdatedAtNotIn(vs ...time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldNotIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtGT applies the GT predicate on the "updated_at" field.
+func UpdatedAtGT(v time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
+func UpdatedAtGTE(v time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldGTE(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLT applies the LT predicate on the "updated_at" field.
+func UpdatedAtLT(v time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
+func UpdatedAtLTE(v time.Time) predicate.Nursery {
+ return predicate.Nursery(sql.FieldLTE(FieldUpdatedAt, v))
+}
+
+// HasGuardians applies the HasEdge predicate on the "guardians" edge.
+func HasGuardians() predicate.Nursery {
+ return predicate.Nursery(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, GuardiansTable, GuardiansColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasGuardiansWith applies the HasEdge predicate on the "guardians" edge with a given conditions (other predicates).
+func HasGuardiansWith(preds ...predicate.Guardian) predicate.Nursery {
+ return predicate.Nursery(func(s *sql.Selector) {
+ step := newGuardiansStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasBuses applies the HasEdge predicate on the "buses" edge.
+func HasBuses() predicate.Nursery {
+ return predicate.Nursery(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, BusesTable, BusesColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasBusesWith applies the HasEdge predicate on the "buses" edge with a given conditions (other predicates).
+func HasBusesWith(preds ...predicate.Bus) predicate.Nursery {
+ return predicate.Nursery(func(s *sql.Selector) {
+ step := newBusesStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.Nursery) predicate.Nursery {
+ return predicate.Nursery(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.Nursery) predicate.Nursery {
+ return predicate.Nursery(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.Nursery) predicate.Nursery {
+ return predicate.Nursery(sql.NotPredicates(p))
+}
diff --git a/backend/domain/repository/ent/nursery_create.go b/backend/domain/repository/ent/nursery_create.go
new file mode 100644
index 00000000..24110879
--- /dev/null
+++ b/backend/domain/repository/ent/nursery_create.go
@@ -0,0 +1,403 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/google/uuid"
+)
+
+// NurseryCreate is the builder for creating a Nursery entity.
+type NurseryCreate struct {
+ config
+ mutation *NurseryMutation
+ hooks []Hook
+}
+
+// SetNurseryCode sets the "nursery_code" field.
+func (nc *NurseryCreate) SetNurseryCode(s string) *NurseryCreate {
+ nc.mutation.SetNurseryCode(s)
+ return nc
+}
+
+// SetEmail sets the "email" field.
+func (nc *NurseryCreate) SetEmail(s string) *NurseryCreate {
+ nc.mutation.SetEmail(s)
+ return nc
+}
+
+// SetHashedPassword sets the "hashed_password" field.
+func (nc *NurseryCreate) SetHashedPassword(s string) *NurseryCreate {
+ nc.mutation.SetHashedPassword(s)
+ return nc
+}
+
+// SetName sets the "name" field.
+func (nc *NurseryCreate) SetName(s string) *NurseryCreate {
+ nc.mutation.SetName(s)
+ return nc
+}
+
+// SetAddress sets the "address" field.
+func (nc *NurseryCreate) SetAddress(s string) *NurseryCreate {
+ nc.mutation.SetAddress(s)
+ return nc
+}
+
+// SetNillableAddress sets the "address" field if the given value is not nil.
+func (nc *NurseryCreate) SetNillableAddress(s *string) *NurseryCreate {
+ if s != nil {
+ nc.SetAddress(*s)
+ }
+ return nc
+}
+
+// SetPhoneNumber sets the "phone_number" field.
+func (nc *NurseryCreate) SetPhoneNumber(s string) *NurseryCreate {
+ nc.mutation.SetPhoneNumber(s)
+ return nc
+}
+
+// SetNillablePhoneNumber sets the "phone_number" field if the given value is not nil.
+func (nc *NurseryCreate) SetNillablePhoneNumber(s *string) *NurseryCreate {
+ if s != nil {
+ nc.SetPhoneNumber(*s)
+ }
+ return nc
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (nc *NurseryCreate) SetCreatedAt(t time.Time) *NurseryCreate {
+ nc.mutation.SetCreatedAt(t)
+ return nc
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (nc *NurseryCreate) SetNillableCreatedAt(t *time.Time) *NurseryCreate {
+ if t != nil {
+ nc.SetCreatedAt(*t)
+ }
+ return nc
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (nc *NurseryCreate) SetUpdatedAt(t time.Time) *NurseryCreate {
+ nc.mutation.SetUpdatedAt(t)
+ return nc
+}
+
+// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
+func (nc *NurseryCreate) SetNillableUpdatedAt(t *time.Time) *NurseryCreate {
+ if t != nil {
+ nc.SetUpdatedAt(*t)
+ }
+ return nc
+}
+
+// SetID sets the "id" field.
+func (nc *NurseryCreate) SetID(u uuid.UUID) *NurseryCreate {
+ nc.mutation.SetID(u)
+ return nc
+}
+
+// SetNillableID sets the "id" field if the given value is not nil.
+func (nc *NurseryCreate) SetNillableID(u *uuid.UUID) *NurseryCreate {
+ if u != nil {
+ nc.SetID(*u)
+ }
+ return nc
+}
+
+// AddGuardianIDs adds the "guardians" edge to the Guardian entity by IDs.
+func (nc *NurseryCreate) AddGuardianIDs(ids ...uuid.UUID) *NurseryCreate {
+ nc.mutation.AddGuardianIDs(ids...)
+ return nc
+}
+
+// AddGuardians adds the "guardians" edges to the Guardian entity.
+func (nc *NurseryCreate) AddGuardians(g ...*Guardian) *NurseryCreate {
+ ids := make([]uuid.UUID, len(g))
+ for i := range g {
+ ids[i] = g[i].ID
+ }
+ return nc.AddGuardianIDs(ids...)
+}
+
+// AddBusIDs adds the "buses" edge to the Bus entity by IDs.
+func (nc *NurseryCreate) AddBusIDs(ids ...uuid.UUID) *NurseryCreate {
+ nc.mutation.AddBusIDs(ids...)
+ return nc
+}
+
+// AddBuses adds the "buses" edges to the Bus entity.
+func (nc *NurseryCreate) AddBuses(b ...*Bus) *NurseryCreate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return nc.AddBusIDs(ids...)
+}
+
+// Mutation returns the NurseryMutation object of the builder.
+func (nc *NurseryCreate) Mutation() *NurseryMutation {
+ return nc.mutation
+}
+
+// Save creates the Nursery in the database.
+func (nc *NurseryCreate) Save(ctx context.Context) (*Nursery, error) {
+ nc.defaults()
+ return withHooks(ctx, nc.sqlSave, nc.mutation, nc.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (nc *NurseryCreate) SaveX(ctx context.Context) *Nursery {
+ v, err := nc.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (nc *NurseryCreate) Exec(ctx context.Context) error {
+ _, err := nc.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (nc *NurseryCreate) ExecX(ctx context.Context) {
+ if err := nc.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (nc *NurseryCreate) defaults() {
+ if _, ok := nc.mutation.CreatedAt(); !ok {
+ v := nursery.DefaultCreatedAt()
+ nc.mutation.SetCreatedAt(v)
+ }
+ if _, ok := nc.mutation.UpdatedAt(); !ok {
+ v := nursery.DefaultUpdatedAt()
+ nc.mutation.SetUpdatedAt(v)
+ }
+ if _, ok := nc.mutation.ID(); !ok {
+ v := nursery.DefaultID()
+ nc.mutation.SetID(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (nc *NurseryCreate) check() error {
+ if _, ok := nc.mutation.NurseryCode(); !ok {
+ return &ValidationError{Name: "nursery_code", err: errors.New(`ent: missing required field "Nursery.nursery_code"`)}
+ }
+ if _, ok := nc.mutation.Email(); !ok {
+ return &ValidationError{Name: "email", err: errors.New(`ent: missing required field "Nursery.email"`)}
+ }
+ if _, ok := nc.mutation.HashedPassword(); !ok {
+ return &ValidationError{Name: "hashed_password", err: errors.New(`ent: missing required field "Nursery.hashed_password"`)}
+ }
+ if _, ok := nc.mutation.Name(); !ok {
+ return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Nursery.name"`)}
+ }
+ if _, ok := nc.mutation.CreatedAt(); !ok {
+ return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Nursery.created_at"`)}
+ }
+ if _, ok := nc.mutation.UpdatedAt(); !ok {
+ return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Nursery.updated_at"`)}
+ }
+ return nil
+}
+
+func (nc *NurseryCreate) sqlSave(ctx context.Context) (*Nursery, error) {
+ if err := nc.check(); err != nil {
+ return nil, err
+ }
+ _node, _spec := nc.createSpec()
+ if err := sqlgraph.CreateNode(ctx, nc.driver, _spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ if _spec.ID.Value != nil {
+ if id, ok := _spec.ID.Value.(*uuid.UUID); ok {
+ _node.ID = *id
+ } else if err := _node.ID.Scan(_spec.ID.Value); err != nil {
+ return nil, err
+ }
+ }
+ nc.mutation.id = &_node.ID
+ nc.mutation.done = true
+ return _node, nil
+}
+
+func (nc *NurseryCreate) createSpec() (*Nursery, *sqlgraph.CreateSpec) {
+ var (
+ _node = &Nursery{config: nc.config}
+ _spec = sqlgraph.NewCreateSpec(nursery.Table, sqlgraph.NewFieldSpec(nursery.FieldID, field.TypeUUID))
+ )
+ if id, ok := nc.mutation.ID(); ok {
+ _node.ID = id
+ _spec.ID.Value = &id
+ }
+ if value, ok := nc.mutation.NurseryCode(); ok {
+ _spec.SetField(nursery.FieldNurseryCode, field.TypeString, value)
+ _node.NurseryCode = value
+ }
+ if value, ok := nc.mutation.Email(); ok {
+ _spec.SetField(nursery.FieldEmail, field.TypeString, value)
+ _node.Email = value
+ }
+ if value, ok := nc.mutation.HashedPassword(); ok {
+ _spec.SetField(nursery.FieldHashedPassword, field.TypeString, value)
+ _node.HashedPassword = value
+ }
+ if value, ok := nc.mutation.Name(); ok {
+ _spec.SetField(nursery.FieldName, field.TypeString, value)
+ _node.Name = value
+ }
+ if value, ok := nc.mutation.Address(); ok {
+ _spec.SetField(nursery.FieldAddress, field.TypeString, value)
+ _node.Address = value
+ }
+ if value, ok := nc.mutation.PhoneNumber(); ok {
+ _spec.SetField(nursery.FieldPhoneNumber, field.TypeString, value)
+ _node.PhoneNumber = value
+ }
+ if value, ok := nc.mutation.CreatedAt(); ok {
+ _spec.SetField(nursery.FieldCreatedAt, field.TypeTime, value)
+ _node.CreatedAt = value
+ }
+ if value, ok := nc.mutation.UpdatedAt(); ok {
+ _spec.SetField(nursery.FieldUpdatedAt, field.TypeTime, value)
+ _node.UpdatedAt = value
+ }
+ if nodes := nc.mutation.GuardiansIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: nursery.GuardiansTable,
+ Columns: []string{nursery.GuardiansColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := nc.mutation.BusesIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: nursery.BusesTable,
+ Columns: []string{nursery.BusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ return _node, _spec
+}
+
+// NurseryCreateBulk is the builder for creating many Nursery entities in bulk.
+type NurseryCreateBulk struct {
+ config
+ err error
+ builders []*NurseryCreate
+}
+
+// Save creates the Nursery entities in the database.
+func (ncb *NurseryCreateBulk) Save(ctx context.Context) ([]*Nursery, error) {
+ if ncb.err != nil {
+ return nil, ncb.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(ncb.builders))
+ nodes := make([]*Nursery, len(ncb.builders))
+ mutators := make([]Mutator, len(ncb.builders))
+ for i := range ncb.builders {
+ func(i int, root context.Context) {
+ builder := ncb.builders[i]
+ builder.defaults()
+ var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+ mutation, ok := m.(*NurseryMutation)
+ if !ok {
+ return nil, fmt.Errorf("unexpected mutation type %T", m)
+ }
+ if err := builder.check(); err != nil {
+ return nil, err
+ }
+ builder.mutation = mutation
+ var err error
+ nodes[i], specs[i] = builder.createSpec()
+ if i < len(mutators)-1 {
+ _, err = mutators[i+1].Mutate(root, ncb.builders[i+1].mutation)
+ } else {
+ spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+ // Invoke the actual operation on the latest mutation in the chain.
+ if err = sqlgraph.BatchCreate(ctx, ncb.driver, spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ }
+ }
+ if err != nil {
+ return nil, err
+ }
+ mutation.id = &nodes[i].ID
+ mutation.done = true
+ return nodes[i], nil
+ })
+ for i := len(builder.hooks) - 1; i >= 0; i-- {
+ mut = builder.hooks[i](mut)
+ }
+ mutators[i] = mut
+ }(i, ctx)
+ }
+ if len(mutators) > 0 {
+ if _, err := mutators[0].Mutate(ctx, ncb.builders[0].mutation); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (ncb *NurseryCreateBulk) SaveX(ctx context.Context) []*Nursery {
+ v, err := ncb.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (ncb *NurseryCreateBulk) Exec(ctx context.Context) error {
+ _, err := ncb.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (ncb *NurseryCreateBulk) ExecX(ctx context.Context) {
+ if err := ncb.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/nursery_delete.go b/backend/domain/repository/ent/nursery_delete.go
new file mode 100644
index 00000000..94dbbd3f
--- /dev/null
+++ b/backend/domain/repository/ent/nursery_delete.go
@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+)
+
+// NurseryDelete is the builder for deleting a Nursery entity.
+type NurseryDelete struct {
+ config
+ hooks []Hook
+ mutation *NurseryMutation
+}
+
+// Where appends a list predicates to the NurseryDelete builder.
+func (nd *NurseryDelete) Where(ps ...predicate.Nursery) *NurseryDelete {
+ nd.mutation.Where(ps...)
+ return nd
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (nd *NurseryDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, nd.sqlExec, nd.mutation, nd.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (nd *NurseryDelete) ExecX(ctx context.Context) int {
+ n, err := nd.Exec(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return n
+}
+
+func (nd *NurseryDelete) sqlExec(ctx context.Context) (int, error) {
+ _spec := sqlgraph.NewDeleteSpec(nursery.Table, sqlgraph.NewFieldSpec(nursery.FieldID, field.TypeUUID))
+ if ps := nd.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ affected, err := sqlgraph.DeleteNodes(ctx, nd.driver, _spec)
+ if err != nil && sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ nd.mutation.done = true
+ return affected, err
+}
+
+// NurseryDeleteOne is the builder for deleting a single Nursery entity.
+type NurseryDeleteOne struct {
+ nd *NurseryDelete
+}
+
+// Where appends a list predicates to the NurseryDelete builder.
+func (ndo *NurseryDeleteOne) Where(ps ...predicate.Nursery) *NurseryDeleteOne {
+ ndo.nd.mutation.Where(ps...)
+ return ndo
+}
+
+// Exec executes the deletion query.
+func (ndo *NurseryDeleteOne) Exec(ctx context.Context) error {
+ n, err := ndo.nd.Exec(ctx)
+ switch {
+ case err != nil:
+ return err
+ case n == 0:
+ return &NotFoundError{nursery.Label}
+ default:
+ return nil
+ }
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (ndo *NurseryDeleteOne) ExecX(ctx context.Context) {
+ if err := ndo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/nursery_query.go b/backend/domain/repository/ent/nursery_query.go
new file mode 100644
index 00000000..33fe562b
--- /dev/null
+++ b/backend/domain/repository/ent/nursery_query.go
@@ -0,0 +1,682 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "database/sql/driver"
+ "fmt"
+ "math"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// NurseryQuery is the builder for querying Nursery entities.
+type NurseryQuery struct {
+ config
+ ctx *QueryContext
+ order []nursery.OrderOption
+ inters []Interceptor
+ predicates []predicate.Nursery
+ withGuardians *GuardianQuery
+ withBuses *BusQuery
+ // intermediate query (i.e. traversal path).
+ sql *sql.Selector
+ path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the NurseryQuery builder.
+func (nq *NurseryQuery) Where(ps ...predicate.Nursery) *NurseryQuery {
+ nq.predicates = append(nq.predicates, ps...)
+ return nq
+}
+
+// Limit the number of records to be returned by this query.
+func (nq *NurseryQuery) Limit(limit int) *NurseryQuery {
+ nq.ctx.Limit = &limit
+ return nq
+}
+
+// Offset to start from.
+func (nq *NurseryQuery) Offset(offset int) *NurseryQuery {
+ nq.ctx.Offset = &offset
+ return nq
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (nq *NurseryQuery) Unique(unique bool) *NurseryQuery {
+ nq.ctx.Unique = &unique
+ return nq
+}
+
+// Order specifies how the records should be ordered.
+func (nq *NurseryQuery) Order(o ...nursery.OrderOption) *NurseryQuery {
+ nq.order = append(nq.order, o...)
+ return nq
+}
+
+// QueryGuardians chains the current query on the "guardians" edge.
+func (nq *NurseryQuery) QueryGuardians() *GuardianQuery {
+ query := (&GuardianClient{config: nq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := nq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := nq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(nursery.Table, nursery.FieldID, selector),
+ sqlgraph.To(guardian.Table, guardian.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, nursery.GuardiansTable, nursery.GuardiansColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(nq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryBuses chains the current query on the "buses" edge.
+func (nq *NurseryQuery) QueryBuses() *BusQuery {
+ query := (&BusClient{config: nq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := nq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := nq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(nursery.Table, nursery.FieldID, selector),
+ sqlgraph.To(bus.Table, bus.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, nursery.BusesTable, nursery.BusesColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(nq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// First returns the first Nursery entity from the query.
+// Returns a *NotFoundError when no Nursery was found.
+func (nq *NurseryQuery) First(ctx context.Context) (*Nursery, error) {
+ nodes, err := nq.Limit(1).All(setContextOp(ctx, nq.ctx, "First"))
+ if err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nil, &NotFoundError{nursery.Label}
+ }
+ return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (nq *NurseryQuery) FirstX(ctx context.Context) *Nursery {
+ node, err := nq.First(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return node
+}
+
+// FirstID returns the first Nursery ID from the query.
+// Returns a *NotFoundError when no Nursery ID was found.
+func (nq *NurseryQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+ var ids []uuid.UUID
+ if ids, err = nq.Limit(1).IDs(setContextOp(ctx, nq.ctx, "FirstID")); err != nil {
+ return
+ }
+ if len(ids) == 0 {
+ err = &NotFoundError{nursery.Label}
+ return
+ }
+ return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (nq *NurseryQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := nq.FirstID(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return id
+}
+
+// Only returns a single Nursery entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one Nursery entity is found.
+// Returns a *NotFoundError when no Nursery entities are found.
+func (nq *NurseryQuery) Only(ctx context.Context) (*Nursery, error) {
+ nodes, err := nq.Limit(2).All(setContextOp(ctx, nq.ctx, "Only"))
+ if err != nil {
+ return nil, err
+ }
+ switch len(nodes) {
+ case 1:
+ return nodes[0], nil
+ case 0:
+ return nil, &NotFoundError{nursery.Label}
+ default:
+ return nil, &NotSingularError{nursery.Label}
+ }
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (nq *NurseryQuery) OnlyX(ctx context.Context) *Nursery {
+ node, err := nq.Only(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// OnlyID is like Only, but returns the only Nursery ID in the query.
+// Returns a *NotSingularError when more than one Nursery ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (nq *NurseryQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+ var ids []uuid.UUID
+ if ids, err = nq.Limit(2).IDs(setContextOp(ctx, nq.ctx, "OnlyID")); err != nil {
+ return
+ }
+ switch len(ids) {
+ case 1:
+ id = ids[0]
+ case 0:
+ err = &NotFoundError{nursery.Label}
+ default:
+ err = &NotSingularError{nursery.Label}
+ }
+ return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (nq *NurseryQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := nq.OnlyID(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// All executes the query and returns a list of Nurseries.
+func (nq *NurseryQuery) All(ctx context.Context) ([]*Nursery, error) {
+ ctx = setContextOp(ctx, nq.ctx, "All")
+ if err := nq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ qr := querierAll[[]*Nursery, *NurseryQuery]()
+ return withInterceptors[[]*Nursery](ctx, nq, qr, nq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (nq *NurseryQuery) AllX(ctx context.Context) []*Nursery {
+ nodes, err := nq.All(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return nodes
+}
+
+// IDs executes the query and returns a list of Nursery IDs.
+func (nq *NurseryQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if nq.ctx.Unique == nil && nq.path != nil {
+ nq.Unique(true)
+ }
+ ctx = setContextOp(ctx, nq.ctx, "IDs")
+ if err = nq.Select(nursery.FieldID).Scan(ctx, &ids); err != nil {
+ return nil, err
+ }
+ return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (nq *NurseryQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := nq.IDs(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return ids
+}
+
+// Count returns the count of the given query.
+func (nq *NurseryQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, nq.ctx, "Count")
+ if err := nq.prepareQuery(ctx); err != nil {
+ return 0, err
+ }
+ return withInterceptors[int](ctx, nq, querierCount[*NurseryQuery](), nq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (nq *NurseryQuery) CountX(ctx context.Context) int {
+ count, err := nq.Count(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (nq *NurseryQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, nq.ctx, "Exist")
+ switch _, err := nq.FirstID(ctx); {
+ case IsNotFound(err):
+ return false, nil
+ case err != nil:
+ return false, fmt.Errorf("ent: check existence: %w", err)
+ default:
+ return true, nil
+ }
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (nq *NurseryQuery) ExistX(ctx context.Context) bool {
+ exist, err := nq.Exist(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return exist
+}
+
+// Clone returns a duplicate of the NurseryQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (nq *NurseryQuery) Clone() *NurseryQuery {
+ if nq == nil {
+ return nil
+ }
+ return &NurseryQuery{
+ config: nq.config,
+ ctx: nq.ctx.Clone(),
+ order: append([]nursery.OrderOption{}, nq.order...),
+ inters: append([]Interceptor{}, nq.inters...),
+ predicates: append([]predicate.Nursery{}, nq.predicates...),
+ withGuardians: nq.withGuardians.Clone(),
+ withBuses: nq.withBuses.Clone(),
+ // clone intermediate query.
+ sql: nq.sql.Clone(),
+ path: nq.path,
+ }
+}
+
+// WithGuardians tells the query-builder to eager-load the nodes that are connected to
+// the "guardians" edge. The optional arguments are used to configure the query builder of the edge.
+func (nq *NurseryQuery) WithGuardians(opts ...func(*GuardianQuery)) *NurseryQuery {
+ query := (&GuardianClient{config: nq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ nq.withGuardians = query
+ return nq
+}
+
+// WithBuses tells the query-builder to eager-load the nodes that are connected to
+// the "buses" edge. The optional arguments are used to configure the query builder of the edge.
+func (nq *NurseryQuery) WithBuses(opts ...func(*BusQuery)) *NurseryQuery {
+ query := (&BusClient{config: nq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ nq.withBuses = query
+ return nq
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+// var v []struct {
+// NurseryCode string `json:"nursery_code,omitempty"`
+// Count int `json:"count,omitempty"`
+// }
+//
+// client.Nursery.Query().
+// GroupBy(nursery.FieldNurseryCode).
+// Aggregate(ent.Count()).
+// Scan(ctx, &v)
+func (nq *NurseryQuery) GroupBy(field string, fields ...string) *NurseryGroupBy {
+ nq.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &NurseryGroupBy{build: nq}
+ grbuild.flds = &nq.ctx.Fields
+ grbuild.label = nursery.Label
+ grbuild.scan = grbuild.Scan
+ return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+// var v []struct {
+// NurseryCode string `json:"nursery_code,omitempty"`
+// }
+//
+// client.Nursery.Query().
+// Select(nursery.FieldNurseryCode).
+// Scan(ctx, &v)
+func (nq *NurseryQuery) Select(fields ...string) *NurserySelect {
+ nq.ctx.Fields = append(nq.ctx.Fields, fields...)
+ sbuild := &NurserySelect{NurseryQuery: nq}
+ sbuild.label = nursery.Label
+ sbuild.flds, sbuild.scan = &nq.ctx.Fields, sbuild.Scan
+ return sbuild
+}
+
+// Aggregate returns a NurserySelect configured with the given aggregations.
+func (nq *NurseryQuery) Aggregate(fns ...AggregateFunc) *NurserySelect {
+ return nq.Select().Aggregate(fns...)
+}
+
+func (nq *NurseryQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range nq.inters {
+ if inter == nil {
+ return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+ }
+ if trv, ok := inter.(Traverser); ok {
+ if err := trv.Traverse(ctx, nq); err != nil {
+ return err
+ }
+ }
+ }
+ for _, f := range nq.ctx.Fields {
+ if !nursery.ValidColumn(f) {
+ return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ }
+ if nq.path != nil {
+ prev, err := nq.path(ctx)
+ if err != nil {
+ return err
+ }
+ nq.sql = prev
+ }
+ return nil
+}
+
+func (nq *NurseryQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Nursery, error) {
+ var (
+ nodes = []*Nursery{}
+ _spec = nq.querySpec()
+ loadedTypes = [2]bool{
+ nq.withGuardians != nil,
+ nq.withBuses != nil,
+ }
+ )
+ _spec.ScanValues = func(columns []string) ([]any, error) {
+ return (*Nursery).scanValues(nil, columns)
+ }
+ _spec.Assign = func(columns []string, values []any) error {
+ node := &Nursery{config: nq.config}
+ nodes = append(nodes, node)
+ node.Edges.loadedTypes = loadedTypes
+ return node.assignValues(columns, values)
+ }
+ for i := range hooks {
+ hooks[i](ctx, _spec)
+ }
+ if err := sqlgraph.QueryNodes(ctx, nq.driver, _spec); err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nodes, nil
+ }
+ if query := nq.withGuardians; query != nil {
+ if err := nq.loadGuardians(ctx, query, nodes,
+ func(n *Nursery) { n.Edges.Guardians = []*Guardian{} },
+ func(n *Nursery, e *Guardian) { n.Edges.Guardians = append(n.Edges.Guardians, e) }); err != nil {
+ return nil, err
+ }
+ }
+ if query := nq.withBuses; query != nil {
+ if err := nq.loadBuses(ctx, query, nodes,
+ func(n *Nursery) { n.Edges.Buses = []*Bus{} },
+ func(n *Nursery, e *Bus) { n.Edges.Buses = append(n.Edges.Buses, e) }); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+func (nq *NurseryQuery) loadGuardians(ctx context.Context, query *GuardianQuery, nodes []*Nursery, init func(*Nursery), assign func(*Nursery, *Guardian)) error {
+ fks := make([]driver.Value, 0, len(nodes))
+ nodeids := make(map[uuid.UUID]*Nursery)
+ for i := range nodes {
+ fks = append(fks, nodes[i].ID)
+ nodeids[nodes[i].ID] = nodes[i]
+ if init != nil {
+ init(nodes[i])
+ }
+ }
+ query.withFKs = true
+ query.Where(predicate.Guardian(func(s *sql.Selector) {
+ s.Where(sql.InValues(s.C(nursery.GuardiansColumn), fks...))
+ }))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ fk := n.guardian_nursery
+ if fk == nil {
+ return fmt.Errorf(`foreign-key "guardian_nursery" is nil for node %v`, n.ID)
+ }
+ node, ok := nodeids[*fk]
+ if !ok {
+ return fmt.Errorf(`unexpected referenced foreign-key "guardian_nursery" returned %v for node %v`, *fk, n.ID)
+ }
+ assign(node, n)
+ }
+ return nil
+}
+func (nq *NurseryQuery) loadBuses(ctx context.Context, query *BusQuery, nodes []*Nursery, init func(*Nursery), assign func(*Nursery, *Bus)) error {
+ fks := make([]driver.Value, 0, len(nodes))
+ nodeids := make(map[uuid.UUID]*Nursery)
+ for i := range nodes {
+ fks = append(fks, nodes[i].ID)
+ nodeids[nodes[i].ID] = nodes[i]
+ if init != nil {
+ init(nodes[i])
+ }
+ }
+ query.withFKs = true
+ query.Where(predicate.Bus(func(s *sql.Selector) {
+ s.Where(sql.InValues(s.C(nursery.BusesColumn), fks...))
+ }))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ fk := n.bus_nursery
+ if fk == nil {
+ return fmt.Errorf(`foreign-key "bus_nursery" is nil for node %v`, n.ID)
+ }
+ node, ok := nodeids[*fk]
+ if !ok {
+ return fmt.Errorf(`unexpected referenced foreign-key "bus_nursery" returned %v for node %v`, *fk, n.ID)
+ }
+ assign(node, n)
+ }
+ return nil
+}
+
+func (nq *NurseryQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := nq.querySpec()
+ _spec.Node.Columns = nq.ctx.Fields
+ if len(nq.ctx.Fields) > 0 {
+ _spec.Unique = nq.ctx.Unique != nil && *nq.ctx.Unique
+ }
+ return sqlgraph.CountNodes(ctx, nq.driver, _spec)
+}
+
+func (nq *NurseryQuery) querySpec() *sqlgraph.QuerySpec {
+ _spec := sqlgraph.NewQuerySpec(nursery.Table, nursery.Columns, sqlgraph.NewFieldSpec(nursery.FieldID, field.TypeUUID))
+ _spec.From = nq.sql
+ if unique := nq.ctx.Unique; unique != nil {
+ _spec.Unique = *unique
+ } else if nq.path != nil {
+ _spec.Unique = true
+ }
+ if fields := nq.ctx.Fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, nursery.FieldID)
+ for i := range fields {
+ if fields[i] != nursery.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+ }
+ }
+ }
+ if ps := nq.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if limit := nq.ctx.Limit; limit != nil {
+ _spec.Limit = *limit
+ }
+ if offset := nq.ctx.Offset; offset != nil {
+ _spec.Offset = *offset
+ }
+ if ps := nq.order; len(ps) > 0 {
+ _spec.Order = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ return _spec
+}
+
+func (nq *NurseryQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(nq.driver.Dialect())
+ t1 := builder.Table(nursery.Table)
+ columns := nq.ctx.Fields
+ if len(columns) == 0 {
+ columns = nursery.Columns
+ }
+ selector := builder.Select(t1.Columns(columns...)...).From(t1)
+ if nq.sql != nil {
+ selector = nq.sql
+ selector.Select(selector.Columns(columns...)...)
+ }
+ if nq.ctx.Unique != nil && *nq.ctx.Unique {
+ selector.Distinct()
+ }
+ for _, p := range nq.predicates {
+ p(selector)
+ }
+ for _, p := range nq.order {
+ p(selector)
+ }
+ if offset := nq.ctx.Offset; offset != nil {
+ // limit is mandatory for offset clause. We start
+ // with default value, and override it below if needed.
+ selector.Offset(*offset).Limit(math.MaxInt32)
+ }
+ if limit := nq.ctx.Limit; limit != nil {
+ selector.Limit(*limit)
+ }
+ return selector
+}
+
+// NurseryGroupBy is the group-by builder for Nursery entities.
+type NurseryGroupBy struct {
+ selector
+ build *NurseryQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (ngb *NurseryGroupBy) Aggregate(fns ...AggregateFunc) *NurseryGroupBy {
+ ngb.fns = append(ngb.fns, fns...)
+ return ngb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (ngb *NurseryGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, ngb.build.ctx, "GroupBy")
+ if err := ngb.build.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*NurseryQuery, *NurseryGroupBy](ctx, ngb.build, ngb, ngb.build.inters, v)
+}
+
+func (ngb *NurseryGroupBy) sqlScan(ctx context.Context, root *NurseryQuery, v any) error {
+ selector := root.sqlQuery(ctx).Select()
+ aggregation := make([]string, 0, len(ngb.fns))
+ for _, fn := range ngb.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ if len(selector.SelectedColumns()) == 0 {
+ columns := make([]string, 0, len(*ngb.flds)+len(ngb.fns))
+ for _, f := range *ngb.flds {
+ columns = append(columns, selector.C(f))
+ }
+ columns = append(columns, aggregation...)
+ selector.Select(columns...)
+ }
+ selector.GroupBy(selector.Columns(*ngb.flds...)...)
+ if err := selector.Err(); err != nil {
+ return err
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := ngb.build.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
+
+// NurserySelect is the builder for selecting fields of Nursery entities.
+type NurserySelect struct {
+ *NurseryQuery
+ selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (ns *NurserySelect) Aggregate(fns ...AggregateFunc) *NurserySelect {
+ ns.fns = append(ns.fns, fns...)
+ return ns
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (ns *NurserySelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, ns.ctx, "Select")
+ if err := ns.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*NurseryQuery, *NurserySelect](ctx, ns.NurseryQuery, ns, ns.inters, v)
+}
+
+func (ns *NurserySelect) sqlScan(ctx context.Context, root *NurseryQuery, v any) error {
+ selector := root.sqlQuery(ctx)
+ aggregation := make([]string, 0, len(ns.fns))
+ for _, fn := range ns.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ switch n := len(*ns.selector.flds); {
+ case n == 0 && len(aggregation) > 0:
+ selector.Select(aggregation...)
+ case n != 0 && len(aggregation) > 0:
+ selector.AppendSelect(aggregation...)
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := ns.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
diff --git a/backend/domain/repository/ent/nursery_update.go b/backend/domain/repository/ent/nursery_update.go
new file mode 100644
index 00000000..57e4515a
--- /dev/null
+++ b/backend/domain/repository/ent/nursery_update.go
@@ -0,0 +1,813 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// NurseryUpdate is the builder for updating Nursery entities.
+type NurseryUpdate struct {
+ config
+ hooks []Hook
+ mutation *NurseryMutation
+}
+
+// Where appends a list predicates to the NurseryUpdate builder.
+func (nu *NurseryUpdate) Where(ps ...predicate.Nursery) *NurseryUpdate {
+ nu.mutation.Where(ps...)
+ return nu
+}
+
+// SetNurseryCode sets the "nursery_code" field.
+func (nu *NurseryUpdate) SetNurseryCode(s string) *NurseryUpdate {
+ nu.mutation.SetNurseryCode(s)
+ return nu
+}
+
+// SetNillableNurseryCode sets the "nursery_code" field if the given value is not nil.
+func (nu *NurseryUpdate) SetNillableNurseryCode(s *string) *NurseryUpdate {
+ if s != nil {
+ nu.SetNurseryCode(*s)
+ }
+ return nu
+}
+
+// SetEmail sets the "email" field.
+func (nu *NurseryUpdate) SetEmail(s string) *NurseryUpdate {
+ nu.mutation.SetEmail(s)
+ return nu
+}
+
+// SetNillableEmail sets the "email" field if the given value is not nil.
+func (nu *NurseryUpdate) SetNillableEmail(s *string) *NurseryUpdate {
+ if s != nil {
+ nu.SetEmail(*s)
+ }
+ return nu
+}
+
+// SetHashedPassword sets the "hashed_password" field.
+func (nu *NurseryUpdate) SetHashedPassword(s string) *NurseryUpdate {
+ nu.mutation.SetHashedPassword(s)
+ return nu
+}
+
+// SetNillableHashedPassword sets the "hashed_password" field if the given value is not nil.
+func (nu *NurseryUpdate) SetNillableHashedPassword(s *string) *NurseryUpdate {
+ if s != nil {
+ nu.SetHashedPassword(*s)
+ }
+ return nu
+}
+
+// SetName sets the "name" field.
+func (nu *NurseryUpdate) SetName(s string) *NurseryUpdate {
+ nu.mutation.SetName(s)
+ return nu
+}
+
+// SetNillableName sets the "name" field if the given value is not nil.
+func (nu *NurseryUpdate) SetNillableName(s *string) *NurseryUpdate {
+ if s != nil {
+ nu.SetName(*s)
+ }
+ return nu
+}
+
+// SetAddress sets the "address" field.
+func (nu *NurseryUpdate) SetAddress(s string) *NurseryUpdate {
+ nu.mutation.SetAddress(s)
+ return nu
+}
+
+// SetNillableAddress sets the "address" field if the given value is not nil.
+func (nu *NurseryUpdate) SetNillableAddress(s *string) *NurseryUpdate {
+ if s != nil {
+ nu.SetAddress(*s)
+ }
+ return nu
+}
+
+// ClearAddress clears the value of the "address" field.
+func (nu *NurseryUpdate) ClearAddress() *NurseryUpdate {
+ nu.mutation.ClearAddress()
+ return nu
+}
+
+// SetPhoneNumber sets the "phone_number" field.
+func (nu *NurseryUpdate) SetPhoneNumber(s string) *NurseryUpdate {
+ nu.mutation.SetPhoneNumber(s)
+ return nu
+}
+
+// SetNillablePhoneNumber sets the "phone_number" field if the given value is not nil.
+func (nu *NurseryUpdate) SetNillablePhoneNumber(s *string) *NurseryUpdate {
+ if s != nil {
+ nu.SetPhoneNumber(*s)
+ }
+ return nu
+}
+
+// ClearPhoneNumber clears the value of the "phone_number" field.
+func (nu *NurseryUpdate) ClearPhoneNumber() *NurseryUpdate {
+ nu.mutation.ClearPhoneNumber()
+ return nu
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (nu *NurseryUpdate) SetCreatedAt(t time.Time) *NurseryUpdate {
+ nu.mutation.SetCreatedAt(t)
+ return nu
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (nu *NurseryUpdate) SetNillableCreatedAt(t *time.Time) *NurseryUpdate {
+ if t != nil {
+ nu.SetCreatedAt(*t)
+ }
+ return nu
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (nu *NurseryUpdate) SetUpdatedAt(t time.Time) *NurseryUpdate {
+ nu.mutation.SetUpdatedAt(t)
+ return nu
+}
+
+// AddGuardianIDs adds the "guardians" edge to the Guardian entity by IDs.
+func (nu *NurseryUpdate) AddGuardianIDs(ids ...uuid.UUID) *NurseryUpdate {
+ nu.mutation.AddGuardianIDs(ids...)
+ return nu
+}
+
+// AddGuardians adds the "guardians" edges to the Guardian entity.
+func (nu *NurseryUpdate) AddGuardians(g ...*Guardian) *NurseryUpdate {
+ ids := make([]uuid.UUID, len(g))
+ for i := range g {
+ ids[i] = g[i].ID
+ }
+ return nu.AddGuardianIDs(ids...)
+}
+
+// AddBusIDs adds the "buses" edge to the Bus entity by IDs.
+func (nu *NurseryUpdate) AddBusIDs(ids ...uuid.UUID) *NurseryUpdate {
+ nu.mutation.AddBusIDs(ids...)
+ return nu
+}
+
+// AddBuses adds the "buses" edges to the Bus entity.
+func (nu *NurseryUpdate) AddBuses(b ...*Bus) *NurseryUpdate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return nu.AddBusIDs(ids...)
+}
+
+// Mutation returns the NurseryMutation object of the builder.
+func (nu *NurseryUpdate) Mutation() *NurseryMutation {
+ return nu.mutation
+}
+
+// ClearGuardians clears all "guardians" edges to the Guardian entity.
+func (nu *NurseryUpdate) ClearGuardians() *NurseryUpdate {
+ nu.mutation.ClearGuardians()
+ return nu
+}
+
+// RemoveGuardianIDs removes the "guardians" edge to Guardian entities by IDs.
+func (nu *NurseryUpdate) RemoveGuardianIDs(ids ...uuid.UUID) *NurseryUpdate {
+ nu.mutation.RemoveGuardianIDs(ids...)
+ return nu
+}
+
+// RemoveGuardians removes "guardians" edges to Guardian entities.
+func (nu *NurseryUpdate) RemoveGuardians(g ...*Guardian) *NurseryUpdate {
+ ids := make([]uuid.UUID, len(g))
+ for i := range g {
+ ids[i] = g[i].ID
+ }
+ return nu.RemoveGuardianIDs(ids...)
+}
+
+// ClearBuses clears all "buses" edges to the Bus entity.
+func (nu *NurseryUpdate) ClearBuses() *NurseryUpdate {
+ nu.mutation.ClearBuses()
+ return nu
+}
+
+// RemoveBusIDs removes the "buses" edge to Bus entities by IDs.
+func (nu *NurseryUpdate) RemoveBusIDs(ids ...uuid.UUID) *NurseryUpdate {
+ nu.mutation.RemoveBusIDs(ids...)
+ return nu
+}
+
+// RemoveBuses removes "buses" edges to Bus entities.
+func (nu *NurseryUpdate) RemoveBuses(b ...*Bus) *NurseryUpdate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return nu.RemoveBusIDs(ids...)
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (nu *NurseryUpdate) Save(ctx context.Context) (int, error) {
+ nu.defaults()
+ return withHooks(ctx, nu.sqlSave, nu.mutation, nu.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (nu *NurseryUpdate) SaveX(ctx context.Context) int {
+ affected, err := nu.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return affected
+}
+
+// Exec executes the query.
+func (nu *NurseryUpdate) Exec(ctx context.Context) error {
+ _, err := nu.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (nu *NurseryUpdate) ExecX(ctx context.Context) {
+ if err := nu.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (nu *NurseryUpdate) defaults() {
+ if _, ok := nu.mutation.UpdatedAt(); !ok {
+ v := nursery.UpdateDefaultUpdatedAt()
+ nu.mutation.SetUpdatedAt(v)
+ }
+}
+
+func (nu *NurseryUpdate) sqlSave(ctx context.Context) (n int, err error) {
+ _spec := sqlgraph.NewUpdateSpec(nursery.Table, nursery.Columns, sqlgraph.NewFieldSpec(nursery.FieldID, field.TypeUUID))
+ if ps := nu.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := nu.mutation.NurseryCode(); ok {
+ _spec.SetField(nursery.FieldNurseryCode, field.TypeString, value)
+ }
+ if value, ok := nu.mutation.Email(); ok {
+ _spec.SetField(nursery.FieldEmail, field.TypeString, value)
+ }
+ if value, ok := nu.mutation.HashedPassword(); ok {
+ _spec.SetField(nursery.FieldHashedPassword, field.TypeString, value)
+ }
+ if value, ok := nu.mutation.Name(); ok {
+ _spec.SetField(nursery.FieldName, field.TypeString, value)
+ }
+ if value, ok := nu.mutation.Address(); ok {
+ _spec.SetField(nursery.FieldAddress, field.TypeString, value)
+ }
+ if nu.mutation.AddressCleared() {
+ _spec.ClearField(nursery.FieldAddress, field.TypeString)
+ }
+ if value, ok := nu.mutation.PhoneNumber(); ok {
+ _spec.SetField(nursery.FieldPhoneNumber, field.TypeString, value)
+ }
+ if nu.mutation.PhoneNumberCleared() {
+ _spec.ClearField(nursery.FieldPhoneNumber, field.TypeString)
+ }
+ if value, ok := nu.mutation.CreatedAt(); ok {
+ _spec.SetField(nursery.FieldCreatedAt, field.TypeTime, value)
+ }
+ if value, ok := nu.mutation.UpdatedAt(); ok {
+ _spec.SetField(nursery.FieldUpdatedAt, field.TypeTime, value)
+ }
+ if nu.mutation.GuardiansCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: nursery.GuardiansTable,
+ Columns: []string{nursery.GuardiansColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := nu.mutation.RemovedGuardiansIDs(); len(nodes) > 0 && !nu.mutation.GuardiansCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: nursery.GuardiansTable,
+ Columns: []string{nursery.GuardiansColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := nu.mutation.GuardiansIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: nursery.GuardiansTable,
+ Columns: []string{nursery.GuardiansColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if nu.mutation.BusesCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: nursery.BusesTable,
+ Columns: []string{nursery.BusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := nu.mutation.RemovedBusesIDs(); len(nodes) > 0 && !nu.mutation.BusesCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: nursery.BusesTable,
+ Columns: []string{nursery.BusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := nu.mutation.BusesIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: nursery.BusesTable,
+ Columns: []string{nursery.BusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if n, err = sqlgraph.UpdateNodes(ctx, nu.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{nursery.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return 0, err
+ }
+ nu.mutation.done = true
+ return n, nil
+}
+
+// NurseryUpdateOne is the builder for updating a single Nursery entity.
+type NurseryUpdateOne struct {
+ config
+ fields []string
+ hooks []Hook
+ mutation *NurseryMutation
+}
+
+// SetNurseryCode sets the "nursery_code" field.
+func (nuo *NurseryUpdateOne) SetNurseryCode(s string) *NurseryUpdateOne {
+ nuo.mutation.SetNurseryCode(s)
+ return nuo
+}
+
+// SetNillableNurseryCode sets the "nursery_code" field if the given value is not nil.
+func (nuo *NurseryUpdateOne) SetNillableNurseryCode(s *string) *NurseryUpdateOne {
+ if s != nil {
+ nuo.SetNurseryCode(*s)
+ }
+ return nuo
+}
+
+// SetEmail sets the "email" field.
+func (nuo *NurseryUpdateOne) SetEmail(s string) *NurseryUpdateOne {
+ nuo.mutation.SetEmail(s)
+ return nuo
+}
+
+// SetNillableEmail sets the "email" field if the given value is not nil.
+func (nuo *NurseryUpdateOne) SetNillableEmail(s *string) *NurseryUpdateOne {
+ if s != nil {
+ nuo.SetEmail(*s)
+ }
+ return nuo
+}
+
+// SetHashedPassword sets the "hashed_password" field.
+func (nuo *NurseryUpdateOne) SetHashedPassword(s string) *NurseryUpdateOne {
+ nuo.mutation.SetHashedPassword(s)
+ return nuo
+}
+
+// SetNillableHashedPassword sets the "hashed_password" field if the given value is not nil.
+func (nuo *NurseryUpdateOne) SetNillableHashedPassword(s *string) *NurseryUpdateOne {
+ if s != nil {
+ nuo.SetHashedPassword(*s)
+ }
+ return nuo
+}
+
+// SetName sets the "name" field.
+func (nuo *NurseryUpdateOne) SetName(s string) *NurseryUpdateOne {
+ nuo.mutation.SetName(s)
+ return nuo
+}
+
+// SetNillableName sets the "name" field if the given value is not nil.
+func (nuo *NurseryUpdateOne) SetNillableName(s *string) *NurseryUpdateOne {
+ if s != nil {
+ nuo.SetName(*s)
+ }
+ return nuo
+}
+
+// SetAddress sets the "address" field.
+func (nuo *NurseryUpdateOne) SetAddress(s string) *NurseryUpdateOne {
+ nuo.mutation.SetAddress(s)
+ return nuo
+}
+
+// SetNillableAddress sets the "address" field if the given value is not nil.
+func (nuo *NurseryUpdateOne) SetNillableAddress(s *string) *NurseryUpdateOne {
+ if s != nil {
+ nuo.SetAddress(*s)
+ }
+ return nuo
+}
+
+// ClearAddress clears the value of the "address" field.
+func (nuo *NurseryUpdateOne) ClearAddress() *NurseryUpdateOne {
+ nuo.mutation.ClearAddress()
+ return nuo
+}
+
+// SetPhoneNumber sets the "phone_number" field.
+func (nuo *NurseryUpdateOne) SetPhoneNumber(s string) *NurseryUpdateOne {
+ nuo.mutation.SetPhoneNumber(s)
+ return nuo
+}
+
+// SetNillablePhoneNumber sets the "phone_number" field if the given value is not nil.
+func (nuo *NurseryUpdateOne) SetNillablePhoneNumber(s *string) *NurseryUpdateOne {
+ if s != nil {
+ nuo.SetPhoneNumber(*s)
+ }
+ return nuo
+}
+
+// ClearPhoneNumber clears the value of the "phone_number" field.
+func (nuo *NurseryUpdateOne) ClearPhoneNumber() *NurseryUpdateOne {
+ nuo.mutation.ClearPhoneNumber()
+ return nuo
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (nuo *NurseryUpdateOne) SetCreatedAt(t time.Time) *NurseryUpdateOne {
+ nuo.mutation.SetCreatedAt(t)
+ return nuo
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (nuo *NurseryUpdateOne) SetNillableCreatedAt(t *time.Time) *NurseryUpdateOne {
+ if t != nil {
+ nuo.SetCreatedAt(*t)
+ }
+ return nuo
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (nuo *NurseryUpdateOne) SetUpdatedAt(t time.Time) *NurseryUpdateOne {
+ nuo.mutation.SetUpdatedAt(t)
+ return nuo
+}
+
+// AddGuardianIDs adds the "guardians" edge to the Guardian entity by IDs.
+func (nuo *NurseryUpdateOne) AddGuardianIDs(ids ...uuid.UUID) *NurseryUpdateOne {
+ nuo.mutation.AddGuardianIDs(ids...)
+ return nuo
+}
+
+// AddGuardians adds the "guardians" edges to the Guardian entity.
+func (nuo *NurseryUpdateOne) AddGuardians(g ...*Guardian) *NurseryUpdateOne {
+ ids := make([]uuid.UUID, len(g))
+ for i := range g {
+ ids[i] = g[i].ID
+ }
+ return nuo.AddGuardianIDs(ids...)
+}
+
+// AddBusIDs adds the "buses" edge to the Bus entity by IDs.
+func (nuo *NurseryUpdateOne) AddBusIDs(ids ...uuid.UUID) *NurseryUpdateOne {
+ nuo.mutation.AddBusIDs(ids...)
+ return nuo
+}
+
+// AddBuses adds the "buses" edges to the Bus entity.
+func (nuo *NurseryUpdateOne) AddBuses(b ...*Bus) *NurseryUpdateOne {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return nuo.AddBusIDs(ids...)
+}
+
+// Mutation returns the NurseryMutation object of the builder.
+func (nuo *NurseryUpdateOne) Mutation() *NurseryMutation {
+ return nuo.mutation
+}
+
+// ClearGuardians clears all "guardians" edges to the Guardian entity.
+func (nuo *NurseryUpdateOne) ClearGuardians() *NurseryUpdateOne {
+ nuo.mutation.ClearGuardians()
+ return nuo
+}
+
+// RemoveGuardianIDs removes the "guardians" edge to Guardian entities by IDs.
+func (nuo *NurseryUpdateOne) RemoveGuardianIDs(ids ...uuid.UUID) *NurseryUpdateOne {
+ nuo.mutation.RemoveGuardianIDs(ids...)
+ return nuo
+}
+
+// RemoveGuardians removes "guardians" edges to Guardian entities.
+func (nuo *NurseryUpdateOne) RemoveGuardians(g ...*Guardian) *NurseryUpdateOne {
+ ids := make([]uuid.UUID, len(g))
+ for i := range g {
+ ids[i] = g[i].ID
+ }
+ return nuo.RemoveGuardianIDs(ids...)
+}
+
+// ClearBuses clears all "buses" edges to the Bus entity.
+func (nuo *NurseryUpdateOne) ClearBuses() *NurseryUpdateOne {
+ nuo.mutation.ClearBuses()
+ return nuo
+}
+
+// RemoveBusIDs removes the "buses" edge to Bus entities by IDs.
+func (nuo *NurseryUpdateOne) RemoveBusIDs(ids ...uuid.UUID) *NurseryUpdateOne {
+ nuo.mutation.RemoveBusIDs(ids...)
+ return nuo
+}
+
+// RemoveBuses removes "buses" edges to Bus entities.
+func (nuo *NurseryUpdateOne) RemoveBuses(b ...*Bus) *NurseryUpdateOne {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return nuo.RemoveBusIDs(ids...)
+}
+
+// Where appends a list predicates to the NurseryUpdate builder.
+func (nuo *NurseryUpdateOne) Where(ps ...predicate.Nursery) *NurseryUpdateOne {
+ nuo.mutation.Where(ps...)
+ return nuo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (nuo *NurseryUpdateOne) Select(field string, fields ...string) *NurseryUpdateOne {
+ nuo.fields = append([]string{field}, fields...)
+ return nuo
+}
+
+// Save executes the query and returns the updated Nursery entity.
+func (nuo *NurseryUpdateOne) Save(ctx context.Context) (*Nursery, error) {
+ nuo.defaults()
+ return withHooks(ctx, nuo.sqlSave, nuo.mutation, nuo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (nuo *NurseryUpdateOne) SaveX(ctx context.Context) *Nursery {
+ node, err := nuo.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// Exec executes the query on the entity.
+func (nuo *NurseryUpdateOne) Exec(ctx context.Context) error {
+ _, err := nuo.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (nuo *NurseryUpdateOne) ExecX(ctx context.Context) {
+ if err := nuo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (nuo *NurseryUpdateOne) defaults() {
+ if _, ok := nuo.mutation.UpdatedAt(); !ok {
+ v := nursery.UpdateDefaultUpdatedAt()
+ nuo.mutation.SetUpdatedAt(v)
+ }
+}
+
+func (nuo *NurseryUpdateOne) sqlSave(ctx context.Context) (_node *Nursery, err error) {
+ _spec := sqlgraph.NewUpdateSpec(nursery.Table, nursery.Columns, sqlgraph.NewFieldSpec(nursery.FieldID, field.TypeUUID))
+ id, ok := nuo.mutation.ID()
+ if !ok {
+ return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Nursery.id" for update`)}
+ }
+ _spec.Node.ID.Value = id
+ if fields := nuo.fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, nursery.FieldID)
+ for _, f := range fields {
+ if !nursery.ValidColumn(f) {
+ return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ if f != nursery.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, f)
+ }
+ }
+ }
+ if ps := nuo.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := nuo.mutation.NurseryCode(); ok {
+ _spec.SetField(nursery.FieldNurseryCode, field.TypeString, value)
+ }
+ if value, ok := nuo.mutation.Email(); ok {
+ _spec.SetField(nursery.FieldEmail, field.TypeString, value)
+ }
+ if value, ok := nuo.mutation.HashedPassword(); ok {
+ _spec.SetField(nursery.FieldHashedPassword, field.TypeString, value)
+ }
+ if value, ok := nuo.mutation.Name(); ok {
+ _spec.SetField(nursery.FieldName, field.TypeString, value)
+ }
+ if value, ok := nuo.mutation.Address(); ok {
+ _spec.SetField(nursery.FieldAddress, field.TypeString, value)
+ }
+ if nuo.mutation.AddressCleared() {
+ _spec.ClearField(nursery.FieldAddress, field.TypeString)
+ }
+ if value, ok := nuo.mutation.PhoneNumber(); ok {
+ _spec.SetField(nursery.FieldPhoneNumber, field.TypeString, value)
+ }
+ if nuo.mutation.PhoneNumberCleared() {
+ _spec.ClearField(nursery.FieldPhoneNumber, field.TypeString)
+ }
+ if value, ok := nuo.mutation.CreatedAt(); ok {
+ _spec.SetField(nursery.FieldCreatedAt, field.TypeTime, value)
+ }
+ if value, ok := nuo.mutation.UpdatedAt(); ok {
+ _spec.SetField(nursery.FieldUpdatedAt, field.TypeTime, value)
+ }
+ if nuo.mutation.GuardiansCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: nursery.GuardiansTable,
+ Columns: []string{nursery.GuardiansColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := nuo.mutation.RemovedGuardiansIDs(); len(nodes) > 0 && !nuo.mutation.GuardiansCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: nursery.GuardiansTable,
+ Columns: []string{nursery.GuardiansColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := nuo.mutation.GuardiansIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: nursery.GuardiansTable,
+ Columns: []string{nursery.GuardiansColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if nuo.mutation.BusesCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: nursery.BusesTable,
+ Columns: []string{nursery.BusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := nuo.mutation.RemovedBusesIDs(); len(nodes) > 0 && !nuo.mutation.BusesCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: nursery.BusesTable,
+ Columns: []string{nursery.BusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := nuo.mutation.BusesIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: nursery.BusesTable,
+ Columns: []string{nursery.BusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ _node = &Nursery{config: nuo.config}
+ _spec.Assign = _node.assignValues
+ _spec.ScanValues = _node.scanValues
+ if err = sqlgraph.UpdateNode(ctx, nuo.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{nursery.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ nuo.mutation.done = true
+ return _node, nil
+}
diff --git a/backend/domain/repository/ent/predicate/predicate.go b/backend/domain/repository/ent/predicate/predicate.go
new file mode 100644
index 00000000..1e29a729
--- /dev/null
+++ b/backend/domain/repository/ent/predicate/predicate.go
@@ -0,0 +1,37 @@
+// Code generated by ent, DO NOT EDIT.
+
+package predicate
+
+import (
+ "entgo.io/ent/dialect/sql"
+)
+
+// BoardingRecord is the predicate function for boardingrecord builders.
+type BoardingRecord func(*sql.Selector)
+
+// Bus is the predicate function for bus builders.
+type Bus func(*sql.Selector)
+
+// BusRoute is the predicate function for busroute builders.
+type BusRoute func(*sql.Selector)
+
+// BusRouteAssociation is the predicate function for busrouteassociation builders.
+type BusRouteAssociation func(*sql.Selector)
+
+// Child is the predicate function for child builders.
+type Child func(*sql.Selector)
+
+// ChildBusAssociation is the predicate function for childbusassociation builders.
+type ChildBusAssociation func(*sql.Selector)
+
+// ChildPhoto is the predicate function for childphoto builders.
+type ChildPhoto func(*sql.Selector)
+
+// Guardian is the predicate function for guardian builders.
+type Guardian func(*sql.Selector)
+
+// Nursery is the predicate function for nursery builders.
+type Nursery func(*sql.Selector)
+
+// Station is the predicate function for station builders.
+type Station func(*sql.Selector)
diff --git a/backend/domain/repository/ent/runtime.go b/backend/domain/repository/ent/runtime.go
new file mode 100644
index 00000000..e114cf3b
--- /dev/null
+++ b/backend/domain/repository/ent/runtime.go
@@ -0,0 +1,194 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "time"
+
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childphoto"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/schema"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// The init function reads all schema descriptors with runtime code
+// (default values, validators, hooks and policies) and stitches it
+// to their package variables.
+func init() {
+ boardingrecordFields := schema.BoardingRecord{}.Fields()
+ _ = boardingrecordFields
+ // boardingrecordDescTimestamp is the schema descriptor for timestamp field.
+ boardingrecordDescTimestamp := boardingrecordFields[1].Descriptor()
+ // boardingrecord.DefaultTimestamp holds the default value on creation for the timestamp field.
+ boardingrecord.DefaultTimestamp = boardingrecordDescTimestamp.Default.(func() time.Time)
+ // boardingrecordDescIsBoarding is the schema descriptor for is_boarding field.
+ boardingrecordDescIsBoarding := boardingrecordFields[2].Descriptor()
+ // boardingrecord.DefaultIsBoarding holds the default value on creation for the is_boarding field.
+ boardingrecord.DefaultIsBoarding = boardingrecordDescIsBoarding.Default.(bool)
+ // boardingrecordDescID is the schema descriptor for id field.
+ boardingrecordDescID := boardingrecordFields[0].Descriptor()
+ // boardingrecord.DefaultID holds the default value on creation for the id field.
+ boardingrecord.DefaultID = boardingrecordDescID.Default.(func() uuid.UUID)
+ busFields := schema.Bus{}.Fields()
+ _ = busFields
+ // busDescEnableFaceRecognition is the schema descriptor for enable_face_recognition field.
+ busDescEnableFaceRecognition := busFields[6].Descriptor()
+ // bus.DefaultEnableFaceRecognition holds the default value on creation for the enable_face_recognition field.
+ bus.DefaultEnableFaceRecognition = busDescEnableFaceRecognition.Default.(bool)
+ // busDescCreatedAt is the schema descriptor for created_at field.
+ busDescCreatedAt := busFields[7].Descriptor()
+ // bus.DefaultCreatedAt holds the default value on creation for the created_at field.
+ bus.DefaultCreatedAt = busDescCreatedAt.Default.(func() time.Time)
+ // busDescUpdatedAt is the schema descriptor for updated_at field.
+ busDescUpdatedAt := busFields[8].Descriptor()
+ // bus.DefaultUpdatedAt holds the default value on creation for the updated_at field.
+ bus.DefaultUpdatedAt = busDescUpdatedAt.Default.(func() time.Time)
+ // bus.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
+ bus.UpdateDefaultUpdatedAt = busDescUpdatedAt.UpdateDefault.(func() time.Time)
+ // busDescID is the schema descriptor for id field.
+ busDescID := busFields[0].Descriptor()
+ // bus.DefaultID holds the default value on creation for the id field.
+ bus.DefaultID = busDescID.Default.(func() uuid.UUID)
+ busrouteFields := schema.BusRoute{}.Fields()
+ _ = busrouteFields
+ // busrouteDescCreatedAt is the schema descriptor for created_at field.
+ busrouteDescCreatedAt := busrouteFields[2].Descriptor()
+ // busroute.DefaultCreatedAt holds the default value on creation for the created_at field.
+ busroute.DefaultCreatedAt = busrouteDescCreatedAt.Default.(time.Time)
+ // busrouteDescUpdatedAt is the schema descriptor for updated_at field.
+ busrouteDescUpdatedAt := busrouteFields[3].Descriptor()
+ // busroute.DefaultUpdatedAt holds the default value on creation for the updated_at field.
+ busroute.DefaultUpdatedAt = busrouteDescUpdatedAt.Default.(func() time.Time)
+ // busroute.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
+ busroute.UpdateDefaultUpdatedAt = busrouteDescUpdatedAt.UpdateDefault.(func() time.Time)
+ // busrouteDescID is the schema descriptor for id field.
+ busrouteDescID := busrouteFields[0].Descriptor()
+ // busroute.DefaultID holds the default value on creation for the id field.
+ busroute.DefaultID = busrouteDescID.Default.(func() uuid.UUID)
+ childFields := schema.Child{}.Fields()
+ _ = childFields
+ // childDescCheckForMissingItems is the schema descriptor for check_for_missing_items field.
+ childDescCheckForMissingItems := childFields[4].Descriptor()
+ // child.DefaultCheckForMissingItems holds the default value on creation for the check_for_missing_items field.
+ child.DefaultCheckForMissingItems = childDescCheckForMissingItems.Default.(bool)
+ // childDescHasBag is the schema descriptor for has_bag field.
+ childDescHasBag := childFields[5].Descriptor()
+ // child.DefaultHasBag holds the default value on creation for the has_bag field.
+ child.DefaultHasBag = childDescHasBag.Default.(bool)
+ // childDescHasLunchBox is the schema descriptor for has_lunch_box field.
+ childDescHasLunchBox := childFields[6].Descriptor()
+ // child.DefaultHasLunchBox holds the default value on creation for the has_lunch_box field.
+ child.DefaultHasLunchBox = childDescHasLunchBox.Default.(bool)
+ // childDescHasWaterBottle is the schema descriptor for has_water_bottle field.
+ childDescHasWaterBottle := childFields[7].Descriptor()
+ // child.DefaultHasWaterBottle holds the default value on creation for the has_water_bottle field.
+ child.DefaultHasWaterBottle = childDescHasWaterBottle.Default.(bool)
+ // childDescHasUmbrella is the schema descriptor for has_umbrella field.
+ childDescHasUmbrella := childFields[8].Descriptor()
+ // child.DefaultHasUmbrella holds the default value on creation for the has_umbrella field.
+ child.DefaultHasUmbrella = childDescHasUmbrella.Default.(bool)
+ // childDescHasOther is the schema descriptor for has_other field.
+ childDescHasOther := childFields[9].Descriptor()
+ // child.DefaultHasOther holds the default value on creation for the has_other field.
+ child.DefaultHasOther = childDescHasOther.Default.(bool)
+ // childDescCreatedAt is the schema descriptor for created_at field.
+ childDescCreatedAt := childFields[10].Descriptor()
+ // child.DefaultCreatedAt holds the default value on creation for the created_at field.
+ child.DefaultCreatedAt = childDescCreatedAt.Default.(func() time.Time)
+ // childDescUpdatedAt is the schema descriptor for updated_at field.
+ childDescUpdatedAt := childFields[11].Descriptor()
+ // child.DefaultUpdatedAt holds the default value on creation for the updated_at field.
+ child.DefaultUpdatedAt = childDescUpdatedAt.Default.(func() time.Time)
+ // child.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
+ child.UpdateDefaultUpdatedAt = childDescUpdatedAt.UpdateDefault.(func() time.Time)
+ // childDescID is the schema descriptor for id field.
+ childDescID := childFields[0].Descriptor()
+ // child.DefaultID holds the default value on creation for the id field.
+ child.DefaultID = childDescID.Default.(func() uuid.UUID)
+ childphotoFields := schema.ChildPhoto{}.Fields()
+ _ = childphotoFields
+ // childphotoDescCreatedAt is the schema descriptor for created_at field.
+ childphotoDescCreatedAt := childphotoFields[1].Descriptor()
+ // childphoto.DefaultCreatedAt holds the default value on creation for the created_at field.
+ childphoto.DefaultCreatedAt = childphotoDescCreatedAt.Default.(func() time.Time)
+ // childphotoDescUpdatedAt is the schema descriptor for updated_at field.
+ childphotoDescUpdatedAt := childphotoFields[2].Descriptor()
+ // childphoto.DefaultUpdatedAt holds the default value on creation for the updated_at field.
+ childphoto.DefaultUpdatedAt = childphotoDescUpdatedAt.Default.(func() time.Time)
+ // childphoto.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
+ childphoto.UpdateDefaultUpdatedAt = childphotoDescUpdatedAt.UpdateDefault.(func() time.Time)
+ // childphotoDescID is the schema descriptor for id field.
+ childphotoDescID := childphotoFields[0].Descriptor()
+ // childphoto.DefaultID holds the default value on creation for the id field.
+ childphoto.DefaultID = childphotoDescID.Default.(func() uuid.UUID)
+ guardianFields := schema.Guardian{}.Fields()
+ _ = guardianFields
+ // guardianDescIsUseMorningBus is the schema descriptor for is_use_morning_bus field.
+ guardianDescIsUseMorningBus := guardianFields[5].Descriptor()
+ // guardian.DefaultIsUseMorningBus holds the default value on creation for the is_use_morning_bus field.
+ guardian.DefaultIsUseMorningBus = guardianDescIsUseMorningBus.Default.(bool)
+ // guardianDescIsUseEveningBus is the schema descriptor for is_use_evening_bus field.
+ guardianDescIsUseEveningBus := guardianFields[6].Descriptor()
+ // guardian.DefaultIsUseEveningBus holds the default value on creation for the is_use_evening_bus field.
+ guardian.DefaultIsUseEveningBus = guardianDescIsUseEveningBus.Default.(bool)
+ // guardianDescCreatedAt is the schema descriptor for created_at field.
+ guardianDescCreatedAt := guardianFields[7].Descriptor()
+ // guardian.DefaultCreatedAt holds the default value on creation for the created_at field.
+ guardian.DefaultCreatedAt = guardianDescCreatedAt.Default.(func() time.Time)
+ // guardianDescUpdatedAt is the schema descriptor for updated_at field.
+ guardianDescUpdatedAt := guardianFields[8].Descriptor()
+ // guardian.DefaultUpdatedAt holds the default value on creation for the updated_at field.
+ guardian.DefaultUpdatedAt = guardianDescUpdatedAt.Default.(func() time.Time)
+ // guardian.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
+ guardian.UpdateDefaultUpdatedAt = guardianDescUpdatedAt.UpdateDefault.(func() time.Time)
+ // guardianDescID is the schema descriptor for id field.
+ guardianDescID := guardianFields[0].Descriptor()
+ // guardian.DefaultID holds the default value on creation for the id field.
+ guardian.DefaultID = guardianDescID.Default.(func() uuid.UUID)
+ nurseryFields := schema.Nursery{}.Fields()
+ _ = nurseryFields
+ // nurseryDescCreatedAt is the schema descriptor for created_at field.
+ nurseryDescCreatedAt := nurseryFields[7].Descriptor()
+ // nursery.DefaultCreatedAt holds the default value on creation for the created_at field.
+ nursery.DefaultCreatedAt = nurseryDescCreatedAt.Default.(func() time.Time)
+ // nurseryDescUpdatedAt is the schema descriptor for updated_at field.
+ nurseryDescUpdatedAt := nurseryFields[8].Descriptor()
+ // nursery.DefaultUpdatedAt holds the default value on creation for the updated_at field.
+ nursery.DefaultUpdatedAt = nurseryDescUpdatedAt.Default.(func() time.Time)
+ // nursery.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
+ nursery.UpdateDefaultUpdatedAt = nurseryDescUpdatedAt.UpdateDefault.(func() time.Time)
+ // nurseryDescID is the schema descriptor for id field.
+ nurseryDescID := nurseryFields[0].Descriptor()
+ // nursery.DefaultID holds the default value on creation for the id field.
+ nursery.DefaultID = nurseryDescID.Default.(func() uuid.UUID)
+ stationFields := schema.Station{}.Fields()
+ _ = stationFields
+ // stationDescLatitude is the schema descriptor for latitude field.
+ stationDescLatitude := stationFields[1].Descriptor()
+ // station.DefaultLatitude holds the default value on creation for the latitude field.
+ station.DefaultLatitude = stationDescLatitude.Default.(float64)
+ // stationDescLongitude is the schema descriptor for longitude field.
+ stationDescLongitude := stationFields[2].Descriptor()
+ // station.DefaultLongitude holds the default value on creation for the longitude field.
+ station.DefaultLongitude = stationDescLongitude.Default.(float64)
+ // stationDescCreatedAt is the schema descriptor for created_at field.
+ stationDescCreatedAt := stationFields[3].Descriptor()
+ // station.DefaultCreatedAt holds the default value on creation for the created_at field.
+ station.DefaultCreatedAt = stationDescCreatedAt.Default.(func() time.Time)
+ // stationDescUpdatedAt is the schema descriptor for updated_at field.
+ stationDescUpdatedAt := stationFields[4].Descriptor()
+ // station.DefaultUpdatedAt holds the default value on creation for the updated_at field.
+ station.DefaultUpdatedAt = stationDescUpdatedAt.Default.(func() time.Time)
+ // station.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
+ station.UpdateDefaultUpdatedAt = stationDescUpdatedAt.UpdateDefault.(func() time.Time)
+ // stationDescID is the schema descriptor for id field.
+ stationDescID := stationFields[0].Descriptor()
+ // station.DefaultID holds the default value on creation for the id field.
+ station.DefaultID = stationDescID.Default.(func() uuid.UUID)
+}
diff --git a/backend/domain/repository/ent/runtime/runtime.go b/backend/domain/repository/ent/runtime/runtime.go
new file mode 100644
index 00000000..528a49cc
--- /dev/null
+++ b/backend/domain/repository/ent/runtime/runtime.go
@@ -0,0 +1,10 @@
+// Code generated by ent, DO NOT EDIT.
+
+package runtime
+
+// The schema-stitching logic is generated in github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/runtime.go
+
+const (
+ Version = "v0.13.0" // Version of ent codegen.
+ Sum = "h1:DclxWczaCpyiKn6ZWVcJjq1zIKtJ11iNKy+08lNYsJE=" // Sum of ent codegen.
+)
diff --git a/backend/domain/repository/ent/schema/boarding_record.go b/backend/domain/repository/ent/schema/boarding_record.go
new file mode 100644
index 00000000..531c4798
--- /dev/null
+++ b/backend/domain/repository/ent/schema/boarding_record.go
@@ -0,0 +1,35 @@
+package schema
+
+import (
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/schema/edge"
+ "entgo.io/ent/schema/field"
+ "github.com/google/uuid"
+)
+
+// BoardingRecord holds the schema definition for the Bus entity.
+type BoardingRecord struct {
+ ent.Schema
+}
+
+// Fields of the BoardingRecord.
+func (BoardingRecord) Fields() []ent.Field {
+ return []ent.Field{
+ field.UUID("id", uuid.UUID{}).Default(uuid.New).StorageKey("id").Unique(),
+ field.Time("timestamp").Default(time.Now).Comment("乗降時刻"),
+ field.Bool("is_boarding").Default(false).Comment("乗車時はtrue、降車時はfalse")}
+}
+
+// Edges of the BoardingRecord.
+func (BoardingRecord) Edges() []ent.Edge {
+ return []ent.Edge{
+ edge.From("child", Child.Type).
+ Ref("boarding_record").
+ Unique(),
+ edge.From("bus", Bus.Type).
+ Ref("boarding_records").
+ Unique(),
+ }
+}
diff --git a/backend/domain/repository/ent/schema/bus.go b/backend/domain/repository/ent/schema/bus.go
new file mode 100644
index 00000000..4680759a
--- /dev/null
+++ b/backend/domain/repository/ent/schema/bus.go
@@ -0,0 +1,47 @@
+package schema
+
+import (
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/schema/edge"
+ "entgo.io/ent/schema/field"
+ "github.com/google/uuid"
+)
+
+// Bus holds the schema definition for the Bus entity.
+type Bus struct {
+ ent.Schema
+}
+
+// Fields of the Bus.
+func (Bus) Fields() []ent.Field {
+ return []ent.Field{
+ field.UUID("id", uuid.UUID{}).Default(uuid.New).StorageKey("id").Unique(),
+ field.String("name"),
+ field.String("plate_number").Optional(),
+ field.Float("latitude").Optional().Comment("現在の緯度"),
+ field.Float("longitude").Optional().Comment("現在の経度"),
+ field.Enum("status").Default("stopped").Comment("バスのステータス(運行中、停止中など)").
+ Values("stopped", "running", "maintenance"),
+ field.Bool("enable_face_recognition").Default(false).Comment("顔識別が有効かどうか"),
+ field.Time("created_at").Default(time.Now),
+ field.Time("updated_at").Default(time.Now).UpdateDefault(time.Now),
+ }
+}
+
+// Edges of the Bus.
+func (Bus) Edges() []ent.Edge {
+ return []ent.Edge{
+ edge.To("nursery", Nursery.Type).Unique(),
+ edge.To("boarding_records", BoardingRecord.Type),
+ // バスが向かっている先のステーション
+ edge.To("next_station", Station.Type).Unique(),
+ edge.From("bus_route", BusRoute.Type).
+ Ref("bus"),
+ edge.To("latest_morning_route", BusRoute.Type).
+ Unique(), // 夕方のバスルートの最新のものを参照するエッジ
+ edge.To("latest_evening_route", BusRoute.Type).
+ Unique(),
+ }
+}
diff --git a/backend/domain/repository/ent/schema/bus_route.go b/backend/domain/repository/ent/schema/bus_route.go
new file mode 100644
index 00000000..a926f4d9
--- /dev/null
+++ b/backend/domain/repository/ent/schema/bus_route.go
@@ -0,0 +1,41 @@
+package schema
+
+import (
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/schema/edge"
+ "entgo.io/ent/schema/field"
+ "github.com/google/uuid"
+)
+
+// BusRoute holds the schema definition for the BusRoute entity.
+type BusRoute struct {
+ ent.Schema
+}
+
+// Fields of the BusRoute.
+func (BusRoute) Fields() []ent.Field {
+ return []ent.Field{
+ field.UUID("id", uuid.UUID{}).Default(uuid.New).StorageKey("id").Unique(),
+ field.Enum("bus_type").
+ Values("morning", "evening").Comment("朝のバスか放課後のバスかを示す"),
+ field.Time("created_at").Default(time.Now()),
+ field.Time("updated_at").Default(time.Now).UpdateDefault(time.Now),
+ }
+}
+
+// Edges of the BusRoute.
+func (BusRoute) Edges() []ent.Edge {
+ return []ent.Edge{
+ edge.To("bus", Bus.Type),
+ edge.To("childBusAssociations", ChildBusAssociation.Type),
+ edge.To("busRouteAssociations", BusRouteAssociation.Type),
+ // このバスルートを朝の最新ルートとして参照するバス
+ edge.From("morning_buses", Bus.Type).
+ Ref("latest_morning_route"),
+ // このバスルートを夕方の最新ルートとして参照するバス
+ edge.From("evening_buses", Bus.Type).
+ Ref("latest_evening_route"),
+ }
+}
diff --git a/backend/domain/repository/ent/schema/bus_route_association.go b/backend/domain/repository/ent/schema/bus_route_association.go
new file mode 100644
index 00000000..6a8937e6
--- /dev/null
+++ b/backend/domain/repository/ent/schema/bus_route_association.go
@@ -0,0 +1,38 @@
+package schema
+
+import (
+ "entgo.io/ent"
+ "entgo.io/ent/schema/edge"
+ "entgo.io/ent/schema/field"
+ "github.com/google/uuid"
+)
+
+// BusRouteAssociation holds the schema definition for the association between Bus and BusRoute.
+type BusRouteAssociation struct {
+ ent.Schema
+}
+
+// Fields of the BusRouteAssociation.
+func (BusRouteAssociation) Fields() []ent.Field {
+ return []ent.Field{
+ field.UUID("station_id", uuid.UUID{}),
+ field.UUID("bus_route_id", uuid.UUID{}),
+ field.Int32("order"),
+ }
+}
+
+// Edges of the BusRouteAssociation.
+func (BusRouteAssociation) Edges() []ent.Edge {
+ return []ent.Edge{
+ edge.From("station", Station.Type).
+ Ref("busRouteAssociations").
+ Unique().
+ Required().
+ Field("station_id"),
+ edge.From("busRoute", BusRoute.Type).
+ Ref("busRouteAssociations").
+ Unique().
+ Required().
+ Field("bus_route_id"),
+ }
+}
diff --git a/backend/domain/repository/ent/schema/child.go b/backend/domain/repository/ent/schema/child.go
new file mode 100644
index 00000000..45ea8ea4
--- /dev/null
+++ b/backend/domain/repository/ent/schema/child.go
@@ -0,0 +1,47 @@
+package schema
+
+import (
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/schema/edge"
+ "entgo.io/ent/schema/field"
+ "github.com/google/uuid"
+)
+
+// Child holds the schema definition for the Child entity.
+type Child struct {
+ ent.Schema
+}
+
+// Fields of the Child.
+func (Child) Fields() []ent.Field {
+ return []ent.Field{
+ field.UUID("id", uuid.UUID{}).Default(uuid.New).StorageKey("id").Unique(),
+ field.String("name"),
+ field.Int("age"),
+ field.Enum("sex").
+ Values("man", "woman", "other"),
+ field.Bool("check_for_missing_items").Default(false).Comment("持ち物が欠けていないかをチェックするかどうか"),
+ // ?: 持ち物エンティティを作成する?
+ field.Bool("has_bag").Default(true),
+ field.Bool("has_lunch_box").Default(true),
+ field.Bool("has_water_bottle").Default(true),
+ field.Bool("has_umbrella").Default(true),
+ field.Bool("has_other").Default(true),
+ field.Time("created_at").Default(time.Now),
+ field.Time("updated_at").Default(time.Now).UpdateDefault(time.Now),
+ }
+}
+
+// Edges of the Child.
+func (Child) Edges() []ent.Edge {
+ return []ent.Edge{
+ edge.From("guardian", Guardian.Type).
+ Ref("children").
+ Unique(),
+ edge.To("childBusAssociations", ChildBusAssociation.Type),
+ edge.To("boarding_record", BoardingRecord.Type),
+ edge.To("photos", ChildPhoto.Type),
+ }
+}
diff --git a/backend/domain/repository/ent/schema/child_bus_association.go b/backend/domain/repository/ent/schema/child_bus_association.go
new file mode 100644
index 00000000..ee8ef89d
--- /dev/null
+++ b/backend/domain/repository/ent/schema/child_bus_association.go
@@ -0,0 +1,38 @@
+package schema
+
+import (
+ "entgo.io/ent"
+ "entgo.io/ent/schema/edge"
+ "entgo.io/ent/schema/field"
+ "github.com/google/uuid"
+)
+
+// ChildBusAssociation holds the schema definition for the association between Child and Bus.
+
+type ChildBusAssociation struct {
+ ent.Schema
+}
+
+// Fields of the ChildBusAssociation.
+func (ChildBusAssociation) Fields() []ent.Field {
+ return []ent.Field{
+ field.UUID("child_id", uuid.UUID{}),
+ field.UUID("bus_route_id", uuid.UUID{}),
+ }
+}
+
+// Edges of the ChildBusAssociation.
+func (ChildBusAssociation) Edges() []ent.Edge {
+ return []ent.Edge{
+ edge.From("child", Child.Type).
+ Ref("childBusAssociations"). // Childエンティティ側の参照名を合わせる
+ Unique(). // 一つのChildBusAssociationは一人の子供に紐づく
+ Required(). // 必ずChildBusAssociationが存在する
+ Field("child_id"),
+ edge.From("bus_route", BusRoute.Type).
+ Ref("childBusAssociations"). // BusRouteエンティティ側の参照名を合わせる
+ Unique(). // 一つのChildBusAssociationは一つのバスルートに紐づく
+ Required(). // 必ずChildBusAssociationが存在する
+ Field("bus_route_id"),
+ }
+}
diff --git a/backend/domain/repository/ent/schema/child_photo.go b/backend/domain/repository/ent/schema/child_photo.go
new file mode 100644
index 00000000..0c78d056
--- /dev/null
+++ b/backend/domain/repository/ent/schema/child_photo.go
@@ -0,0 +1,33 @@
+package schema
+
+import (
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/schema/edge"
+ "entgo.io/ent/schema/field"
+ "github.com/google/uuid"
+)
+
+// ChildPhoto holds the schema definition for the ChildPhoto entity.
+type ChildPhoto struct {
+ ent.Schema
+}
+
+// Fields of the ChildPhoto.
+func (ChildPhoto) Fields() []ent.Field {
+ return []ent.Field{
+ field.UUID("id", uuid.UUID{}).Default(uuid.New).StorageKey("id").Unique(),
+ field.Time("created_at").Default(time.Now).Comment("レコードの作成日時"),
+ field.Time("updated_at").Default(time.Now).UpdateDefault(time.Now).Comment("レコードの最終更新日時"),
+ }
+}
+
+// Edges of the ChildPhoto.
+func (ChildPhoto) Edges() []ent.Edge {
+ return []ent.Edge{
+ edge.From("child", Child.Type).
+ Ref("photos").
+ Unique(),
+ }
+}
diff --git a/backend/domain/repository/ent/schema/guardian.go b/backend/domain/repository/ent/schema/guardian.go
new file mode 100644
index 00000000..778004ee
--- /dev/null
+++ b/backend/domain/repository/ent/schema/guardian.go
@@ -0,0 +1,41 @@
+package schema
+
+import (
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/schema/edge"
+ "entgo.io/ent/schema/field"
+ "github.com/google/uuid"
+)
+
+// Guardian holds the schema definition for the Guardian entity.
+type Guardian struct {
+ ent.Schema
+}
+
+// Fields of the Guardian.
+func (Guardian) Fields() []ent.Field {
+ return []ent.Field{
+ field.UUID("id", uuid.UUID{}).Default(uuid.New).StorageKey("id").Unique(),
+ field.String("email").Unique(),
+ field.String("hashed_password"),
+ field.String("name"),
+ field.String("phone_number").Optional(),
+ field.Bool("is_use_morning_bus").Default(true).Comment("バスを利用するかどうか"),
+ field.Bool("is_use_evening_bus").Default(true).Comment("バスを利用するかどうか"),
+ field.Time("created_at").Default(time.Now),
+ field.Time("updated_at").Default(time.Now).UpdateDefault(time.Now),
+ }
+}
+
+// Edges of the Guardian.
+func (Guardian) Edges() []ent.Edge {
+ return []ent.Edge{
+ edge.To("children", Child.Type),
+ edge.To("nursery", Nursery.Type).
+ Unique(),
+ edge.To("station", Station.Type).
+ Unique(),
+ }
+}
diff --git a/backend/domain/repository/ent/schema/nursery.go b/backend/domain/repository/ent/schema/nursery.go
new file mode 100644
index 00000000..385c0321
--- /dev/null
+++ b/backend/domain/repository/ent/schema/nursery.go
@@ -0,0 +1,39 @@
+package schema
+
+import (
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/schema/edge"
+ "entgo.io/ent/schema/field"
+ "github.com/google/uuid"
+)
+
+// Nursery holds the schema definition for the Nursery entity.
+
+type Nursery struct {
+ ent.Schema
+}
+
+// Fields of the Nursery.
+func (Nursery) Fields() []ent.Field {
+ return []ent.Field{
+ field.UUID("id", uuid.UUID{}).Default(uuid.New).StorageKey("id").Unique(),
+ field.String("nursery_code").Unique().Comment("ユニークな数字(文字列)のコード"),
+ field.String("email").Unique(),
+ field.String("hashed_password"),
+ field.String("name"),
+ field.String("address").Optional(),
+ field.String("phone_number").Optional(),
+ field.Time("created_at").Default(time.Now),
+ field.Time("updated_at").Default(time.Now).UpdateDefault(time.Now),
+ }
+}
+
+// Edges of the Nursery.
+func (Nursery) Edges() []ent.Edge {
+ return []ent.Edge{
+ edge.From("guardians", Guardian.Type).Ref("nursery"),
+ edge.From("buses", Bus.Type).Ref("nursery"),
+ }
+}
diff --git a/backend/domain/repository/ent/schema/station.go b/backend/domain/repository/ent/schema/station.go
new file mode 100644
index 00000000..b361c7d2
--- /dev/null
+++ b/backend/domain/repository/ent/schema/station.go
@@ -0,0 +1,39 @@
+package schema
+
+import (
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/schema/edge"
+ "entgo.io/ent/schema/field"
+ "github.com/google/uuid"
+)
+
+// Station holds the schema definition for the Station entity.
+type Station struct {
+ ent.Schema
+}
+
+// Fields of the Station.
+func (Station) Fields() []ent.Field {
+ return []ent.Field{
+ field.UUID("id", uuid.UUID{}).Default(uuid.New).StorageKey("id").Unique(),
+ field.Float("latitude").Optional().Default(0),
+ field.Float("longitude").Optional().Default(0),
+ field.Time("created_at").Default(time.Now),
+ field.Time("updated_at").Default(time.Now).UpdateDefault(time.Now),
+ }
+}
+
+// Edges of the Station.
+func (Station) Edges() []ent.Edge {
+ return []ent.Edge{
+ edge.From("guardian", Guardian.Type).
+ Ref("station").
+ Unique(),
+ // このステーションが「現在」の目的地であるバス
+ edge.From("next_for_buses", Bus.Type).
+ Ref("next_station"),
+ edge.To("busRouteAssociations", BusRouteAssociation.Type),
+ }
+}
diff --git a/backend/domain/repository/ent/station.go b/backend/domain/repository/ent/station.go
new file mode 100644
index 00000000..66be2750
--- /dev/null
+++ b/backend/domain/repository/ent/station.go
@@ -0,0 +1,213 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "fmt"
+ "strings"
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/sql"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// Station is the model entity for the Station schema.
+type Station struct {
+ config `json:"-"`
+ // ID of the ent.
+ ID uuid.UUID `json:"id,omitempty"`
+ // Latitude holds the value of the "latitude" field.
+ Latitude float64 `json:"latitude,omitempty"`
+ // Longitude holds the value of the "longitude" field.
+ Longitude float64 `json:"longitude,omitempty"`
+ // CreatedAt holds the value of the "created_at" field.
+ CreatedAt time.Time `json:"created_at,omitempty"`
+ // UpdatedAt holds the value of the "updated_at" field.
+ UpdatedAt time.Time `json:"updated_at,omitempty"`
+ // Edges holds the relations/edges for other nodes in the graph.
+ // The values are being populated by the StationQuery when eager-loading is set.
+ Edges StationEdges `json:"edges"`
+ guardian_station *uuid.UUID
+ selectValues sql.SelectValues
+}
+
+// StationEdges holds the relations/edges for other nodes in the graph.
+type StationEdges struct {
+ // Guardian holds the value of the guardian edge.
+ Guardian *Guardian `json:"guardian,omitempty"`
+ // NextForBuses holds the value of the next_for_buses edge.
+ NextForBuses []*Bus `json:"next_for_buses,omitempty"`
+ // BusRouteAssociations holds the value of the busRouteAssociations edge.
+ BusRouteAssociations []*BusRouteAssociation `json:"busRouteAssociations,omitempty"`
+ // loadedTypes holds the information for reporting if a
+ // type was loaded (or requested) in eager-loading or not.
+ loadedTypes [3]bool
+}
+
+// GuardianOrErr returns the Guardian value or an error if the edge
+// was not loaded in eager-loading, or loaded but was not found.
+func (e StationEdges) GuardianOrErr() (*Guardian, error) {
+ if e.loadedTypes[0] {
+ if e.Guardian == nil {
+ // Edge was loaded but was not found.
+ return nil, &NotFoundError{label: guardian.Label}
+ }
+ return e.Guardian, nil
+ }
+ return nil, &NotLoadedError{edge: "guardian"}
+}
+
+// NextForBusesOrErr returns the NextForBuses value or an error if the edge
+// was not loaded in eager-loading.
+func (e StationEdges) NextForBusesOrErr() ([]*Bus, error) {
+ if e.loadedTypes[1] {
+ return e.NextForBuses, nil
+ }
+ return nil, &NotLoadedError{edge: "next_for_buses"}
+}
+
+// BusRouteAssociationsOrErr returns the BusRouteAssociations value or an error if the edge
+// was not loaded in eager-loading.
+func (e StationEdges) BusRouteAssociationsOrErr() ([]*BusRouteAssociation, error) {
+ if e.loadedTypes[2] {
+ return e.BusRouteAssociations, nil
+ }
+ return nil, &NotLoadedError{edge: "busRouteAssociations"}
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*Station) scanValues(columns []string) ([]any, error) {
+ values := make([]any, len(columns))
+ for i := range columns {
+ switch columns[i] {
+ case station.FieldLatitude, station.FieldLongitude:
+ values[i] = new(sql.NullFloat64)
+ case station.FieldCreatedAt, station.FieldUpdatedAt:
+ values[i] = new(sql.NullTime)
+ case station.FieldID:
+ values[i] = new(uuid.UUID)
+ case station.ForeignKeys[0]: // guardian_station
+ values[i] = &sql.NullScanner{S: new(uuid.UUID)}
+ default:
+ values[i] = new(sql.UnknownType)
+ }
+ }
+ return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the Station fields.
+func (s *Station) assignValues(columns []string, values []any) error {
+ if m, n := len(values), len(columns); m < n {
+ return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+ }
+ for i := range columns {
+ switch columns[i] {
+ case station.FieldID:
+ if value, ok := values[i].(*uuid.UUID); !ok {
+ return fmt.Errorf("unexpected type %T for field id", values[i])
+ } else if value != nil {
+ s.ID = *value
+ }
+ case station.FieldLatitude:
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field latitude", values[i])
+ } else if value.Valid {
+ s.Latitude = value.Float64
+ }
+ case station.FieldLongitude:
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field longitude", values[i])
+ } else if value.Valid {
+ s.Longitude = value.Float64
+ }
+ case station.FieldCreatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field created_at", values[i])
+ } else if value.Valid {
+ s.CreatedAt = value.Time
+ }
+ case station.FieldUpdatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field updated_at", values[i])
+ } else if value.Valid {
+ s.UpdatedAt = value.Time
+ }
+ case station.ForeignKeys[0]:
+ if value, ok := values[i].(*sql.NullScanner); !ok {
+ return fmt.Errorf("unexpected type %T for field guardian_station", values[i])
+ } else if value.Valid {
+ s.guardian_station = new(uuid.UUID)
+ *s.guardian_station = *value.S.(*uuid.UUID)
+ }
+ default:
+ s.selectValues.Set(columns[i], values[i])
+ }
+ }
+ return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the Station.
+// This includes values selected through modifiers, order, etc.
+func (s *Station) Value(name string) (ent.Value, error) {
+ return s.selectValues.Get(name)
+}
+
+// QueryGuardian queries the "guardian" edge of the Station entity.
+func (s *Station) QueryGuardian() *GuardianQuery {
+ return NewStationClient(s.config).QueryGuardian(s)
+}
+
+// QueryNextForBuses queries the "next_for_buses" edge of the Station entity.
+func (s *Station) QueryNextForBuses() *BusQuery {
+ return NewStationClient(s.config).QueryNextForBuses(s)
+}
+
+// QueryBusRouteAssociations queries the "busRouteAssociations" edge of the Station entity.
+func (s *Station) QueryBusRouteAssociations() *BusRouteAssociationQuery {
+ return NewStationClient(s.config).QueryBusRouteAssociations(s)
+}
+
+// Update returns a builder for updating this Station.
+// Note that you need to call Station.Unwrap() before calling this method if this Station
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (s *Station) Update() *StationUpdateOne {
+ return NewStationClient(s.config).UpdateOne(s)
+}
+
+// Unwrap unwraps the Station entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (s *Station) Unwrap() *Station {
+ _tx, ok := s.config.driver.(*txDriver)
+ if !ok {
+ panic("ent: Station is not a transactional entity")
+ }
+ s.config.driver = _tx.drv
+ return s
+}
+
+// String implements the fmt.Stringer.
+func (s *Station) String() string {
+ var builder strings.Builder
+ builder.WriteString("Station(")
+ builder.WriteString(fmt.Sprintf("id=%v, ", s.ID))
+ builder.WriteString("latitude=")
+ builder.WriteString(fmt.Sprintf("%v", s.Latitude))
+ builder.WriteString(", ")
+ builder.WriteString("longitude=")
+ builder.WriteString(fmt.Sprintf("%v", s.Longitude))
+ builder.WriteString(", ")
+ builder.WriteString("created_at=")
+ builder.WriteString(s.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(", ")
+ builder.WriteString("updated_at=")
+ builder.WriteString(s.UpdatedAt.Format(time.ANSIC))
+ builder.WriteByte(')')
+ return builder.String()
+}
+
+// Stations is a parsable slice of Station.
+type Stations []*Station
diff --git a/backend/domain/repository/ent/station/station.go b/backend/domain/repository/ent/station/station.go
new file mode 100644
index 00000000..a205e5d0
--- /dev/null
+++ b/backend/domain/repository/ent/station/station.go
@@ -0,0 +1,184 @@
+// Code generated by ent, DO NOT EDIT.
+
+package station
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/google/uuid"
+)
+
+const (
+ // Label holds the string label denoting the station type in the database.
+ Label = "station"
+ // FieldID holds the string denoting the id field in the database.
+ FieldID = "id"
+ // FieldLatitude holds the string denoting the latitude field in the database.
+ FieldLatitude = "latitude"
+ // FieldLongitude holds the string denoting the longitude field in the database.
+ FieldLongitude = "longitude"
+ // FieldCreatedAt holds the string denoting the created_at field in the database.
+ FieldCreatedAt = "created_at"
+ // FieldUpdatedAt holds the string denoting the updated_at field in the database.
+ FieldUpdatedAt = "updated_at"
+ // EdgeGuardian holds the string denoting the guardian edge name in mutations.
+ EdgeGuardian = "guardian"
+ // EdgeNextForBuses holds the string denoting the next_for_buses edge name in mutations.
+ EdgeNextForBuses = "next_for_buses"
+ // EdgeBusRouteAssociations holds the string denoting the busrouteassociations edge name in mutations.
+ EdgeBusRouteAssociations = "busRouteAssociations"
+ // Table holds the table name of the station in the database.
+ Table = "stations"
+ // GuardianTable is the table that holds the guardian relation/edge.
+ GuardianTable = "stations"
+ // GuardianInverseTable is the table name for the Guardian entity.
+ // It exists in this package in order to avoid circular dependency with the "guardian" package.
+ GuardianInverseTable = "guardians"
+ // GuardianColumn is the table column denoting the guardian relation/edge.
+ GuardianColumn = "guardian_station"
+ // NextForBusesTable is the table that holds the next_for_buses relation/edge.
+ NextForBusesTable = "bus"
+ // NextForBusesInverseTable is the table name for the Bus entity.
+ // It exists in this package in order to avoid circular dependency with the "bus" package.
+ NextForBusesInverseTable = "bus"
+ // NextForBusesColumn is the table column denoting the next_for_buses relation/edge.
+ NextForBusesColumn = "bus_next_station"
+ // BusRouteAssociationsTable is the table that holds the busRouteAssociations relation/edge.
+ BusRouteAssociationsTable = "bus_route_associations"
+ // BusRouteAssociationsInverseTable is the table name for the BusRouteAssociation entity.
+ // It exists in this package in order to avoid circular dependency with the "busrouteassociation" package.
+ BusRouteAssociationsInverseTable = "bus_route_associations"
+ // BusRouteAssociationsColumn is the table column denoting the busRouteAssociations relation/edge.
+ BusRouteAssociationsColumn = "station_id"
+)
+
+// Columns holds all SQL columns for station fields.
+var Columns = []string{
+ FieldID,
+ FieldLatitude,
+ FieldLongitude,
+ FieldCreatedAt,
+ FieldUpdatedAt,
+}
+
+// ForeignKeys holds the SQL foreign-keys that are owned by the "stations"
+// table and are not defined as standalone fields in the schema.
+var ForeignKeys = []string{
+ "guardian_station",
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+ for i := range Columns {
+ if column == Columns[i] {
+ return true
+ }
+ }
+ for i := range ForeignKeys {
+ if column == ForeignKeys[i] {
+ return true
+ }
+ }
+ return false
+}
+
+var (
+ // DefaultLatitude holds the default value on creation for the "latitude" field.
+ DefaultLatitude float64
+ // DefaultLongitude holds the default value on creation for the "longitude" field.
+ DefaultLongitude float64
+ // DefaultCreatedAt holds the default value on creation for the "created_at" field.
+ DefaultCreatedAt func() time.Time
+ // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
+ DefaultUpdatedAt func() time.Time
+ // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
+ UpdateDefaultUpdatedAt func() time.Time
+ // DefaultID holds the default value on creation for the "id" field.
+ DefaultID func() uuid.UUID
+)
+
+// OrderOption defines the ordering options for the Station queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByLatitude orders the results by the latitude field.
+func ByLatitude(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldLatitude, opts...).ToFunc()
+}
+
+// ByLongitude orders the results by the longitude field.
+func ByLongitude(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldLongitude, opts...).ToFunc()
+}
+
+// ByCreatedAt orders the results by the created_at field.
+func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
+}
+
+// ByUpdatedAt orders the results by the updated_at field.
+func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
+}
+
+// ByGuardianField orders the results by guardian field.
+func ByGuardianField(field string, opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newGuardianStep(), sql.OrderByField(field, opts...))
+ }
+}
+
+// ByNextForBusesCount orders the results by next_for_buses count.
+func ByNextForBusesCount(opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborsCount(s, newNextForBusesStep(), opts...)
+ }
+}
+
+// ByNextForBuses orders the results by next_for_buses terms.
+func ByNextForBuses(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newNextForBusesStep(), append([]sql.OrderTerm{term}, terms...)...)
+ }
+}
+
+// ByBusRouteAssociationsCount orders the results by busRouteAssociations count.
+func ByBusRouteAssociationsCount(opts ...sql.OrderTermOption) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborsCount(s, newBusRouteAssociationsStep(), opts...)
+ }
+}
+
+// ByBusRouteAssociations orders the results by busRouteAssociations terms.
+func ByBusRouteAssociations(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
+ return func(s *sql.Selector) {
+ sqlgraph.OrderByNeighborTerms(s, newBusRouteAssociationsStep(), append([]sql.OrderTerm{term}, terms...)...)
+ }
+}
+func newGuardianStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(GuardianInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.O2O, true, GuardianTable, GuardianColumn),
+ )
+}
+func newNextForBusesStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(NextForBusesInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, NextForBusesTable, NextForBusesColumn),
+ )
+}
+func newBusRouteAssociationsStep() *sqlgraph.Step {
+ return sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.To(BusRouteAssociationsInverseTable, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, BusRouteAssociationsTable, BusRouteAssociationsColumn),
+ )
+}
diff --git a/backend/domain/repository/ent/station/where.go b/backend/domain/repository/ent/station/where.go
new file mode 100644
index 00000000..2aeeeceb
--- /dev/null
+++ b/backend/domain/repository/ent/station/where.go
@@ -0,0 +1,341 @@
+// Code generated by ent, DO NOT EDIT.
+
+package station
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/google/uuid"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id uuid.UUID) predicate.Station {
+ return predicate.Station(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id uuid.UUID) predicate.Station {
+ return predicate.Station(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id uuid.UUID) predicate.Station {
+ return predicate.Station(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...uuid.UUID) predicate.Station {
+ return predicate.Station(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...uuid.UUID) predicate.Station {
+ return predicate.Station(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id uuid.UUID) predicate.Station {
+ return predicate.Station(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id uuid.UUID) predicate.Station {
+ return predicate.Station(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id uuid.UUID) predicate.Station {
+ return predicate.Station(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id uuid.UUID) predicate.Station {
+ return predicate.Station(sql.FieldLTE(FieldID, id))
+}
+
+// Latitude applies equality check predicate on the "latitude" field. It's identical to LatitudeEQ.
+func Latitude(v float64) predicate.Station {
+ return predicate.Station(sql.FieldEQ(FieldLatitude, v))
+}
+
+// Longitude applies equality check predicate on the "longitude" field. It's identical to LongitudeEQ.
+func Longitude(v float64) predicate.Station {
+ return predicate.Station(sql.FieldEQ(FieldLongitude, v))
+}
+
+// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.Station {
+ return predicate.Station(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
+func UpdatedAt(v time.Time) predicate.Station {
+ return predicate.Station(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// LatitudeEQ applies the EQ predicate on the "latitude" field.
+func LatitudeEQ(v float64) predicate.Station {
+ return predicate.Station(sql.FieldEQ(FieldLatitude, v))
+}
+
+// LatitudeNEQ applies the NEQ predicate on the "latitude" field.
+func LatitudeNEQ(v float64) predicate.Station {
+ return predicate.Station(sql.FieldNEQ(FieldLatitude, v))
+}
+
+// LatitudeIn applies the In predicate on the "latitude" field.
+func LatitudeIn(vs ...float64) predicate.Station {
+ return predicate.Station(sql.FieldIn(FieldLatitude, vs...))
+}
+
+// LatitudeNotIn applies the NotIn predicate on the "latitude" field.
+func LatitudeNotIn(vs ...float64) predicate.Station {
+ return predicate.Station(sql.FieldNotIn(FieldLatitude, vs...))
+}
+
+// LatitudeGT applies the GT predicate on the "latitude" field.
+func LatitudeGT(v float64) predicate.Station {
+ return predicate.Station(sql.FieldGT(FieldLatitude, v))
+}
+
+// LatitudeGTE applies the GTE predicate on the "latitude" field.
+func LatitudeGTE(v float64) predicate.Station {
+ return predicate.Station(sql.FieldGTE(FieldLatitude, v))
+}
+
+// LatitudeLT applies the LT predicate on the "latitude" field.
+func LatitudeLT(v float64) predicate.Station {
+ return predicate.Station(sql.FieldLT(FieldLatitude, v))
+}
+
+// LatitudeLTE applies the LTE predicate on the "latitude" field.
+func LatitudeLTE(v float64) predicate.Station {
+ return predicate.Station(sql.FieldLTE(FieldLatitude, v))
+}
+
+// LatitudeIsNil applies the IsNil predicate on the "latitude" field.
+func LatitudeIsNil() predicate.Station {
+ return predicate.Station(sql.FieldIsNull(FieldLatitude))
+}
+
+// LatitudeNotNil applies the NotNil predicate on the "latitude" field.
+func LatitudeNotNil() predicate.Station {
+ return predicate.Station(sql.FieldNotNull(FieldLatitude))
+}
+
+// LongitudeEQ applies the EQ predicate on the "longitude" field.
+func LongitudeEQ(v float64) predicate.Station {
+ return predicate.Station(sql.FieldEQ(FieldLongitude, v))
+}
+
+// LongitudeNEQ applies the NEQ predicate on the "longitude" field.
+func LongitudeNEQ(v float64) predicate.Station {
+ return predicate.Station(sql.FieldNEQ(FieldLongitude, v))
+}
+
+// LongitudeIn applies the In predicate on the "longitude" field.
+func LongitudeIn(vs ...float64) predicate.Station {
+ return predicate.Station(sql.FieldIn(FieldLongitude, vs...))
+}
+
+// LongitudeNotIn applies the NotIn predicate on the "longitude" field.
+func LongitudeNotIn(vs ...float64) predicate.Station {
+ return predicate.Station(sql.FieldNotIn(FieldLongitude, vs...))
+}
+
+// LongitudeGT applies the GT predicate on the "longitude" field.
+func LongitudeGT(v float64) predicate.Station {
+ return predicate.Station(sql.FieldGT(FieldLongitude, v))
+}
+
+// LongitudeGTE applies the GTE predicate on the "longitude" field.
+func LongitudeGTE(v float64) predicate.Station {
+ return predicate.Station(sql.FieldGTE(FieldLongitude, v))
+}
+
+// LongitudeLT applies the LT predicate on the "longitude" field.
+func LongitudeLT(v float64) predicate.Station {
+ return predicate.Station(sql.FieldLT(FieldLongitude, v))
+}
+
+// LongitudeLTE applies the LTE predicate on the "longitude" field.
+func LongitudeLTE(v float64) predicate.Station {
+ return predicate.Station(sql.FieldLTE(FieldLongitude, v))
+}
+
+// LongitudeIsNil applies the IsNil predicate on the "longitude" field.
+func LongitudeIsNil() predicate.Station {
+ return predicate.Station(sql.FieldIsNull(FieldLongitude))
+}
+
+// LongitudeNotNil applies the NotNil predicate on the "longitude" field.
+func LongitudeNotNil() predicate.Station {
+ return predicate.Station(sql.FieldNotNull(FieldLongitude))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.Station {
+ return predicate.Station(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.Station {
+ return predicate.Station(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.Station {
+ return predicate.Station(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.Station {
+ return predicate.Station(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.Station {
+ return predicate.Station(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.Station {
+ return predicate.Station(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.Station {
+ return predicate.Station(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.Station {
+ return predicate.Station(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
+func UpdatedAtEQ(v time.Time) predicate.Station {
+ return predicate.Station(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
+func UpdatedAtNEQ(v time.Time) predicate.Station {
+ return predicate.Station(sql.FieldNEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtIn applies the In predicate on the "updated_at" field.
+func UpdatedAtIn(vs ...time.Time) predicate.Station {
+ return predicate.Station(sql.FieldIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
+func UpdatedAtNotIn(vs ...time.Time) predicate.Station {
+ return predicate.Station(sql.FieldNotIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtGT applies the GT predicate on the "updated_at" field.
+func UpdatedAtGT(v time.Time) predicate.Station {
+ return predicate.Station(sql.FieldGT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
+func UpdatedAtGTE(v time.Time) predicate.Station {
+ return predicate.Station(sql.FieldGTE(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLT applies the LT predicate on the "updated_at" field.
+func UpdatedAtLT(v time.Time) predicate.Station {
+ return predicate.Station(sql.FieldLT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
+func UpdatedAtLTE(v time.Time) predicate.Station {
+ return predicate.Station(sql.FieldLTE(FieldUpdatedAt, v))
+}
+
+// HasGuardian applies the HasEdge predicate on the "guardian" edge.
+func HasGuardian() predicate.Station {
+ return predicate.Station(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.O2O, true, GuardianTable, GuardianColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasGuardianWith applies the HasEdge predicate on the "guardian" edge with a given conditions (other predicates).
+func HasGuardianWith(preds ...predicate.Guardian) predicate.Station {
+ return predicate.Station(func(s *sql.Selector) {
+ step := newGuardianStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasNextForBuses applies the HasEdge predicate on the "next_for_buses" edge.
+func HasNextForBuses() predicate.Station {
+ return predicate.Station(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, NextForBusesTable, NextForBusesColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasNextForBusesWith applies the HasEdge predicate on the "next_for_buses" edge with a given conditions (other predicates).
+func HasNextForBusesWith(preds ...predicate.Bus) predicate.Station {
+ return predicate.Station(func(s *sql.Selector) {
+ step := newNextForBusesStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// HasBusRouteAssociations applies the HasEdge predicate on the "busRouteAssociations" edge.
+func HasBusRouteAssociations() predicate.Station {
+ return predicate.Station(func(s *sql.Selector) {
+ step := sqlgraph.NewStep(
+ sqlgraph.From(Table, FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, BusRouteAssociationsTable, BusRouteAssociationsColumn),
+ )
+ sqlgraph.HasNeighbors(s, step)
+ })
+}
+
+// HasBusRouteAssociationsWith applies the HasEdge predicate on the "busRouteAssociations" edge with a given conditions (other predicates).
+func HasBusRouteAssociationsWith(preds ...predicate.BusRouteAssociation) predicate.Station {
+ return predicate.Station(func(s *sql.Selector) {
+ step := newBusRouteAssociationsStep()
+ sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
+ for _, p := range preds {
+ p(s)
+ }
+ })
+ })
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.Station) predicate.Station {
+ return predicate.Station(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.Station) predicate.Station {
+ return predicate.Station(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.Station) predicate.Station {
+ return predicate.Station(sql.NotPredicates(p))
+}
diff --git a/backend/domain/repository/ent/station_create.go b/backend/domain/repository/ent/station_create.go
new file mode 100644
index 00000000..3b3aaa8c
--- /dev/null
+++ b/backend/domain/repository/ent/station_create.go
@@ -0,0 +1,396 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busrouteassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// StationCreate is the builder for creating a Station entity.
+type StationCreate struct {
+ config
+ mutation *StationMutation
+ hooks []Hook
+}
+
+// SetLatitude sets the "latitude" field.
+func (sc *StationCreate) SetLatitude(f float64) *StationCreate {
+ sc.mutation.SetLatitude(f)
+ return sc
+}
+
+// SetNillableLatitude sets the "latitude" field if the given value is not nil.
+func (sc *StationCreate) SetNillableLatitude(f *float64) *StationCreate {
+ if f != nil {
+ sc.SetLatitude(*f)
+ }
+ return sc
+}
+
+// SetLongitude sets the "longitude" field.
+func (sc *StationCreate) SetLongitude(f float64) *StationCreate {
+ sc.mutation.SetLongitude(f)
+ return sc
+}
+
+// SetNillableLongitude sets the "longitude" field if the given value is not nil.
+func (sc *StationCreate) SetNillableLongitude(f *float64) *StationCreate {
+ if f != nil {
+ sc.SetLongitude(*f)
+ }
+ return sc
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (sc *StationCreate) SetCreatedAt(t time.Time) *StationCreate {
+ sc.mutation.SetCreatedAt(t)
+ return sc
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (sc *StationCreate) SetNillableCreatedAt(t *time.Time) *StationCreate {
+ if t != nil {
+ sc.SetCreatedAt(*t)
+ }
+ return sc
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (sc *StationCreate) SetUpdatedAt(t time.Time) *StationCreate {
+ sc.mutation.SetUpdatedAt(t)
+ return sc
+}
+
+// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
+func (sc *StationCreate) SetNillableUpdatedAt(t *time.Time) *StationCreate {
+ if t != nil {
+ sc.SetUpdatedAt(*t)
+ }
+ return sc
+}
+
+// SetID sets the "id" field.
+func (sc *StationCreate) SetID(u uuid.UUID) *StationCreate {
+ sc.mutation.SetID(u)
+ return sc
+}
+
+// SetNillableID sets the "id" field if the given value is not nil.
+func (sc *StationCreate) SetNillableID(u *uuid.UUID) *StationCreate {
+ if u != nil {
+ sc.SetID(*u)
+ }
+ return sc
+}
+
+// SetGuardianID sets the "guardian" edge to the Guardian entity by ID.
+func (sc *StationCreate) SetGuardianID(id uuid.UUID) *StationCreate {
+ sc.mutation.SetGuardianID(id)
+ return sc
+}
+
+// SetNillableGuardianID sets the "guardian" edge to the Guardian entity by ID if the given value is not nil.
+func (sc *StationCreate) SetNillableGuardianID(id *uuid.UUID) *StationCreate {
+ if id != nil {
+ sc = sc.SetGuardianID(*id)
+ }
+ return sc
+}
+
+// SetGuardian sets the "guardian" edge to the Guardian entity.
+func (sc *StationCreate) SetGuardian(g *Guardian) *StationCreate {
+ return sc.SetGuardianID(g.ID)
+}
+
+// AddNextForBusIDs adds the "next_for_buses" edge to the Bus entity by IDs.
+func (sc *StationCreate) AddNextForBusIDs(ids ...uuid.UUID) *StationCreate {
+ sc.mutation.AddNextForBusIDs(ids...)
+ return sc
+}
+
+// AddNextForBuses adds the "next_for_buses" edges to the Bus entity.
+func (sc *StationCreate) AddNextForBuses(b ...*Bus) *StationCreate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return sc.AddNextForBusIDs(ids...)
+}
+
+// AddBusRouteAssociationIDs adds the "busRouteAssociations" edge to the BusRouteAssociation entity by IDs.
+func (sc *StationCreate) AddBusRouteAssociationIDs(ids ...int) *StationCreate {
+ sc.mutation.AddBusRouteAssociationIDs(ids...)
+ return sc
+}
+
+// AddBusRouteAssociations adds the "busRouteAssociations" edges to the BusRouteAssociation entity.
+func (sc *StationCreate) AddBusRouteAssociations(b ...*BusRouteAssociation) *StationCreate {
+ ids := make([]int, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return sc.AddBusRouteAssociationIDs(ids...)
+}
+
+// Mutation returns the StationMutation object of the builder.
+func (sc *StationCreate) Mutation() *StationMutation {
+ return sc.mutation
+}
+
+// Save creates the Station in the database.
+func (sc *StationCreate) Save(ctx context.Context) (*Station, error) {
+ sc.defaults()
+ return withHooks(ctx, sc.sqlSave, sc.mutation, sc.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (sc *StationCreate) SaveX(ctx context.Context) *Station {
+ v, err := sc.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (sc *StationCreate) Exec(ctx context.Context) error {
+ _, err := sc.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (sc *StationCreate) ExecX(ctx context.Context) {
+ if err := sc.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (sc *StationCreate) defaults() {
+ if _, ok := sc.mutation.Latitude(); !ok {
+ v := station.DefaultLatitude
+ sc.mutation.SetLatitude(v)
+ }
+ if _, ok := sc.mutation.Longitude(); !ok {
+ v := station.DefaultLongitude
+ sc.mutation.SetLongitude(v)
+ }
+ if _, ok := sc.mutation.CreatedAt(); !ok {
+ v := station.DefaultCreatedAt()
+ sc.mutation.SetCreatedAt(v)
+ }
+ if _, ok := sc.mutation.UpdatedAt(); !ok {
+ v := station.DefaultUpdatedAt()
+ sc.mutation.SetUpdatedAt(v)
+ }
+ if _, ok := sc.mutation.ID(); !ok {
+ v := station.DefaultID()
+ sc.mutation.SetID(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (sc *StationCreate) check() error {
+ if _, ok := sc.mutation.CreatedAt(); !ok {
+ return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Station.created_at"`)}
+ }
+ if _, ok := sc.mutation.UpdatedAt(); !ok {
+ return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Station.updated_at"`)}
+ }
+ return nil
+}
+
+func (sc *StationCreate) sqlSave(ctx context.Context) (*Station, error) {
+ if err := sc.check(); err != nil {
+ return nil, err
+ }
+ _node, _spec := sc.createSpec()
+ if err := sqlgraph.CreateNode(ctx, sc.driver, _spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ if _spec.ID.Value != nil {
+ if id, ok := _spec.ID.Value.(*uuid.UUID); ok {
+ _node.ID = *id
+ } else if err := _node.ID.Scan(_spec.ID.Value); err != nil {
+ return nil, err
+ }
+ }
+ sc.mutation.id = &_node.ID
+ sc.mutation.done = true
+ return _node, nil
+}
+
+func (sc *StationCreate) createSpec() (*Station, *sqlgraph.CreateSpec) {
+ var (
+ _node = &Station{config: sc.config}
+ _spec = sqlgraph.NewCreateSpec(station.Table, sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID))
+ )
+ if id, ok := sc.mutation.ID(); ok {
+ _node.ID = id
+ _spec.ID.Value = &id
+ }
+ if value, ok := sc.mutation.Latitude(); ok {
+ _spec.SetField(station.FieldLatitude, field.TypeFloat64, value)
+ _node.Latitude = value
+ }
+ if value, ok := sc.mutation.Longitude(); ok {
+ _spec.SetField(station.FieldLongitude, field.TypeFloat64, value)
+ _node.Longitude = value
+ }
+ if value, ok := sc.mutation.CreatedAt(); ok {
+ _spec.SetField(station.FieldCreatedAt, field.TypeTime, value)
+ _node.CreatedAt = value
+ }
+ if value, ok := sc.mutation.UpdatedAt(); ok {
+ _spec.SetField(station.FieldUpdatedAt, field.TypeTime, value)
+ _node.UpdatedAt = value
+ }
+ if nodes := sc.mutation.GuardianIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2O,
+ Inverse: true,
+ Table: station.GuardianTable,
+ Columns: []string{station.GuardianColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _node.guardian_station = &nodes[0]
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := sc.mutation.NextForBusesIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: station.NextForBusesTable,
+ Columns: []string{station.NextForBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ if nodes := sc.mutation.BusRouteAssociationsIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: station.BusRouteAssociationsTable,
+ Columns: []string{station.BusRouteAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges = append(_spec.Edges, edge)
+ }
+ return _node, _spec
+}
+
+// StationCreateBulk is the builder for creating many Station entities in bulk.
+type StationCreateBulk struct {
+ config
+ err error
+ builders []*StationCreate
+}
+
+// Save creates the Station entities in the database.
+func (scb *StationCreateBulk) Save(ctx context.Context) ([]*Station, error) {
+ if scb.err != nil {
+ return nil, scb.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(scb.builders))
+ nodes := make([]*Station, len(scb.builders))
+ mutators := make([]Mutator, len(scb.builders))
+ for i := range scb.builders {
+ func(i int, root context.Context) {
+ builder := scb.builders[i]
+ builder.defaults()
+ var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+ mutation, ok := m.(*StationMutation)
+ if !ok {
+ return nil, fmt.Errorf("unexpected mutation type %T", m)
+ }
+ if err := builder.check(); err != nil {
+ return nil, err
+ }
+ builder.mutation = mutation
+ var err error
+ nodes[i], specs[i] = builder.createSpec()
+ if i < len(mutators)-1 {
+ _, err = mutators[i+1].Mutate(root, scb.builders[i+1].mutation)
+ } else {
+ spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+ // Invoke the actual operation on the latest mutation in the chain.
+ if err = sqlgraph.BatchCreate(ctx, scb.driver, spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ }
+ }
+ if err != nil {
+ return nil, err
+ }
+ mutation.id = &nodes[i].ID
+ mutation.done = true
+ return nodes[i], nil
+ })
+ for i := len(builder.hooks) - 1; i >= 0; i-- {
+ mut = builder.hooks[i](mut)
+ }
+ mutators[i] = mut
+ }(i, ctx)
+ }
+ if len(mutators) > 0 {
+ if _, err := mutators[0].Mutate(ctx, scb.builders[0].mutation); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (scb *StationCreateBulk) SaveX(ctx context.Context) []*Station {
+ v, err := scb.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (scb *StationCreateBulk) Exec(ctx context.Context) error {
+ _, err := scb.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (scb *StationCreateBulk) ExecX(ctx context.Context) {
+ if err := scb.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/station_delete.go b/backend/domain/repository/ent/station_delete.go
new file mode 100644
index 00000000..e1dcfaac
--- /dev/null
+++ b/backend/domain/repository/ent/station_delete.go
@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+)
+
+// StationDelete is the builder for deleting a Station entity.
+type StationDelete struct {
+ config
+ hooks []Hook
+ mutation *StationMutation
+}
+
+// Where appends a list predicates to the StationDelete builder.
+func (sd *StationDelete) Where(ps ...predicate.Station) *StationDelete {
+ sd.mutation.Where(ps...)
+ return sd
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (sd *StationDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, sd.sqlExec, sd.mutation, sd.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (sd *StationDelete) ExecX(ctx context.Context) int {
+ n, err := sd.Exec(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return n
+}
+
+func (sd *StationDelete) sqlExec(ctx context.Context) (int, error) {
+ _spec := sqlgraph.NewDeleteSpec(station.Table, sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID))
+ if ps := sd.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ affected, err := sqlgraph.DeleteNodes(ctx, sd.driver, _spec)
+ if err != nil && sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ sd.mutation.done = true
+ return affected, err
+}
+
+// StationDeleteOne is the builder for deleting a single Station entity.
+type StationDeleteOne struct {
+ sd *StationDelete
+}
+
+// Where appends a list predicates to the StationDelete builder.
+func (sdo *StationDeleteOne) Where(ps ...predicate.Station) *StationDeleteOne {
+ sdo.sd.mutation.Where(ps...)
+ return sdo
+}
+
+// Exec executes the deletion query.
+func (sdo *StationDeleteOne) Exec(ctx context.Context) error {
+ n, err := sdo.sd.Exec(ctx)
+ switch {
+ case err != nil:
+ return err
+ case n == 0:
+ return &NotFoundError{station.Label}
+ default:
+ return nil
+ }
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (sdo *StationDeleteOne) ExecX(ctx context.Context) {
+ if err := sdo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/domain/repository/ent/station_query.go b/backend/domain/repository/ent/station_query.go
new file mode 100644
index 00000000..051f8fe7
--- /dev/null
+++ b/backend/domain/repository/ent/station_query.go
@@ -0,0 +1,766 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "database/sql/driver"
+ "fmt"
+ "math"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busrouteassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// StationQuery is the builder for querying Station entities.
+type StationQuery struct {
+ config
+ ctx *QueryContext
+ order []station.OrderOption
+ inters []Interceptor
+ predicates []predicate.Station
+ withGuardian *GuardianQuery
+ withNextForBuses *BusQuery
+ withBusRouteAssociations *BusRouteAssociationQuery
+ withFKs bool
+ // intermediate query (i.e. traversal path).
+ sql *sql.Selector
+ path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the StationQuery builder.
+func (sq *StationQuery) Where(ps ...predicate.Station) *StationQuery {
+ sq.predicates = append(sq.predicates, ps...)
+ return sq
+}
+
+// Limit the number of records to be returned by this query.
+func (sq *StationQuery) Limit(limit int) *StationQuery {
+ sq.ctx.Limit = &limit
+ return sq
+}
+
+// Offset to start from.
+func (sq *StationQuery) Offset(offset int) *StationQuery {
+ sq.ctx.Offset = &offset
+ return sq
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (sq *StationQuery) Unique(unique bool) *StationQuery {
+ sq.ctx.Unique = &unique
+ return sq
+}
+
+// Order specifies how the records should be ordered.
+func (sq *StationQuery) Order(o ...station.OrderOption) *StationQuery {
+ sq.order = append(sq.order, o...)
+ return sq
+}
+
+// QueryGuardian chains the current query on the "guardian" edge.
+func (sq *StationQuery) QueryGuardian() *GuardianQuery {
+ query := (&GuardianClient{config: sq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := sq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := sq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(station.Table, station.FieldID, selector),
+ sqlgraph.To(guardian.Table, guardian.FieldID),
+ sqlgraph.Edge(sqlgraph.O2O, true, station.GuardianTable, station.GuardianColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(sq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryNextForBuses chains the current query on the "next_for_buses" edge.
+func (sq *StationQuery) QueryNextForBuses() *BusQuery {
+ query := (&BusClient{config: sq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := sq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := sq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(station.Table, station.FieldID, selector),
+ sqlgraph.To(bus.Table, bus.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, true, station.NextForBusesTable, station.NextForBusesColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(sq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// QueryBusRouteAssociations chains the current query on the "busRouteAssociations" edge.
+func (sq *StationQuery) QueryBusRouteAssociations() *BusRouteAssociationQuery {
+ query := (&BusRouteAssociationClient{config: sq.config}).Query()
+ query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
+ if err := sq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ selector := sq.sqlQuery(ctx)
+ if err := selector.Err(); err != nil {
+ return nil, err
+ }
+ step := sqlgraph.NewStep(
+ sqlgraph.From(station.Table, station.FieldID, selector),
+ sqlgraph.To(busrouteassociation.Table, busrouteassociation.FieldID),
+ sqlgraph.Edge(sqlgraph.O2M, false, station.BusRouteAssociationsTable, station.BusRouteAssociationsColumn),
+ )
+ fromU = sqlgraph.SetNeighbors(sq.driver.Dialect(), step)
+ return fromU, nil
+ }
+ return query
+}
+
+// First returns the first Station entity from the query.
+// Returns a *NotFoundError when no Station was found.
+func (sq *StationQuery) First(ctx context.Context) (*Station, error) {
+ nodes, err := sq.Limit(1).All(setContextOp(ctx, sq.ctx, "First"))
+ if err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nil, &NotFoundError{station.Label}
+ }
+ return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (sq *StationQuery) FirstX(ctx context.Context) *Station {
+ node, err := sq.First(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return node
+}
+
+// FirstID returns the first Station ID from the query.
+// Returns a *NotFoundError when no Station ID was found.
+func (sq *StationQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) {
+ var ids []uuid.UUID
+ if ids, err = sq.Limit(1).IDs(setContextOp(ctx, sq.ctx, "FirstID")); err != nil {
+ return
+ }
+ if len(ids) == 0 {
+ err = &NotFoundError{station.Label}
+ return
+ }
+ return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (sq *StationQuery) FirstIDX(ctx context.Context) uuid.UUID {
+ id, err := sq.FirstID(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return id
+}
+
+// Only returns a single Station entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one Station entity is found.
+// Returns a *NotFoundError when no Station entities are found.
+func (sq *StationQuery) Only(ctx context.Context) (*Station, error) {
+ nodes, err := sq.Limit(2).All(setContextOp(ctx, sq.ctx, "Only"))
+ if err != nil {
+ return nil, err
+ }
+ switch len(nodes) {
+ case 1:
+ return nodes[0], nil
+ case 0:
+ return nil, &NotFoundError{station.Label}
+ default:
+ return nil, &NotSingularError{station.Label}
+ }
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (sq *StationQuery) OnlyX(ctx context.Context) *Station {
+ node, err := sq.Only(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// OnlyID is like Only, but returns the only Station ID in the query.
+// Returns a *NotSingularError when more than one Station ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (sq *StationQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) {
+ var ids []uuid.UUID
+ if ids, err = sq.Limit(2).IDs(setContextOp(ctx, sq.ctx, "OnlyID")); err != nil {
+ return
+ }
+ switch len(ids) {
+ case 1:
+ id = ids[0]
+ case 0:
+ err = &NotFoundError{station.Label}
+ default:
+ err = &NotSingularError{station.Label}
+ }
+ return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (sq *StationQuery) OnlyIDX(ctx context.Context) uuid.UUID {
+ id, err := sq.OnlyID(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// All executes the query and returns a list of Stations.
+func (sq *StationQuery) All(ctx context.Context) ([]*Station, error) {
+ ctx = setContextOp(ctx, sq.ctx, "All")
+ if err := sq.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ qr := querierAll[[]*Station, *StationQuery]()
+ return withInterceptors[[]*Station](ctx, sq, qr, sq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (sq *StationQuery) AllX(ctx context.Context) []*Station {
+ nodes, err := sq.All(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return nodes
+}
+
+// IDs executes the query and returns a list of Station IDs.
+func (sq *StationQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
+ if sq.ctx.Unique == nil && sq.path != nil {
+ sq.Unique(true)
+ }
+ ctx = setContextOp(ctx, sq.ctx, "IDs")
+ if err = sq.Select(station.FieldID).Scan(ctx, &ids); err != nil {
+ return nil, err
+ }
+ return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (sq *StationQuery) IDsX(ctx context.Context) []uuid.UUID {
+ ids, err := sq.IDs(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return ids
+}
+
+// Count returns the count of the given query.
+func (sq *StationQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, sq.ctx, "Count")
+ if err := sq.prepareQuery(ctx); err != nil {
+ return 0, err
+ }
+ return withInterceptors[int](ctx, sq, querierCount[*StationQuery](), sq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (sq *StationQuery) CountX(ctx context.Context) int {
+ count, err := sq.Count(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (sq *StationQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, sq.ctx, "Exist")
+ switch _, err := sq.FirstID(ctx); {
+ case IsNotFound(err):
+ return false, nil
+ case err != nil:
+ return false, fmt.Errorf("ent: check existence: %w", err)
+ default:
+ return true, nil
+ }
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (sq *StationQuery) ExistX(ctx context.Context) bool {
+ exist, err := sq.Exist(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return exist
+}
+
+// Clone returns a duplicate of the StationQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (sq *StationQuery) Clone() *StationQuery {
+ if sq == nil {
+ return nil
+ }
+ return &StationQuery{
+ config: sq.config,
+ ctx: sq.ctx.Clone(),
+ order: append([]station.OrderOption{}, sq.order...),
+ inters: append([]Interceptor{}, sq.inters...),
+ predicates: append([]predicate.Station{}, sq.predicates...),
+ withGuardian: sq.withGuardian.Clone(),
+ withNextForBuses: sq.withNextForBuses.Clone(),
+ withBusRouteAssociations: sq.withBusRouteAssociations.Clone(),
+ // clone intermediate query.
+ sql: sq.sql.Clone(),
+ path: sq.path,
+ }
+}
+
+// WithGuardian tells the query-builder to eager-load the nodes that are connected to
+// the "guardian" edge. The optional arguments are used to configure the query builder of the edge.
+func (sq *StationQuery) WithGuardian(opts ...func(*GuardianQuery)) *StationQuery {
+ query := (&GuardianClient{config: sq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ sq.withGuardian = query
+ return sq
+}
+
+// WithNextForBuses tells the query-builder to eager-load the nodes that are connected to
+// the "next_for_buses" edge. The optional arguments are used to configure the query builder of the edge.
+func (sq *StationQuery) WithNextForBuses(opts ...func(*BusQuery)) *StationQuery {
+ query := (&BusClient{config: sq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ sq.withNextForBuses = query
+ return sq
+}
+
+// WithBusRouteAssociations tells the query-builder to eager-load the nodes that are connected to
+// the "busRouteAssociations" edge. The optional arguments are used to configure the query builder of the edge.
+func (sq *StationQuery) WithBusRouteAssociations(opts ...func(*BusRouteAssociationQuery)) *StationQuery {
+ query := (&BusRouteAssociationClient{config: sq.config}).Query()
+ for _, opt := range opts {
+ opt(query)
+ }
+ sq.withBusRouteAssociations = query
+ return sq
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+// var v []struct {
+// Latitude float64 `json:"latitude,omitempty"`
+// Count int `json:"count,omitempty"`
+// }
+//
+// client.Station.Query().
+// GroupBy(station.FieldLatitude).
+// Aggregate(ent.Count()).
+// Scan(ctx, &v)
+func (sq *StationQuery) GroupBy(field string, fields ...string) *StationGroupBy {
+ sq.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &StationGroupBy{build: sq}
+ grbuild.flds = &sq.ctx.Fields
+ grbuild.label = station.Label
+ grbuild.scan = grbuild.Scan
+ return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+// var v []struct {
+// Latitude float64 `json:"latitude,omitempty"`
+// }
+//
+// client.Station.Query().
+// Select(station.FieldLatitude).
+// Scan(ctx, &v)
+func (sq *StationQuery) Select(fields ...string) *StationSelect {
+ sq.ctx.Fields = append(sq.ctx.Fields, fields...)
+ sbuild := &StationSelect{StationQuery: sq}
+ sbuild.label = station.Label
+ sbuild.flds, sbuild.scan = &sq.ctx.Fields, sbuild.Scan
+ return sbuild
+}
+
+// Aggregate returns a StationSelect configured with the given aggregations.
+func (sq *StationQuery) Aggregate(fns ...AggregateFunc) *StationSelect {
+ return sq.Select().Aggregate(fns...)
+}
+
+func (sq *StationQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range sq.inters {
+ if inter == nil {
+ return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+ }
+ if trv, ok := inter.(Traverser); ok {
+ if err := trv.Traverse(ctx, sq); err != nil {
+ return err
+ }
+ }
+ }
+ for _, f := range sq.ctx.Fields {
+ if !station.ValidColumn(f) {
+ return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ }
+ if sq.path != nil {
+ prev, err := sq.path(ctx)
+ if err != nil {
+ return err
+ }
+ sq.sql = prev
+ }
+ return nil
+}
+
+func (sq *StationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Station, error) {
+ var (
+ nodes = []*Station{}
+ withFKs = sq.withFKs
+ _spec = sq.querySpec()
+ loadedTypes = [3]bool{
+ sq.withGuardian != nil,
+ sq.withNextForBuses != nil,
+ sq.withBusRouteAssociations != nil,
+ }
+ )
+ if sq.withGuardian != nil {
+ withFKs = true
+ }
+ if withFKs {
+ _spec.Node.Columns = append(_spec.Node.Columns, station.ForeignKeys...)
+ }
+ _spec.ScanValues = func(columns []string) ([]any, error) {
+ return (*Station).scanValues(nil, columns)
+ }
+ _spec.Assign = func(columns []string, values []any) error {
+ node := &Station{config: sq.config}
+ nodes = append(nodes, node)
+ node.Edges.loadedTypes = loadedTypes
+ return node.assignValues(columns, values)
+ }
+ for i := range hooks {
+ hooks[i](ctx, _spec)
+ }
+ if err := sqlgraph.QueryNodes(ctx, sq.driver, _spec); err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nodes, nil
+ }
+ if query := sq.withGuardian; query != nil {
+ if err := sq.loadGuardian(ctx, query, nodes, nil,
+ func(n *Station, e *Guardian) { n.Edges.Guardian = e }); err != nil {
+ return nil, err
+ }
+ }
+ if query := sq.withNextForBuses; query != nil {
+ if err := sq.loadNextForBuses(ctx, query, nodes,
+ func(n *Station) { n.Edges.NextForBuses = []*Bus{} },
+ func(n *Station, e *Bus) { n.Edges.NextForBuses = append(n.Edges.NextForBuses, e) }); err != nil {
+ return nil, err
+ }
+ }
+ if query := sq.withBusRouteAssociations; query != nil {
+ if err := sq.loadBusRouteAssociations(ctx, query, nodes,
+ func(n *Station) { n.Edges.BusRouteAssociations = []*BusRouteAssociation{} },
+ func(n *Station, e *BusRouteAssociation) {
+ n.Edges.BusRouteAssociations = append(n.Edges.BusRouteAssociations, e)
+ }); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+func (sq *StationQuery) loadGuardian(ctx context.Context, query *GuardianQuery, nodes []*Station, init func(*Station), assign func(*Station, *Guardian)) error {
+ ids := make([]uuid.UUID, 0, len(nodes))
+ nodeids := make(map[uuid.UUID][]*Station)
+ for i := range nodes {
+ if nodes[i].guardian_station == nil {
+ continue
+ }
+ fk := *nodes[i].guardian_station
+ if _, ok := nodeids[fk]; !ok {
+ ids = append(ids, fk)
+ }
+ nodeids[fk] = append(nodeids[fk], nodes[i])
+ }
+ if len(ids) == 0 {
+ return nil
+ }
+ query.Where(guardian.IDIn(ids...))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ nodes, ok := nodeids[n.ID]
+ if !ok {
+ return fmt.Errorf(`unexpected foreign-key "guardian_station" returned %v`, n.ID)
+ }
+ for i := range nodes {
+ assign(nodes[i], n)
+ }
+ }
+ return nil
+}
+func (sq *StationQuery) loadNextForBuses(ctx context.Context, query *BusQuery, nodes []*Station, init func(*Station), assign func(*Station, *Bus)) error {
+ fks := make([]driver.Value, 0, len(nodes))
+ nodeids := make(map[uuid.UUID]*Station)
+ for i := range nodes {
+ fks = append(fks, nodes[i].ID)
+ nodeids[nodes[i].ID] = nodes[i]
+ if init != nil {
+ init(nodes[i])
+ }
+ }
+ query.withFKs = true
+ query.Where(predicate.Bus(func(s *sql.Selector) {
+ s.Where(sql.InValues(s.C(station.NextForBusesColumn), fks...))
+ }))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ fk := n.bus_next_station
+ if fk == nil {
+ return fmt.Errorf(`foreign-key "bus_next_station" is nil for node %v`, n.ID)
+ }
+ node, ok := nodeids[*fk]
+ if !ok {
+ return fmt.Errorf(`unexpected referenced foreign-key "bus_next_station" returned %v for node %v`, *fk, n.ID)
+ }
+ assign(node, n)
+ }
+ return nil
+}
+func (sq *StationQuery) loadBusRouteAssociations(ctx context.Context, query *BusRouteAssociationQuery, nodes []*Station, init func(*Station), assign func(*Station, *BusRouteAssociation)) error {
+ fks := make([]driver.Value, 0, len(nodes))
+ nodeids := make(map[uuid.UUID]*Station)
+ for i := range nodes {
+ fks = append(fks, nodes[i].ID)
+ nodeids[nodes[i].ID] = nodes[i]
+ if init != nil {
+ init(nodes[i])
+ }
+ }
+ if len(query.ctx.Fields) > 0 {
+ query.ctx.AppendFieldOnce(busrouteassociation.FieldStationID)
+ }
+ query.Where(predicate.BusRouteAssociation(func(s *sql.Selector) {
+ s.Where(sql.InValues(s.C(station.BusRouteAssociationsColumn), fks...))
+ }))
+ neighbors, err := query.All(ctx)
+ if err != nil {
+ return err
+ }
+ for _, n := range neighbors {
+ fk := n.StationID
+ node, ok := nodeids[fk]
+ if !ok {
+ return fmt.Errorf(`unexpected referenced foreign-key "station_id" returned %v for node %v`, fk, n.ID)
+ }
+ assign(node, n)
+ }
+ return nil
+}
+
+func (sq *StationQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := sq.querySpec()
+ _spec.Node.Columns = sq.ctx.Fields
+ if len(sq.ctx.Fields) > 0 {
+ _spec.Unique = sq.ctx.Unique != nil && *sq.ctx.Unique
+ }
+ return sqlgraph.CountNodes(ctx, sq.driver, _spec)
+}
+
+func (sq *StationQuery) querySpec() *sqlgraph.QuerySpec {
+ _spec := sqlgraph.NewQuerySpec(station.Table, station.Columns, sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID))
+ _spec.From = sq.sql
+ if unique := sq.ctx.Unique; unique != nil {
+ _spec.Unique = *unique
+ } else if sq.path != nil {
+ _spec.Unique = true
+ }
+ if fields := sq.ctx.Fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, station.FieldID)
+ for i := range fields {
+ if fields[i] != station.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+ }
+ }
+ }
+ if ps := sq.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if limit := sq.ctx.Limit; limit != nil {
+ _spec.Limit = *limit
+ }
+ if offset := sq.ctx.Offset; offset != nil {
+ _spec.Offset = *offset
+ }
+ if ps := sq.order; len(ps) > 0 {
+ _spec.Order = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ return _spec
+}
+
+func (sq *StationQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(sq.driver.Dialect())
+ t1 := builder.Table(station.Table)
+ columns := sq.ctx.Fields
+ if len(columns) == 0 {
+ columns = station.Columns
+ }
+ selector := builder.Select(t1.Columns(columns...)...).From(t1)
+ if sq.sql != nil {
+ selector = sq.sql
+ selector.Select(selector.Columns(columns...)...)
+ }
+ if sq.ctx.Unique != nil && *sq.ctx.Unique {
+ selector.Distinct()
+ }
+ for _, p := range sq.predicates {
+ p(selector)
+ }
+ for _, p := range sq.order {
+ p(selector)
+ }
+ if offset := sq.ctx.Offset; offset != nil {
+ // limit is mandatory for offset clause. We start
+ // with default value, and override it below if needed.
+ selector.Offset(*offset).Limit(math.MaxInt32)
+ }
+ if limit := sq.ctx.Limit; limit != nil {
+ selector.Limit(*limit)
+ }
+ return selector
+}
+
+// StationGroupBy is the group-by builder for Station entities.
+type StationGroupBy struct {
+ selector
+ build *StationQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (sgb *StationGroupBy) Aggregate(fns ...AggregateFunc) *StationGroupBy {
+ sgb.fns = append(sgb.fns, fns...)
+ return sgb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (sgb *StationGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, sgb.build.ctx, "GroupBy")
+ if err := sgb.build.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*StationQuery, *StationGroupBy](ctx, sgb.build, sgb, sgb.build.inters, v)
+}
+
+func (sgb *StationGroupBy) sqlScan(ctx context.Context, root *StationQuery, v any) error {
+ selector := root.sqlQuery(ctx).Select()
+ aggregation := make([]string, 0, len(sgb.fns))
+ for _, fn := range sgb.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ if len(selector.SelectedColumns()) == 0 {
+ columns := make([]string, 0, len(*sgb.flds)+len(sgb.fns))
+ for _, f := range *sgb.flds {
+ columns = append(columns, selector.C(f))
+ }
+ columns = append(columns, aggregation...)
+ selector.Select(columns...)
+ }
+ selector.GroupBy(selector.Columns(*sgb.flds...)...)
+ if err := selector.Err(); err != nil {
+ return err
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := sgb.build.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
+
+// StationSelect is the builder for selecting fields of Station entities.
+type StationSelect struct {
+ *StationQuery
+ selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (ss *StationSelect) Aggregate(fns ...AggregateFunc) *StationSelect {
+ ss.fns = append(ss.fns, fns...)
+ return ss
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (ss *StationSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, ss.ctx, "Select")
+ if err := ss.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*StationQuery, *StationSelect](ctx, ss.StationQuery, ss, ss.inters, v)
+}
+
+func (ss *StationSelect) sqlScan(ctx context.Context, root *StationQuery, v any) error {
+ selector := root.sqlQuery(ctx)
+ aggregation := make([]string, 0, len(ss.fns))
+ for _, fn := range ss.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ switch n := len(*ss.selector.flds); {
+ case n == 0 && len(aggregation) > 0:
+ selector.Select(aggregation...)
+ case n != 0 && len(aggregation) > 0:
+ selector.AppendSelect(aggregation...)
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := ss.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
diff --git a/backend/domain/repository/ent/station_update.go b/backend/domain/repository/ent/station_update.go
new file mode 100644
index 00000000..86931193
--- /dev/null
+++ b/backend/domain/repository/ent/station_update.go
@@ -0,0 +1,826 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busrouteassociation"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/predicate"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ "github.com/google/uuid"
+)
+
+// StationUpdate is the builder for updating Station entities.
+type StationUpdate struct {
+ config
+ hooks []Hook
+ mutation *StationMutation
+}
+
+// Where appends a list predicates to the StationUpdate builder.
+func (su *StationUpdate) Where(ps ...predicate.Station) *StationUpdate {
+ su.mutation.Where(ps...)
+ return su
+}
+
+// SetLatitude sets the "latitude" field.
+func (su *StationUpdate) SetLatitude(f float64) *StationUpdate {
+ su.mutation.ResetLatitude()
+ su.mutation.SetLatitude(f)
+ return su
+}
+
+// SetNillableLatitude sets the "latitude" field if the given value is not nil.
+func (su *StationUpdate) SetNillableLatitude(f *float64) *StationUpdate {
+ if f != nil {
+ su.SetLatitude(*f)
+ }
+ return su
+}
+
+// AddLatitude adds f to the "latitude" field.
+func (su *StationUpdate) AddLatitude(f float64) *StationUpdate {
+ su.mutation.AddLatitude(f)
+ return su
+}
+
+// ClearLatitude clears the value of the "latitude" field.
+func (su *StationUpdate) ClearLatitude() *StationUpdate {
+ su.mutation.ClearLatitude()
+ return su
+}
+
+// SetLongitude sets the "longitude" field.
+func (su *StationUpdate) SetLongitude(f float64) *StationUpdate {
+ su.mutation.ResetLongitude()
+ su.mutation.SetLongitude(f)
+ return su
+}
+
+// SetNillableLongitude sets the "longitude" field if the given value is not nil.
+func (su *StationUpdate) SetNillableLongitude(f *float64) *StationUpdate {
+ if f != nil {
+ su.SetLongitude(*f)
+ }
+ return su
+}
+
+// AddLongitude adds f to the "longitude" field.
+func (su *StationUpdate) AddLongitude(f float64) *StationUpdate {
+ su.mutation.AddLongitude(f)
+ return su
+}
+
+// ClearLongitude clears the value of the "longitude" field.
+func (su *StationUpdate) ClearLongitude() *StationUpdate {
+ su.mutation.ClearLongitude()
+ return su
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (su *StationUpdate) SetCreatedAt(t time.Time) *StationUpdate {
+ su.mutation.SetCreatedAt(t)
+ return su
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (su *StationUpdate) SetNillableCreatedAt(t *time.Time) *StationUpdate {
+ if t != nil {
+ su.SetCreatedAt(*t)
+ }
+ return su
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (su *StationUpdate) SetUpdatedAt(t time.Time) *StationUpdate {
+ su.mutation.SetUpdatedAt(t)
+ return su
+}
+
+// SetGuardianID sets the "guardian" edge to the Guardian entity by ID.
+func (su *StationUpdate) SetGuardianID(id uuid.UUID) *StationUpdate {
+ su.mutation.SetGuardianID(id)
+ return su
+}
+
+// SetNillableGuardianID sets the "guardian" edge to the Guardian entity by ID if the given value is not nil.
+func (su *StationUpdate) SetNillableGuardianID(id *uuid.UUID) *StationUpdate {
+ if id != nil {
+ su = su.SetGuardianID(*id)
+ }
+ return su
+}
+
+// SetGuardian sets the "guardian" edge to the Guardian entity.
+func (su *StationUpdate) SetGuardian(g *Guardian) *StationUpdate {
+ return su.SetGuardianID(g.ID)
+}
+
+// AddNextForBusIDs adds the "next_for_buses" edge to the Bus entity by IDs.
+func (su *StationUpdate) AddNextForBusIDs(ids ...uuid.UUID) *StationUpdate {
+ su.mutation.AddNextForBusIDs(ids...)
+ return su
+}
+
+// AddNextForBuses adds the "next_for_buses" edges to the Bus entity.
+func (su *StationUpdate) AddNextForBuses(b ...*Bus) *StationUpdate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return su.AddNextForBusIDs(ids...)
+}
+
+// AddBusRouteAssociationIDs adds the "busRouteAssociations" edge to the BusRouteAssociation entity by IDs.
+func (su *StationUpdate) AddBusRouteAssociationIDs(ids ...int) *StationUpdate {
+ su.mutation.AddBusRouteAssociationIDs(ids...)
+ return su
+}
+
+// AddBusRouteAssociations adds the "busRouteAssociations" edges to the BusRouteAssociation entity.
+func (su *StationUpdate) AddBusRouteAssociations(b ...*BusRouteAssociation) *StationUpdate {
+ ids := make([]int, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return su.AddBusRouteAssociationIDs(ids...)
+}
+
+// Mutation returns the StationMutation object of the builder.
+func (su *StationUpdate) Mutation() *StationMutation {
+ return su.mutation
+}
+
+// ClearGuardian clears the "guardian" edge to the Guardian entity.
+func (su *StationUpdate) ClearGuardian() *StationUpdate {
+ su.mutation.ClearGuardian()
+ return su
+}
+
+// ClearNextForBuses clears all "next_for_buses" edges to the Bus entity.
+func (su *StationUpdate) ClearNextForBuses() *StationUpdate {
+ su.mutation.ClearNextForBuses()
+ return su
+}
+
+// RemoveNextForBusIDs removes the "next_for_buses" edge to Bus entities by IDs.
+func (su *StationUpdate) RemoveNextForBusIDs(ids ...uuid.UUID) *StationUpdate {
+ su.mutation.RemoveNextForBusIDs(ids...)
+ return su
+}
+
+// RemoveNextForBuses removes "next_for_buses" edges to Bus entities.
+func (su *StationUpdate) RemoveNextForBuses(b ...*Bus) *StationUpdate {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return su.RemoveNextForBusIDs(ids...)
+}
+
+// ClearBusRouteAssociations clears all "busRouteAssociations" edges to the BusRouteAssociation entity.
+func (su *StationUpdate) ClearBusRouteAssociations() *StationUpdate {
+ su.mutation.ClearBusRouteAssociations()
+ return su
+}
+
+// RemoveBusRouteAssociationIDs removes the "busRouteAssociations" edge to BusRouteAssociation entities by IDs.
+func (su *StationUpdate) RemoveBusRouteAssociationIDs(ids ...int) *StationUpdate {
+ su.mutation.RemoveBusRouteAssociationIDs(ids...)
+ return su
+}
+
+// RemoveBusRouteAssociations removes "busRouteAssociations" edges to BusRouteAssociation entities.
+func (su *StationUpdate) RemoveBusRouteAssociations(b ...*BusRouteAssociation) *StationUpdate {
+ ids := make([]int, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return su.RemoveBusRouteAssociationIDs(ids...)
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (su *StationUpdate) Save(ctx context.Context) (int, error) {
+ su.defaults()
+ return withHooks(ctx, su.sqlSave, su.mutation, su.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (su *StationUpdate) SaveX(ctx context.Context) int {
+ affected, err := su.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return affected
+}
+
+// Exec executes the query.
+func (su *StationUpdate) Exec(ctx context.Context) error {
+ _, err := su.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (su *StationUpdate) ExecX(ctx context.Context) {
+ if err := su.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (su *StationUpdate) defaults() {
+ if _, ok := su.mutation.UpdatedAt(); !ok {
+ v := station.UpdateDefaultUpdatedAt()
+ su.mutation.SetUpdatedAt(v)
+ }
+}
+
+func (su *StationUpdate) sqlSave(ctx context.Context) (n int, err error) {
+ _spec := sqlgraph.NewUpdateSpec(station.Table, station.Columns, sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID))
+ if ps := su.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := su.mutation.Latitude(); ok {
+ _spec.SetField(station.FieldLatitude, field.TypeFloat64, value)
+ }
+ if value, ok := su.mutation.AddedLatitude(); ok {
+ _spec.AddField(station.FieldLatitude, field.TypeFloat64, value)
+ }
+ if su.mutation.LatitudeCleared() {
+ _spec.ClearField(station.FieldLatitude, field.TypeFloat64)
+ }
+ if value, ok := su.mutation.Longitude(); ok {
+ _spec.SetField(station.FieldLongitude, field.TypeFloat64, value)
+ }
+ if value, ok := su.mutation.AddedLongitude(); ok {
+ _spec.AddField(station.FieldLongitude, field.TypeFloat64, value)
+ }
+ if su.mutation.LongitudeCleared() {
+ _spec.ClearField(station.FieldLongitude, field.TypeFloat64)
+ }
+ if value, ok := su.mutation.CreatedAt(); ok {
+ _spec.SetField(station.FieldCreatedAt, field.TypeTime, value)
+ }
+ if value, ok := su.mutation.UpdatedAt(); ok {
+ _spec.SetField(station.FieldUpdatedAt, field.TypeTime, value)
+ }
+ if su.mutation.GuardianCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2O,
+ Inverse: true,
+ Table: station.GuardianTable,
+ Columns: []string{station.GuardianColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := su.mutation.GuardianIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2O,
+ Inverse: true,
+ Table: station.GuardianTable,
+ Columns: []string{station.GuardianColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if su.mutation.NextForBusesCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: station.NextForBusesTable,
+ Columns: []string{station.NextForBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := su.mutation.RemovedNextForBusesIDs(); len(nodes) > 0 && !su.mutation.NextForBusesCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: station.NextForBusesTable,
+ Columns: []string{station.NextForBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := su.mutation.NextForBusesIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: station.NextForBusesTable,
+ Columns: []string{station.NextForBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if su.mutation.BusRouteAssociationsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: station.BusRouteAssociationsTable,
+ Columns: []string{station.BusRouteAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := su.mutation.RemovedBusRouteAssociationsIDs(); len(nodes) > 0 && !su.mutation.BusRouteAssociationsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: station.BusRouteAssociationsTable,
+ Columns: []string{station.BusRouteAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := su.mutation.BusRouteAssociationsIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: station.BusRouteAssociationsTable,
+ Columns: []string{station.BusRouteAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if n, err = sqlgraph.UpdateNodes(ctx, su.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{station.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return 0, err
+ }
+ su.mutation.done = true
+ return n, nil
+}
+
+// StationUpdateOne is the builder for updating a single Station entity.
+type StationUpdateOne struct {
+ config
+ fields []string
+ hooks []Hook
+ mutation *StationMutation
+}
+
+// SetLatitude sets the "latitude" field.
+func (suo *StationUpdateOne) SetLatitude(f float64) *StationUpdateOne {
+ suo.mutation.ResetLatitude()
+ suo.mutation.SetLatitude(f)
+ return suo
+}
+
+// SetNillableLatitude sets the "latitude" field if the given value is not nil.
+func (suo *StationUpdateOne) SetNillableLatitude(f *float64) *StationUpdateOne {
+ if f != nil {
+ suo.SetLatitude(*f)
+ }
+ return suo
+}
+
+// AddLatitude adds f to the "latitude" field.
+func (suo *StationUpdateOne) AddLatitude(f float64) *StationUpdateOne {
+ suo.mutation.AddLatitude(f)
+ return suo
+}
+
+// ClearLatitude clears the value of the "latitude" field.
+func (suo *StationUpdateOne) ClearLatitude() *StationUpdateOne {
+ suo.mutation.ClearLatitude()
+ return suo
+}
+
+// SetLongitude sets the "longitude" field.
+func (suo *StationUpdateOne) SetLongitude(f float64) *StationUpdateOne {
+ suo.mutation.ResetLongitude()
+ suo.mutation.SetLongitude(f)
+ return suo
+}
+
+// SetNillableLongitude sets the "longitude" field if the given value is not nil.
+func (suo *StationUpdateOne) SetNillableLongitude(f *float64) *StationUpdateOne {
+ if f != nil {
+ suo.SetLongitude(*f)
+ }
+ return suo
+}
+
+// AddLongitude adds f to the "longitude" field.
+func (suo *StationUpdateOne) AddLongitude(f float64) *StationUpdateOne {
+ suo.mutation.AddLongitude(f)
+ return suo
+}
+
+// ClearLongitude clears the value of the "longitude" field.
+func (suo *StationUpdateOne) ClearLongitude() *StationUpdateOne {
+ suo.mutation.ClearLongitude()
+ return suo
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (suo *StationUpdateOne) SetCreatedAt(t time.Time) *StationUpdateOne {
+ suo.mutation.SetCreatedAt(t)
+ return suo
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (suo *StationUpdateOne) SetNillableCreatedAt(t *time.Time) *StationUpdateOne {
+ if t != nil {
+ suo.SetCreatedAt(*t)
+ }
+ return suo
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (suo *StationUpdateOne) SetUpdatedAt(t time.Time) *StationUpdateOne {
+ suo.mutation.SetUpdatedAt(t)
+ return suo
+}
+
+// SetGuardianID sets the "guardian" edge to the Guardian entity by ID.
+func (suo *StationUpdateOne) SetGuardianID(id uuid.UUID) *StationUpdateOne {
+ suo.mutation.SetGuardianID(id)
+ return suo
+}
+
+// SetNillableGuardianID sets the "guardian" edge to the Guardian entity by ID if the given value is not nil.
+func (suo *StationUpdateOne) SetNillableGuardianID(id *uuid.UUID) *StationUpdateOne {
+ if id != nil {
+ suo = suo.SetGuardianID(*id)
+ }
+ return suo
+}
+
+// SetGuardian sets the "guardian" edge to the Guardian entity.
+func (suo *StationUpdateOne) SetGuardian(g *Guardian) *StationUpdateOne {
+ return suo.SetGuardianID(g.ID)
+}
+
+// AddNextForBusIDs adds the "next_for_buses" edge to the Bus entity by IDs.
+func (suo *StationUpdateOne) AddNextForBusIDs(ids ...uuid.UUID) *StationUpdateOne {
+ suo.mutation.AddNextForBusIDs(ids...)
+ return suo
+}
+
+// AddNextForBuses adds the "next_for_buses" edges to the Bus entity.
+func (suo *StationUpdateOne) AddNextForBuses(b ...*Bus) *StationUpdateOne {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return suo.AddNextForBusIDs(ids...)
+}
+
+// AddBusRouteAssociationIDs adds the "busRouteAssociations" edge to the BusRouteAssociation entity by IDs.
+func (suo *StationUpdateOne) AddBusRouteAssociationIDs(ids ...int) *StationUpdateOne {
+ suo.mutation.AddBusRouteAssociationIDs(ids...)
+ return suo
+}
+
+// AddBusRouteAssociations adds the "busRouteAssociations" edges to the BusRouteAssociation entity.
+func (suo *StationUpdateOne) AddBusRouteAssociations(b ...*BusRouteAssociation) *StationUpdateOne {
+ ids := make([]int, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return suo.AddBusRouteAssociationIDs(ids...)
+}
+
+// Mutation returns the StationMutation object of the builder.
+func (suo *StationUpdateOne) Mutation() *StationMutation {
+ return suo.mutation
+}
+
+// ClearGuardian clears the "guardian" edge to the Guardian entity.
+func (suo *StationUpdateOne) ClearGuardian() *StationUpdateOne {
+ suo.mutation.ClearGuardian()
+ return suo
+}
+
+// ClearNextForBuses clears all "next_for_buses" edges to the Bus entity.
+func (suo *StationUpdateOne) ClearNextForBuses() *StationUpdateOne {
+ suo.mutation.ClearNextForBuses()
+ return suo
+}
+
+// RemoveNextForBusIDs removes the "next_for_buses" edge to Bus entities by IDs.
+func (suo *StationUpdateOne) RemoveNextForBusIDs(ids ...uuid.UUID) *StationUpdateOne {
+ suo.mutation.RemoveNextForBusIDs(ids...)
+ return suo
+}
+
+// RemoveNextForBuses removes "next_for_buses" edges to Bus entities.
+func (suo *StationUpdateOne) RemoveNextForBuses(b ...*Bus) *StationUpdateOne {
+ ids := make([]uuid.UUID, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return suo.RemoveNextForBusIDs(ids...)
+}
+
+// ClearBusRouteAssociations clears all "busRouteAssociations" edges to the BusRouteAssociation entity.
+func (suo *StationUpdateOne) ClearBusRouteAssociations() *StationUpdateOne {
+ suo.mutation.ClearBusRouteAssociations()
+ return suo
+}
+
+// RemoveBusRouteAssociationIDs removes the "busRouteAssociations" edge to BusRouteAssociation entities by IDs.
+func (suo *StationUpdateOne) RemoveBusRouteAssociationIDs(ids ...int) *StationUpdateOne {
+ suo.mutation.RemoveBusRouteAssociationIDs(ids...)
+ return suo
+}
+
+// RemoveBusRouteAssociations removes "busRouteAssociations" edges to BusRouteAssociation entities.
+func (suo *StationUpdateOne) RemoveBusRouteAssociations(b ...*BusRouteAssociation) *StationUpdateOne {
+ ids := make([]int, len(b))
+ for i := range b {
+ ids[i] = b[i].ID
+ }
+ return suo.RemoveBusRouteAssociationIDs(ids...)
+}
+
+// Where appends a list predicates to the StationUpdate builder.
+func (suo *StationUpdateOne) Where(ps ...predicate.Station) *StationUpdateOne {
+ suo.mutation.Where(ps...)
+ return suo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (suo *StationUpdateOne) Select(field string, fields ...string) *StationUpdateOne {
+ suo.fields = append([]string{field}, fields...)
+ return suo
+}
+
+// Save executes the query and returns the updated Station entity.
+func (suo *StationUpdateOne) Save(ctx context.Context) (*Station, error) {
+ suo.defaults()
+ return withHooks(ctx, suo.sqlSave, suo.mutation, suo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (suo *StationUpdateOne) SaveX(ctx context.Context) *Station {
+ node, err := suo.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// Exec executes the query on the entity.
+func (suo *StationUpdateOne) Exec(ctx context.Context) error {
+ _, err := suo.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (suo *StationUpdateOne) ExecX(ctx context.Context) {
+ if err := suo.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (suo *StationUpdateOne) defaults() {
+ if _, ok := suo.mutation.UpdatedAt(); !ok {
+ v := station.UpdateDefaultUpdatedAt()
+ suo.mutation.SetUpdatedAt(v)
+ }
+}
+
+func (suo *StationUpdateOne) sqlSave(ctx context.Context) (_node *Station, err error) {
+ _spec := sqlgraph.NewUpdateSpec(station.Table, station.Columns, sqlgraph.NewFieldSpec(station.FieldID, field.TypeUUID))
+ id, ok := suo.mutation.ID()
+ if !ok {
+ return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Station.id" for update`)}
+ }
+ _spec.Node.ID.Value = id
+ if fields := suo.fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, station.FieldID)
+ for _, f := range fields {
+ if !station.ValidColumn(f) {
+ return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ if f != station.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, f)
+ }
+ }
+ }
+ if ps := suo.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := suo.mutation.Latitude(); ok {
+ _spec.SetField(station.FieldLatitude, field.TypeFloat64, value)
+ }
+ if value, ok := suo.mutation.AddedLatitude(); ok {
+ _spec.AddField(station.FieldLatitude, field.TypeFloat64, value)
+ }
+ if suo.mutation.LatitudeCleared() {
+ _spec.ClearField(station.FieldLatitude, field.TypeFloat64)
+ }
+ if value, ok := suo.mutation.Longitude(); ok {
+ _spec.SetField(station.FieldLongitude, field.TypeFloat64, value)
+ }
+ if value, ok := suo.mutation.AddedLongitude(); ok {
+ _spec.AddField(station.FieldLongitude, field.TypeFloat64, value)
+ }
+ if suo.mutation.LongitudeCleared() {
+ _spec.ClearField(station.FieldLongitude, field.TypeFloat64)
+ }
+ if value, ok := suo.mutation.CreatedAt(); ok {
+ _spec.SetField(station.FieldCreatedAt, field.TypeTime, value)
+ }
+ if value, ok := suo.mutation.UpdatedAt(); ok {
+ _spec.SetField(station.FieldUpdatedAt, field.TypeTime, value)
+ }
+ if suo.mutation.GuardianCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2O,
+ Inverse: true,
+ Table: station.GuardianTable,
+ Columns: []string{station.GuardianColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := suo.mutation.GuardianIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2O,
+ Inverse: true,
+ Table: station.GuardianTable,
+ Columns: []string{station.GuardianColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(guardian.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if suo.mutation.NextForBusesCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: station.NextForBusesTable,
+ Columns: []string{station.NextForBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := suo.mutation.RemovedNextForBusesIDs(); len(nodes) > 0 && !suo.mutation.NextForBusesCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: station.NextForBusesTable,
+ Columns: []string{station.NextForBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := suo.mutation.NextForBusesIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: true,
+ Table: station.NextForBusesTable,
+ Columns: []string{station.NextForBusesColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(bus.FieldID, field.TypeUUID),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ if suo.mutation.BusRouteAssociationsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: station.BusRouteAssociationsTable,
+ Columns: []string{station.BusRouteAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt),
+ },
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := suo.mutation.RemovedBusRouteAssociationsIDs(); len(nodes) > 0 && !suo.mutation.BusRouteAssociationsCleared() {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: station.BusRouteAssociationsTable,
+ Columns: []string{station.BusRouteAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
+ }
+ if nodes := suo.mutation.BusRouteAssociationsIDs(); len(nodes) > 0 {
+ edge := &sqlgraph.EdgeSpec{
+ Rel: sqlgraph.O2M,
+ Inverse: false,
+ Table: station.BusRouteAssociationsTable,
+ Columns: []string{station.BusRouteAssociationsColumn},
+ Bidi: false,
+ Target: &sqlgraph.EdgeTarget{
+ IDSpec: sqlgraph.NewFieldSpec(busrouteassociation.FieldID, field.TypeInt),
+ },
+ }
+ for _, k := range nodes {
+ edge.Target.Nodes = append(edge.Target.Nodes, k)
+ }
+ _spec.Edges.Add = append(_spec.Edges.Add, edge)
+ }
+ _node = &Station{config: suo.config}
+ _spec.Assign = _node.assignValues
+ _spec.ScanValues = _node.scanValues
+ if err = sqlgraph.UpdateNode(ctx, suo.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{station.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ suo.mutation.done = true
+ return _node, nil
+}
diff --git a/backend/domain/repository/ent/tx.go b/backend/domain/repository/ent/tx.go
new file mode 100644
index 00000000..12a7dd20
--- /dev/null
+++ b/backend/domain/repository/ent/tx.go
@@ -0,0 +1,237 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "sync"
+
+ "entgo.io/ent/dialect"
+)
+
+// Tx is a transactional client that is created by calling Client.Tx().
+type Tx struct {
+ config
+ // BoardingRecord is the client for interacting with the BoardingRecord builders.
+ BoardingRecord *BoardingRecordClient
+ // Bus is the client for interacting with the Bus builders.
+ Bus *BusClient
+ // BusRoute is the client for interacting with the BusRoute builders.
+ BusRoute *BusRouteClient
+ // BusRouteAssociation is the client for interacting with the BusRouteAssociation builders.
+ BusRouteAssociation *BusRouteAssociationClient
+ // Child is the client for interacting with the Child builders.
+ Child *ChildClient
+ // ChildBusAssociation is the client for interacting with the ChildBusAssociation builders.
+ ChildBusAssociation *ChildBusAssociationClient
+ // ChildPhoto is the client for interacting with the ChildPhoto builders.
+ ChildPhoto *ChildPhotoClient
+ // Guardian is the client for interacting with the Guardian builders.
+ Guardian *GuardianClient
+ // Nursery is the client for interacting with the Nursery builders.
+ Nursery *NurseryClient
+ // Station is the client for interacting with the Station builders.
+ Station *StationClient
+
+ // lazily loaded.
+ client *Client
+ clientOnce sync.Once
+ // ctx lives for the life of the transaction. It is
+ // the same context used by the underlying connection.
+ ctx context.Context
+}
+
+type (
+ // Committer is the interface that wraps the Commit method.
+ Committer interface {
+ Commit(context.Context, *Tx) error
+ }
+
+ // The CommitFunc type is an adapter to allow the use of ordinary
+ // function as a Committer. If f is a function with the appropriate
+ // signature, CommitFunc(f) is a Committer that calls f.
+ CommitFunc func(context.Context, *Tx) error
+
+ // CommitHook defines the "commit middleware". A function that gets a Committer
+ // and returns a Committer. For example:
+ //
+ // hook := func(next ent.Committer) ent.Committer {
+ // return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error {
+ // // Do some stuff before.
+ // if err := next.Commit(ctx, tx); err != nil {
+ // return err
+ // }
+ // // Do some stuff after.
+ // return nil
+ // })
+ // }
+ //
+ CommitHook func(Committer) Committer
+)
+
+// Commit calls f(ctx, m).
+func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error {
+ return f(ctx, tx)
+}
+
+// Commit commits the transaction.
+func (tx *Tx) Commit() error {
+ txDriver := tx.config.driver.(*txDriver)
+ var fn Committer = CommitFunc(func(context.Context, *Tx) error {
+ return txDriver.tx.Commit()
+ })
+ txDriver.mu.Lock()
+ hooks := append([]CommitHook(nil), txDriver.onCommit...)
+ txDriver.mu.Unlock()
+ for i := len(hooks) - 1; i >= 0; i-- {
+ fn = hooks[i](fn)
+ }
+ return fn.Commit(tx.ctx, tx)
+}
+
+// OnCommit adds a hook to call on commit.
+func (tx *Tx) OnCommit(f CommitHook) {
+ txDriver := tx.config.driver.(*txDriver)
+ txDriver.mu.Lock()
+ txDriver.onCommit = append(txDriver.onCommit, f)
+ txDriver.mu.Unlock()
+}
+
+type (
+ // Rollbacker is the interface that wraps the Rollback method.
+ Rollbacker interface {
+ Rollback(context.Context, *Tx) error
+ }
+
+ // The RollbackFunc type is an adapter to allow the use of ordinary
+ // function as a Rollbacker. If f is a function with the appropriate
+ // signature, RollbackFunc(f) is a Rollbacker that calls f.
+ RollbackFunc func(context.Context, *Tx) error
+
+ // RollbackHook defines the "rollback middleware". A function that gets a Rollbacker
+ // and returns a Rollbacker. For example:
+ //
+ // hook := func(next ent.Rollbacker) ent.Rollbacker {
+ // return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error {
+ // // Do some stuff before.
+ // if err := next.Rollback(ctx, tx); err != nil {
+ // return err
+ // }
+ // // Do some stuff after.
+ // return nil
+ // })
+ // }
+ //
+ RollbackHook func(Rollbacker) Rollbacker
+)
+
+// Rollback calls f(ctx, m).
+func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error {
+ return f(ctx, tx)
+}
+
+// Rollback rollbacks the transaction.
+func (tx *Tx) Rollback() error {
+ txDriver := tx.config.driver.(*txDriver)
+ var fn Rollbacker = RollbackFunc(func(context.Context, *Tx) error {
+ return txDriver.tx.Rollback()
+ })
+ txDriver.mu.Lock()
+ hooks := append([]RollbackHook(nil), txDriver.onRollback...)
+ txDriver.mu.Unlock()
+ for i := len(hooks) - 1; i >= 0; i-- {
+ fn = hooks[i](fn)
+ }
+ return fn.Rollback(tx.ctx, tx)
+}
+
+// OnRollback adds a hook to call on rollback.
+func (tx *Tx) OnRollback(f RollbackHook) {
+ txDriver := tx.config.driver.(*txDriver)
+ txDriver.mu.Lock()
+ txDriver.onRollback = append(txDriver.onRollback, f)
+ txDriver.mu.Unlock()
+}
+
+// Client returns a Client that binds to current transaction.
+func (tx *Tx) Client() *Client {
+ tx.clientOnce.Do(func() {
+ tx.client = &Client{config: tx.config}
+ tx.client.init()
+ })
+ return tx.client
+}
+
+func (tx *Tx) init() {
+ tx.BoardingRecord = NewBoardingRecordClient(tx.config)
+ tx.Bus = NewBusClient(tx.config)
+ tx.BusRoute = NewBusRouteClient(tx.config)
+ tx.BusRouteAssociation = NewBusRouteAssociationClient(tx.config)
+ tx.Child = NewChildClient(tx.config)
+ tx.ChildBusAssociation = NewChildBusAssociationClient(tx.config)
+ tx.ChildPhoto = NewChildPhotoClient(tx.config)
+ tx.Guardian = NewGuardianClient(tx.config)
+ tx.Nursery = NewNurseryClient(tx.config)
+ tx.Station = NewStationClient(tx.config)
+}
+
+// txDriver wraps the given dialect.Tx with a nop dialect.Driver implementation.
+// The idea is to support transactions without adding any extra code to the builders.
+// When a builder calls to driver.Tx(), it gets the same dialect.Tx instance.
+// Commit and Rollback are nop for the internal builders and the user must call one
+// of them in order to commit or rollback the transaction.
+//
+// If a closed transaction is embedded in one of the generated entities, and the entity
+// applies a query, for example: BoardingRecord.QueryXXX(), the query will be executed
+// through the driver which created this transaction.
+//
+// Note that txDriver is not goroutine safe.
+type txDriver struct {
+ // the driver we started the transaction from.
+ drv dialect.Driver
+ // tx is the underlying transaction.
+ tx dialect.Tx
+ // completion hooks.
+ mu sync.Mutex
+ onCommit []CommitHook
+ onRollback []RollbackHook
+}
+
+// newTx creates a new transactional driver.
+func newTx(ctx context.Context, drv dialect.Driver) (*txDriver, error) {
+ tx, err := drv.Tx(ctx)
+ if err != nil {
+ return nil, err
+ }
+ return &txDriver{tx: tx, drv: drv}, nil
+}
+
+// Tx returns the transaction wrapper (txDriver) to avoid Commit or Rollback calls
+// from the internal builders. Should be called only by the internal builders.
+func (tx *txDriver) Tx(context.Context) (dialect.Tx, error) { return tx, nil }
+
+// Dialect returns the dialect of the driver we started the transaction from.
+func (tx *txDriver) Dialect() string { return tx.drv.Dialect() }
+
+// Close is a nop close.
+func (*txDriver) Close() error { return nil }
+
+// Commit is a nop commit for the internal builders.
+// User must call `Tx.Commit` in order to commit the transaction.
+func (*txDriver) Commit() error { return nil }
+
+// Rollback is a nop rollback for the internal builders.
+// User must call `Tx.Rollback` in order to rollback the transaction.
+func (*txDriver) Rollback() error { return nil }
+
+// Exec calls tx.Exec.
+func (tx *txDriver) Exec(ctx context.Context, query string, args, v any) error {
+ return tx.tx.Exec(ctx, query, args, v)
+}
+
+// Query calls tx.Query.
+func (tx *txDriver) Query(ctx context.Context, query string, args, v any) error {
+ return tx.tx.Query(ctx, query, args, v)
+}
+
+var _ dialect.Driver = (*txDriver)(nil)
diff --git a/backend/go.mod b/backend/go.mod
new file mode 100644
index 00000000..ebf9f509
--- /dev/null
+++ b/backend/go.mod
@@ -0,0 +1,64 @@
+module github.com/GreenTeaProgrammers/WhereChildBus/backend
+
+go 1.21.5
+
+require (
+ entgo.io/ent v0.13.0
+ github.com/google/uuid v1.5.0
+ google.golang.org/api v0.157.0
+)
+
+require (
+ cloud.google.com/go v0.112.0 // indirect
+ cloud.google.com/go/compute v1.23.3 // indirect
+ cloud.google.com/go/compute/metadata v0.2.3 // indirect
+ cloud.google.com/go/iam v1.1.5 // indirect
+ github.com/felixge/httpsnoop v1.0.4 // indirect
+ github.com/go-logr/logr v1.3.0 // indirect
+ github.com/go-logr/stdr v1.2.2 // indirect
+ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
+ github.com/google/s2a-go v0.1.7 // indirect
+ github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
+ github.com/googleapis/gax-go/v2 v2.12.0 // indirect
+ go.opencensus.io v0.24.0 // indirect
+ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect
+ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect
+ go.opentelemetry.io/otel v1.21.0 // indirect
+ go.opentelemetry.io/otel/metric v1.21.0 // indirect
+ go.opentelemetry.io/otel/trace v1.21.0 // indirect
+ golang.org/x/oauth2 v0.16.0 // indirect
+ golang.org/x/sync v0.6.0 // indirect
+ golang.org/x/time v0.5.0 // indirect
+ google.golang.org/appengine v1.6.8 // indirect
+ google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac // indirect
+ google.golang.org/genproto/googleapis/api v0.0.0-20240122161410-6c6643bf1457 // indirect
+ google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect
+)
+
+require (
+ github.com/golang/protobuf v1.5.3 // indirect
+ golang.org/x/net v0.20.0 // indirect
+ golang.org/x/sys v0.17.0 // indirect
+ google.golang.org/grpc v1.61.0
+ google.golang.org/protobuf v1.32.0
+)
+
+require (
+ ariga.io/atlas v0.19.1-0.20240203083654-5948b60a8e43 // indirect
+ cloud.google.com/go/storage v1.37.0
+ github.com/agext/levenshtein v1.2.1 // indirect
+ github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
+ github.com/go-openapi/inflect v0.19.0 // indirect
+ github.com/go-sql-driver/mysql v1.7.1
+ github.com/google/go-cmp v0.6.0 // indirect
+ github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.1
+ github.com/hashicorp/hcl/v2 v2.13.0 // indirect
+ github.com/joho/godotenv v1.5.1
+ github.com/kelseyhightower/envconfig v1.4.0
+ github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect
+ github.com/zclconf/go-cty v1.8.0 // indirect
+ golang.org/x/crypto v0.19.0
+ golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3
+ golang.org/x/mod v0.14.0 // indirect
+ golang.org/x/text v0.14.0 // indirect
+)
diff --git a/backend/go.sum b/backend/go.sum
new file mode 100644
index 00000000..80f613e2
--- /dev/null
+++ b/backend/go.sum
@@ -0,0 +1,253 @@
+ariga.io/atlas v0.19.1-0.20240203083654-5948b60a8e43 h1:GwdJbXydHCYPedeeLt4x/lrlIISQ4JTH1mRWuE5ZZ14=
+ariga.io/atlas v0.19.1-0.20240203083654-5948b60a8e43/go.mod h1:uj3pm+hUTVN/X5yfdBexHlZv+1Xu5u5ZbZx7+CDavNU=
+cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM=
+cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4=
+cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk=
+cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI=
+cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY=
+cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
+cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI=
+cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8=
+cloud.google.com/go/storage v1.37.0 h1:WI8CsaFO8Q9KjPVtsZ5Cmi0dXV25zMoX0FklT7c3Jm4=
+cloud.google.com/go/storage v1.37.0/go.mod h1:i34TiT2IhiNDmcj65PqwCjcoUX7Z5pLzS8DEmoiFq1k=
+entgo.io/ent v0.13.0 h1:DclxWczaCpyiKn6ZWVcJjq1zIKtJ11iNKy+08lNYsJE=
+entgo.io/ent v0.13.0/go.mod h1:+oU8oGna69xy29O+g+NEz+/TM7yJDhQQGJfuOWq1pT8=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
+github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
+github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8=
+github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
+github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
+github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
+github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
+github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
+github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101 h1:7To3pQ+pZo0i3dsWEbinPNFs5gPSBOsJtx3wTT94VBY=
+github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
+github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
+github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
+github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
+github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA=
+github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE=
+github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
+github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
+github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
+github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY=
+github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
+github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
+github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
+github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
+github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
+github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
+github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
+github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
+github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
+github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
+github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
+github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
+github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
+github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
+github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
+github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
+github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
+github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
+github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
+github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
+github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
+github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
+github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
+github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw=
+github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk=
+github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o=
+github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw=
+github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
+github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs=
+github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0=
+github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas=
+github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU=
+github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.1 h1:HcUWd006luQPljE73d5sk+/VgYPGUReEVz2y1/qylwY=
+github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.1/go.mod h1:w9Y7gY31krpLmrVU5ZPG9H7l9fZuRu5/3R3S3FMtVQ4=
+github.com/hashicorp/hcl/v2 v2.13.0 h1:0Apadu1w6M11dyGFxWnmhhcMjkbAiKCv7G1r/2QgCNc=
+github.com/hashicorp/hcl/v2 v2.13.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0=
+github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
+github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
+github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=
+github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
+github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
+github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
+github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
+github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
+github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
+github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM=
+github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
+github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
+github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
+github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
+github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
+github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
+github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
+github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
+github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
+github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
+github.com/zclconf/go-cty v1.8.0 h1:s4AvqaeQzJIu3ndv4gVIhplVD0krU+bgrcLSVUnaWuA=
+github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
+go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
+go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
+go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 h1:SpGay3w+nEwMpfVnbqOLH5gY52/foP8RE8UzTZ1pdSE=
+go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE=
+go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24=
+go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo=
+go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc=
+go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo=
+go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4=
+go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM=
+go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8=
+go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E=
+go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc=
+go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
+golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
+golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 h1:/RIbNt/Zr7rVhIkQhooTxCxFcdWLGIKnZA4IXNFSrvo=
+golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
+golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
+golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
+golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
+golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
+golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
+golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
+golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
+golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ=
+golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o=
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
+golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
+golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
+golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
+golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
+golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
+golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
+golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
+golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU=
+golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90=
+google.golang.org/api v0.157.0 h1:ORAeqmbrrozeyw5NjnMxh7peHO0UzV4wWYSwZeCUb20=
+google.golang.org/api v0.157.0/go.mod h1:+z4v4ufbZ1WEpld6yMGHyggs+PmAHiaLNj5ytP3N01g=
+google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
+google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
+google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
+google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
+google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
+google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
+google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac h1:ZL/Teoy/ZGnzyrqK/Optxxp2pmVh+fmJ97slxSRyzUg=
+google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:+Rvu7ElI+aLzyDQhpHMFMMltsD6m7nqpuWDd2CwJw3k=
+google.golang.org/genproto/googleapis/api v0.0.0-20240122161410-6c6643bf1457 h1:KHBtwE+eQc3+NxpjmRFlQ3pJQ2FNnhhgB9xOV8kyBuU=
+google.golang.org/genproto/googleapis/api v0.0.0-20240122161410-6c6643bf1457/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac h1:nUQEQmH/csSvFECKYRv6HWEyypysidKl2I6Qpsglq/0=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA=
+google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
+google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
+google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
+google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0=
+google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs=
+google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
+google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
+google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
+google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
+google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
+google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
+google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
+google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
diff --git a/backend/gprc_server/grpc_server.go b/backend/gprc_server/grpc_server.go
new file mode 100644
index 00000000..afbd1b05
--- /dev/null
+++ b/backend/gprc_server/grpc_server.go
@@ -0,0 +1,77 @@
+package grpc_server
+
+import (
+ "context"
+
+ grpc_interfaces "github.com/GreenTeaProgrammers/WhereChildBus/backend/interfaces"
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/bus"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/guardian"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/nursery"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/station"
+ "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging"
+ "golang.org/x/exp/slog"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/reflection"
+)
+
+func New(opts ...optionFunc) *grpc.Server {
+ opt := defaultOption()
+ for _, f := range opts {
+ f(opt)
+ }
+
+ serverOptions := make([]grpc.ServerOption, 0)
+
+ // set logging interceptor
+ serverOptions = append(serverOptions,
+ grpc.ChainUnaryInterceptor(logging.UnaryServerInterceptor(interceptorLogger(opt.logger))),
+ grpc.ChainStreamInterceptor(logging.StreamServerInterceptor(interceptorLogger(opt.logger))),
+ )
+
+ // set maximum message sizes
+ maxMsgSize := 100 * 1024 * 1024 // 100MB
+ serverOptions = append(serverOptions, grpc.MaxRecvMsgSize(maxMsgSize), grpc.MaxSendMsgSize(maxMsgSize))
+
+ srv := grpc.NewServer(serverOptions...)
+ if opt.useReflection {
+ reflection.Register(srv)
+ }
+
+ busInteractor := bus.NewInteractor(opt.entClient, opt.logger, opt.MLClient)
+ busSrv := grpc_interfaces.NewBusServiceServer(busInteractor)
+ pb.RegisterBusServiceServer(srv, busSrv)
+
+ busRouteInteractor := busroute.NewInteractor(opt.entClient, opt.logger, opt.MLClient)
+ busRouteSrv := grpc_interfaces.NewBusRouteServiceServer(busRouteInteractor)
+ pb.RegisterBusRouteServiceServer(srv, busRouteSrv)
+
+ childInteractor := child.NewInteractor(opt.entClient, opt.logger, opt.storageClient, opt.MLClient, opt.bucketName) // NOTE: GCSを使うのでstorageClientとbucketNameを渡す
+ childSrv := grpc_interfaces.NewChildServiceServer(childInteractor)
+ pb.RegisterChildServiceServer(srv, childSrv)
+
+ guardianInteractor := guardian.NewInteractor(opt.entClient, opt.logger)
+ guardianSrv := grpc_interfaces.NewGuardianServiceServer(guardianInteractor)
+ pb.RegisterGuardianServiceServer(srv, guardianSrv)
+
+ healthcheckSrv := grpc_interfaces.NewHealthcheckServiceServer()
+ pb.RegisterHealthcheckServiceServer(srv, healthcheckSrv)
+
+ nurseryInteractor := nursery.NewInteractor(opt.entClient, opt.logger)
+ nurserySrv := grpc_interfaces.NewNurseryServiceServer(nurseryInteractor)
+ pb.RegisterNurseryServiceServer(srv, nurserySrv)
+
+ stationInteractor := station.NewInteractor(opt.entClient, opt.logger)
+ stationSrv := grpc_interfaces.NewStationServiceServer(stationInteractor)
+ pb.RegisterStationServiceServer(srv, stationSrv)
+
+ return srv
+}
+
+func interceptorLogger(l *slog.Logger) logging.Logger {
+ return logging.LoggerFunc(func(ctx context.Context, lvl logging.Level, msg string, fields ...any) {
+ l.Log(ctx, slog.Level(lvl), msg, fields...)
+ })
+}
diff --git a/backend/gprc_server/option.go b/backend/gprc_server/option.go
new file mode 100644
index 00000000..d783c115
--- /dev/null
+++ b/backend/gprc_server/option.go
@@ -0,0 +1,62 @@
+package grpc_server
+
+import (
+ "cloud.google.com/go/storage"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent"
+ mlv1 "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/machine_learning/v1"
+ "golang.org/x/exp/slog"
+)
+
+type option struct {
+ logger *slog.Logger
+ entClient *ent.Client
+ storageClient *storage.Client
+ bucketName string
+ useReflection bool
+ MLClient mlv1.MachineLearningServiceClient
+}
+
+func defaultOption() *option {
+ return &option{
+ logger: slog.Default(),
+ }
+}
+
+type optionFunc func(*option)
+
+func WithLogger(logger *slog.Logger) optionFunc {
+ return func(o *option) {
+ o.logger = logger
+ }
+}
+
+// publish grpc server information(method, service, etc.)
+func WithReflection(b bool) optionFunc {
+ return func(o *option) {
+ o.useReflection = b
+ }
+}
+
+func WithEntClient(c *ent.Client) optionFunc {
+ return func(o *option) {
+ o.entClient = c
+ }
+}
+
+func WithStorageClient(s *storage.Client) optionFunc {
+ return func(o *option) {
+ o.storageClient = s
+ }
+}
+
+func WithBucketName(b string) optionFunc {
+ return func(o *option) {
+ o.bucketName = b
+ }
+}
+
+func WithMLClient(c mlv1.MachineLearningServiceClient) optionFunc {
+ return func(o *option) {
+ o.MLClient = c
+ }
+}
diff --git a/backend/interfaces/bus.go b/backend/interfaces/bus.go
new file mode 100644
index 00000000..844a4b0b
--- /dev/null
+++ b/backend/interfaces/bus.go
@@ -0,0 +1,56 @@
+package interfaces
+
+import (
+ "context"
+
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/bus"
+)
+
+type busServiceServer struct {
+ interactor *bus.Interactor
+}
+
+func NewBusServiceServer(interactor *bus.Interactor) pb.BusServiceServer {
+ return &busServiceServer{interactor}
+}
+
+// GetRunningBusByGuardianId implements where_child_busv1.BusServiceServer.
+func (s *busServiceServer) GetRunningBusByGuardianId(ctx context.Context, req *pb.GetRunningBusByGuardianIdRequest) (*pb.GetRunningBusByGuardianIdResponse, error) {
+ return s.interactor.GetRunningBusByGuardianID(ctx, req)
+}
+
+// UpdateBus implements where_child_busv1.BusServiceServer.
+func (s *busServiceServer) UpdateBus(ctx context.Context, req *pb.UpdateBusRequest) (*pb.UpdateBusResponse, error) {
+ return s.interactor.UpdateBus(ctx, req)
+}
+
+// SendLocationContinuous implements where_child_busv1.BusServiceServer.
+func (s *busServiceServer) SendLocationContinuous(stream pb.BusService_SendLocationContinuousServer) error {
+ return s.interactor.SendLocationContinuous(stream)
+}
+
+// TrackBusContinuous implements where_child_busv1.BusServiceServer.
+func (s *busServiceServer) TrackBusContinuous(req *pb.TrackBusContinuousRequest, stream pb.BusService_TrackBusContinuousServer) error {
+ return s.interactor.TrackBusContinuous(req, stream)
+}
+
+// StreamBusVideo implements where_child_busv1.BusServiceServer.
+func (s *busServiceServer) StreamBusVideo(stream pb.BusService_StreamBusVideoServer) error {
+ return s.interactor.StreamBusVideo(stream)
+}
+
+// CreateBus implements where_child_busv1.BusServiceServer.
+func (s *busServiceServer) CreateBus(ctx context.Context, req *pb.CreateBusRequest) (*pb.CreateBusResponse, error) {
+ return s.interactor.CreateBus(ctx, req)
+}
+
+// GetBusListByNurseryId implements where_child_busv1.BusServiceServer.
+func (s *busServiceServer) GetBusListByNurseryId(ctx context.Context, req *pb.GetBusListByNurseryIdRequest) (*pb.GetBusListByNurseryIdResponse, error) {
+ return s.interactor.GetBusListByNurseryID(ctx, req)
+}
+
+// ChangeBusStatus implements where_child_busv1.BusServiceServer.
+func (s *busServiceServer) ChangeBusStatus(ctx context.Context, req *pb.ChangeBusStatusRequest) (*pb.ChangeBusStatusResponse, error) {
+ return s.interactor.ChangeBusStatus(ctx, req)
+}
diff --git a/backend/interfaces/bus_route.go b/backend/interfaces/bus_route.go
new file mode 100644
index 00000000..d4180b15
--- /dev/null
+++ b/backend/interfaces/bus_route.go
@@ -0,0 +1,26 @@
+package interfaces
+
+import (
+ "context"
+
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/busroute"
+)
+
+type busRouteServiceServer struct {
+ interactor *busroute.Interactor
+}
+
+func NewBusRouteServiceServer(interactor *busroute.Interactor) pb.BusRouteServiceServer {
+ return &busRouteServiceServer{interactor}
+}
+
+// CreateBusRoute implements where_child_busv1.BusRouteServiceServer.
+func (s *busRouteServiceServer) CreateBusRoute(ctx context.Context, req *pb.CreateBusRouteRequest) (*pb.CreateBusRouteResponse, error) {
+ return s.interactor.CreateBusRoute(ctx, req)
+}
+
+// GetBusRoute implements where_child_busv1.BusRouteServiceServer.
+func (s *busRouteServiceServer) GetBusRouteByBusID(ctx context.Context, req *pb.GetBusRouteByBusIDRequest) (*pb.GetBusRouteByBusIDResponse, error) {
+ return s.interactor.GetBusRouteByBusID(ctx, req)
+}
diff --git a/backend/interfaces/child.go b/backend/interfaces/child.go
new file mode 100644
index 00000000..9813be83
--- /dev/null
+++ b/backend/interfaces/child.go
@@ -0,0 +1,46 @@
+package interfaces
+
+import (
+ "context"
+
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/child"
+)
+
+type childServiceServer struct {
+ interactor *child.Interactor
+}
+
+func NewChildServiceServer(interactor *child.Interactor) pb.ChildServiceServer {
+ return &childServiceServer{interactor}
+}
+
+// CheckIsChildInBus implements where_child_busv1.ChildServiceServer.
+func (s *childServiceServer) CheckIsChildInBus(ctx context.Context, req *pb.CheckIsChildInBusRequest) (*pb.CheckIsChildInBusResponse, error) {
+ return s.interactor.CheckIsChildInBus(ctx, req)
+}
+
+// GetChildListByBusID implements where_child_busv1.ChildServiceServer.
+func (s *childServiceServer) GetChildListByBusID(ctx context.Context, req *pb.GetChildListByBusIDRequest) (*pb.GetChildListByBusIDResponse, error) {
+ return s.interactor.GetChildListByBusID(ctx, req)
+}
+
+// CreateChild implements where_child_busv1.ChildServiceServer.
+func (s *childServiceServer) CreateChild(ctx context.Context, req *pb.CreateChildRequest) (*pb.CreateChildResponse, error) {
+ return s.interactor.CreateChild(ctx, req)
+}
+
+// GetChildListByGuardianID implements where_child_busv1.ChildServiceServer.
+func (s *childServiceServer) GetChildListByGuardianID(ctx context.Context, req *pb.GetChildListByGuardianIDRequest) (*pb.GetChildListByGuardianIDResponse, error) {
+ return s.interactor.GetChildListByGuardianID(ctx, req)
+}
+
+// GetChildListByNurseryID implements where_child_busv1.ChildServiceServer.
+func (s *childServiceServer) GetChildListByNurseryID(ctx context.Context, req *pb.GetChildListByNurseryIDRequest) (*pb.GetChildListByNurseryIDResponse, error) {
+ return s.interactor.GetChildListByNurseryID(ctx, req)
+}
+
+// UpdateChild implements where_child_busv1.ChildServiceServer.
+func (s *childServiceServer) UpdateChild(ctx context.Context, req *pb.UpdateChildRequest) (*pb.UpdateChildResponse, error) {
+ return s.interactor.UpdateChild(ctx, req)
+}
diff --git a/backend/interfaces/guardian.go b/backend/interfaces/guardian.go
new file mode 100644
index 00000000..eeb2d593
--- /dev/null
+++ b/backend/interfaces/guardian.go
@@ -0,0 +1,46 @@
+package interfaces
+
+import (
+ "context"
+
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/guardian"
+)
+
+type guardianServiceServer struct {
+ interactor *guardian.Interactor
+}
+
+func NewGuardianServiceServer(interactor *guardian.Interactor) pb.GuardianServiceServer {
+ return &guardianServiceServer{interactor}
+}
+
+// CreateGuardian implements where_child_busv1.GuardianServiceServer.
+func (s *guardianServiceServer) CreateGuardian(ctx context.Context, req *pb.CreateGuardianRequest) (*pb.CreateGuardianResponse, error) {
+ return s.interactor.CreateGuardian(ctx, req)
+}
+
+// GuardianLogin implements where_child_busv1.GuardianServiceServer.
+func (s *guardianServiceServer) GuardianLogin(ctx context.Context, req *pb.GuardianLoginRequest) (*pb.GuardianLoginResponse, error) {
+ return s.interactor.GuardianLogin(ctx, req)
+}
+
+// GetGuardianListByBusId implements where_child_busv1.GuardianServiceServer.
+func (s *guardianServiceServer) GetGuardianListByBusId(ctx context.Context, req *pb.GetGuardianListByBusIdRequest) (*pb.GetGuardianListByBusIdResponse, error) {
+ return s.interactor.GetGuardianListByBusID(ctx, req)
+}
+
+// GetGuardianByChildId implements where_child_busv1.GuardianServiceServer.
+func (s *guardianServiceServer) GetGuardianByChildId(ctx context.Context, req *pb.GetGuardianByChildIdRequest) (*pb.GetGuardianByChildIdResponse, error) {
+ return s.interactor.GetGuardianByChildID(ctx, req)
+}
+
+// GetGuardianListByNurseryId implements where_child_busv1.GuardianServiceServer.
+func (s *guardianServiceServer) GetGuardianListByNurseryId(ctx context.Context, req *pb.GetGuardianListByNurseryIdRequest) (*pb.GetGuardianListByNurseryIdResponse, error) {
+ return s.interactor.GetGuardianListByNurseryID(ctx, req)
+}
+
+// UpdateGuardian implements where_child_busv1.GuardianServiceServer.
+func (s *guardianServiceServer) UpdateGuardian(ctx context.Context, req *pb.UpdateGuardianRequest) (*pb.UpdateGuardianResponse, error) {
+ return s.interactor.UpdateGuardian(ctx, req)
+}
diff --git a/backend/interfaces/healthcheck.go b/backend/interfaces/healthcheck.go
new file mode 100644
index 00000000..7f2018f6
--- /dev/null
+++ b/backend/interfaces/healthcheck.go
@@ -0,0 +1,22 @@
+package interfaces
+
+import (
+ "context"
+
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/healthcheck"
+)
+
+type healthcheckServiceServer struct {
+ healthcheckInteractor *healthcheck.Interactor
+}
+
+func NewHealthcheckServiceServer() pb.HealthcheckServiceServer {
+ return &healthcheckServiceServer{
+ healthcheckInteractor: healthcheck.NewInteractor(),
+ }
+}
+
+func (s *healthcheckServiceServer) Ping(ctx context.Context, req *pb.PingRequest) (*pb.PingResponse, error) {
+ return s.healthcheckInteractor.Ping(req), nil
+}
diff --git a/backend/interfaces/nursery.go b/backend/interfaces/nursery.go
new file mode 100644
index 00000000..60cf2069
--- /dev/null
+++ b/backend/interfaces/nursery.go
@@ -0,0 +1,35 @@
+package interfaces
+
+import (
+ "context"
+
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/nursery"
+)
+
+type nurseryServiceServer struct {
+ interactor *nursery.Interactor
+}
+
+func NewNurseryServiceServer(interactor *nursery.Interactor) pb.NurseryServiceServer {
+ return &nurseryServiceServer{interactor}
+}
+
+// GetNurseryByGuardianId implements where_child_busv1.NurseryServiceServer.
+func (s *nurseryServiceServer) GetNurseryByGuardianId(ctx context.Context, req *pb.GetNurseryByGuardianIdRequest) (*pb.GetNurseryByGuardianIdResponse, error) {
+ return s.interactor.GetNurseryByGuardianID(ctx, req)
+}
+
+// CreateNursery implements where_child_busv1.NurseryServiceServer.
+func (s *nurseryServiceServer) CreateNursery(ctx context.Context, req *pb.CreateNurseryRequest) (*pb.CreateNurseryResponse, error) {
+ return s.interactor.CreateNursery(ctx, req)
+}
+
+// UpdateNursery implements where_child_busv1.NurseryServiceServer.
+func (s *nurseryServiceServer) UpdateNursery(ctx context.Context, req *pb.UpdateNurseryRequest) (*pb.UpdateNurseryResponse, error) {
+ return s.interactor.UpdateNursery(ctx, req)
+}
+
+func (s *nurseryServiceServer) NurseryLogin(ctx context.Context, req *pb.NurseryLoginRequest) (*pb.NurseryLoginResponse, error) {
+ return s.interactor.NurseryLogin(ctx, req)
+}
diff --git a/backend/interfaces/station.go b/backend/interfaces/station.go
new file mode 100644
index 00000000..2428300d
--- /dev/null
+++ b/backend/interfaces/station.go
@@ -0,0 +1,36 @@
+package interfaces
+
+import (
+ "context"
+
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/station"
+)
+
+type stationServiceServer struct {
+ interactor *station.Interactor
+}
+
+func NewStationServiceServer(interactor *station.Interactor) pb.StationServiceServer {
+ return &stationServiceServer{interactor}
+}
+
+// GetUnregisteredStationList implements where_child_busv1.StationServiceServer.
+func (s *stationServiceServer) GetUnregisteredStationList(ctx context.Context, req *pb.GetUnregisteredStationListRequest) (*pb.GetUnregisteredStationListResponse, error) {
+ return s.interactor.GetUnregisteredStationList(ctx, req)
+}
+
+// UpdateStation implements where_child_busv1.StationServiceServer.
+func (s *stationServiceServer) UpdateStation(ctx context.Context, req *pb.UpdateStationRequest) (*pb.UpdateStationResponse, error) {
+ return s.interactor.UpdateStation(ctx, req)
+}
+
+// UpdateStationLocationByGuardianId implements where_child_busv1.StationServiceServer.
+func (s *stationServiceServer) UpdateStationLocationByGuardianId(ctx context.Context, req *pb.UpdateStationLocationByGuardianIdRequest) (*pb.UpdateStationLocationByGuardianIdResponse, error) {
+ return s.interactor.UpdateStationLocationByGuardianID(ctx, req)
+}
+
+// GetStationListByBusId implements where_child_busv1.StationServiceServer.
+func (s *stationServiceServer) GetStationListByBusId(ctx context.Context, req *pb.GetStationListByBusIdRequest) (*pb.GetStationListByBusIdResponse, error) {
+ return s.interactor.GetStationListByBusId(ctx, req)
+}
diff --git a/backend/proto-gen/go/machine_learning/v1/health_check.pb.go b/backend/proto-gen/go/machine_learning/v1/health_check.pb.go
new file mode 100644
index 00000000..7bc89c15
--- /dev/null
+++ b/backend/proto-gen/go/machine_learning/v1/health_check.pb.go
@@ -0,0 +1,230 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.32.0
+// protoc (unknown)
+// source: machine_learning/v1/health_check.proto
+
+package machine_learningv1
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type PingRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+}
+
+func (x *PingRequest) Reset() {
+ *x = PingRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_machine_learning_v1_health_check_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PingRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PingRequest) ProtoMessage() {}
+
+func (x *PingRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_machine_learning_v1_health_check_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PingRequest.ProtoReflect.Descriptor instead.
+func (*PingRequest) Descriptor() ([]byte, []int) {
+ return file_machine_learning_v1_health_check_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *PingRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+type PingResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
+}
+
+func (x *PingResponse) Reset() {
+ *x = PingResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_machine_learning_v1_health_check_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PingResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PingResponse) ProtoMessage() {}
+
+func (x *PingResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_machine_learning_v1_health_check_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PingResponse.ProtoReflect.Descriptor instead.
+func (*PingResponse) Descriptor() ([]byte, []int) {
+ return file_machine_learning_v1_health_check_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *PingResponse) GetMessage() string {
+ if x != nil {
+ return x.Message
+ }
+ return ""
+}
+
+var File_machine_learning_v1_health_check_proto protoreflect.FileDescriptor
+
+var file_machine_learning_v1_health_check_proto_rawDesc = []byte{
+ 0x0a, 0x26, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x6c, 0x65, 0x61, 0x72, 0x6e, 0x69,
+ 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x63, 0x68, 0x65,
+ 0x63, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e,
+ 0x65, 0x5f, 0x6c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x22, 0x21, 0x0a,
+ 0x0b, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04,
+ 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
+ 0x22, 0x28, 0x0a, 0x0c, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x61, 0x0a, 0x12, 0x48, 0x65,
+ 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
+ 0x12, 0x4b, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x20, 0x2e, 0x6d, 0x61, 0x63, 0x68, 0x69,
+ 0x6e, 0x65, 0x5f, 0x6c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x50,
+ 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, 0x61, 0x63,
+ 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x6c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31,
+ 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xfe, 0x01,
+ 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x6c, 0x65,
+ 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x48, 0x65, 0x61, 0x6c, 0x74,
+ 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x68, 0x67,
+ 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x65, 0x6e, 0x54,
+ 0x65, 0x61, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x6d, 0x65, 0x72, 0x73, 0x2f, 0x57, 0x68,
+ 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x2f, 0x62, 0x61, 0x63, 0x6b,
+ 0x65, 0x6e, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f,
+ 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x6c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e,
+ 0x67, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x6c, 0x65, 0x61,
+ 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x58, 0x58, 0xaa, 0x02, 0x12,
+ 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x2e,
+ 0x56, 0x31, 0xca, 0x02, 0x12, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x65, 0x61, 0x72,
+ 0x6e, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e,
+ 0x65, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42,
+ 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x4d, 0x61, 0x63, 0x68, 0x69,
+ 0x6e, 0x65, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_machine_learning_v1_health_check_proto_rawDescOnce sync.Once
+ file_machine_learning_v1_health_check_proto_rawDescData = file_machine_learning_v1_health_check_proto_rawDesc
+)
+
+func file_machine_learning_v1_health_check_proto_rawDescGZIP() []byte {
+ file_machine_learning_v1_health_check_proto_rawDescOnce.Do(func() {
+ file_machine_learning_v1_health_check_proto_rawDescData = protoimpl.X.CompressGZIP(file_machine_learning_v1_health_check_proto_rawDescData)
+ })
+ return file_machine_learning_v1_health_check_proto_rawDescData
+}
+
+var file_machine_learning_v1_health_check_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
+var file_machine_learning_v1_health_check_proto_goTypes = []interface{}{
+ (*PingRequest)(nil), // 0: machine_learning.v1.PingRequest
+ (*PingResponse)(nil), // 1: machine_learning.v1.PingResponse
+}
+var file_machine_learning_v1_health_check_proto_depIdxs = []int32{
+ 0, // 0: machine_learning.v1.HealthcheckService.Ping:input_type -> machine_learning.v1.PingRequest
+ 1, // 1: machine_learning.v1.HealthcheckService.Ping:output_type -> machine_learning.v1.PingResponse
+ 1, // [1:2] is the sub-list for method output_type
+ 0, // [0:1] is the sub-list for method input_type
+ 0, // [0:0] is the sub-list for extension type_name
+ 0, // [0:0] is the sub-list for extension extendee
+ 0, // [0:0] is the sub-list for field type_name
+}
+
+func init() { file_machine_learning_v1_health_check_proto_init() }
+func file_machine_learning_v1_health_check_proto_init() {
+ if File_machine_learning_v1_health_check_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_machine_learning_v1_health_check_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PingRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_machine_learning_v1_health_check_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PingResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_machine_learning_v1_health_check_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 2,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_machine_learning_v1_health_check_proto_goTypes,
+ DependencyIndexes: file_machine_learning_v1_health_check_proto_depIdxs,
+ MessageInfos: file_machine_learning_v1_health_check_proto_msgTypes,
+ }.Build()
+ File_machine_learning_v1_health_check_proto = out.File
+ file_machine_learning_v1_health_check_proto_rawDesc = nil
+ file_machine_learning_v1_health_check_proto_goTypes = nil
+ file_machine_learning_v1_health_check_proto_depIdxs = nil
+}
diff --git a/backend/proto-gen/go/machine_learning/v1/health_check_grpc.pb.go b/backend/proto-gen/go/machine_learning/v1/health_check_grpc.pb.go
new file mode 100644
index 00000000..badb00cc
--- /dev/null
+++ b/backend/proto-gen/go/machine_learning/v1/health_check_grpc.pb.go
@@ -0,0 +1,107 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.3.0
+// - protoc (unknown)
+// source: machine_learning/v1/health_check.proto
+
+package machine_learningv1
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+const (
+ HealthcheckService_Ping_FullMethodName = "/machine_learning.v1.HealthcheckService/Ping"
+)
+
+// HealthcheckServiceClient is the client API for HealthcheckService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type HealthcheckServiceClient interface {
+ Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error)
+}
+
+type healthcheckServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewHealthcheckServiceClient(cc grpc.ClientConnInterface) HealthcheckServiceClient {
+ return &healthcheckServiceClient{cc}
+}
+
+func (c *healthcheckServiceClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) {
+ out := new(PingResponse)
+ err := c.cc.Invoke(ctx, HealthcheckService_Ping_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// HealthcheckServiceServer is the server API for HealthcheckService service.
+// All implementations should embed UnimplementedHealthcheckServiceServer
+// for forward compatibility
+type HealthcheckServiceServer interface {
+ Ping(context.Context, *PingRequest) (*PingResponse, error)
+}
+
+// UnimplementedHealthcheckServiceServer should be embedded to have forward compatible implementations.
+type UnimplementedHealthcheckServiceServer struct {
+}
+
+func (UnimplementedHealthcheckServiceServer) Ping(context.Context, *PingRequest) (*PingResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
+}
+
+// UnsafeHealthcheckServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to HealthcheckServiceServer will
+// result in compilation errors.
+type UnsafeHealthcheckServiceServer interface {
+ mustEmbedUnimplementedHealthcheckServiceServer()
+}
+
+func RegisterHealthcheckServiceServer(s grpc.ServiceRegistrar, srv HealthcheckServiceServer) {
+ s.RegisterService(&HealthcheckService_ServiceDesc, srv)
+}
+
+func _HealthcheckService_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(PingRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(HealthcheckServiceServer).Ping(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: HealthcheckService_Ping_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(HealthcheckServiceServer).Ping(ctx, req.(*PingRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// HealthcheckService_ServiceDesc is the grpc.ServiceDesc for HealthcheckService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var HealthcheckService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "machine_learning.v1.HealthcheckService",
+ HandlerType: (*HealthcheckServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "Ping",
+ Handler: _HealthcheckService_Ping_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "machine_learning/v1/health_check.proto",
+}
diff --git a/backend/proto-gen/go/machine_learning/v1/machine_learning.pb.go b/backend/proto-gen/go/machine_learning/v1/machine_learning.pb.go
new file mode 100644
index 00000000..e030f835
--- /dev/null
+++ b/backend/proto-gen/go/machine_learning/v1/machine_learning.pb.go
@@ -0,0 +1,566 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.32.0
+// protoc (unknown)
+// source: machine_learning/v1/machine_learning.proto
+
+package machine_learningv1
+
+import (
+ v1 "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type Status int32
+
+const (
+ Status_STATUS_UNSPECIFIED Status = 0
+ Status_STATUS_SUCCESS Status = 1
+ Status_STATUS_PROCESSING Status = 2
+ Status_STATUS_FAILED Status = 3
+ Status_STATUS_WAITING Status = 4
+)
+
+// Enum value maps for Status.
+var (
+ Status_name = map[int32]string{
+ 0: "STATUS_UNSPECIFIED",
+ 1: "STATUS_SUCCESS",
+ 2: "STATUS_PROCESSING",
+ 3: "STATUS_FAILED",
+ 4: "STATUS_WAITING",
+ }
+ Status_value = map[string]int32{
+ "STATUS_UNSPECIFIED": 0,
+ "STATUS_SUCCESS": 1,
+ "STATUS_PROCESSING": 2,
+ "STATUS_FAILED": 3,
+ "STATUS_WAITING": 4,
+ }
+)
+
+func (x Status) Enum() *Status {
+ p := new(Status)
+ *p = x
+ return p
+}
+
+func (x Status) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (Status) Descriptor() protoreflect.EnumDescriptor {
+ return file_machine_learning_v1_machine_learning_proto_enumTypes[0].Descriptor()
+}
+
+func (Status) Type() protoreflect.EnumType {
+ return &file_machine_learning_v1_machine_learning_proto_enumTypes[0]
+}
+
+func (x Status) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use Status.Descriptor instead.
+func (Status) EnumDescriptor() ([]byte, []int) {
+ return file_machine_learning_v1_machine_learning_proto_rawDescGZIP(), []int{0}
+}
+
+type TrainRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ NurseryId string `protobuf:"bytes,1,opt,name=nursery_id,json=nurseryId,proto3" json:"nursery_id,omitempty"`
+ BusId string `protobuf:"bytes,2,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+ ChildIds []string `protobuf:"bytes,3,rep,name=child_ids,json=childIds,proto3" json:"child_ids,omitempty"`
+ BusType v1.BusType `protobuf:"varint,4,opt,name=bus_type,json=busType,proto3,enum=where_child_bus.v1.BusType" json:"bus_type,omitempty"`
+}
+
+func (x *TrainRequest) Reset() {
+ *x = TrainRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_machine_learning_v1_machine_learning_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *TrainRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*TrainRequest) ProtoMessage() {}
+
+func (x *TrainRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_machine_learning_v1_machine_learning_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use TrainRequest.ProtoReflect.Descriptor instead.
+func (*TrainRequest) Descriptor() ([]byte, []int) {
+ return file_machine_learning_v1_machine_learning_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *TrainRequest) GetNurseryId() string {
+ if x != nil {
+ return x.NurseryId
+ }
+ return ""
+}
+
+func (x *TrainRequest) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+func (x *TrainRequest) GetChildIds() []string {
+ if x != nil {
+ return x.ChildIds
+ }
+ return nil
+}
+
+func (x *TrainRequest) GetBusType() v1.BusType {
+ if x != nil {
+ return x.BusType
+ }
+ return v1.BusType(0)
+}
+
+type TrainResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Status Status `protobuf:"varint,1,opt,name=status,proto3,enum=machine_learning.v1.Status" json:"status,omitempty"`
+}
+
+func (x *TrainResponse) Reset() {
+ *x = TrainResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_machine_learning_v1_machine_learning_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *TrainResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*TrainResponse) ProtoMessage() {}
+
+func (x *TrainResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_machine_learning_v1_machine_learning_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use TrainResponse.ProtoReflect.Descriptor instead.
+func (*TrainResponse) Descriptor() ([]byte, []int) {
+ return file_machine_learning_v1_machine_learning_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *TrainResponse) GetStatus() Status {
+ if x != nil {
+ return x.Status
+ }
+ return Status_STATUS_UNSPECIFIED
+}
+
+type PredResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ IsDetected bool `protobuf:"varint,1,opt,name=is_detected,json=isDetected,proto3" json:"is_detected,omitempty"`
+ ChildIds []string `protobuf:"bytes,2,rep,name=child_ids,json=childIds,proto3" json:"child_ids,omitempty"`
+}
+
+func (x *PredResponse) Reset() {
+ *x = PredResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_machine_learning_v1_machine_learning_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PredResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PredResponse) ProtoMessage() {}
+
+func (x *PredResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_machine_learning_v1_machine_learning_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PredResponse.ProtoReflect.Descriptor instead.
+func (*PredResponse) Descriptor() ([]byte, []int) {
+ return file_machine_learning_v1_machine_learning_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *PredResponse) GetIsDetected() bool {
+ if x != nil {
+ return x.IsDetected
+ }
+ return false
+}
+
+func (x *PredResponse) GetChildIds() []string {
+ if x != nil {
+ return x.ChildIds
+ }
+ return nil
+}
+
+type FaceDetectAndClipRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ NurseryId string `protobuf:"bytes,1,opt,name=nursery_id,json=nurseryId,proto3" json:"nursery_id,omitempty"`
+ ChildId string `protobuf:"bytes,2,opt,name=child_id,json=childId,proto3" json:"child_id,omitempty"`
+}
+
+func (x *FaceDetectAndClipRequest) Reset() {
+ *x = FaceDetectAndClipRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_machine_learning_v1_machine_learning_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *FaceDetectAndClipRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FaceDetectAndClipRequest) ProtoMessage() {}
+
+func (x *FaceDetectAndClipRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_machine_learning_v1_machine_learning_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use FaceDetectAndClipRequest.ProtoReflect.Descriptor instead.
+func (*FaceDetectAndClipRequest) Descriptor() ([]byte, []int) {
+ return file_machine_learning_v1_machine_learning_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *FaceDetectAndClipRequest) GetNurseryId() string {
+ if x != nil {
+ return x.NurseryId
+ }
+ return ""
+}
+
+func (x *FaceDetectAndClipRequest) GetChildId() string {
+ if x != nil {
+ return x.ChildId
+ }
+ return ""
+}
+
+type FaceDetectAndClipResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ IsStarted bool `protobuf:"varint,1,opt,name=is_started,json=isStarted,proto3" json:"is_started,omitempty"`
+}
+
+func (x *FaceDetectAndClipResponse) Reset() {
+ *x = FaceDetectAndClipResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_machine_learning_v1_machine_learning_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *FaceDetectAndClipResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FaceDetectAndClipResponse) ProtoMessage() {}
+
+func (x *FaceDetectAndClipResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_machine_learning_v1_machine_learning_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use FaceDetectAndClipResponse.ProtoReflect.Descriptor instead.
+func (*FaceDetectAndClipResponse) Descriptor() ([]byte, []int) {
+ return file_machine_learning_v1_machine_learning_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *FaceDetectAndClipResponse) GetIsStarted() bool {
+ if x != nil {
+ return x.IsStarted
+ }
+ return false
+}
+
+var File_machine_learning_v1_machine_learning_proto protoreflect.FileDescriptor
+
+var file_machine_learning_v1_machine_learning_proto_rawDesc = []byte{
+ 0x0a, 0x2a, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x6c, 0x65, 0x61, 0x72, 0x6e, 0x69,
+ 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x6c, 0x65,
+ 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x6d, 0x61,
+ 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x6c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x76,
+ 0x31, 0x1a, 0x1c, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62,
+ 0x75, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
+ 0x22, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73,
+ 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x22, 0x99, 0x01, 0x0a, 0x0c, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71,
+ 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x5f,
+ 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72,
+ 0x79, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x62, 0x75, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x75, 0x73, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x68,
+ 0x69, 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x73, 0x12, 0x36, 0x0a, 0x08, 0x62, 0x75, 0x73, 0x5f, 0x74,
+ 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x77, 0x68, 0x65, 0x72,
+ 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42,
+ 0x75, 0x73, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x62, 0x75, 0x73, 0x54, 0x79, 0x70, 0x65, 0x22,
+ 0x44, 0x0a, 0x0d, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x12, 0x33, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e,
+ 0x32, 0x1b, 0x2e, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x6c, 0x65, 0x61, 0x72, 0x6e,
+ 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73,
+ 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x4c, 0x0a, 0x0c, 0x50, 0x72, 0x65, 0x64, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x73, 0x5f, 0x64, 0x65, 0x74, 0x65,
+ 0x63, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x44, 0x65,
+ 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f,
+ 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64,
+ 0x49, 0x64, 0x73, 0x22, 0x54, 0x0a, 0x18, 0x46, 0x61, 0x63, 0x65, 0x44, 0x65, 0x74, 0x65, 0x63,
+ 0x74, 0x41, 0x6e, 0x64, 0x43, 0x6c, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
+ 0x1d, 0x0a, 0x0a, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x19,
+ 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x07, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x22, 0x3a, 0x0a, 0x19, 0x46, 0x61, 0x63,
+ 0x65, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x41, 0x6e, 0x64, 0x43, 0x6c, 0x69, 0x70, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x73, 0x74, 0x61,
+ 0x72, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x53, 0x74,
+ 0x61, 0x72, 0x74, 0x65, 0x64, 0x2a, 0x72, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12,
+ 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43,
+ 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x54, 0x41, 0x54, 0x55,
+ 0x53, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x53,
+ 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x50, 0x52, 0x4f, 0x43, 0x45, 0x53, 0x53, 0x49, 0x4e, 0x47,
+ 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x46, 0x41, 0x49,
+ 0x4c, 0x45, 0x44, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f,
+ 0x57, 0x41, 0x49, 0x54, 0x49, 0x4e, 0x47, 0x10, 0x04, 0x32, 0xb8, 0x02, 0x0a, 0x16, 0x4d, 0x61,
+ 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72,
+ 0x76, 0x69, 0x63, 0x65, 0x12, 0x50, 0x0a, 0x05, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x12, 0x21, 0x2e,
+ 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x6c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67,
+ 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+ 0x1a, 0x22, 0x2e, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x6c, 0x65, 0x61, 0x72, 0x6e,
+ 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70,
+ 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x58, 0x0a, 0x04, 0x50, 0x72, 0x65, 0x64, 0x12, 0x29,
+ 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73,
+ 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x42, 0x75, 0x73, 0x56, 0x69, 0x64,
+ 0x65, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, 0x61, 0x63, 0x68,
+ 0x69, 0x6e, 0x65, 0x5f, 0x6c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e,
+ 0x50, 0x72, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x30, 0x01,
+ 0x12, 0x72, 0x0a, 0x11, 0x46, 0x61, 0x63, 0x65, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x41, 0x6e,
+ 0x64, 0x43, 0x6c, 0x69, 0x70, 0x12, 0x2d, 0x2e, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f,
+ 0x6c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x61, 0x63, 0x65,
+ 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x41, 0x6e, 0x64, 0x43, 0x6c, 0x69, 0x70, 0x52, 0x65, 0x71,
+ 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x6c,
+ 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x61, 0x63, 0x65, 0x44,
+ 0x65, 0x74, 0x65, 0x63, 0x74, 0x41, 0x6e, 0x64, 0x43, 0x6c, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70,
+ 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x82, 0x02, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x61, 0x63,
+ 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x6c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31,
+ 0x42, 0x14, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e,
+ 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x68, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
+ 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x65, 0x6e, 0x54, 0x65, 0x61, 0x50, 0x72, 0x6f,
+ 0x67, 0x72, 0x61, 0x6d, 0x6d, 0x65, 0x72, 0x73, 0x2f, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68,
+ 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2f, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x6d, 0x61, 0x63, 0x68,
+ 0x69, 0x6e, 0x65, 0x5f, 0x6c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x3b,
+ 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x6c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67,
+ 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x58, 0x58, 0xaa, 0x02, 0x12, 0x4d, 0x61, 0x63, 0x68, 0x69,
+ 0x6e, 0x65, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12,
+ 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x5c,
+ 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x65, 0x61, 0x72,
+ 0x6e, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64,
+ 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x65, 0x61,
+ 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x33,
+}
+
+var (
+ file_machine_learning_v1_machine_learning_proto_rawDescOnce sync.Once
+ file_machine_learning_v1_machine_learning_proto_rawDescData = file_machine_learning_v1_machine_learning_proto_rawDesc
+)
+
+func file_machine_learning_v1_machine_learning_proto_rawDescGZIP() []byte {
+ file_machine_learning_v1_machine_learning_proto_rawDescOnce.Do(func() {
+ file_machine_learning_v1_machine_learning_proto_rawDescData = protoimpl.X.CompressGZIP(file_machine_learning_v1_machine_learning_proto_rawDescData)
+ })
+ return file_machine_learning_v1_machine_learning_proto_rawDescData
+}
+
+var file_machine_learning_v1_machine_learning_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
+var file_machine_learning_v1_machine_learning_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
+var file_machine_learning_v1_machine_learning_proto_goTypes = []interface{}{
+ (Status)(0), // 0: machine_learning.v1.Status
+ (*TrainRequest)(nil), // 1: machine_learning.v1.TrainRequest
+ (*TrainResponse)(nil), // 2: machine_learning.v1.TrainResponse
+ (*PredResponse)(nil), // 3: machine_learning.v1.PredResponse
+ (*FaceDetectAndClipRequest)(nil), // 4: machine_learning.v1.FaceDetectAndClipRequest
+ (*FaceDetectAndClipResponse)(nil), // 5: machine_learning.v1.FaceDetectAndClipResponse
+ (v1.BusType)(0), // 6: where_child_bus.v1.BusType
+ (*v1.StreamBusVideoRequest)(nil), // 7: where_child_bus.v1.StreamBusVideoRequest
+}
+var file_machine_learning_v1_machine_learning_proto_depIdxs = []int32{
+ 6, // 0: machine_learning.v1.TrainRequest.bus_type:type_name -> where_child_bus.v1.BusType
+ 0, // 1: machine_learning.v1.TrainResponse.status:type_name -> machine_learning.v1.Status
+ 1, // 2: machine_learning.v1.MachineLearningService.Train:input_type -> machine_learning.v1.TrainRequest
+ 7, // 3: machine_learning.v1.MachineLearningService.Pred:input_type -> where_child_bus.v1.StreamBusVideoRequest
+ 4, // 4: machine_learning.v1.MachineLearningService.FaceDetectAndClip:input_type -> machine_learning.v1.FaceDetectAndClipRequest
+ 2, // 5: machine_learning.v1.MachineLearningService.Train:output_type -> machine_learning.v1.TrainResponse
+ 3, // 6: machine_learning.v1.MachineLearningService.Pred:output_type -> machine_learning.v1.PredResponse
+ 5, // 7: machine_learning.v1.MachineLearningService.FaceDetectAndClip:output_type -> machine_learning.v1.FaceDetectAndClipResponse
+ 5, // [5:8] is the sub-list for method output_type
+ 2, // [2:5] is the sub-list for method input_type
+ 2, // [2:2] is the sub-list for extension type_name
+ 2, // [2:2] is the sub-list for extension extendee
+ 0, // [0:2] is the sub-list for field type_name
+}
+
+func init() { file_machine_learning_v1_machine_learning_proto_init() }
+func file_machine_learning_v1_machine_learning_proto_init() {
+ if File_machine_learning_v1_machine_learning_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_machine_learning_v1_machine_learning_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*TrainRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_machine_learning_v1_machine_learning_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*TrainResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_machine_learning_v1_machine_learning_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PredResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_machine_learning_v1_machine_learning_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*FaceDetectAndClipRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_machine_learning_v1_machine_learning_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*FaceDetectAndClipResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_machine_learning_v1_machine_learning_proto_rawDesc,
+ NumEnums: 1,
+ NumMessages: 5,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_machine_learning_v1_machine_learning_proto_goTypes,
+ DependencyIndexes: file_machine_learning_v1_machine_learning_proto_depIdxs,
+ EnumInfos: file_machine_learning_v1_machine_learning_proto_enumTypes,
+ MessageInfos: file_machine_learning_v1_machine_learning_proto_msgTypes,
+ }.Build()
+ File_machine_learning_v1_machine_learning_proto = out.File
+ file_machine_learning_v1_machine_learning_proto_rawDesc = nil
+ file_machine_learning_v1_machine_learning_proto_goTypes = nil
+ file_machine_learning_v1_machine_learning_proto_depIdxs = nil
+}
diff --git a/backend/proto-gen/go/machine_learning/v1/machine_learning_grpc.pb.go b/backend/proto-gen/go/machine_learning/v1/machine_learning_grpc.pb.go
new file mode 100644
index 00000000..13b6c838
--- /dev/null
+++ b/backend/proto-gen/go/machine_learning/v1/machine_learning_grpc.pb.go
@@ -0,0 +1,242 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.3.0
+// - protoc (unknown)
+// source: machine_learning/v1/machine_learning.proto
+
+package machine_learningv1
+
+import (
+ context "context"
+ v1 "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+const (
+ MachineLearningService_Train_FullMethodName = "/machine_learning.v1.MachineLearningService/Train"
+ MachineLearningService_Pred_FullMethodName = "/machine_learning.v1.MachineLearningService/Pred"
+ MachineLearningService_FaceDetectAndClip_FullMethodName = "/machine_learning.v1.MachineLearningService/FaceDetectAndClip"
+)
+
+// MachineLearningServiceClient is the client API for MachineLearningService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type MachineLearningServiceClient interface {
+ Train(ctx context.Context, in *TrainRequest, opts ...grpc.CallOption) (MachineLearningService_TrainClient, error)
+ Pred(ctx context.Context, opts ...grpc.CallOption) (MachineLearningService_PredClient, error)
+ FaceDetectAndClip(ctx context.Context, in *FaceDetectAndClipRequest, opts ...grpc.CallOption) (*FaceDetectAndClipResponse, error)
+}
+
+type machineLearningServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewMachineLearningServiceClient(cc grpc.ClientConnInterface) MachineLearningServiceClient {
+ return &machineLearningServiceClient{cc}
+}
+
+func (c *machineLearningServiceClient) Train(ctx context.Context, in *TrainRequest, opts ...grpc.CallOption) (MachineLearningService_TrainClient, error) {
+ stream, err := c.cc.NewStream(ctx, &MachineLearningService_ServiceDesc.Streams[0], MachineLearningService_Train_FullMethodName, opts...)
+ if err != nil {
+ return nil, err
+ }
+ x := &machineLearningServiceTrainClient{stream}
+ if err := x.ClientStream.SendMsg(in); err != nil {
+ return nil, err
+ }
+ if err := x.ClientStream.CloseSend(); err != nil {
+ return nil, err
+ }
+ return x, nil
+}
+
+type MachineLearningService_TrainClient interface {
+ Recv() (*TrainResponse, error)
+ grpc.ClientStream
+}
+
+type machineLearningServiceTrainClient struct {
+ grpc.ClientStream
+}
+
+func (x *machineLearningServiceTrainClient) Recv() (*TrainResponse, error) {
+ m := new(TrainResponse)
+ if err := x.ClientStream.RecvMsg(m); err != nil {
+ return nil, err
+ }
+ return m, nil
+}
+
+func (c *machineLearningServiceClient) Pred(ctx context.Context, opts ...grpc.CallOption) (MachineLearningService_PredClient, error) {
+ stream, err := c.cc.NewStream(ctx, &MachineLearningService_ServiceDesc.Streams[1], MachineLearningService_Pred_FullMethodName, opts...)
+ if err != nil {
+ return nil, err
+ }
+ x := &machineLearningServicePredClient{stream}
+ return x, nil
+}
+
+type MachineLearningService_PredClient interface {
+ Send(*v1.StreamBusVideoRequest) error
+ Recv() (*PredResponse, error)
+ grpc.ClientStream
+}
+
+type machineLearningServicePredClient struct {
+ grpc.ClientStream
+}
+
+func (x *machineLearningServicePredClient) Send(m *v1.StreamBusVideoRequest) error {
+ return x.ClientStream.SendMsg(m)
+}
+
+func (x *machineLearningServicePredClient) Recv() (*PredResponse, error) {
+ m := new(PredResponse)
+ if err := x.ClientStream.RecvMsg(m); err != nil {
+ return nil, err
+ }
+ return m, nil
+}
+
+func (c *machineLearningServiceClient) FaceDetectAndClip(ctx context.Context, in *FaceDetectAndClipRequest, opts ...grpc.CallOption) (*FaceDetectAndClipResponse, error) {
+ out := new(FaceDetectAndClipResponse)
+ err := c.cc.Invoke(ctx, MachineLearningService_FaceDetectAndClip_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// MachineLearningServiceServer is the server API for MachineLearningService service.
+// All implementations should embed UnimplementedMachineLearningServiceServer
+// for forward compatibility
+type MachineLearningServiceServer interface {
+ Train(*TrainRequest, MachineLearningService_TrainServer) error
+ Pred(MachineLearningService_PredServer) error
+ FaceDetectAndClip(context.Context, *FaceDetectAndClipRequest) (*FaceDetectAndClipResponse, error)
+}
+
+// UnimplementedMachineLearningServiceServer should be embedded to have forward compatible implementations.
+type UnimplementedMachineLearningServiceServer struct {
+}
+
+func (UnimplementedMachineLearningServiceServer) Train(*TrainRequest, MachineLearningService_TrainServer) error {
+ return status.Errorf(codes.Unimplemented, "method Train not implemented")
+}
+func (UnimplementedMachineLearningServiceServer) Pred(MachineLearningService_PredServer) error {
+ return status.Errorf(codes.Unimplemented, "method Pred not implemented")
+}
+func (UnimplementedMachineLearningServiceServer) FaceDetectAndClip(context.Context, *FaceDetectAndClipRequest) (*FaceDetectAndClipResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method FaceDetectAndClip not implemented")
+}
+
+// UnsafeMachineLearningServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to MachineLearningServiceServer will
+// result in compilation errors.
+type UnsafeMachineLearningServiceServer interface {
+ mustEmbedUnimplementedMachineLearningServiceServer()
+}
+
+func RegisterMachineLearningServiceServer(s grpc.ServiceRegistrar, srv MachineLearningServiceServer) {
+ s.RegisterService(&MachineLearningService_ServiceDesc, srv)
+}
+
+func _MachineLearningService_Train_Handler(srv interface{}, stream grpc.ServerStream) error {
+ m := new(TrainRequest)
+ if err := stream.RecvMsg(m); err != nil {
+ return err
+ }
+ return srv.(MachineLearningServiceServer).Train(m, &machineLearningServiceTrainServer{stream})
+}
+
+type MachineLearningService_TrainServer interface {
+ Send(*TrainResponse) error
+ grpc.ServerStream
+}
+
+type machineLearningServiceTrainServer struct {
+ grpc.ServerStream
+}
+
+func (x *machineLearningServiceTrainServer) Send(m *TrainResponse) error {
+ return x.ServerStream.SendMsg(m)
+}
+
+func _MachineLearningService_Pred_Handler(srv interface{}, stream grpc.ServerStream) error {
+ return srv.(MachineLearningServiceServer).Pred(&machineLearningServicePredServer{stream})
+}
+
+type MachineLearningService_PredServer interface {
+ Send(*PredResponse) error
+ Recv() (*v1.StreamBusVideoRequest, error)
+ grpc.ServerStream
+}
+
+type machineLearningServicePredServer struct {
+ grpc.ServerStream
+}
+
+func (x *machineLearningServicePredServer) Send(m *PredResponse) error {
+ return x.ServerStream.SendMsg(m)
+}
+
+func (x *machineLearningServicePredServer) Recv() (*v1.StreamBusVideoRequest, error) {
+ m := new(v1.StreamBusVideoRequest)
+ if err := x.ServerStream.RecvMsg(m); err != nil {
+ return nil, err
+ }
+ return m, nil
+}
+
+func _MachineLearningService_FaceDetectAndClip_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(FaceDetectAndClipRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(MachineLearningServiceServer).FaceDetectAndClip(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: MachineLearningService_FaceDetectAndClip_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(MachineLearningServiceServer).FaceDetectAndClip(ctx, req.(*FaceDetectAndClipRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// MachineLearningService_ServiceDesc is the grpc.ServiceDesc for MachineLearningService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var MachineLearningService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "machine_learning.v1.MachineLearningService",
+ HandlerType: (*MachineLearningServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "FaceDetectAndClip",
+ Handler: _MachineLearningService_FaceDetectAndClip_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{
+ {
+ StreamName: "Train",
+ Handler: _MachineLearningService_Train_Handler,
+ ServerStreams: true,
+ },
+ {
+ StreamName: "Pred",
+ Handler: _MachineLearningService_Pred_Handler,
+ ServerStreams: true,
+ ClientStreams: true,
+ },
+ },
+ Metadata: "machine_learning/v1/machine_learning.proto",
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/bus.pb.go b/backend/proto-gen/go/where_child_bus/v1/bus.pb.go
new file mode 100644
index 00000000..a846655b
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/bus.pb.go
@@ -0,0 +1,1444 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.32.0
+// protoc (unknown)
+// source: where_child_bus/v1/bus.proto
+
+package where_child_busv1
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type CreateBusRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ NurseryId string `protobuf:"bytes,1,opt,name=nursery_id,json=nurseryId,proto3" json:"nursery_id,omitempty"`
+ Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
+ PlateNumber string `protobuf:"bytes,3,opt,name=plate_number,json=plateNumber,proto3" json:"plate_number,omitempty"`
+}
+
+func (x *CreateBusRequest) Reset() {
+ *x = CreateBusRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreateBusRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateBusRequest) ProtoMessage() {}
+
+func (x *CreateBusRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateBusRequest.ProtoReflect.Descriptor instead.
+func (*CreateBusRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *CreateBusRequest) GetNurseryId() string {
+ if x != nil {
+ return x.NurseryId
+ }
+ return ""
+}
+
+func (x *CreateBusRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *CreateBusRequest) GetPlateNumber() string {
+ if x != nil {
+ return x.PlateNumber
+ }
+ return ""
+}
+
+type CreateBusResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Bus *Bus `protobuf:"bytes,1,opt,name=bus,proto3" json:"bus,omitempty"`
+}
+
+func (x *CreateBusResponse) Reset() {
+ *x = CreateBusResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreateBusResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateBusResponse) ProtoMessage() {}
+
+func (x *CreateBusResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateBusResponse.ProtoReflect.Descriptor instead.
+func (*CreateBusResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *CreateBusResponse) GetBus() *Bus {
+ if x != nil {
+ return x.Bus
+ }
+ return nil
+}
+
+type GetBusListByNurseryIdRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ NurseryId string `protobuf:"bytes,1,opt,name=nursery_id,json=nurseryId,proto3" json:"nursery_id,omitempty"`
+}
+
+func (x *GetBusListByNurseryIdRequest) Reset() {
+ *x = GetBusListByNurseryIdRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetBusListByNurseryIdRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetBusListByNurseryIdRequest) ProtoMessage() {}
+
+func (x *GetBusListByNurseryIdRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetBusListByNurseryIdRequest.ProtoReflect.Descriptor instead.
+func (*GetBusListByNurseryIdRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *GetBusListByNurseryIdRequest) GetNurseryId() string {
+ if x != nil {
+ return x.NurseryId
+ }
+ return ""
+}
+
+type GetBusListByNurseryIdResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Buses []*Bus `protobuf:"bytes,1,rep,name=buses,proto3" json:"buses,omitempty"`
+}
+
+func (x *GetBusListByNurseryIdResponse) Reset() {
+ *x = GetBusListByNurseryIdResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetBusListByNurseryIdResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetBusListByNurseryIdResponse) ProtoMessage() {}
+
+func (x *GetBusListByNurseryIdResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetBusListByNurseryIdResponse.ProtoReflect.Descriptor instead.
+func (*GetBusListByNurseryIdResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *GetBusListByNurseryIdResponse) GetBuses() []*Bus {
+ if x != nil {
+ return x.Buses
+ }
+ return nil
+}
+
+type GetRunningBusByGuardianIdRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ GuardianId string `protobuf:"bytes,1,opt,name=guardian_id,json=guardianId,proto3" json:"guardian_id,omitempty"`
+}
+
+func (x *GetRunningBusByGuardianIdRequest) Reset() {
+ *x = GetRunningBusByGuardianIdRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetRunningBusByGuardianIdRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetRunningBusByGuardianIdRequest) ProtoMessage() {}
+
+func (x *GetRunningBusByGuardianIdRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetRunningBusByGuardianIdRequest.ProtoReflect.Descriptor instead.
+func (*GetRunningBusByGuardianIdRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *GetRunningBusByGuardianIdRequest) GetGuardianId() string {
+ if x != nil {
+ return x.GuardianId
+ }
+ return ""
+}
+
+type GetRunningBusByGuardianIdResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Bus *Bus `protobuf:"bytes,1,opt,name=bus,proto3" json:"bus,omitempty"`
+}
+
+func (x *GetRunningBusByGuardianIdResponse) Reset() {
+ *x = GetRunningBusByGuardianIdResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetRunningBusByGuardianIdResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetRunningBusByGuardianIdResponse) ProtoMessage() {}
+
+func (x *GetRunningBusByGuardianIdResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetRunningBusByGuardianIdResponse.ProtoReflect.Descriptor instead.
+func (*GetRunningBusByGuardianIdResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *GetRunningBusByGuardianIdResponse) GetBus() *Bus {
+ if x != nil {
+ return x.Bus
+ }
+ return nil
+}
+
+type ChangeBusStatusRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusId string `protobuf:"bytes,1,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+ BusStatus BusStatus `protobuf:"varint,2,opt,name=bus_status,json=busStatus,proto3,enum=where_child_bus.v1.BusStatus" json:"bus_status,omitempty"`
+ BusType BusType `protobuf:"varint,3,opt,name=bus_type,json=busType,proto3,enum=where_child_bus.v1.BusType" json:"bus_type,omitempty"`
+}
+
+func (x *ChangeBusStatusRequest) Reset() {
+ *x = ChangeBusStatusRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ChangeBusStatusRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ChangeBusStatusRequest) ProtoMessage() {}
+
+func (x *ChangeBusStatusRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ChangeBusStatusRequest.ProtoReflect.Descriptor instead.
+func (*ChangeBusStatusRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *ChangeBusStatusRequest) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+func (x *ChangeBusStatusRequest) GetBusStatus() BusStatus {
+ if x != nil {
+ return x.BusStatus
+ }
+ return BusStatus_BUS_STATUS_UNSPECIFIED
+}
+
+func (x *ChangeBusStatusRequest) GetBusType() BusType {
+ if x != nil {
+ return x.BusType
+ }
+ return BusType_BUS_TYPE_UNSPECIFIED
+}
+
+type ChangeBusStatusResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Bus *Bus `protobuf:"bytes,1,opt,name=bus,proto3" json:"bus,omitempty"`
+}
+
+func (x *ChangeBusStatusResponse) Reset() {
+ *x = ChangeBusStatusResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ChangeBusStatusResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ChangeBusStatusResponse) ProtoMessage() {}
+
+func (x *ChangeBusStatusResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ChangeBusStatusResponse.ProtoReflect.Descriptor instead.
+func (*ChangeBusStatusResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *ChangeBusStatusResponse) GetBus() *Bus {
+ if x != nil {
+ return x.Bus
+ }
+ return nil
+}
+
+// Updated and newly defined messages for the adjusted RPCs
+type SendLocationContinuousRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusId string `protobuf:"bytes,1,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+ Latitude float64 `protobuf:"fixed64,2,opt,name=latitude,proto3" json:"latitude,omitempty"`
+ Longitude float64 `protobuf:"fixed64,3,opt,name=longitude,proto3" json:"longitude,omitempty"`
+}
+
+func (x *SendLocationContinuousRequest) Reset() {
+ *x = SendLocationContinuousRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SendLocationContinuousRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SendLocationContinuousRequest) ProtoMessage() {}
+
+func (x *SendLocationContinuousRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[8]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SendLocationContinuousRequest.ProtoReflect.Descriptor instead.
+func (*SendLocationContinuousRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *SendLocationContinuousRequest) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+func (x *SendLocationContinuousRequest) GetLatitude() float64 {
+ if x != nil {
+ return x.Latitude
+ }
+ return 0
+}
+
+func (x *SendLocationContinuousRequest) GetLongitude() float64 {
+ if x != nil {
+ return x.Longitude
+ }
+ return 0
+}
+
+type SendLocationContinuousResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+}
+
+func (x *SendLocationContinuousResponse) Reset() {
+ *x = SendLocationContinuousResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SendLocationContinuousResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SendLocationContinuousResponse) ProtoMessage() {}
+
+func (x *SendLocationContinuousResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[9]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SendLocationContinuousResponse.ProtoReflect.Descriptor instead.
+func (*SendLocationContinuousResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_proto_rawDescGZIP(), []int{9}
+}
+
+type TrackBusContinuousRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusId string `protobuf:"bytes,1,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+}
+
+func (x *TrackBusContinuousRequest) Reset() {
+ *x = TrackBusContinuousRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *TrackBusContinuousRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*TrackBusContinuousRequest) ProtoMessage() {}
+
+func (x *TrackBusContinuousRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[10]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use TrackBusContinuousRequest.ProtoReflect.Descriptor instead.
+func (*TrackBusContinuousRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *TrackBusContinuousRequest) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+type TrackBusContinuousResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusId string `protobuf:"bytes,1,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+ Latitude float64 `protobuf:"fixed64,2,opt,name=latitude,proto3" json:"latitude,omitempty"`
+ Longitude float64 `protobuf:"fixed64,3,opt,name=longitude,proto3" json:"longitude,omitempty"`
+ NextStationId string `protobuf:"bytes,4,opt,name=next_station_id,json=nextStationId,proto3" json:"next_station_id,omitempty"`
+}
+
+func (x *TrackBusContinuousResponse) Reset() {
+ *x = TrackBusContinuousResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *TrackBusContinuousResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*TrackBusContinuousResponse) ProtoMessage() {}
+
+func (x *TrackBusContinuousResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[11]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use TrackBusContinuousResponse.ProtoReflect.Descriptor instead.
+func (*TrackBusContinuousResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *TrackBusContinuousResponse) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+func (x *TrackBusContinuousResponse) GetLatitude() float64 {
+ if x != nil {
+ return x.Latitude
+ }
+ return 0
+}
+
+func (x *TrackBusContinuousResponse) GetLongitude() float64 {
+ if x != nil {
+ return x.Longitude
+ }
+ return 0
+}
+
+func (x *TrackBusContinuousResponse) GetNextStationId() string {
+ if x != nil {
+ return x.NextStationId
+ }
+ return ""
+}
+
+type StreamBusVideoRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusId string `protobuf:"bytes,1,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+ NurseryId string `protobuf:"bytes,2,opt,name=nursery_id,json=nurseryId,proto3" json:"nursery_id,omitempty"`
+ BusType BusType `protobuf:"varint,3,opt,name=bus_type,json=busType,proto3,enum=where_child_bus.v1.BusType" json:"bus_type,omitempty"`
+ VehicleEvent VehicleEvent `protobuf:"varint,4,opt,name=vehicle_event,json=vehicleEvent,proto3,enum=where_child_bus.v1.VehicleEvent" json:"vehicle_event,omitempty"`
+ VideoChunk [][]byte `protobuf:"bytes,5,rep,name=video_chunk,json=videoChunk,proto3" json:"video_chunk,omitempty"` // Chunk of video data
+ PhotoHeight int32 `protobuf:"varint,6,opt,name=photo_height,json=photoHeight,proto3" json:"photo_height,omitempty"`
+ PhotoWidth int32 `protobuf:"varint,7,opt,name=photo_width,json=photoWidth,proto3" json:"photo_width,omitempty"`
+}
+
+func (x *StreamBusVideoRequest) Reset() {
+ *x = StreamBusVideoRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *StreamBusVideoRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*StreamBusVideoRequest) ProtoMessage() {}
+
+func (x *StreamBusVideoRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[12]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use StreamBusVideoRequest.ProtoReflect.Descriptor instead.
+func (*StreamBusVideoRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *StreamBusVideoRequest) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+func (x *StreamBusVideoRequest) GetNurseryId() string {
+ if x != nil {
+ return x.NurseryId
+ }
+ return ""
+}
+
+func (x *StreamBusVideoRequest) GetBusType() BusType {
+ if x != nil {
+ return x.BusType
+ }
+ return BusType_BUS_TYPE_UNSPECIFIED
+}
+
+func (x *StreamBusVideoRequest) GetVehicleEvent() VehicleEvent {
+ if x != nil {
+ return x.VehicleEvent
+ }
+ return VehicleEvent_VEHICLE_EVENT_UNSPECIFIED
+}
+
+func (x *StreamBusVideoRequest) GetVideoChunk() [][]byte {
+ if x != nil {
+ return x.VideoChunk
+ }
+ return nil
+}
+
+func (x *StreamBusVideoRequest) GetPhotoHeight() int32 {
+ if x != nil {
+ return x.PhotoHeight
+ }
+ return 0
+}
+
+func (x *StreamBusVideoRequest) GetPhotoWidth() int32 {
+ if x != nil {
+ return x.PhotoWidth
+ }
+ return 0
+}
+
+type StreamBusVideoResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ IsDetected bool `protobuf:"varint,1,opt,name=is_detected,json=isDetected,proto3" json:"is_detected,omitempty"`
+ Children []*Child `protobuf:"bytes,2,rep,name=children,proto3" json:"children,omitempty"`
+}
+
+func (x *StreamBusVideoResponse) Reset() {
+ *x = StreamBusVideoResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[13]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *StreamBusVideoResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*StreamBusVideoResponse) ProtoMessage() {}
+
+func (x *StreamBusVideoResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[13]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use StreamBusVideoResponse.ProtoReflect.Descriptor instead.
+func (*StreamBusVideoResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_proto_rawDescGZIP(), []int{13}
+}
+
+func (x *StreamBusVideoResponse) GetIsDetected() bool {
+ if x != nil {
+ return x.IsDetected
+ }
+ return false
+}
+
+func (x *StreamBusVideoResponse) GetChildren() []*Child {
+ if x != nil {
+ return x.Children
+ }
+ return nil
+}
+
+type UpdateBusRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusId string `protobuf:"bytes,1,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+ Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
+ PlateNumber string `protobuf:"bytes,3,opt,name=plate_number,json=plateNumber,proto3" json:"plate_number,omitempty"`
+ Latitude float64 `protobuf:"fixed64,4,opt,name=latitude,proto3" json:"latitude,omitempty"`
+ Longitude float64 `protobuf:"fixed64,5,opt,name=longitude,proto3" json:"longitude,omitempty"`
+ EnableFaceRecognition bool `protobuf:"varint,6,opt,name=enable_face_recognition,json=enableFaceRecognition,proto3" json:"enable_face_recognition,omitempty"`
+ NextStationId string `protobuf:"bytes,9,opt,name=next_station_id,json=nextStationId,proto3" json:"next_station_id,omitempty"`
+ UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,10,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
+}
+
+func (x *UpdateBusRequest) Reset() {
+ *x = UpdateBusRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[14]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateBusRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateBusRequest) ProtoMessage() {}
+
+func (x *UpdateBusRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[14]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateBusRequest.ProtoReflect.Descriptor instead.
+func (*UpdateBusRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_proto_rawDescGZIP(), []int{14}
+}
+
+func (x *UpdateBusRequest) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+func (x *UpdateBusRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *UpdateBusRequest) GetPlateNumber() string {
+ if x != nil {
+ return x.PlateNumber
+ }
+ return ""
+}
+
+func (x *UpdateBusRequest) GetLatitude() float64 {
+ if x != nil {
+ return x.Latitude
+ }
+ return 0
+}
+
+func (x *UpdateBusRequest) GetLongitude() float64 {
+ if x != nil {
+ return x.Longitude
+ }
+ return 0
+}
+
+func (x *UpdateBusRequest) GetEnableFaceRecognition() bool {
+ if x != nil {
+ return x.EnableFaceRecognition
+ }
+ return false
+}
+
+func (x *UpdateBusRequest) GetNextStationId() string {
+ if x != nil {
+ return x.NextStationId
+ }
+ return ""
+}
+
+func (x *UpdateBusRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
+ if x != nil {
+ return x.UpdateMask
+ }
+ return nil
+}
+
+type UpdateBusResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Bus *Bus `protobuf:"bytes,1,opt,name=bus,proto3" json:"bus,omitempty"`
+}
+
+func (x *UpdateBusResponse) Reset() {
+ *x = UpdateBusResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[15]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateBusResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateBusResponse) ProtoMessage() {}
+
+func (x *UpdateBusResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_proto_msgTypes[15]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateBusResponse.ProtoReflect.Descriptor instead.
+func (*UpdateBusResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_proto_rawDescGZIP(), []int{15}
+}
+
+func (x *UpdateBusResponse) GetBus() *Bus {
+ if x != nil {
+ return x.Bus
+ }
+ return nil
+}
+
+var File_where_child_bus_v1_bus_proto protoreflect.FileDescriptor
+
+var file_where_child_bus_v1_bus_proto_rawDesc = []byte{
+ 0x0a, 0x1c, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12,
+ 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e,
+ 0x76, 0x31, 0x1a, 0x22, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f,
+ 0x62, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61,
+ 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x68, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61,
+ 0x74, 0x65, 0x42, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a,
+ 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x09, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
+ 0x21, 0x0a, 0x0c, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4e, 0x75, 0x6d, 0x62,
+ 0x65, 0x72, 0x22, 0x3e, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x75, 0x73, 0x52,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x03, 0x62, 0x75, 0x73, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x73, 0x52, 0x03, 0x62,
+ 0x75, 0x73, 0x22, 0x3d, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x42, 0x75, 0x73, 0x4c, 0x69, 0x73, 0x74,
+ 0x42, 0x79, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x5f, 0x69, 0x64,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49,
+ 0x64, 0x22, 0x4e, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x42, 0x75, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x42,
+ 0x79, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+ 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x62, 0x75, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x17, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f,
+ 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x73, 0x52, 0x05, 0x62, 0x75, 0x73, 0x65,
+ 0x73, 0x22, 0x43, 0x0a, 0x20, 0x47, 0x65, 0x74, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x42,
+ 0x75, 0x73, 0x42, 0x79, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x52, 0x65,
+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61,
+ 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x67, 0x75, 0x61, 0x72,
+ 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x22, 0x4e, 0x0a, 0x21, 0x47, 0x65, 0x74, 0x52, 0x75, 0x6e,
+ 0x6e, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x73, 0x42, 0x79, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61,
+ 0x6e, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x03, 0x62,
+ 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65,
+ 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75,
+ 0x73, 0x52, 0x03, 0x62, 0x75, 0x73, 0x22, 0xa5, 0x01, 0x0a, 0x16, 0x43, 0x68, 0x61, 0x6e, 0x67,
+ 0x65, 0x42, 0x75, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+ 0x74, 0x12, 0x15, 0x0a, 0x06, 0x62, 0x75, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x05, 0x62, 0x75, 0x73, 0x49, 0x64, 0x12, 0x3c, 0x0a, 0x0a, 0x62, 0x75, 0x73, 0x5f,
+ 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x77,
+ 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76,
+ 0x31, 0x2e, 0x42, 0x75, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x62, 0x75, 0x73,
+ 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x36, 0x0a, 0x08, 0x62, 0x75, 0x73, 0x5f, 0x74, 0x79,
+ 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65,
+ 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75,
+ 0x73, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x62, 0x75, 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x44,
+ 0x0a, 0x17, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x42, 0x75, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75,
+ 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x03, 0x62, 0x75, 0x73,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x73, 0x52,
+ 0x03, 0x62, 0x75, 0x73, 0x22, 0x70, 0x0a, 0x1d, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x6f, 0x75, 0x73, 0x52, 0x65,
+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x62, 0x75, 0x73, 0x5f, 0x69, 0x64, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x75, 0x73, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08,
+ 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08,
+ 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, 0x6e, 0x67,
+ 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x6c, 0x6f, 0x6e,
+ 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x22, 0x20, 0x0a, 0x1e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f,
+ 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x6f, 0x75, 0x73,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x0a, 0x19, 0x54, 0x72, 0x61, 0x63,
+ 0x6b, 0x42, 0x75, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x6f, 0x75, 0x73, 0x52, 0x65,
+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x62, 0x75, 0x73, 0x5f, 0x69, 0x64, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x75, 0x73, 0x49, 0x64, 0x22, 0x95, 0x01, 0x0a,
+ 0x1a, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x42, 0x75, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75,
+ 0x6f, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x62,
+ 0x75, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x75, 0x73,
+ 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1c,
+ 0x0a, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
+ 0x01, 0x52, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x26, 0x0a, 0x0f,
+ 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18,
+ 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x53, 0x74, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x49, 0x64, 0x22, 0xb1, 0x02, 0x0a, 0x15, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x42,
+ 0x75, 0x73, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15,
+ 0x0a, 0x06, 0x62, 0x75, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
+ 0x62, 0x75, 0x73, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79,
+ 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x75, 0x72, 0x73, 0x65,
+ 0x72, 0x79, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x08, 0x62, 0x75, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65,
+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x73, 0x54,
+ 0x79, 0x70, 0x65, 0x52, 0x07, 0x62, 0x75, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x45, 0x0a, 0x0d,
+ 0x76, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20,
+ 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c,
+ 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65,
+ 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x0c, 0x76, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x45, 0x76,
+ 0x65, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x5f, 0x63, 0x68, 0x75,
+ 0x6e, 0x6b, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x43,
+ 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x5f, 0x68, 0x65,
+ 0x69, 0x67, 0x68, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x74,
+ 0x6f, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x68, 0x6f, 0x74, 0x6f,
+ 0x5f, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x70, 0x68,
+ 0x6f, 0x74, 0x6f, 0x57, 0x69, 0x64, 0x74, 0x68, 0x22, 0x70, 0x0a, 0x16, 0x53, 0x74, 0x72, 0x65,
+ 0x61, 0x6d, 0x42, 0x75, 0x73, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+ 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x73, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x65,
+ 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x44, 0x65, 0x74, 0x65, 0x63,
+ 0x74, 0x65, 0x64, 0x12, 0x35, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18,
+ 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68,
+ 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x69, 0x6c, 0x64,
+ 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x22, 0xb7, 0x02, 0x0a, 0x10, 0x55,
+ 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
+ 0x15, 0x0a, 0x06, 0x62, 0x75, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x05, 0x62, 0x75, 0x73, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x6c,
+ 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x0b, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a,
+ 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52,
+ 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, 0x6e,
+ 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x6c, 0x6f,
+ 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x36, 0x0a, 0x17, 0x65, 0x6e, 0x61, 0x62, 0x6c,
+ 0x65, 0x5f, 0x66, 0x61, 0x63, 0x65, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x74, 0x69,
+ 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65,
+ 0x46, 0x61, 0x63, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12,
+ 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
+ 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x53, 0x74,
+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74,
+ 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67,
+ 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46,
+ 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
+ 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x3e, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x75,
+ 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x03, 0x62, 0x75, 0x73,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x73, 0x52,
+ 0x03, 0x62, 0x75, 0x73, 0x32, 0x9d, 0x07, 0x0a, 0x0a, 0x42, 0x75, 0x73, 0x53, 0x65, 0x72, 0x76,
+ 0x69, 0x63, 0x65, 0x12, 0x58, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x75, 0x73,
+ 0x12, 0x24, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62,
+ 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x75, 0x73, 0x52,
+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61,
+ 0x74, 0x65, 0x42, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7c, 0x0a,
+ 0x15, 0x47, 0x65, 0x74, 0x42, 0x75, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x75, 0x72,
+ 0x73, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x30, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42,
+ 0x75, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49,
+ 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65,
+ 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65,
+ 0x74, 0x42, 0x75, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72,
+ 0x79, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x88, 0x01, 0x0a, 0x19,
+ 0x47, 0x65, 0x74, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x73, 0x42, 0x79, 0x47,
+ 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x34, 0x2e, 0x77, 0x68, 0x65, 0x72,
+ 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47,
+ 0x65, 0x74, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x73, 0x42, 0x79, 0x47, 0x75,
+ 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
+ 0x35, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x42,
+ 0x75, 0x73, 0x42, 0x79, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
+ 0x42, 0x75, 0x73, 0x12, 0x24, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c,
+ 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42,
+ 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x77, 0x68, 0x65, 0x72,
+ 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55,
+ 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x12, 0x6a, 0x0a, 0x0f, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x42, 0x75, 0x73, 0x53, 0x74, 0x61,
+ 0x74, 0x75, 0x73, 0x12, 0x2a, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c,
+ 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x42,
+ 0x75, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
+ 0x2b, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x42, 0x75, 0x73, 0x53, 0x74,
+ 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x81, 0x01, 0x0a,
+ 0x16, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e,
+ 0x74, 0x69, 0x6e, 0x75, 0x6f, 0x75, 0x73, 0x12, 0x31, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f,
+ 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e,
+ 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75,
+ 0x6f, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x77, 0x68, 0x65,
+ 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e,
+ 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74,
+ 0x69, 0x6e, 0x75, 0x6f, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01,
+ 0x12, 0x75, 0x0a, 0x12, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x42, 0x75, 0x73, 0x43, 0x6f, 0x6e, 0x74,
+ 0x69, 0x6e, 0x75, 0x6f, 0x75, 0x73, 0x12, 0x2d, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x63,
+ 0x6b, 0x42, 0x75, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x6f, 0x75, 0x73, 0x52, 0x65,
+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68,
+ 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b,
+ 0x42, 0x75, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x6f, 0x75, 0x73, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x6b, 0x0a, 0x0e, 0x53, 0x74, 0x72, 0x65, 0x61,
+ 0x6d, 0x42, 0x75, 0x73, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x12, 0x29, 0x2e, 0x77, 0x68, 0x65, 0x72,
+ 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53,
+ 0x74, 0x72, 0x65, 0x61, 0x6d, 0x42, 0x75, 0x73, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x52, 0x65, 0x71,
+ 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d,
+ 0x42, 0x75, 0x73, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x28, 0x01, 0x30, 0x01, 0x42, 0xeb, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x77, 0x68, 0x65,
+ 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x42,
+ 0x08, 0x42, 0x75, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x66, 0x67, 0x69, 0x74,
+ 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x65, 0x6e, 0x54, 0x65, 0x61,
+ 0x50, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x6d, 0x65, 0x72, 0x73, 0x2f, 0x57, 0x68, 0x65, 0x72,
+ 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e,
+ 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x77,
+ 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2f, 0x76,
+ 0x31, 0x3b, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x57, 0x58, 0x58, 0xaa, 0x02, 0x10, 0x57, 0x68, 0x65, 0x72,
+ 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x57,
+ 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x5c, 0x56, 0x31, 0xe2,
+ 0x02, 0x1c, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x5c,
+ 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02,
+ 0x11, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x3a, 0x3a,
+ 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_where_child_bus_v1_bus_proto_rawDescOnce sync.Once
+ file_where_child_bus_v1_bus_proto_rawDescData = file_where_child_bus_v1_bus_proto_rawDesc
+)
+
+func file_where_child_bus_v1_bus_proto_rawDescGZIP() []byte {
+ file_where_child_bus_v1_bus_proto_rawDescOnce.Do(func() {
+ file_where_child_bus_v1_bus_proto_rawDescData = protoimpl.X.CompressGZIP(file_where_child_bus_v1_bus_proto_rawDescData)
+ })
+ return file_where_child_bus_v1_bus_proto_rawDescData
+}
+
+var file_where_child_bus_v1_bus_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
+var file_where_child_bus_v1_bus_proto_goTypes = []interface{}{
+ (*CreateBusRequest)(nil), // 0: where_child_bus.v1.CreateBusRequest
+ (*CreateBusResponse)(nil), // 1: where_child_bus.v1.CreateBusResponse
+ (*GetBusListByNurseryIdRequest)(nil), // 2: where_child_bus.v1.GetBusListByNurseryIdRequest
+ (*GetBusListByNurseryIdResponse)(nil), // 3: where_child_bus.v1.GetBusListByNurseryIdResponse
+ (*GetRunningBusByGuardianIdRequest)(nil), // 4: where_child_bus.v1.GetRunningBusByGuardianIdRequest
+ (*GetRunningBusByGuardianIdResponse)(nil), // 5: where_child_bus.v1.GetRunningBusByGuardianIdResponse
+ (*ChangeBusStatusRequest)(nil), // 6: where_child_bus.v1.ChangeBusStatusRequest
+ (*ChangeBusStatusResponse)(nil), // 7: where_child_bus.v1.ChangeBusStatusResponse
+ (*SendLocationContinuousRequest)(nil), // 8: where_child_bus.v1.SendLocationContinuousRequest
+ (*SendLocationContinuousResponse)(nil), // 9: where_child_bus.v1.SendLocationContinuousResponse
+ (*TrackBusContinuousRequest)(nil), // 10: where_child_bus.v1.TrackBusContinuousRequest
+ (*TrackBusContinuousResponse)(nil), // 11: where_child_bus.v1.TrackBusContinuousResponse
+ (*StreamBusVideoRequest)(nil), // 12: where_child_bus.v1.StreamBusVideoRequest
+ (*StreamBusVideoResponse)(nil), // 13: where_child_bus.v1.StreamBusVideoResponse
+ (*UpdateBusRequest)(nil), // 14: where_child_bus.v1.UpdateBusRequest
+ (*UpdateBusResponse)(nil), // 15: where_child_bus.v1.UpdateBusResponse
+ (*Bus)(nil), // 16: where_child_bus.v1.Bus
+ (BusStatus)(0), // 17: where_child_bus.v1.BusStatus
+ (BusType)(0), // 18: where_child_bus.v1.BusType
+ (VehicleEvent)(0), // 19: where_child_bus.v1.VehicleEvent
+ (*Child)(nil), // 20: where_child_bus.v1.Child
+ (*fieldmaskpb.FieldMask)(nil), // 21: google.protobuf.FieldMask
+}
+var file_where_child_bus_v1_bus_proto_depIdxs = []int32{
+ 16, // 0: where_child_bus.v1.CreateBusResponse.bus:type_name -> where_child_bus.v1.Bus
+ 16, // 1: where_child_bus.v1.GetBusListByNurseryIdResponse.buses:type_name -> where_child_bus.v1.Bus
+ 16, // 2: where_child_bus.v1.GetRunningBusByGuardianIdResponse.bus:type_name -> where_child_bus.v1.Bus
+ 17, // 3: where_child_bus.v1.ChangeBusStatusRequest.bus_status:type_name -> where_child_bus.v1.BusStatus
+ 18, // 4: where_child_bus.v1.ChangeBusStatusRequest.bus_type:type_name -> where_child_bus.v1.BusType
+ 16, // 5: where_child_bus.v1.ChangeBusStatusResponse.bus:type_name -> where_child_bus.v1.Bus
+ 18, // 6: where_child_bus.v1.StreamBusVideoRequest.bus_type:type_name -> where_child_bus.v1.BusType
+ 19, // 7: where_child_bus.v1.StreamBusVideoRequest.vehicle_event:type_name -> where_child_bus.v1.VehicleEvent
+ 20, // 8: where_child_bus.v1.StreamBusVideoResponse.children:type_name -> where_child_bus.v1.Child
+ 21, // 9: where_child_bus.v1.UpdateBusRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 16, // 10: where_child_bus.v1.UpdateBusResponse.bus:type_name -> where_child_bus.v1.Bus
+ 0, // 11: where_child_bus.v1.BusService.CreateBus:input_type -> where_child_bus.v1.CreateBusRequest
+ 2, // 12: where_child_bus.v1.BusService.GetBusListByNurseryId:input_type -> where_child_bus.v1.GetBusListByNurseryIdRequest
+ 4, // 13: where_child_bus.v1.BusService.GetRunningBusByGuardianId:input_type -> where_child_bus.v1.GetRunningBusByGuardianIdRequest
+ 14, // 14: where_child_bus.v1.BusService.UpdateBus:input_type -> where_child_bus.v1.UpdateBusRequest
+ 6, // 15: where_child_bus.v1.BusService.ChangeBusStatus:input_type -> where_child_bus.v1.ChangeBusStatusRequest
+ 8, // 16: where_child_bus.v1.BusService.SendLocationContinuous:input_type -> where_child_bus.v1.SendLocationContinuousRequest
+ 10, // 17: where_child_bus.v1.BusService.TrackBusContinuous:input_type -> where_child_bus.v1.TrackBusContinuousRequest
+ 12, // 18: where_child_bus.v1.BusService.StreamBusVideo:input_type -> where_child_bus.v1.StreamBusVideoRequest
+ 1, // 19: where_child_bus.v1.BusService.CreateBus:output_type -> where_child_bus.v1.CreateBusResponse
+ 3, // 20: where_child_bus.v1.BusService.GetBusListByNurseryId:output_type -> where_child_bus.v1.GetBusListByNurseryIdResponse
+ 5, // 21: where_child_bus.v1.BusService.GetRunningBusByGuardianId:output_type -> where_child_bus.v1.GetRunningBusByGuardianIdResponse
+ 15, // 22: where_child_bus.v1.BusService.UpdateBus:output_type -> where_child_bus.v1.UpdateBusResponse
+ 7, // 23: where_child_bus.v1.BusService.ChangeBusStatus:output_type -> where_child_bus.v1.ChangeBusStatusResponse
+ 9, // 24: where_child_bus.v1.BusService.SendLocationContinuous:output_type -> where_child_bus.v1.SendLocationContinuousResponse
+ 11, // 25: where_child_bus.v1.BusService.TrackBusContinuous:output_type -> where_child_bus.v1.TrackBusContinuousResponse
+ 13, // 26: where_child_bus.v1.BusService.StreamBusVideo:output_type -> where_child_bus.v1.StreamBusVideoResponse
+ 19, // [19:27] is the sub-list for method output_type
+ 11, // [11:19] is the sub-list for method input_type
+ 11, // [11:11] is the sub-list for extension type_name
+ 11, // [11:11] is the sub-list for extension extendee
+ 0, // [0:11] is the sub-list for field type_name
+}
+
+func init() { file_where_child_bus_v1_bus_proto_init() }
+func file_where_child_bus_v1_bus_proto_init() {
+ if File_where_child_bus_v1_bus_proto != nil {
+ return
+ }
+ file_where_child_bus_v1_resources_proto_init()
+ if !protoimpl.UnsafeEnabled {
+ file_where_child_bus_v1_bus_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CreateBusRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CreateBusResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetBusListByNurseryIdRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetBusListByNurseryIdResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetRunningBusByGuardianIdRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetRunningBusByGuardianIdResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ChangeBusStatusRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ChangeBusStatusResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SendLocationContinuousRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SendLocationContinuousResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*TrackBusContinuousRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*TrackBusContinuousResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*StreamBusVideoRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*StreamBusVideoResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*UpdateBusRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*UpdateBusResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_where_child_bus_v1_bus_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 16,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_where_child_bus_v1_bus_proto_goTypes,
+ DependencyIndexes: file_where_child_bus_v1_bus_proto_depIdxs,
+ MessageInfos: file_where_child_bus_v1_bus_proto_msgTypes,
+ }.Build()
+ File_where_child_bus_v1_bus_proto = out.File
+ file_where_child_bus_v1_bus_proto_rawDesc = nil
+ file_where_child_bus_v1_bus_proto_goTypes = nil
+ file_where_child_bus_v1_bus_proto_depIdxs = nil
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/bus_grpc.pb.go b/backend/proto-gen/go/where_child_bus/v1/bus_grpc.pb.go
new file mode 100644
index 00000000..c62d2705
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/bus_grpc.pb.go
@@ -0,0 +1,460 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.3.0
+// - protoc (unknown)
+// source: where_child_bus/v1/bus.proto
+
+package where_child_busv1
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+const (
+ BusService_CreateBus_FullMethodName = "/where_child_bus.v1.BusService/CreateBus"
+ BusService_GetBusListByNurseryId_FullMethodName = "/where_child_bus.v1.BusService/GetBusListByNurseryId"
+ BusService_GetRunningBusByGuardianId_FullMethodName = "/where_child_bus.v1.BusService/GetRunningBusByGuardianId"
+ BusService_UpdateBus_FullMethodName = "/where_child_bus.v1.BusService/UpdateBus"
+ BusService_ChangeBusStatus_FullMethodName = "/where_child_bus.v1.BusService/ChangeBusStatus"
+ BusService_SendLocationContinuous_FullMethodName = "/where_child_bus.v1.BusService/SendLocationContinuous"
+ BusService_TrackBusContinuous_FullMethodName = "/where_child_bus.v1.BusService/TrackBusContinuous"
+ BusService_StreamBusVideo_FullMethodName = "/where_child_bus.v1.BusService/StreamBusVideo"
+)
+
+// BusServiceClient is the client API for BusService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type BusServiceClient interface {
+ CreateBus(ctx context.Context, in *CreateBusRequest, opts ...grpc.CallOption) (*CreateBusResponse, error)
+ GetBusListByNurseryId(ctx context.Context, in *GetBusListByNurseryIdRequest, opts ...grpc.CallOption) (*GetBusListByNurseryIdResponse, error)
+ GetRunningBusByGuardianId(ctx context.Context, in *GetRunningBusByGuardianIdRequest, opts ...grpc.CallOption) (*GetRunningBusByGuardianIdResponse, error)
+ UpdateBus(ctx context.Context, in *UpdateBusRequest, opts ...grpc.CallOption) (*UpdateBusResponse, error)
+ ChangeBusStatus(ctx context.Context, in *ChangeBusStatusRequest, opts ...grpc.CallOption) (*ChangeBusStatusResponse, error)
+ SendLocationContinuous(ctx context.Context, opts ...grpc.CallOption) (BusService_SendLocationContinuousClient, error)
+ TrackBusContinuous(ctx context.Context, in *TrackBusContinuousRequest, opts ...grpc.CallOption) (BusService_TrackBusContinuousClient, error)
+ StreamBusVideo(ctx context.Context, opts ...grpc.CallOption) (BusService_StreamBusVideoClient, error)
+}
+
+type busServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewBusServiceClient(cc grpc.ClientConnInterface) BusServiceClient {
+ return &busServiceClient{cc}
+}
+
+func (c *busServiceClient) CreateBus(ctx context.Context, in *CreateBusRequest, opts ...grpc.CallOption) (*CreateBusResponse, error) {
+ out := new(CreateBusResponse)
+ err := c.cc.Invoke(ctx, BusService_CreateBus_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *busServiceClient) GetBusListByNurseryId(ctx context.Context, in *GetBusListByNurseryIdRequest, opts ...grpc.CallOption) (*GetBusListByNurseryIdResponse, error) {
+ out := new(GetBusListByNurseryIdResponse)
+ err := c.cc.Invoke(ctx, BusService_GetBusListByNurseryId_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *busServiceClient) GetRunningBusByGuardianId(ctx context.Context, in *GetRunningBusByGuardianIdRequest, opts ...grpc.CallOption) (*GetRunningBusByGuardianIdResponse, error) {
+ out := new(GetRunningBusByGuardianIdResponse)
+ err := c.cc.Invoke(ctx, BusService_GetRunningBusByGuardianId_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *busServiceClient) UpdateBus(ctx context.Context, in *UpdateBusRequest, opts ...grpc.CallOption) (*UpdateBusResponse, error) {
+ out := new(UpdateBusResponse)
+ err := c.cc.Invoke(ctx, BusService_UpdateBus_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *busServiceClient) ChangeBusStatus(ctx context.Context, in *ChangeBusStatusRequest, opts ...grpc.CallOption) (*ChangeBusStatusResponse, error) {
+ out := new(ChangeBusStatusResponse)
+ err := c.cc.Invoke(ctx, BusService_ChangeBusStatus_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *busServiceClient) SendLocationContinuous(ctx context.Context, opts ...grpc.CallOption) (BusService_SendLocationContinuousClient, error) {
+ stream, err := c.cc.NewStream(ctx, &BusService_ServiceDesc.Streams[0], BusService_SendLocationContinuous_FullMethodName, opts...)
+ if err != nil {
+ return nil, err
+ }
+ x := &busServiceSendLocationContinuousClient{stream}
+ return x, nil
+}
+
+type BusService_SendLocationContinuousClient interface {
+ Send(*SendLocationContinuousRequest) error
+ CloseAndRecv() (*SendLocationContinuousResponse, error)
+ grpc.ClientStream
+}
+
+type busServiceSendLocationContinuousClient struct {
+ grpc.ClientStream
+}
+
+func (x *busServiceSendLocationContinuousClient) Send(m *SendLocationContinuousRequest) error {
+ return x.ClientStream.SendMsg(m)
+}
+
+func (x *busServiceSendLocationContinuousClient) CloseAndRecv() (*SendLocationContinuousResponse, error) {
+ if err := x.ClientStream.CloseSend(); err != nil {
+ return nil, err
+ }
+ m := new(SendLocationContinuousResponse)
+ if err := x.ClientStream.RecvMsg(m); err != nil {
+ return nil, err
+ }
+ return m, nil
+}
+
+func (c *busServiceClient) TrackBusContinuous(ctx context.Context, in *TrackBusContinuousRequest, opts ...grpc.CallOption) (BusService_TrackBusContinuousClient, error) {
+ stream, err := c.cc.NewStream(ctx, &BusService_ServiceDesc.Streams[1], BusService_TrackBusContinuous_FullMethodName, opts...)
+ if err != nil {
+ return nil, err
+ }
+ x := &busServiceTrackBusContinuousClient{stream}
+ if err := x.ClientStream.SendMsg(in); err != nil {
+ return nil, err
+ }
+ if err := x.ClientStream.CloseSend(); err != nil {
+ return nil, err
+ }
+ return x, nil
+}
+
+type BusService_TrackBusContinuousClient interface {
+ Recv() (*TrackBusContinuousResponse, error)
+ grpc.ClientStream
+}
+
+type busServiceTrackBusContinuousClient struct {
+ grpc.ClientStream
+}
+
+func (x *busServiceTrackBusContinuousClient) Recv() (*TrackBusContinuousResponse, error) {
+ m := new(TrackBusContinuousResponse)
+ if err := x.ClientStream.RecvMsg(m); err != nil {
+ return nil, err
+ }
+ return m, nil
+}
+
+func (c *busServiceClient) StreamBusVideo(ctx context.Context, opts ...grpc.CallOption) (BusService_StreamBusVideoClient, error) {
+ stream, err := c.cc.NewStream(ctx, &BusService_ServiceDesc.Streams[2], BusService_StreamBusVideo_FullMethodName, opts...)
+ if err != nil {
+ return nil, err
+ }
+ x := &busServiceStreamBusVideoClient{stream}
+ return x, nil
+}
+
+type BusService_StreamBusVideoClient interface {
+ Send(*StreamBusVideoRequest) error
+ Recv() (*StreamBusVideoResponse, error)
+ grpc.ClientStream
+}
+
+type busServiceStreamBusVideoClient struct {
+ grpc.ClientStream
+}
+
+func (x *busServiceStreamBusVideoClient) Send(m *StreamBusVideoRequest) error {
+ return x.ClientStream.SendMsg(m)
+}
+
+func (x *busServiceStreamBusVideoClient) Recv() (*StreamBusVideoResponse, error) {
+ m := new(StreamBusVideoResponse)
+ if err := x.ClientStream.RecvMsg(m); err != nil {
+ return nil, err
+ }
+ return m, nil
+}
+
+// BusServiceServer is the server API for BusService service.
+// All implementations should embed UnimplementedBusServiceServer
+// for forward compatibility
+type BusServiceServer interface {
+ CreateBus(context.Context, *CreateBusRequest) (*CreateBusResponse, error)
+ GetBusListByNurseryId(context.Context, *GetBusListByNurseryIdRequest) (*GetBusListByNurseryIdResponse, error)
+ GetRunningBusByGuardianId(context.Context, *GetRunningBusByGuardianIdRequest) (*GetRunningBusByGuardianIdResponse, error)
+ UpdateBus(context.Context, *UpdateBusRequest) (*UpdateBusResponse, error)
+ ChangeBusStatus(context.Context, *ChangeBusStatusRequest) (*ChangeBusStatusResponse, error)
+ SendLocationContinuous(BusService_SendLocationContinuousServer) error
+ TrackBusContinuous(*TrackBusContinuousRequest, BusService_TrackBusContinuousServer) error
+ StreamBusVideo(BusService_StreamBusVideoServer) error
+}
+
+// UnimplementedBusServiceServer should be embedded to have forward compatible implementations.
+type UnimplementedBusServiceServer struct {
+}
+
+func (UnimplementedBusServiceServer) CreateBus(context.Context, *CreateBusRequest) (*CreateBusResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CreateBus not implemented")
+}
+func (UnimplementedBusServiceServer) GetBusListByNurseryId(context.Context, *GetBusListByNurseryIdRequest) (*GetBusListByNurseryIdResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetBusListByNurseryId not implemented")
+}
+func (UnimplementedBusServiceServer) GetRunningBusByGuardianId(context.Context, *GetRunningBusByGuardianIdRequest) (*GetRunningBusByGuardianIdResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetRunningBusByGuardianId not implemented")
+}
+func (UnimplementedBusServiceServer) UpdateBus(context.Context, *UpdateBusRequest) (*UpdateBusResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdateBus not implemented")
+}
+func (UnimplementedBusServiceServer) ChangeBusStatus(context.Context, *ChangeBusStatusRequest) (*ChangeBusStatusResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method ChangeBusStatus not implemented")
+}
+func (UnimplementedBusServiceServer) SendLocationContinuous(BusService_SendLocationContinuousServer) error {
+ return status.Errorf(codes.Unimplemented, "method SendLocationContinuous not implemented")
+}
+func (UnimplementedBusServiceServer) TrackBusContinuous(*TrackBusContinuousRequest, BusService_TrackBusContinuousServer) error {
+ return status.Errorf(codes.Unimplemented, "method TrackBusContinuous not implemented")
+}
+func (UnimplementedBusServiceServer) StreamBusVideo(BusService_StreamBusVideoServer) error {
+ return status.Errorf(codes.Unimplemented, "method StreamBusVideo not implemented")
+}
+
+// UnsafeBusServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to BusServiceServer will
+// result in compilation errors.
+type UnsafeBusServiceServer interface {
+ mustEmbedUnimplementedBusServiceServer()
+}
+
+func RegisterBusServiceServer(s grpc.ServiceRegistrar, srv BusServiceServer) {
+ s.RegisterService(&BusService_ServiceDesc, srv)
+}
+
+func _BusService_CreateBus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CreateBusRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(BusServiceServer).CreateBus(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: BusService_CreateBus_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(BusServiceServer).CreateBus(ctx, req.(*CreateBusRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _BusService_GetBusListByNurseryId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetBusListByNurseryIdRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(BusServiceServer).GetBusListByNurseryId(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: BusService_GetBusListByNurseryId_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(BusServiceServer).GetBusListByNurseryId(ctx, req.(*GetBusListByNurseryIdRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _BusService_GetRunningBusByGuardianId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetRunningBusByGuardianIdRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(BusServiceServer).GetRunningBusByGuardianId(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: BusService_GetRunningBusByGuardianId_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(BusServiceServer).GetRunningBusByGuardianId(ctx, req.(*GetRunningBusByGuardianIdRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _BusService_UpdateBus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(UpdateBusRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(BusServiceServer).UpdateBus(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: BusService_UpdateBus_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(BusServiceServer).UpdateBus(ctx, req.(*UpdateBusRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _BusService_ChangeBusStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(ChangeBusStatusRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(BusServiceServer).ChangeBusStatus(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: BusService_ChangeBusStatus_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(BusServiceServer).ChangeBusStatus(ctx, req.(*ChangeBusStatusRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _BusService_SendLocationContinuous_Handler(srv interface{}, stream grpc.ServerStream) error {
+ return srv.(BusServiceServer).SendLocationContinuous(&busServiceSendLocationContinuousServer{stream})
+}
+
+type BusService_SendLocationContinuousServer interface {
+ SendAndClose(*SendLocationContinuousResponse) error
+ Recv() (*SendLocationContinuousRequest, error)
+ grpc.ServerStream
+}
+
+type busServiceSendLocationContinuousServer struct {
+ grpc.ServerStream
+}
+
+func (x *busServiceSendLocationContinuousServer) SendAndClose(m *SendLocationContinuousResponse) error {
+ return x.ServerStream.SendMsg(m)
+}
+
+func (x *busServiceSendLocationContinuousServer) Recv() (*SendLocationContinuousRequest, error) {
+ m := new(SendLocationContinuousRequest)
+ if err := x.ServerStream.RecvMsg(m); err != nil {
+ return nil, err
+ }
+ return m, nil
+}
+
+func _BusService_TrackBusContinuous_Handler(srv interface{}, stream grpc.ServerStream) error {
+ m := new(TrackBusContinuousRequest)
+ if err := stream.RecvMsg(m); err != nil {
+ return err
+ }
+ return srv.(BusServiceServer).TrackBusContinuous(m, &busServiceTrackBusContinuousServer{stream})
+}
+
+type BusService_TrackBusContinuousServer interface {
+ Send(*TrackBusContinuousResponse) error
+ grpc.ServerStream
+}
+
+type busServiceTrackBusContinuousServer struct {
+ grpc.ServerStream
+}
+
+func (x *busServiceTrackBusContinuousServer) Send(m *TrackBusContinuousResponse) error {
+ return x.ServerStream.SendMsg(m)
+}
+
+func _BusService_StreamBusVideo_Handler(srv interface{}, stream grpc.ServerStream) error {
+ return srv.(BusServiceServer).StreamBusVideo(&busServiceStreamBusVideoServer{stream})
+}
+
+type BusService_StreamBusVideoServer interface {
+ Send(*StreamBusVideoResponse) error
+ Recv() (*StreamBusVideoRequest, error)
+ grpc.ServerStream
+}
+
+type busServiceStreamBusVideoServer struct {
+ grpc.ServerStream
+}
+
+func (x *busServiceStreamBusVideoServer) Send(m *StreamBusVideoResponse) error {
+ return x.ServerStream.SendMsg(m)
+}
+
+func (x *busServiceStreamBusVideoServer) Recv() (*StreamBusVideoRequest, error) {
+ m := new(StreamBusVideoRequest)
+ if err := x.ServerStream.RecvMsg(m); err != nil {
+ return nil, err
+ }
+ return m, nil
+}
+
+// BusService_ServiceDesc is the grpc.ServiceDesc for BusService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var BusService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "where_child_bus.v1.BusService",
+ HandlerType: (*BusServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "CreateBus",
+ Handler: _BusService_CreateBus_Handler,
+ },
+ {
+ MethodName: "GetBusListByNurseryId",
+ Handler: _BusService_GetBusListByNurseryId_Handler,
+ },
+ {
+ MethodName: "GetRunningBusByGuardianId",
+ Handler: _BusService_GetRunningBusByGuardianId_Handler,
+ },
+ {
+ MethodName: "UpdateBus",
+ Handler: _BusService_UpdateBus_Handler,
+ },
+ {
+ MethodName: "ChangeBusStatus",
+ Handler: _BusService_ChangeBusStatus_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{
+ {
+ StreamName: "SendLocationContinuous",
+ Handler: _BusService_SendLocationContinuous_Handler,
+ ClientStreams: true,
+ },
+ {
+ StreamName: "TrackBusContinuous",
+ Handler: _BusService_TrackBusContinuous_Handler,
+ ServerStreams: true,
+ },
+ {
+ StreamName: "StreamBusVideo",
+ Handler: _BusService_StreamBusVideo_Handler,
+ ServerStreams: true,
+ ClientStreams: true,
+ },
+ },
+ Metadata: "where_child_bus/v1/bus.proto",
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/bus_route.pb.go b/backend/proto-gen/go/where_child_bus/v1/bus_route.pb.go
new file mode 100644
index 00000000..cb9a1dc5
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/bus_route.pb.go
@@ -0,0 +1,424 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.32.0
+// protoc (unknown)
+// source: where_child_bus/v1/bus_route.proto
+
+package where_child_busv1
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type CreateBusRouteRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusId string `protobuf:"bytes,1,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+ BusType BusType `protobuf:"varint,2,opt,name=bus_type,json=busType,proto3,enum=where_child_bus.v1.BusType" json:"bus_type,omitempty"`
+ NurseryId string `protobuf:"bytes,3,opt,name=nursery_id,json=nurseryId,proto3" json:"nursery_id,omitempty"` // 機械学習サーバーにわたすため
+ GuardianIds []string `protobuf:"bytes,4,rep,name=guardian_ids,json=guardianIds,proto3" json:"guardian_ids,omitempty"`
+}
+
+func (x *CreateBusRouteRequest) Reset() {
+ *x = CreateBusRouteRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_route_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreateBusRouteRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateBusRouteRequest) ProtoMessage() {}
+
+func (x *CreateBusRouteRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_route_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateBusRouteRequest.ProtoReflect.Descriptor instead.
+func (*CreateBusRouteRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_route_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *CreateBusRouteRequest) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+func (x *CreateBusRouteRequest) GetBusType() BusType {
+ if x != nil {
+ return x.BusType
+ }
+ return BusType_BUS_TYPE_UNSPECIFIED
+}
+
+func (x *CreateBusRouteRequest) GetNurseryId() string {
+ if x != nil {
+ return x.NurseryId
+ }
+ return ""
+}
+
+func (x *CreateBusRouteRequest) GetGuardianIds() []string {
+ if x != nil {
+ return x.GuardianIds
+ }
+ return nil
+}
+
+type CreateBusRouteResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusRoute *BusRoute `protobuf:"bytes,1,opt,name=bus_route,json=busRoute,proto3" json:"bus_route,omitempty"`
+}
+
+func (x *CreateBusRouteResponse) Reset() {
+ *x = CreateBusRouteResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_route_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreateBusRouteResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateBusRouteResponse) ProtoMessage() {}
+
+func (x *CreateBusRouteResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_route_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateBusRouteResponse.ProtoReflect.Descriptor instead.
+func (*CreateBusRouteResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_route_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *CreateBusRouteResponse) GetBusRoute() *BusRoute {
+ if x != nil {
+ return x.BusRoute
+ }
+ return nil
+}
+
+type GetBusRouteByBusIDRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusId string `protobuf:"bytes,1,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+ BusType BusType `protobuf:"varint,2,opt,name=bus_type,json=busType,proto3,enum=where_child_bus.v1.BusType" json:"bus_type,omitempty"`
+}
+
+func (x *GetBusRouteByBusIDRequest) Reset() {
+ *x = GetBusRouteByBusIDRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_route_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetBusRouteByBusIDRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetBusRouteByBusIDRequest) ProtoMessage() {}
+
+func (x *GetBusRouteByBusIDRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_route_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetBusRouteByBusIDRequest.ProtoReflect.Descriptor instead.
+func (*GetBusRouteByBusIDRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_route_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *GetBusRouteByBusIDRequest) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+func (x *GetBusRouteByBusIDRequest) GetBusType() BusType {
+ if x != nil {
+ return x.BusType
+ }
+ return BusType_BUS_TYPE_UNSPECIFIED
+}
+
+type GetBusRouteByBusIDResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusRoute *BusRoute `protobuf:"bytes,1,opt,name=bus_route,json=busRoute,proto3" json:"bus_route,omitempty"`
+}
+
+func (x *GetBusRouteByBusIDResponse) Reset() {
+ *x = GetBusRouteByBusIDResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_bus_route_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetBusRouteByBusIDResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetBusRouteByBusIDResponse) ProtoMessage() {}
+
+func (x *GetBusRouteByBusIDResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_bus_route_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetBusRouteByBusIDResponse.ProtoReflect.Descriptor instead.
+func (*GetBusRouteByBusIDResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_bus_route_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *GetBusRouteByBusIDResponse) GetBusRoute() *BusRoute {
+ if x != nil {
+ return x.BusRoute
+ }
+ return nil
+}
+
+var File_where_child_bus_v1_bus_route_proto protoreflect.FileDescriptor
+
+var file_where_child_bus_v1_bus_route_proto_rawDesc = []byte{
+ 0x0a, 0x22, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x75, 0x73, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c,
+ 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x22, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f,
+ 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73,
+ 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa8, 0x01, 0x0a,
+ 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x75, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52,
+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x62, 0x75, 0x73, 0x5f, 0x69, 0x64,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x75, 0x73, 0x49, 0x64, 0x12, 0x36, 0x0a,
+ 0x08, 0x62, 0x75, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32,
+ 0x1b, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x73, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x62, 0x75,
+ 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79,
+ 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x75, 0x72, 0x73, 0x65,
+ 0x72, 0x79, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e,
+ 0x5f, 0x69, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x67, 0x75, 0x61, 0x72,
+ 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x73, 0x22, 0x53, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74,
+ 0x65, 0x42, 0x75, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+ 0x65, 0x12, 0x39, 0x0a, 0x09, 0x62, 0x75, 0x73, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x73, 0x52, 0x6f, 0x75,
+ 0x74, 0x65, 0x52, 0x08, 0x62, 0x75, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x22, 0x6a, 0x0a, 0x19,
+ 0x47, 0x65, 0x74, 0x42, 0x75, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x42, 0x79, 0x42, 0x75, 0x73,
+ 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x62, 0x75, 0x73,
+ 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x75, 0x73, 0x49, 0x64,
+ 0x12, 0x36, 0x0a, 0x08, 0x62, 0x75, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64,
+ 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x73, 0x54, 0x79, 0x70, 0x65, 0x52,
+ 0x07, 0x62, 0x75, 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x57, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x42,
+ 0x75, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x42, 0x79, 0x42, 0x75, 0x73, 0x49, 0x44, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x09, 0x62, 0x75, 0x73, 0x5f, 0x72, 0x6f,
+ 0x75, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x77, 0x68, 0x65, 0x72,
+ 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42,
+ 0x75, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x08, 0x62, 0x75, 0x73, 0x52, 0x6f, 0x75, 0x74,
+ 0x65, 0x32, 0xef, 0x01, 0x0a, 0x0f, 0x42, 0x75, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x53, 0x65,
+ 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x67, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42,
+ 0x75, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x29, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f,
+ 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65,
+ 0x61, 0x74, 0x65, 0x42, 0x75, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64,
+ 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x75,
+ 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x73,
+ 0x0a, 0x12, 0x47, 0x65, 0x74, 0x42, 0x75, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x42, 0x79, 0x42,
+ 0x75, 0x73, 0x49, 0x44, 0x12, 0x2d, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x75, 0x73,
+ 0x52, 0x6f, 0x75, 0x74, 0x65, 0x42, 0x79, 0x42, 0x75, 0x73, 0x49, 0x44, 0x52, 0x65, 0x71, 0x75,
+ 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c,
+ 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x75, 0x73, 0x52,
+ 0x6f, 0x75, 0x74, 0x65, 0x42, 0x79, 0x42, 0x75, 0x73, 0x49, 0x44, 0x52, 0x65, 0x73, 0x70, 0x6f,
+ 0x6e, 0x73, 0x65, 0x42, 0xf0, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x77, 0x68, 0x65, 0x72,
+ 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0d,
+ 0x42, 0x75, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a,
+ 0x66, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x65,
+ 0x6e, 0x54, 0x65, 0x61, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x6d, 0x65, 0x72, 0x73, 0x2f,
+ 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x2f, 0x62, 0x61,
+ 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x67, 0x65, 0x6e, 0x2f,
+ 0x67, 0x6f, 0x2f, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62,
+ 0x75, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c,
+ 0x64, 0x5f, 0x62, 0x75, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x57, 0x58, 0x58, 0xaa, 0x02, 0x10,
+ 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x2e, 0x56, 0x31,
+ 0xca, 0x02, 0x10, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73,
+ 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64,
+ 0x42, 0x75, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
+ 0x74, 0x61, 0xea, 0x02, 0x11, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42,
+ 0x75, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_where_child_bus_v1_bus_route_proto_rawDescOnce sync.Once
+ file_where_child_bus_v1_bus_route_proto_rawDescData = file_where_child_bus_v1_bus_route_proto_rawDesc
+)
+
+func file_where_child_bus_v1_bus_route_proto_rawDescGZIP() []byte {
+ file_where_child_bus_v1_bus_route_proto_rawDescOnce.Do(func() {
+ file_where_child_bus_v1_bus_route_proto_rawDescData = protoimpl.X.CompressGZIP(file_where_child_bus_v1_bus_route_proto_rawDescData)
+ })
+ return file_where_child_bus_v1_bus_route_proto_rawDescData
+}
+
+var file_where_child_bus_v1_bus_route_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
+var file_where_child_bus_v1_bus_route_proto_goTypes = []interface{}{
+ (*CreateBusRouteRequest)(nil), // 0: where_child_bus.v1.CreateBusRouteRequest
+ (*CreateBusRouteResponse)(nil), // 1: where_child_bus.v1.CreateBusRouteResponse
+ (*GetBusRouteByBusIDRequest)(nil), // 2: where_child_bus.v1.GetBusRouteByBusIDRequest
+ (*GetBusRouteByBusIDResponse)(nil), // 3: where_child_bus.v1.GetBusRouteByBusIDResponse
+ (BusType)(0), // 4: where_child_bus.v1.BusType
+ (*BusRoute)(nil), // 5: where_child_bus.v1.BusRoute
+}
+var file_where_child_bus_v1_bus_route_proto_depIdxs = []int32{
+ 4, // 0: where_child_bus.v1.CreateBusRouteRequest.bus_type:type_name -> where_child_bus.v1.BusType
+ 5, // 1: where_child_bus.v1.CreateBusRouteResponse.bus_route:type_name -> where_child_bus.v1.BusRoute
+ 4, // 2: where_child_bus.v1.GetBusRouteByBusIDRequest.bus_type:type_name -> where_child_bus.v1.BusType
+ 5, // 3: where_child_bus.v1.GetBusRouteByBusIDResponse.bus_route:type_name -> where_child_bus.v1.BusRoute
+ 0, // 4: where_child_bus.v1.BusRouteService.CreateBusRoute:input_type -> where_child_bus.v1.CreateBusRouteRequest
+ 2, // 5: where_child_bus.v1.BusRouteService.GetBusRouteByBusID:input_type -> where_child_bus.v1.GetBusRouteByBusIDRequest
+ 1, // 6: where_child_bus.v1.BusRouteService.CreateBusRoute:output_type -> where_child_bus.v1.CreateBusRouteResponse
+ 3, // 7: where_child_bus.v1.BusRouteService.GetBusRouteByBusID:output_type -> where_child_bus.v1.GetBusRouteByBusIDResponse
+ 6, // [6:8] is the sub-list for method output_type
+ 4, // [4:6] is the sub-list for method input_type
+ 4, // [4:4] is the sub-list for extension type_name
+ 4, // [4:4] is the sub-list for extension extendee
+ 0, // [0:4] is the sub-list for field type_name
+}
+
+func init() { file_where_child_bus_v1_bus_route_proto_init() }
+func file_where_child_bus_v1_bus_route_proto_init() {
+ if File_where_child_bus_v1_bus_route_proto != nil {
+ return
+ }
+ file_where_child_bus_v1_resources_proto_init()
+ if !protoimpl.UnsafeEnabled {
+ file_where_child_bus_v1_bus_route_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CreateBusRouteRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_route_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CreateBusRouteResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_route_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetBusRouteByBusIDRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_bus_route_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetBusRouteByBusIDResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_where_child_bus_v1_bus_route_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 4,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_where_child_bus_v1_bus_route_proto_goTypes,
+ DependencyIndexes: file_where_child_bus_v1_bus_route_proto_depIdxs,
+ MessageInfos: file_where_child_bus_v1_bus_route_proto_msgTypes,
+ }.Build()
+ File_where_child_bus_v1_bus_route_proto = out.File
+ file_where_child_bus_v1_bus_route_proto_rawDesc = nil
+ file_where_child_bus_v1_bus_route_proto_goTypes = nil
+ file_where_child_bus_v1_bus_route_proto_depIdxs = nil
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/bus_route_grpc.pb.go b/backend/proto-gen/go/where_child_bus/v1/bus_route_grpc.pb.go
new file mode 100644
index 00000000..342e29fa
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/bus_route_grpc.pb.go
@@ -0,0 +1,144 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.3.0
+// - protoc (unknown)
+// source: where_child_bus/v1/bus_route.proto
+
+package where_child_busv1
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+const (
+ BusRouteService_CreateBusRoute_FullMethodName = "/where_child_bus.v1.BusRouteService/CreateBusRoute"
+ BusRouteService_GetBusRouteByBusID_FullMethodName = "/where_child_bus.v1.BusRouteService/GetBusRouteByBusID"
+)
+
+// BusRouteServiceClient is the client API for BusRouteService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type BusRouteServiceClient interface {
+ CreateBusRoute(ctx context.Context, in *CreateBusRouteRequest, opts ...grpc.CallOption) (*CreateBusRouteResponse, error)
+ GetBusRouteByBusID(ctx context.Context, in *GetBusRouteByBusIDRequest, opts ...grpc.CallOption) (*GetBusRouteByBusIDResponse, error)
+}
+
+type busRouteServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewBusRouteServiceClient(cc grpc.ClientConnInterface) BusRouteServiceClient {
+ return &busRouteServiceClient{cc}
+}
+
+func (c *busRouteServiceClient) CreateBusRoute(ctx context.Context, in *CreateBusRouteRequest, opts ...grpc.CallOption) (*CreateBusRouteResponse, error) {
+ out := new(CreateBusRouteResponse)
+ err := c.cc.Invoke(ctx, BusRouteService_CreateBusRoute_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *busRouteServiceClient) GetBusRouteByBusID(ctx context.Context, in *GetBusRouteByBusIDRequest, opts ...grpc.CallOption) (*GetBusRouteByBusIDResponse, error) {
+ out := new(GetBusRouteByBusIDResponse)
+ err := c.cc.Invoke(ctx, BusRouteService_GetBusRouteByBusID_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// BusRouteServiceServer is the server API for BusRouteService service.
+// All implementations should embed UnimplementedBusRouteServiceServer
+// for forward compatibility
+type BusRouteServiceServer interface {
+ CreateBusRoute(context.Context, *CreateBusRouteRequest) (*CreateBusRouteResponse, error)
+ GetBusRouteByBusID(context.Context, *GetBusRouteByBusIDRequest) (*GetBusRouteByBusIDResponse, error)
+}
+
+// UnimplementedBusRouteServiceServer should be embedded to have forward compatible implementations.
+type UnimplementedBusRouteServiceServer struct {
+}
+
+func (UnimplementedBusRouteServiceServer) CreateBusRoute(context.Context, *CreateBusRouteRequest) (*CreateBusRouteResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CreateBusRoute not implemented")
+}
+func (UnimplementedBusRouteServiceServer) GetBusRouteByBusID(context.Context, *GetBusRouteByBusIDRequest) (*GetBusRouteByBusIDResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetBusRouteByBusID not implemented")
+}
+
+// UnsafeBusRouteServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to BusRouteServiceServer will
+// result in compilation errors.
+type UnsafeBusRouteServiceServer interface {
+ mustEmbedUnimplementedBusRouteServiceServer()
+}
+
+func RegisterBusRouteServiceServer(s grpc.ServiceRegistrar, srv BusRouteServiceServer) {
+ s.RegisterService(&BusRouteService_ServiceDesc, srv)
+}
+
+func _BusRouteService_CreateBusRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CreateBusRouteRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(BusRouteServiceServer).CreateBusRoute(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: BusRouteService_CreateBusRoute_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(BusRouteServiceServer).CreateBusRoute(ctx, req.(*CreateBusRouteRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _BusRouteService_GetBusRouteByBusID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetBusRouteByBusIDRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(BusRouteServiceServer).GetBusRouteByBusID(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: BusRouteService_GetBusRouteByBusID_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(BusRouteServiceServer).GetBusRouteByBusID(ctx, req.(*GetBusRouteByBusIDRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// BusRouteService_ServiceDesc is the grpc.ServiceDesc for BusRouteService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var BusRouteService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "where_child_bus.v1.BusRouteService",
+ HandlerType: (*BusRouteServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "CreateBusRoute",
+ Handler: _BusRouteService_CreateBusRoute_Handler,
+ },
+ {
+ MethodName: "GetBusRouteByBusID",
+ Handler: _BusRouteService_GetBusRouteByBusID_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "where_child_bus/v1/bus_route.proto",
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/child.pb.go b/backend/proto-gen/go/where_child_bus/v1/child.pb.go
new file mode 100644
index 00000000..539fc52d
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/child.pb.go
@@ -0,0 +1,1130 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.32.0
+// protoc (unknown)
+// source: where_child_bus/v1/child.proto
+
+package where_child_busv1
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type CreateChildRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ NurseryId string `protobuf:"bytes,1,opt,name=nursery_id,json=nurseryId,proto3" json:"nursery_id,omitempty"`
+ GuardianId string `protobuf:"bytes,2,opt,name=guardian_id,json=guardianId,proto3" json:"guardian_id,omitempty"`
+ Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
+ Age int32 `protobuf:"varint,4,opt,name=age,proto3" json:"age,omitempty"`
+ Sex Sex `protobuf:"varint,5,opt,name=sex,proto3,enum=where_child_bus.v1.Sex" json:"sex,omitempty"`
+ Photos [][]byte `protobuf:"bytes,6,rep,name=photos,proto3" json:"photos,omitempty"`
+}
+
+func (x *CreateChildRequest) Reset() {
+ *x = CreateChildRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreateChildRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateChildRequest) ProtoMessage() {}
+
+func (x *CreateChildRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateChildRequest.ProtoReflect.Descriptor instead.
+func (*CreateChildRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *CreateChildRequest) GetNurseryId() string {
+ if x != nil {
+ return x.NurseryId
+ }
+ return ""
+}
+
+func (x *CreateChildRequest) GetGuardianId() string {
+ if x != nil {
+ return x.GuardianId
+ }
+ return ""
+}
+
+func (x *CreateChildRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *CreateChildRequest) GetAge() int32 {
+ if x != nil {
+ return x.Age
+ }
+ return 0
+}
+
+func (x *CreateChildRequest) GetSex() Sex {
+ if x != nil {
+ return x.Sex
+ }
+ return Sex_SEX_UNSPECIFIED
+}
+
+func (x *CreateChildRequest) GetPhotos() [][]byte {
+ if x != nil {
+ return x.Photos
+ }
+ return nil
+}
+
+type CreateChildResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Child *Child `protobuf:"bytes,1,opt,name=child,proto3" json:"child,omitempty"`
+}
+
+func (x *CreateChildResponse) Reset() {
+ *x = CreateChildResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreateChildResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateChildResponse) ProtoMessage() {}
+
+func (x *CreateChildResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateChildResponse.ProtoReflect.Descriptor instead.
+func (*CreateChildResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *CreateChildResponse) GetChild() *Child {
+ if x != nil {
+ return x.Child
+ }
+ return nil
+}
+
+type GetChildListByNurseryIDRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ NurseryId string `protobuf:"bytes,1,opt,name=nursery_id,json=nurseryId,proto3" json:"nursery_id,omitempty"`
+}
+
+func (x *GetChildListByNurseryIDRequest) Reset() {
+ *x = GetChildListByNurseryIDRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetChildListByNurseryIDRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetChildListByNurseryIDRequest) ProtoMessage() {}
+
+func (x *GetChildListByNurseryIDRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetChildListByNurseryIDRequest.ProtoReflect.Descriptor instead.
+func (*GetChildListByNurseryIDRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *GetChildListByNurseryIDRequest) GetNurseryId() string {
+ if x != nil {
+ return x.NurseryId
+ }
+ return ""
+}
+
+type GetChildListByNurseryIDResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Children []*Child `protobuf:"bytes,1,rep,name=children,proto3" json:"children,omitempty"`
+ Photos []*ChildPhoto `protobuf:"bytes,2,rep,name=photos,proto3" json:"photos,omitempty"`
+}
+
+func (x *GetChildListByNurseryIDResponse) Reset() {
+ *x = GetChildListByNurseryIDResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetChildListByNurseryIDResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetChildListByNurseryIDResponse) ProtoMessage() {}
+
+func (x *GetChildListByNurseryIDResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetChildListByNurseryIDResponse.ProtoReflect.Descriptor instead.
+func (*GetChildListByNurseryIDResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *GetChildListByNurseryIDResponse) GetChildren() []*Child {
+ if x != nil {
+ return x.Children
+ }
+ return nil
+}
+
+func (x *GetChildListByNurseryIDResponse) GetPhotos() []*ChildPhoto {
+ if x != nil {
+ return x.Photos
+ }
+ return nil
+}
+
+type GetChildListByGuardianIDRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ GuardianId string `protobuf:"bytes,1,opt,name=guardian_id,json=guardianId,proto3" json:"guardian_id,omitempty"`
+}
+
+func (x *GetChildListByGuardianIDRequest) Reset() {
+ *x = GetChildListByGuardianIDRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetChildListByGuardianIDRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetChildListByGuardianIDRequest) ProtoMessage() {}
+
+func (x *GetChildListByGuardianIDRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetChildListByGuardianIDRequest.ProtoReflect.Descriptor instead.
+func (*GetChildListByGuardianIDRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *GetChildListByGuardianIDRequest) GetGuardianId() string {
+ if x != nil {
+ return x.GuardianId
+ }
+ return ""
+}
+
+type GetChildListByGuardianIDResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Children []*Child `protobuf:"bytes,1,rep,name=children,proto3" json:"children,omitempty"`
+ Photos []*ChildPhoto `protobuf:"bytes,2,rep,name=photos,proto3" json:"photos,omitempty"`
+}
+
+func (x *GetChildListByGuardianIDResponse) Reset() {
+ *x = GetChildListByGuardianIDResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetChildListByGuardianIDResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetChildListByGuardianIDResponse) ProtoMessage() {}
+
+func (x *GetChildListByGuardianIDResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetChildListByGuardianIDResponse.ProtoReflect.Descriptor instead.
+func (*GetChildListByGuardianIDResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *GetChildListByGuardianIDResponse) GetChildren() []*Child {
+ if x != nil {
+ return x.Children
+ }
+ return nil
+}
+
+func (x *GetChildListByGuardianIDResponse) GetPhotos() []*ChildPhoto {
+ if x != nil {
+ return x.Photos
+ }
+ return nil
+}
+
+type GetChildListByBusIDRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusId string `protobuf:"bytes,1,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+}
+
+func (x *GetChildListByBusIDRequest) Reset() {
+ *x = GetChildListByBusIDRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetChildListByBusIDRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetChildListByBusIDRequest) ProtoMessage() {}
+
+func (x *GetChildListByBusIDRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetChildListByBusIDRequest.ProtoReflect.Descriptor instead.
+func (*GetChildListByBusIDRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *GetChildListByBusIDRequest) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+type GetChildListByBusIDResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Children []*Child `protobuf:"bytes,1,rep,name=children,proto3" json:"children,omitempty"`
+ Photos []*ChildPhoto `protobuf:"bytes,2,rep,name=photos,proto3" json:"photos,omitempty"`
+}
+
+func (x *GetChildListByBusIDResponse) Reset() {
+ *x = GetChildListByBusIDResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetChildListByBusIDResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetChildListByBusIDResponse) ProtoMessage() {}
+
+func (x *GetChildListByBusIDResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetChildListByBusIDResponse.ProtoReflect.Descriptor instead.
+func (*GetChildListByBusIDResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *GetChildListByBusIDResponse) GetChildren() []*Child {
+ if x != nil {
+ return x.Children
+ }
+ return nil
+}
+
+func (x *GetChildListByBusIDResponse) GetPhotos() []*ChildPhoto {
+ if x != nil {
+ return x.Photos
+ }
+ return nil
+}
+
+type CheckIsChildInBusRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ ChildId string `protobuf:"bytes,1,opt,name=child_id,json=childId,proto3" json:"child_id,omitempty"`
+}
+
+func (x *CheckIsChildInBusRequest) Reset() {
+ *x = CheckIsChildInBusRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CheckIsChildInBusRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CheckIsChildInBusRequest) ProtoMessage() {}
+
+func (x *CheckIsChildInBusRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[8]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CheckIsChildInBusRequest.ProtoReflect.Descriptor instead.
+func (*CheckIsChildInBusRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *CheckIsChildInBusRequest) GetChildId() string {
+ if x != nil {
+ return x.ChildId
+ }
+ return ""
+}
+
+type CheckIsChildInBusResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ IsInBus bool `protobuf:"varint,1,opt,name=is_in_bus,json=isInBus,proto3" json:"is_in_bus,omitempty"`
+}
+
+func (x *CheckIsChildInBusResponse) Reset() {
+ *x = CheckIsChildInBusResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CheckIsChildInBusResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CheckIsChildInBusResponse) ProtoMessage() {}
+
+func (x *CheckIsChildInBusResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[9]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CheckIsChildInBusResponse.ProtoReflect.Descriptor instead.
+func (*CheckIsChildInBusResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_proto_rawDescGZIP(), []int{9}
+}
+
+func (x *CheckIsChildInBusResponse) GetIsInBus() bool {
+ if x != nil {
+ return x.IsInBus
+ }
+ return false
+}
+
+type UpdateChildRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ ChildId string `protobuf:"bytes,1,opt,name=child_id,json=childId,proto3" json:"child_id,omitempty"`
+ Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
+ Age int32 `protobuf:"varint,3,opt,name=age,proto3" json:"age,omitempty"`
+ Sex Sex `protobuf:"varint,4,opt,name=sex,proto3,enum=where_child_bus.v1.Sex" json:"sex,omitempty"`
+ CheckForMissingItems bool `protobuf:"varint,5,opt,name=check_for_missing_items,json=checkForMissingItems,proto3" json:"check_for_missing_items,omitempty"`
+ HasBag bool `protobuf:"varint,6,opt,name=has_bag,json=hasBag,proto3" json:"has_bag,omitempty"`
+ HasLunchBox bool `protobuf:"varint,7,opt,name=has_lunch_box,json=hasLunchBox,proto3" json:"has_lunch_box,omitempty"`
+ HasWaterBottle bool `protobuf:"varint,8,opt,name=has_water_bottle,json=hasWaterBottle,proto3" json:"has_water_bottle,omitempty"`
+ HasUmbrella bool `protobuf:"varint,9,opt,name=has_umbrella,json=hasUmbrella,proto3" json:"has_umbrella,omitempty"`
+ HasOther bool `protobuf:"varint,10,opt,name=has_other,json=hasOther,proto3" json:"has_other,omitempty"`
+ UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,11,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
+}
+
+func (x *UpdateChildRequest) Reset() {
+ *x = UpdateChildRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateChildRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateChildRequest) ProtoMessage() {}
+
+func (x *UpdateChildRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[10]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateChildRequest.ProtoReflect.Descriptor instead.
+func (*UpdateChildRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *UpdateChildRequest) GetChildId() string {
+ if x != nil {
+ return x.ChildId
+ }
+ return ""
+}
+
+func (x *UpdateChildRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *UpdateChildRequest) GetAge() int32 {
+ if x != nil {
+ return x.Age
+ }
+ return 0
+}
+
+func (x *UpdateChildRequest) GetSex() Sex {
+ if x != nil {
+ return x.Sex
+ }
+ return Sex_SEX_UNSPECIFIED
+}
+
+func (x *UpdateChildRequest) GetCheckForMissingItems() bool {
+ if x != nil {
+ return x.CheckForMissingItems
+ }
+ return false
+}
+
+func (x *UpdateChildRequest) GetHasBag() bool {
+ if x != nil {
+ return x.HasBag
+ }
+ return false
+}
+
+func (x *UpdateChildRequest) GetHasLunchBox() bool {
+ if x != nil {
+ return x.HasLunchBox
+ }
+ return false
+}
+
+func (x *UpdateChildRequest) GetHasWaterBottle() bool {
+ if x != nil {
+ return x.HasWaterBottle
+ }
+ return false
+}
+
+func (x *UpdateChildRequest) GetHasUmbrella() bool {
+ if x != nil {
+ return x.HasUmbrella
+ }
+ return false
+}
+
+func (x *UpdateChildRequest) GetHasOther() bool {
+ if x != nil {
+ return x.HasOther
+ }
+ return false
+}
+
+func (x *UpdateChildRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
+ if x != nil {
+ return x.UpdateMask
+ }
+ return nil
+}
+
+type UpdateChildResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Child *Child `protobuf:"bytes,1,opt,name=child,proto3" json:"child,omitempty"`
+}
+
+func (x *UpdateChildResponse) Reset() {
+ *x = UpdateChildResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateChildResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateChildResponse) ProtoMessage() {}
+
+func (x *UpdateChildResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_proto_msgTypes[11]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateChildResponse.ProtoReflect.Descriptor instead.
+func (*UpdateChildResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *UpdateChildResponse) GetChild() *Child {
+ if x != nil {
+ return x.Child
+ }
+ return nil
+}
+
+var File_where_child_bus_v1_child_proto protoreflect.FileDescriptor
+
+var file_where_child_bus_v1_child_proto_rawDesc = []byte{
+ 0x0a, 0x1e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x12, 0x12, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x22, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c,
+ 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
+ 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+ 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f,
+ 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x12, 0x43,
+ 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+ 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49, 0x64,
+ 0x12, 0x1f, 0x0a, 0x0b, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49,
+ 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01,
+ 0x28, 0x05, 0x52, 0x03, 0x61, 0x67, 0x65, 0x12, 0x29, 0x0a, 0x03, 0x73, 0x65, 0x78, 0x18, 0x05,
+ 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x78, 0x52, 0x03, 0x73,
+ 0x65, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x18, 0x06, 0x20, 0x03,
+ 0x28, 0x0c, 0x52, 0x06, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x22, 0x46, 0x0a, 0x13, 0x43, 0x72,
+ 0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+ 0x65, 0x12, 0x2f, 0x0a, 0x05, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x19, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62,
+ 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x52, 0x05, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x22, 0x3f, 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x4c, 0x69,
+ 0x73, 0x74, 0x42, 0x79, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49, 0x44, 0x52, 0x65, 0x71,
+ 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x5f,
+ 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72,
+ 0x79, 0x49, 0x64, 0x22, 0x90, 0x01, 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64,
+ 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49, 0x44, 0x52,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64,
+ 0x72, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x77, 0x68, 0x65, 0x72,
+ 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43,
+ 0x68, 0x69, 0x6c, 0x64, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x36,
+ 0x0a, 0x06, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e,
+ 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73,
+ 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x06,
+ 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x22, 0x42, 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x43, 0x68, 0x69,
+ 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e,
+ 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x67, 0x75, 0x61,
+ 0x72, 0x64, 0x69, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
+ 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x22, 0x91, 0x01, 0x0a, 0x20, 0x47,
+ 0x65, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x47, 0x75, 0x61,
+ 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x44, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+ 0x35, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x19, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f,
+ 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x52, 0x08, 0x63, 0x68,
+ 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x36, 0x0a, 0x06, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73,
+ 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x69, 0x6c,
+ 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x06, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x22, 0x33,
+ 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79,
+ 0x42, 0x75, 0x73, 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06,
+ 0x62, 0x75, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x75,
+ 0x73, 0x49, 0x64, 0x22, 0x8c, 0x01, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64,
+ 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x42, 0x75, 0x73, 0x49, 0x44, 0x52, 0x65, 0x73, 0x70, 0x6f,
+ 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18,
+ 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68,
+ 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x69, 0x6c, 0x64,
+ 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x36, 0x0a, 0x06, 0x70, 0x68,
+ 0x6f, 0x74, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x77, 0x68, 0x65,
+ 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e,
+ 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x06, 0x70, 0x68, 0x6f, 0x74,
+ 0x6f, 0x73, 0x22, 0x35, 0x0a, 0x18, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x73, 0x43, 0x68, 0x69,
+ 0x6c, 0x64, 0x49, 0x6e, 0x42, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19,
+ 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x07, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x22, 0x37, 0x0a, 0x19, 0x43, 0x68, 0x65,
+ 0x63, 0x6b, 0x49, 0x73, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x49, 0x6e, 0x42, 0x75, 0x73, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x69, 0x6e, 0x5f,
+ 0x62, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x49, 0x6e, 0x42,
+ 0x75, 0x73, 0x22, 0x9b, 0x03, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x69,
+ 0x6c, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x67, 0x65, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x61, 0x67, 0x65, 0x12, 0x29, 0x0a, 0x03, 0x73, 0x65,
+ 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f,
+ 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x78,
+ 0x52, 0x03, 0x73, 0x65, 0x78, 0x12, 0x35, 0x0a, 0x17, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x66,
+ 0x6f, 0x72, 0x5f, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73,
+ 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x46, 0x6f, 0x72,
+ 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x17, 0x0a, 0x07,
+ 0x68, 0x61, 0x73, 0x5f, 0x62, 0x61, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x68,
+ 0x61, 0x73, 0x42, 0x61, 0x67, 0x12, 0x22, 0x0a, 0x0d, 0x68, 0x61, 0x73, 0x5f, 0x6c, 0x75, 0x6e,
+ 0x63, 0x68, 0x5f, 0x62, 0x6f, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x68, 0x61,
+ 0x73, 0x4c, 0x75, 0x6e, 0x63, 0x68, 0x42, 0x6f, 0x78, 0x12, 0x28, 0x0a, 0x10, 0x68, 0x61, 0x73,
+ 0x5f, 0x77, 0x61, 0x74, 0x65, 0x72, 0x5f, 0x62, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x18, 0x08, 0x20,
+ 0x01, 0x28, 0x08, 0x52, 0x0e, 0x68, 0x61, 0x73, 0x57, 0x61, 0x74, 0x65, 0x72, 0x42, 0x6f, 0x74,
+ 0x74, 0x6c, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x68, 0x61, 0x73, 0x5f, 0x75, 0x6d, 0x62, 0x72, 0x65,
+ 0x6c, 0x6c, 0x61, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x68, 0x61, 0x73, 0x55, 0x6d,
+ 0x62, 0x72, 0x65, 0x6c, 0x6c, 0x61, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x5f, 0x6f, 0x74,
+ 0x68, 0x65, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x68, 0x61, 0x73, 0x4f, 0x74,
+ 0x68, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61,
+ 0x73, 0x6b, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
+ 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64,
+ 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b,
+ 0x22, 0x46, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x52,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x05, 0x63, 0x68, 0x69, 0x6c, 0x64,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x69, 0x6c,
+ 0x64, 0x52, 0x05, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x32, 0xc5, 0x05, 0x0a, 0x0c, 0x43, 0x68, 0x69,
+ 0x6c, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5e, 0x0a, 0x0b, 0x43, 0x72, 0x65,
+ 0x61, 0x74, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x12, 0x26, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65,
+ 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72,
+ 0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+ 0x1a, 0x27, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62,
+ 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x69, 0x6c,
+ 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x82, 0x01, 0x0a, 0x17, 0x47, 0x65,
+ 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x75, 0x72, 0x73,
+ 0x65, 0x72, 0x79, 0x49, 0x44, 0x12, 0x32, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68,
+ 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68,
+ 0x69, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79,
+ 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x77, 0x68, 0x65, 0x72,
+ 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47,
+ 0x65, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x75, 0x72,
+ 0x73, 0x65, 0x72, 0x79, 0x49, 0x44, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x85,
+ 0x01, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x42,
+ 0x79, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x44, 0x12, 0x33, 0x2e, 0x77, 0x68,
+ 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31,
+ 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x47,
+ 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+ 0x1a, 0x34, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62,
+ 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x4c, 0x69,
+ 0x73, 0x74, 0x42, 0x79, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x44, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x43, 0x68, 0x69,
+ 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x42, 0x75, 0x73, 0x49, 0x44, 0x12, 0x2e, 0x2e,
+ 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e,
+ 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x42,
+ 0x79, 0x42, 0x75, 0x73, 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e,
+ 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e,
+ 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x42,
+ 0x79, 0x42, 0x75, 0x73, 0x49, 0x44, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x70,
+ 0x0a, 0x11, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x73, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x49, 0x6e,
+ 0x42, 0x75, 0x73, 0x12, 0x2c, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c,
+ 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x73,
+ 0x43, 0x68, 0x69, 0x6c, 0x64, 0x49, 0x6e, 0x42, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+ 0x74, 0x1a, 0x2d, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f,
+ 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x73, 0x43, 0x68,
+ 0x69, 0x6c, 0x64, 0x49, 0x6e, 0x42, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x12, 0x5e, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x12,
+ 0x26, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f,
+ 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64,
+ 0x61, 0x74, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x42, 0xed, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x43, 0x68, 0x69,
+ 0x6c, 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x66, 0x67, 0x69, 0x74, 0x68, 0x75,
+ 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x65, 0x6e, 0x54, 0x65, 0x61, 0x50, 0x72,
+ 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x6d, 0x65, 0x72, 0x73, 0x2f, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43,
+ 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2f,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x77, 0x68, 0x65,
+ 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x3b,
+ 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x76,
+ 0x31, 0xa2, 0x02, 0x03, 0x57, 0x58, 0x58, 0xaa, 0x02, 0x10, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43,
+ 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x57, 0x68, 0x65,
+ 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c,
+ 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x5c, 0x56, 0x31,
+ 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x57,
+ 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x3a, 0x3a, 0x56, 0x31,
+ 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_where_child_bus_v1_child_proto_rawDescOnce sync.Once
+ file_where_child_bus_v1_child_proto_rawDescData = file_where_child_bus_v1_child_proto_rawDesc
+)
+
+func file_where_child_bus_v1_child_proto_rawDescGZIP() []byte {
+ file_where_child_bus_v1_child_proto_rawDescOnce.Do(func() {
+ file_where_child_bus_v1_child_proto_rawDescData = protoimpl.X.CompressGZIP(file_where_child_bus_v1_child_proto_rawDescData)
+ })
+ return file_where_child_bus_v1_child_proto_rawDescData
+}
+
+var file_where_child_bus_v1_child_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
+var file_where_child_bus_v1_child_proto_goTypes = []interface{}{
+ (*CreateChildRequest)(nil), // 0: where_child_bus.v1.CreateChildRequest
+ (*CreateChildResponse)(nil), // 1: where_child_bus.v1.CreateChildResponse
+ (*GetChildListByNurseryIDRequest)(nil), // 2: where_child_bus.v1.GetChildListByNurseryIDRequest
+ (*GetChildListByNurseryIDResponse)(nil), // 3: where_child_bus.v1.GetChildListByNurseryIDResponse
+ (*GetChildListByGuardianIDRequest)(nil), // 4: where_child_bus.v1.GetChildListByGuardianIDRequest
+ (*GetChildListByGuardianIDResponse)(nil), // 5: where_child_bus.v1.GetChildListByGuardianIDResponse
+ (*GetChildListByBusIDRequest)(nil), // 6: where_child_bus.v1.GetChildListByBusIDRequest
+ (*GetChildListByBusIDResponse)(nil), // 7: where_child_bus.v1.GetChildListByBusIDResponse
+ (*CheckIsChildInBusRequest)(nil), // 8: where_child_bus.v1.CheckIsChildInBusRequest
+ (*CheckIsChildInBusResponse)(nil), // 9: where_child_bus.v1.CheckIsChildInBusResponse
+ (*UpdateChildRequest)(nil), // 10: where_child_bus.v1.UpdateChildRequest
+ (*UpdateChildResponse)(nil), // 11: where_child_bus.v1.UpdateChildResponse
+ (Sex)(0), // 12: where_child_bus.v1.Sex
+ (*Child)(nil), // 13: where_child_bus.v1.Child
+ (*ChildPhoto)(nil), // 14: where_child_bus.v1.ChildPhoto
+ (*fieldmaskpb.FieldMask)(nil), // 15: google.protobuf.FieldMask
+}
+var file_where_child_bus_v1_child_proto_depIdxs = []int32{
+ 12, // 0: where_child_bus.v1.CreateChildRequest.sex:type_name -> where_child_bus.v1.Sex
+ 13, // 1: where_child_bus.v1.CreateChildResponse.child:type_name -> where_child_bus.v1.Child
+ 13, // 2: where_child_bus.v1.GetChildListByNurseryIDResponse.children:type_name -> where_child_bus.v1.Child
+ 14, // 3: where_child_bus.v1.GetChildListByNurseryIDResponse.photos:type_name -> where_child_bus.v1.ChildPhoto
+ 13, // 4: where_child_bus.v1.GetChildListByGuardianIDResponse.children:type_name -> where_child_bus.v1.Child
+ 14, // 5: where_child_bus.v1.GetChildListByGuardianIDResponse.photos:type_name -> where_child_bus.v1.ChildPhoto
+ 13, // 6: where_child_bus.v1.GetChildListByBusIDResponse.children:type_name -> where_child_bus.v1.Child
+ 14, // 7: where_child_bus.v1.GetChildListByBusIDResponse.photos:type_name -> where_child_bus.v1.ChildPhoto
+ 12, // 8: where_child_bus.v1.UpdateChildRequest.sex:type_name -> where_child_bus.v1.Sex
+ 15, // 9: where_child_bus.v1.UpdateChildRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 13, // 10: where_child_bus.v1.UpdateChildResponse.child:type_name -> where_child_bus.v1.Child
+ 0, // 11: where_child_bus.v1.ChildService.CreateChild:input_type -> where_child_bus.v1.CreateChildRequest
+ 2, // 12: where_child_bus.v1.ChildService.GetChildListByNurseryID:input_type -> where_child_bus.v1.GetChildListByNurseryIDRequest
+ 4, // 13: where_child_bus.v1.ChildService.GetChildListByGuardianID:input_type -> where_child_bus.v1.GetChildListByGuardianIDRequest
+ 6, // 14: where_child_bus.v1.ChildService.GetChildListByBusID:input_type -> where_child_bus.v1.GetChildListByBusIDRequest
+ 8, // 15: where_child_bus.v1.ChildService.CheckIsChildInBus:input_type -> where_child_bus.v1.CheckIsChildInBusRequest
+ 10, // 16: where_child_bus.v1.ChildService.UpdateChild:input_type -> where_child_bus.v1.UpdateChildRequest
+ 1, // 17: where_child_bus.v1.ChildService.CreateChild:output_type -> where_child_bus.v1.CreateChildResponse
+ 3, // 18: where_child_bus.v1.ChildService.GetChildListByNurseryID:output_type -> where_child_bus.v1.GetChildListByNurseryIDResponse
+ 5, // 19: where_child_bus.v1.ChildService.GetChildListByGuardianID:output_type -> where_child_bus.v1.GetChildListByGuardianIDResponse
+ 7, // 20: where_child_bus.v1.ChildService.GetChildListByBusID:output_type -> where_child_bus.v1.GetChildListByBusIDResponse
+ 9, // 21: where_child_bus.v1.ChildService.CheckIsChildInBus:output_type -> where_child_bus.v1.CheckIsChildInBusResponse
+ 11, // 22: where_child_bus.v1.ChildService.UpdateChild:output_type -> where_child_bus.v1.UpdateChildResponse
+ 17, // [17:23] is the sub-list for method output_type
+ 11, // [11:17] is the sub-list for method input_type
+ 11, // [11:11] is the sub-list for extension type_name
+ 11, // [11:11] is the sub-list for extension extendee
+ 0, // [0:11] is the sub-list for field type_name
+}
+
+func init() { file_where_child_bus_v1_child_proto_init() }
+func file_where_child_bus_v1_child_proto_init() {
+ if File_where_child_bus_v1_child_proto != nil {
+ return
+ }
+ file_where_child_bus_v1_resources_proto_init()
+ if !protoimpl.UnsafeEnabled {
+ file_where_child_bus_v1_child_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CreateChildRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CreateChildResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetChildListByNurseryIDRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetChildListByNurseryIDResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetChildListByGuardianIDRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetChildListByGuardianIDResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetChildListByBusIDRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetChildListByBusIDResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CheckIsChildInBusRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CheckIsChildInBusResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*UpdateChildRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*UpdateChildResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_where_child_bus_v1_child_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 12,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_where_child_bus_v1_child_proto_goTypes,
+ DependencyIndexes: file_where_child_bus_v1_child_proto_depIdxs,
+ MessageInfos: file_where_child_bus_v1_child_proto_msgTypes,
+ }.Build()
+ File_where_child_bus_v1_child_proto = out.File
+ file_where_child_bus_v1_child_proto_rawDesc = nil
+ file_where_child_bus_v1_child_proto_goTypes = nil
+ file_where_child_bus_v1_child_proto_depIdxs = nil
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/child_grpc.pb.go b/backend/proto-gen/go/where_child_bus/v1/child_grpc.pb.go
new file mode 100644
index 00000000..c2234933
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/child_grpc.pb.go
@@ -0,0 +1,292 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.3.0
+// - protoc (unknown)
+// source: where_child_bus/v1/child.proto
+
+package where_child_busv1
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+const (
+ ChildService_CreateChild_FullMethodName = "/where_child_bus.v1.ChildService/CreateChild"
+ ChildService_GetChildListByNurseryID_FullMethodName = "/where_child_bus.v1.ChildService/GetChildListByNurseryID"
+ ChildService_GetChildListByGuardianID_FullMethodName = "/where_child_bus.v1.ChildService/GetChildListByGuardianID"
+ ChildService_GetChildListByBusID_FullMethodName = "/where_child_bus.v1.ChildService/GetChildListByBusID"
+ ChildService_CheckIsChildInBus_FullMethodName = "/where_child_bus.v1.ChildService/CheckIsChildInBus"
+ ChildService_UpdateChild_FullMethodName = "/where_child_bus.v1.ChildService/UpdateChild"
+)
+
+// ChildServiceClient is the client API for ChildService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type ChildServiceClient interface {
+ CreateChild(ctx context.Context, in *CreateChildRequest, opts ...grpc.CallOption) (*CreateChildResponse, error)
+ GetChildListByNurseryID(ctx context.Context, in *GetChildListByNurseryIDRequest, opts ...grpc.CallOption) (*GetChildListByNurseryIDResponse, error)
+ GetChildListByGuardianID(ctx context.Context, in *GetChildListByGuardianIDRequest, opts ...grpc.CallOption) (*GetChildListByGuardianIDResponse, error)
+ GetChildListByBusID(ctx context.Context, in *GetChildListByBusIDRequest, opts ...grpc.CallOption) (*GetChildListByBusIDResponse, error)
+ CheckIsChildInBus(ctx context.Context, in *CheckIsChildInBusRequest, opts ...grpc.CallOption) (*CheckIsChildInBusResponse, error)
+ UpdateChild(ctx context.Context, in *UpdateChildRequest, opts ...grpc.CallOption) (*UpdateChildResponse, error)
+}
+
+type childServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewChildServiceClient(cc grpc.ClientConnInterface) ChildServiceClient {
+ return &childServiceClient{cc}
+}
+
+func (c *childServiceClient) CreateChild(ctx context.Context, in *CreateChildRequest, opts ...grpc.CallOption) (*CreateChildResponse, error) {
+ out := new(CreateChildResponse)
+ err := c.cc.Invoke(ctx, ChildService_CreateChild_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *childServiceClient) GetChildListByNurseryID(ctx context.Context, in *GetChildListByNurseryIDRequest, opts ...grpc.CallOption) (*GetChildListByNurseryIDResponse, error) {
+ out := new(GetChildListByNurseryIDResponse)
+ err := c.cc.Invoke(ctx, ChildService_GetChildListByNurseryID_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *childServiceClient) GetChildListByGuardianID(ctx context.Context, in *GetChildListByGuardianIDRequest, opts ...grpc.CallOption) (*GetChildListByGuardianIDResponse, error) {
+ out := new(GetChildListByGuardianIDResponse)
+ err := c.cc.Invoke(ctx, ChildService_GetChildListByGuardianID_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *childServiceClient) GetChildListByBusID(ctx context.Context, in *GetChildListByBusIDRequest, opts ...grpc.CallOption) (*GetChildListByBusIDResponse, error) {
+ out := new(GetChildListByBusIDResponse)
+ err := c.cc.Invoke(ctx, ChildService_GetChildListByBusID_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *childServiceClient) CheckIsChildInBus(ctx context.Context, in *CheckIsChildInBusRequest, opts ...grpc.CallOption) (*CheckIsChildInBusResponse, error) {
+ out := new(CheckIsChildInBusResponse)
+ err := c.cc.Invoke(ctx, ChildService_CheckIsChildInBus_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *childServiceClient) UpdateChild(ctx context.Context, in *UpdateChildRequest, opts ...grpc.CallOption) (*UpdateChildResponse, error) {
+ out := new(UpdateChildResponse)
+ err := c.cc.Invoke(ctx, ChildService_UpdateChild_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// ChildServiceServer is the server API for ChildService service.
+// All implementations should embed UnimplementedChildServiceServer
+// for forward compatibility
+type ChildServiceServer interface {
+ CreateChild(context.Context, *CreateChildRequest) (*CreateChildResponse, error)
+ GetChildListByNurseryID(context.Context, *GetChildListByNurseryIDRequest) (*GetChildListByNurseryIDResponse, error)
+ GetChildListByGuardianID(context.Context, *GetChildListByGuardianIDRequest) (*GetChildListByGuardianIDResponse, error)
+ GetChildListByBusID(context.Context, *GetChildListByBusIDRequest) (*GetChildListByBusIDResponse, error)
+ CheckIsChildInBus(context.Context, *CheckIsChildInBusRequest) (*CheckIsChildInBusResponse, error)
+ UpdateChild(context.Context, *UpdateChildRequest) (*UpdateChildResponse, error)
+}
+
+// UnimplementedChildServiceServer should be embedded to have forward compatible implementations.
+type UnimplementedChildServiceServer struct {
+}
+
+func (UnimplementedChildServiceServer) CreateChild(context.Context, *CreateChildRequest) (*CreateChildResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CreateChild not implemented")
+}
+func (UnimplementedChildServiceServer) GetChildListByNurseryID(context.Context, *GetChildListByNurseryIDRequest) (*GetChildListByNurseryIDResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetChildListByNurseryID not implemented")
+}
+func (UnimplementedChildServiceServer) GetChildListByGuardianID(context.Context, *GetChildListByGuardianIDRequest) (*GetChildListByGuardianIDResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetChildListByGuardianID not implemented")
+}
+func (UnimplementedChildServiceServer) GetChildListByBusID(context.Context, *GetChildListByBusIDRequest) (*GetChildListByBusIDResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetChildListByBusID not implemented")
+}
+func (UnimplementedChildServiceServer) CheckIsChildInBus(context.Context, *CheckIsChildInBusRequest) (*CheckIsChildInBusResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CheckIsChildInBus not implemented")
+}
+func (UnimplementedChildServiceServer) UpdateChild(context.Context, *UpdateChildRequest) (*UpdateChildResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdateChild not implemented")
+}
+
+// UnsafeChildServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to ChildServiceServer will
+// result in compilation errors.
+type UnsafeChildServiceServer interface {
+ mustEmbedUnimplementedChildServiceServer()
+}
+
+func RegisterChildServiceServer(s grpc.ServiceRegistrar, srv ChildServiceServer) {
+ s.RegisterService(&ChildService_ServiceDesc, srv)
+}
+
+func _ChildService_CreateChild_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CreateChildRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ChildServiceServer).CreateChild(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: ChildService_CreateChild_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ChildServiceServer).CreateChild(ctx, req.(*CreateChildRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _ChildService_GetChildListByNurseryID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetChildListByNurseryIDRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ChildServiceServer).GetChildListByNurseryID(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: ChildService_GetChildListByNurseryID_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ChildServiceServer).GetChildListByNurseryID(ctx, req.(*GetChildListByNurseryIDRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _ChildService_GetChildListByGuardianID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetChildListByGuardianIDRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ChildServiceServer).GetChildListByGuardianID(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: ChildService_GetChildListByGuardianID_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ChildServiceServer).GetChildListByGuardianID(ctx, req.(*GetChildListByGuardianIDRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _ChildService_GetChildListByBusID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetChildListByBusIDRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ChildServiceServer).GetChildListByBusID(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: ChildService_GetChildListByBusID_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ChildServiceServer).GetChildListByBusID(ctx, req.(*GetChildListByBusIDRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _ChildService_CheckIsChildInBus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CheckIsChildInBusRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ChildServiceServer).CheckIsChildInBus(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: ChildService_CheckIsChildInBus_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ChildServiceServer).CheckIsChildInBus(ctx, req.(*CheckIsChildInBusRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _ChildService_UpdateChild_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(UpdateChildRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ChildServiceServer).UpdateChild(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: ChildService_UpdateChild_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ChildServiceServer).UpdateChild(ctx, req.(*UpdateChildRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// ChildService_ServiceDesc is the grpc.ServiceDesc for ChildService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var ChildService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "where_child_bus.v1.ChildService",
+ HandlerType: (*ChildServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "CreateChild",
+ Handler: _ChildService_CreateChild_Handler,
+ },
+ {
+ MethodName: "GetChildListByNurseryID",
+ Handler: _ChildService_GetChildListByNurseryID_Handler,
+ },
+ {
+ MethodName: "GetChildListByGuardianID",
+ Handler: _ChildService_GetChildListByGuardianID_Handler,
+ },
+ {
+ MethodName: "GetChildListByBusID",
+ Handler: _ChildService_GetChildListByBusID_Handler,
+ },
+ {
+ MethodName: "CheckIsChildInBus",
+ Handler: _ChildService_CheckIsChildInBus_Handler,
+ },
+ {
+ MethodName: "UpdateChild",
+ Handler: _ChildService_UpdateChild_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "where_child_bus/v1/child.proto",
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/child_photo.pb.go b/backend/proto-gen/go/where_child_bus/v1/child_photo.pb.go
new file mode 100644
index 00000000..a7c182f9
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/child_photo.pb.go
@@ -0,0 +1,612 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.32.0
+// protoc (unknown)
+// source: where_child_bus/v1/child_photo.proto
+
+package where_child_busv1
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type DuplicationCheckRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ ChildIds []string `protobuf:"bytes,1,rep,name=child_ids,json=childIds,proto3" json:"child_ids,omitempty"`
+}
+
+func (x *DuplicationCheckRequest) Reset() {
+ *x = DuplicationCheckRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_photo_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DuplicationCheckRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DuplicationCheckRequest) ProtoMessage() {}
+
+func (x *DuplicationCheckRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_photo_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DuplicationCheckRequest.ProtoReflect.Descriptor instead.
+func (*DuplicationCheckRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_photo_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *DuplicationCheckRequest) GetChildIds() []string {
+ if x != nil {
+ return x.ChildIds
+ }
+ return nil
+}
+
+type DuplicationCheckResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ IsDuplicated bool `protobuf:"varint,1,opt,name=is_duplicated,json=isDuplicated,proto3" json:"is_duplicated,omitempty"`
+ PhotoIds []string `protobuf:"bytes,2,rep,name=photo_ids,json=photoIds,proto3" json:"photo_ids,omitempty"`
+ DuplicatedPhotos [][]byte `protobuf:"bytes,3,rep,name=duplicated_photos,json=duplicatedPhotos,proto3" json:"duplicated_photos,omitempty"`
+}
+
+func (x *DuplicationCheckResponse) Reset() {
+ *x = DuplicationCheckResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_photo_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DuplicationCheckResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DuplicationCheckResponse) ProtoMessage() {}
+
+func (x *DuplicationCheckResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_photo_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DuplicationCheckResponse.ProtoReflect.Descriptor instead.
+func (*DuplicationCheckResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_photo_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *DuplicationCheckResponse) GetIsDuplicated() bool {
+ if x != nil {
+ return x.IsDuplicated
+ }
+ return false
+}
+
+func (x *DuplicationCheckResponse) GetPhotoIds() []string {
+ if x != nil {
+ return x.PhotoIds
+ }
+ return nil
+}
+
+func (x *DuplicationCheckResponse) GetDuplicatedPhotos() [][]byte {
+ if x != nil {
+ return x.DuplicatedPhotos
+ }
+ return nil
+}
+
+type DeleteChildPhotoRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"`
+}
+
+func (x *DeleteChildPhotoRequest) Reset() {
+ *x = DeleteChildPhotoRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_photo_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DeleteChildPhotoRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DeleteChildPhotoRequest) ProtoMessage() {}
+
+func (x *DeleteChildPhotoRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_photo_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DeleteChildPhotoRequest.ProtoReflect.Descriptor instead.
+func (*DeleteChildPhotoRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_photo_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *DeleteChildPhotoRequest) GetIds() []string {
+ if x != nil {
+ return x.Ids
+ }
+ return nil
+}
+
+type DeleteChildPhotoResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ IsSuccessList []bool `protobuf:"varint,1,rep,packed,name=is_success_list,json=isSuccessList,proto3" json:"is_success_list,omitempty"`
+ Ids []string `protobuf:"bytes,2,rep,name=ids,proto3" json:"ids,omitempty"`
+}
+
+func (x *DeleteChildPhotoResponse) Reset() {
+ *x = DeleteChildPhotoResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_photo_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DeleteChildPhotoResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DeleteChildPhotoResponse) ProtoMessage() {}
+
+func (x *DeleteChildPhotoResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_photo_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DeleteChildPhotoResponse.ProtoReflect.Descriptor instead.
+func (*DeleteChildPhotoResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_photo_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *DeleteChildPhotoResponse) GetIsSuccessList() []bool {
+ if x != nil {
+ return x.IsSuccessList
+ }
+ return nil
+}
+
+func (x *DeleteChildPhotoResponse) GetIds() []string {
+ if x != nil {
+ return x.Ids
+ }
+ return nil
+}
+
+type GetChildPhotoRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ ChildId string `protobuf:"bytes,1,opt,name=child_id,json=childId,proto3" json:"child_id,omitempty"`
+}
+
+func (x *GetChildPhotoRequest) Reset() {
+ *x = GetChildPhotoRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_photo_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetChildPhotoRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetChildPhotoRequest) ProtoMessage() {}
+
+func (x *GetChildPhotoRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_photo_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetChildPhotoRequest.ProtoReflect.Descriptor instead.
+func (*GetChildPhotoRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_photo_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *GetChildPhotoRequest) GetChildId() string {
+ if x != nil {
+ return x.ChildId
+ }
+ return ""
+}
+
+type ChildPhotoResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ ChildPhotoId string `protobuf:"bytes,1,opt,name=child_photo_id,json=childPhotoId,proto3" json:"child_photo_id,omitempty"`
+ Photo []byte `protobuf:"bytes,2,opt,name=photo,proto3" json:"photo,omitempty"`
+}
+
+func (x *ChildPhotoResponse) Reset() {
+ *x = ChildPhotoResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_photo_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ChildPhotoResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ChildPhotoResponse) ProtoMessage() {}
+
+func (x *ChildPhotoResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_photo_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ChildPhotoResponse.ProtoReflect.Descriptor instead.
+func (*ChildPhotoResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_photo_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *ChildPhotoResponse) GetChildPhotoId() string {
+ if x != nil {
+ return x.ChildPhotoId
+ }
+ return ""
+}
+
+func (x *ChildPhotoResponse) GetPhoto() []byte {
+ if x != nil {
+ return x.Photo
+ }
+ return nil
+}
+
+type GetChildPhotoResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ ChildPhotos []*ChildPhotoResponse `protobuf:"bytes,1,rep,name=child_photos,json=childPhotos,proto3" json:"child_photos,omitempty"`
+}
+
+func (x *GetChildPhotoResponse) Reset() {
+ *x = GetChildPhotoResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_child_photo_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetChildPhotoResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetChildPhotoResponse) ProtoMessage() {}
+
+func (x *GetChildPhotoResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_child_photo_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetChildPhotoResponse.ProtoReflect.Descriptor instead.
+func (*GetChildPhotoResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_child_photo_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *GetChildPhotoResponse) GetChildPhotos() []*ChildPhotoResponse {
+ if x != nil {
+ return x.ChildPhotos
+ }
+ return nil
+}
+
+var File_where_child_bus_v1_child_photo_proto protoreflect.FileDescriptor
+
+var file_where_child_bus_v1_child_photo_proto_rawDesc = []byte{
+ 0x0a, 0x24, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x70, 0x68, 0x6f, 0x74, 0x6f,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68,
+ 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x22, 0x36, 0x0a, 0x17, 0x44, 0x75,
+ 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65,
+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x69,
+ 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x49,
+ 0x64, 0x73, 0x22, 0x89, 0x01, 0x0a, 0x18, 0x44, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+ 0x23, 0x0a, 0x0d, 0x69, 0x73, 0x5f, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x44, 0x75, 0x70, 0x6c, 0x69, 0x63,
+ 0x61, 0x74, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x5f, 0x69, 0x64,
+ 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x64,
+ 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f,
+ 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x10, 0x64, 0x75,
+ 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x22, 0x2b,
+ 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x68, 0x6f,
+ 0x74, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73,
+ 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0x54, 0x0a, 0x18, 0x44,
+ 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x69, 0x73, 0x5f, 0x73, 0x75,
+ 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x08,
+ 0x52, 0x0d, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12,
+ 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64,
+ 0x73, 0x22, 0x31, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x68, 0x6f,
+ 0x74, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x49, 0x64, 0x22, 0x50, 0x0a, 0x12, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x68, 0x6f,
+ 0x74, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x63, 0x68,
+ 0x69, 0x6c, 0x64, 0x5f, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x0c, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x64,
+ 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52,
+ 0x05, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x22, 0x62, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x43, 0x68, 0x69,
+ 0x6c, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+ 0x49, 0x0a, 0x0c, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x18,
+ 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68,
+ 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x69, 0x6c, 0x64,
+ 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0b, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x32, 0xd7, 0x02, 0x0a, 0x11, 0x43,
+ 0x68, 0x69, 0x6c, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
+ 0x12, 0x6d, 0x0a, 0x10, 0x44, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43,
+ 0x68, 0x65, 0x63, 0x6b, 0x12, 0x2b, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x75, 0x70, 0x6c, 0x69, 0x63,
+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+ 0x74, 0x1a, 0x2c, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f,
+ 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+ 0x6d, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x68,
+ 0x6f, 0x74, 0x6f, 0x12, 0x2b, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c,
+ 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43,
+ 0x68, 0x69, 0x6c, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+ 0x1a, 0x2c, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62,
+ 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x68, 0x69, 0x6c,
+ 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64,
+ 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12,
+ 0x28, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x68, 0x6f,
+ 0x74, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x77, 0x68, 0x65, 0x72,
+ 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47,
+ 0x65, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x65, 0x73, 0x70,
+ 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xf2, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x77, 0x68, 0x65,
+ 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x42,
+ 0x0f, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x50, 0x72, 0x6f, 0x74, 0x6f,
+ 0x50, 0x01, 0x5a, 0x66, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47,
+ 0x72, 0x65, 0x65, 0x6e, 0x54, 0x65, 0x61, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x6d, 0x65,
+ 0x72, 0x73, 0x2f, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73,
+ 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x67,
+ 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c,
+ 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x57, 0x58, 0x58,
+ 0xaa, 0x02, 0x10, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73,
+ 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64,
+ 0x42, 0x75, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68,
+ 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74,
+ 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69,
+ 0x6c, 0x64, 0x42, 0x75, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x33,
+}
+
+var (
+ file_where_child_bus_v1_child_photo_proto_rawDescOnce sync.Once
+ file_where_child_bus_v1_child_photo_proto_rawDescData = file_where_child_bus_v1_child_photo_proto_rawDesc
+)
+
+func file_where_child_bus_v1_child_photo_proto_rawDescGZIP() []byte {
+ file_where_child_bus_v1_child_photo_proto_rawDescOnce.Do(func() {
+ file_where_child_bus_v1_child_photo_proto_rawDescData = protoimpl.X.CompressGZIP(file_where_child_bus_v1_child_photo_proto_rawDescData)
+ })
+ return file_where_child_bus_v1_child_photo_proto_rawDescData
+}
+
+var file_where_child_bus_v1_child_photo_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
+var file_where_child_bus_v1_child_photo_proto_goTypes = []interface{}{
+ (*DuplicationCheckRequest)(nil), // 0: where_child_bus.v1.DuplicationCheckRequest
+ (*DuplicationCheckResponse)(nil), // 1: where_child_bus.v1.DuplicationCheckResponse
+ (*DeleteChildPhotoRequest)(nil), // 2: where_child_bus.v1.DeleteChildPhotoRequest
+ (*DeleteChildPhotoResponse)(nil), // 3: where_child_bus.v1.DeleteChildPhotoResponse
+ (*GetChildPhotoRequest)(nil), // 4: where_child_bus.v1.GetChildPhotoRequest
+ (*ChildPhotoResponse)(nil), // 5: where_child_bus.v1.ChildPhotoResponse
+ (*GetChildPhotoResponse)(nil), // 6: where_child_bus.v1.GetChildPhotoResponse
+}
+var file_where_child_bus_v1_child_photo_proto_depIdxs = []int32{
+ 5, // 0: where_child_bus.v1.GetChildPhotoResponse.child_photos:type_name -> where_child_bus.v1.ChildPhotoResponse
+ 0, // 1: where_child_bus.v1.ChildPhotoService.DuplicationCheck:input_type -> where_child_bus.v1.DuplicationCheckRequest
+ 2, // 2: where_child_bus.v1.ChildPhotoService.DeleteChildPhoto:input_type -> where_child_bus.v1.DeleteChildPhotoRequest
+ 4, // 3: where_child_bus.v1.ChildPhotoService.GetChildPhoto:input_type -> where_child_bus.v1.GetChildPhotoRequest
+ 1, // 4: where_child_bus.v1.ChildPhotoService.DuplicationCheck:output_type -> where_child_bus.v1.DuplicationCheckResponse
+ 3, // 5: where_child_bus.v1.ChildPhotoService.DeleteChildPhoto:output_type -> where_child_bus.v1.DeleteChildPhotoResponse
+ 6, // 6: where_child_bus.v1.ChildPhotoService.GetChildPhoto:output_type -> where_child_bus.v1.GetChildPhotoResponse
+ 4, // [4:7] is the sub-list for method output_type
+ 1, // [1:4] is the sub-list for method input_type
+ 1, // [1:1] is the sub-list for extension type_name
+ 1, // [1:1] is the sub-list for extension extendee
+ 0, // [0:1] is the sub-list for field type_name
+}
+
+func init() { file_where_child_bus_v1_child_photo_proto_init() }
+func file_where_child_bus_v1_child_photo_proto_init() {
+ if File_where_child_bus_v1_child_photo_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_where_child_bus_v1_child_photo_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DuplicationCheckRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_photo_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DuplicationCheckResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_photo_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DeleteChildPhotoRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_photo_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DeleteChildPhotoResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_photo_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetChildPhotoRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_photo_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ChildPhotoResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_child_photo_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetChildPhotoResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_where_child_bus_v1_child_photo_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 7,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_where_child_bus_v1_child_photo_proto_goTypes,
+ DependencyIndexes: file_where_child_bus_v1_child_photo_proto_depIdxs,
+ MessageInfos: file_where_child_bus_v1_child_photo_proto_msgTypes,
+ }.Build()
+ File_where_child_bus_v1_child_photo_proto = out.File
+ file_where_child_bus_v1_child_photo_proto_rawDesc = nil
+ file_where_child_bus_v1_child_photo_proto_goTypes = nil
+ file_where_child_bus_v1_child_photo_proto_depIdxs = nil
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/child_photo_grpc.pb.go b/backend/proto-gen/go/where_child_bus/v1/child_photo_grpc.pb.go
new file mode 100644
index 00000000..fa22f481
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/child_photo_grpc.pb.go
@@ -0,0 +1,181 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.3.0
+// - protoc (unknown)
+// source: where_child_bus/v1/child_photo.proto
+
+package where_child_busv1
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+const (
+ ChildPhotoService_DuplicationCheck_FullMethodName = "/where_child_bus.v1.ChildPhotoService/DuplicationCheck"
+ ChildPhotoService_DeleteChildPhoto_FullMethodName = "/where_child_bus.v1.ChildPhotoService/DeleteChildPhoto"
+ ChildPhotoService_GetChildPhoto_FullMethodName = "/where_child_bus.v1.ChildPhotoService/GetChildPhoto"
+)
+
+// ChildPhotoServiceClient is the client API for ChildPhotoService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type ChildPhotoServiceClient interface {
+ DuplicationCheck(ctx context.Context, in *DuplicationCheckRequest, opts ...grpc.CallOption) (*DuplicationCheckResponse, error)
+ DeleteChildPhoto(ctx context.Context, in *DeleteChildPhotoRequest, opts ...grpc.CallOption) (*DeleteChildPhotoResponse, error)
+ GetChildPhoto(ctx context.Context, in *GetChildPhotoRequest, opts ...grpc.CallOption) (*GetChildPhotoResponse, error)
+}
+
+type childPhotoServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewChildPhotoServiceClient(cc grpc.ClientConnInterface) ChildPhotoServiceClient {
+ return &childPhotoServiceClient{cc}
+}
+
+func (c *childPhotoServiceClient) DuplicationCheck(ctx context.Context, in *DuplicationCheckRequest, opts ...grpc.CallOption) (*DuplicationCheckResponse, error) {
+ out := new(DuplicationCheckResponse)
+ err := c.cc.Invoke(ctx, ChildPhotoService_DuplicationCheck_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *childPhotoServiceClient) DeleteChildPhoto(ctx context.Context, in *DeleteChildPhotoRequest, opts ...grpc.CallOption) (*DeleteChildPhotoResponse, error) {
+ out := new(DeleteChildPhotoResponse)
+ err := c.cc.Invoke(ctx, ChildPhotoService_DeleteChildPhoto_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *childPhotoServiceClient) GetChildPhoto(ctx context.Context, in *GetChildPhotoRequest, opts ...grpc.CallOption) (*GetChildPhotoResponse, error) {
+ out := new(GetChildPhotoResponse)
+ err := c.cc.Invoke(ctx, ChildPhotoService_GetChildPhoto_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// ChildPhotoServiceServer is the server API for ChildPhotoService service.
+// All implementations should embed UnimplementedChildPhotoServiceServer
+// for forward compatibility
+type ChildPhotoServiceServer interface {
+ DuplicationCheck(context.Context, *DuplicationCheckRequest) (*DuplicationCheckResponse, error)
+ DeleteChildPhoto(context.Context, *DeleteChildPhotoRequest) (*DeleteChildPhotoResponse, error)
+ GetChildPhoto(context.Context, *GetChildPhotoRequest) (*GetChildPhotoResponse, error)
+}
+
+// UnimplementedChildPhotoServiceServer should be embedded to have forward compatible implementations.
+type UnimplementedChildPhotoServiceServer struct {
+}
+
+func (UnimplementedChildPhotoServiceServer) DuplicationCheck(context.Context, *DuplicationCheckRequest) (*DuplicationCheckResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method DuplicationCheck not implemented")
+}
+func (UnimplementedChildPhotoServiceServer) DeleteChildPhoto(context.Context, *DeleteChildPhotoRequest) (*DeleteChildPhotoResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method DeleteChildPhoto not implemented")
+}
+func (UnimplementedChildPhotoServiceServer) GetChildPhoto(context.Context, *GetChildPhotoRequest) (*GetChildPhotoResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetChildPhoto not implemented")
+}
+
+// UnsafeChildPhotoServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to ChildPhotoServiceServer will
+// result in compilation errors.
+type UnsafeChildPhotoServiceServer interface {
+ mustEmbedUnimplementedChildPhotoServiceServer()
+}
+
+func RegisterChildPhotoServiceServer(s grpc.ServiceRegistrar, srv ChildPhotoServiceServer) {
+ s.RegisterService(&ChildPhotoService_ServiceDesc, srv)
+}
+
+func _ChildPhotoService_DuplicationCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(DuplicationCheckRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ChildPhotoServiceServer).DuplicationCheck(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: ChildPhotoService_DuplicationCheck_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ChildPhotoServiceServer).DuplicationCheck(ctx, req.(*DuplicationCheckRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _ChildPhotoService_DeleteChildPhoto_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(DeleteChildPhotoRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ChildPhotoServiceServer).DeleteChildPhoto(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: ChildPhotoService_DeleteChildPhoto_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ChildPhotoServiceServer).DeleteChildPhoto(ctx, req.(*DeleteChildPhotoRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _ChildPhotoService_GetChildPhoto_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetChildPhotoRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ChildPhotoServiceServer).GetChildPhoto(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: ChildPhotoService_GetChildPhoto_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ChildPhotoServiceServer).GetChildPhoto(ctx, req.(*GetChildPhotoRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// ChildPhotoService_ServiceDesc is the grpc.ServiceDesc for ChildPhotoService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var ChildPhotoService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "where_child_bus.v1.ChildPhotoService",
+ HandlerType: (*ChildPhotoServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "DuplicationCheck",
+ Handler: _ChildPhotoService_DuplicationCheck_Handler,
+ },
+ {
+ MethodName: "DeleteChildPhoto",
+ Handler: _ChildPhotoService_DeleteChildPhoto_Handler,
+ },
+ {
+ MethodName: "GetChildPhoto",
+ Handler: _ChildPhotoService_GetChildPhoto_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "where_child_bus/v1/child_photo.proto",
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/guardian.pb.go b/backend/proto-gen/go/where_child_bus/v1/guardian.pb.go
new file mode 100644
index 00000000..75c780cb
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/guardian.pb.go
@@ -0,0 +1,1081 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.32.0
+// protoc (unknown)
+// source: where_child_bus/v1/guardian.proto
+
+package where_child_busv1
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type CreateGuardianRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ NurseryCode string `protobuf:"bytes,1,opt,name=nursery_code,json=nurseryCode,proto3" json:"nursery_code,omitempty"`
+ Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
+ Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`
+ Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
+ PhoneNumber string `protobuf:"bytes,5,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"`
+}
+
+func (x *CreateGuardianRequest) Reset() {
+ *x = CreateGuardianRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreateGuardianRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateGuardianRequest) ProtoMessage() {}
+
+func (x *CreateGuardianRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateGuardianRequest.ProtoReflect.Descriptor instead.
+func (*CreateGuardianRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_guardian_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *CreateGuardianRequest) GetNurseryCode() string {
+ if x != nil {
+ return x.NurseryCode
+ }
+ return ""
+}
+
+func (x *CreateGuardianRequest) GetEmail() string {
+ if x != nil {
+ return x.Email
+ }
+ return ""
+}
+
+func (x *CreateGuardianRequest) GetPassword() string {
+ if x != nil {
+ return x.Password
+ }
+ return ""
+}
+
+func (x *CreateGuardianRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *CreateGuardianRequest) GetPhoneNumber() string {
+ if x != nil {
+ return x.PhoneNumber
+ }
+ return ""
+}
+
+type CreateGuardianResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Guardian *GuardianResponse `protobuf:"bytes,1,opt,name=guardian,proto3" json:"guardian,omitempty"`
+}
+
+func (x *CreateGuardianResponse) Reset() {
+ *x = CreateGuardianResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreateGuardianResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateGuardianResponse) ProtoMessage() {}
+
+func (x *CreateGuardianResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateGuardianResponse.ProtoReflect.Descriptor instead.
+func (*CreateGuardianResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_guardian_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *CreateGuardianResponse) GetGuardian() *GuardianResponse {
+ if x != nil {
+ return x.Guardian
+ }
+ return nil
+}
+
+type GuardianLoginRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
+ Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
+}
+
+func (x *GuardianLoginRequest) Reset() {
+ *x = GuardianLoginRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GuardianLoginRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GuardianLoginRequest) ProtoMessage() {}
+
+func (x *GuardianLoginRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GuardianLoginRequest.ProtoReflect.Descriptor instead.
+func (*GuardianLoginRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_guardian_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *GuardianLoginRequest) GetEmail() string {
+ if x != nil {
+ return x.Email
+ }
+ return ""
+}
+
+func (x *GuardianLoginRequest) GetPassword() string {
+ if x != nil {
+ return x.Password
+ }
+ return ""
+}
+
+type GuardianLoginResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
+ Guardian *GuardianResponse `protobuf:"bytes,2,opt,name=guardian,proto3" json:"guardian,omitempty"`
+ Nursery *NurseryResponse `protobuf:"bytes,3,opt,name=nursery,proto3" json:"nursery,omitempty"`
+}
+
+func (x *GuardianLoginResponse) Reset() {
+ *x = GuardianLoginResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GuardianLoginResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GuardianLoginResponse) ProtoMessage() {}
+
+func (x *GuardianLoginResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GuardianLoginResponse.ProtoReflect.Descriptor instead.
+func (*GuardianLoginResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_guardian_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *GuardianLoginResponse) GetSuccess() bool {
+ if x != nil {
+ return x.Success
+ }
+ return false
+}
+
+func (x *GuardianLoginResponse) GetGuardian() *GuardianResponse {
+ if x != nil {
+ return x.Guardian
+ }
+ return nil
+}
+
+func (x *GuardianLoginResponse) GetNursery() *NurseryResponse {
+ if x != nil {
+ return x.Nursery
+ }
+ return nil
+}
+
+type GetGuardianListByBusIdRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusId string `protobuf:"bytes,1,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+}
+
+func (x *GetGuardianListByBusIdRequest) Reset() {
+ *x = GetGuardianListByBusIdRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetGuardianListByBusIdRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetGuardianListByBusIdRequest) ProtoMessage() {}
+
+func (x *GetGuardianListByBusIdRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetGuardianListByBusIdRequest.ProtoReflect.Descriptor instead.
+func (*GetGuardianListByBusIdRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_guardian_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *GetGuardianListByBusIdRequest) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+type GetGuardianListByBusIdResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Guardians []*GuardianResponse `protobuf:"bytes,1,rep,name=guardians,proto3" json:"guardians,omitempty"`
+}
+
+func (x *GetGuardianListByBusIdResponse) Reset() {
+ *x = GetGuardianListByBusIdResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetGuardianListByBusIdResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetGuardianListByBusIdResponse) ProtoMessage() {}
+
+func (x *GetGuardianListByBusIdResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetGuardianListByBusIdResponse.ProtoReflect.Descriptor instead.
+func (*GetGuardianListByBusIdResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_guardian_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *GetGuardianListByBusIdResponse) GetGuardians() []*GuardianResponse {
+ if x != nil {
+ return x.Guardians
+ }
+ return nil
+}
+
+type GetGuardianByChildIdRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ ChildId string `protobuf:"bytes,1,opt,name=child_id,json=childId,proto3" json:"child_id,omitempty"`
+}
+
+func (x *GetGuardianByChildIdRequest) Reset() {
+ *x = GetGuardianByChildIdRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetGuardianByChildIdRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetGuardianByChildIdRequest) ProtoMessage() {}
+
+func (x *GetGuardianByChildIdRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetGuardianByChildIdRequest.ProtoReflect.Descriptor instead.
+func (*GetGuardianByChildIdRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_guardian_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *GetGuardianByChildIdRequest) GetChildId() string {
+ if x != nil {
+ return x.ChildId
+ }
+ return ""
+}
+
+type GetGuardianByChildIdResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Guardian *GuardianResponse `protobuf:"bytes,1,opt,name=guardian,proto3" json:"guardian,omitempty"`
+}
+
+func (x *GetGuardianByChildIdResponse) Reset() {
+ *x = GetGuardianByChildIdResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetGuardianByChildIdResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetGuardianByChildIdResponse) ProtoMessage() {}
+
+func (x *GetGuardianByChildIdResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetGuardianByChildIdResponse.ProtoReflect.Descriptor instead.
+func (*GetGuardianByChildIdResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_guardian_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *GetGuardianByChildIdResponse) GetGuardian() *GuardianResponse {
+ if x != nil {
+ return x.Guardian
+ }
+ return nil
+}
+
+type GetGuardianListByNurseryIdRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ NurseryId string `protobuf:"bytes,1,opt,name=nursery_id,json=nurseryId,proto3" json:"nursery_id,omitempty"`
+}
+
+func (x *GetGuardianListByNurseryIdRequest) Reset() {
+ *x = GetGuardianListByNurseryIdRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetGuardianListByNurseryIdRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetGuardianListByNurseryIdRequest) ProtoMessage() {}
+
+func (x *GetGuardianListByNurseryIdRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[8]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetGuardianListByNurseryIdRequest.ProtoReflect.Descriptor instead.
+func (*GetGuardianListByNurseryIdRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_guardian_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *GetGuardianListByNurseryIdRequest) GetNurseryId() string {
+ if x != nil {
+ return x.NurseryId
+ }
+ return ""
+}
+
+type GetGuardianListByNurseryIdResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Guardians []*GuardianResponse `protobuf:"bytes,1,rep,name=guardians,proto3" json:"guardians,omitempty"`
+}
+
+func (x *GetGuardianListByNurseryIdResponse) Reset() {
+ *x = GetGuardianListByNurseryIdResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetGuardianListByNurseryIdResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetGuardianListByNurseryIdResponse) ProtoMessage() {}
+
+func (x *GetGuardianListByNurseryIdResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[9]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetGuardianListByNurseryIdResponse.ProtoReflect.Descriptor instead.
+func (*GetGuardianListByNurseryIdResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_guardian_proto_rawDescGZIP(), []int{9}
+}
+
+func (x *GetGuardianListByNurseryIdResponse) GetGuardians() []*GuardianResponse {
+ if x != nil {
+ return x.Guardians
+ }
+ return nil
+}
+
+type UpdateGuardianRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ GuardianId string `protobuf:"bytes,1,opt,name=guardian_id,json=guardianId,proto3" json:"guardian_id,omitempty"`
+ Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
+ Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
+ PhoneNumber string `protobuf:"bytes,4,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"`
+ IsUseMorningBus bool `protobuf:"varint,5,opt,name=is_use_morning_bus,json=isUseMorningBus,proto3" json:"is_use_morning_bus,omitempty"`
+ IsUseEveningBus bool `protobuf:"varint,6,opt,name=is_use_evening_bus,json=isUseEveningBus,proto3" json:"is_use_evening_bus,omitempty"`
+ UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,11,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
+}
+
+func (x *UpdateGuardianRequest) Reset() {
+ *x = UpdateGuardianRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateGuardianRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateGuardianRequest) ProtoMessage() {}
+
+func (x *UpdateGuardianRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[10]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateGuardianRequest.ProtoReflect.Descriptor instead.
+func (*UpdateGuardianRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_guardian_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *UpdateGuardianRequest) GetGuardianId() string {
+ if x != nil {
+ return x.GuardianId
+ }
+ return ""
+}
+
+func (x *UpdateGuardianRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *UpdateGuardianRequest) GetEmail() string {
+ if x != nil {
+ return x.Email
+ }
+ return ""
+}
+
+func (x *UpdateGuardianRequest) GetPhoneNumber() string {
+ if x != nil {
+ return x.PhoneNumber
+ }
+ return ""
+}
+
+func (x *UpdateGuardianRequest) GetIsUseMorningBus() bool {
+ if x != nil {
+ return x.IsUseMorningBus
+ }
+ return false
+}
+
+func (x *UpdateGuardianRequest) GetIsUseEveningBus() bool {
+ if x != nil {
+ return x.IsUseEveningBus
+ }
+ return false
+}
+
+func (x *UpdateGuardianRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
+ if x != nil {
+ return x.UpdateMask
+ }
+ return nil
+}
+
+type UpdateGuardianResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Guardian *GuardianResponse `protobuf:"bytes,1,opt,name=guardian,proto3" json:"guardian,omitempty"`
+}
+
+func (x *UpdateGuardianResponse) Reset() {
+ *x = UpdateGuardianResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateGuardianResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateGuardianResponse) ProtoMessage() {}
+
+func (x *UpdateGuardianResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_guardian_proto_msgTypes[11]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateGuardianResponse.ProtoReflect.Descriptor instead.
+func (*UpdateGuardianResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_guardian_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *UpdateGuardianResponse) GetGuardian() *GuardianResponse {
+ if x != nil {
+ return x.Guardian
+ }
+ return nil
+}
+
+var File_where_child_bus_v1_guardian_proto protoreflect.FileDescriptor
+
+var file_where_child_bus_v1_guardian_proto_rawDesc = []byte{
+ 0x0a, 0x21, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x2e, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64,
+ 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x22, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f,
+ 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f,
+ 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65,
+ 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa3, 0x01,
+ 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x75, 0x72, 0x73, 0x65,
+ 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6e,
+ 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d,
+ 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c,
+ 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04,
+ 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
+ 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72,
+ 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d,
+ 0x62, 0x65, 0x72, 0x22, 0x5a, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x75, 0x61,
+ 0x72, 0x64, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a,
+ 0x08, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x24, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x22,
+ 0x48, 0x0a, 0x14, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x4c, 0x6f, 0x67, 0x69, 0x6e,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a,
+ 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0xb2, 0x01, 0x0a, 0x15, 0x47, 0x75,
+ 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f,
+ 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x40, 0x0a,
+ 0x08, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x24, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x12,
+ 0x3d, 0x0a, 0x07, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x23, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62,
+ 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x07, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x22, 0x36,
+ 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x4c, 0x69, 0x73,
+ 0x74, 0x42, 0x79, 0x42, 0x75, 0x73, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
+ 0x15, 0x0a, 0x06, 0x62, 0x75, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x05, 0x62, 0x75, 0x73, 0x49, 0x64, 0x22, 0x64, 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x47, 0x75, 0x61,
+ 0x72, 0x64, 0x69, 0x61, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x42, 0x75, 0x73, 0x49, 0x64,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x09, 0x67, 0x75, 0x61, 0x72,
+ 0x64, 0x69, 0x61, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x77, 0x68,
+ 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31,
+ 0x2e, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+ 0x65, 0x52, 0x09, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x73, 0x22, 0x38, 0x0a, 0x1b,
+ 0x47, 0x65, 0x74, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x42, 0x79, 0x43, 0x68, 0x69,
+ 0x6c, 0x64, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x22, 0x60, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x47, 0x75, 0x61,
+ 0x72, 0x64, 0x69, 0x61, 0x6e, 0x42, 0x79, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x08, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69,
+ 0x61, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65,
+ 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x75,
+ 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08,
+ 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x22, 0x42, 0x0a, 0x21, 0x47, 0x65, 0x74, 0x47,
+ 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x75, 0x72,
+ 0x73, 0x65, 0x72, 0x79, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a,
+ 0x0a, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x09, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49, 0x64, 0x22, 0x68, 0x0a, 0x22,
+ 0x47, 0x65, 0x74, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x42,
+ 0x79, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+ 0x73, 0x65, 0x12, 0x42, 0x0a, 0x09, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x73, 0x18,
+ 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68,
+ 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x75, 0x61, 0x72, 0x64,
+ 0x69, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x09, 0x67, 0x75, 0x61,
+ 0x72, 0x64, 0x69, 0x61, 0x6e, 0x73, 0x22, 0x9c, 0x02, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74,
+ 0x65, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+ 0x12, 0x1f, 0x0a, 0x0b, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49,
+ 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x21, 0x0a, 0x0c, 0x70,
+ 0x68, 0x6f, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2b,
+ 0x0a, 0x12, 0x69, 0x73, 0x5f, 0x75, 0x73, 0x65, 0x5f, 0x6d, 0x6f, 0x72, 0x6e, 0x69, 0x6e, 0x67,
+ 0x5f, 0x62, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x69, 0x73, 0x55, 0x73,
+ 0x65, 0x4d, 0x6f, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x73, 0x12, 0x2b, 0x0a, 0x12, 0x69,
+ 0x73, 0x5f, 0x75, 0x73, 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x62, 0x75,
+ 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x69, 0x73, 0x55, 0x73, 0x65, 0x45, 0x76,
+ 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x73, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61,
+ 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
+ 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
+ 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74,
+ 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x5a, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47,
+ 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+ 0x40, 0x0a, 0x08, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x24, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f,
+ 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x52,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61,
+ 0x6e, 0x32, 0xd3, 0x05, 0x0a, 0x0f, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x53, 0x65,
+ 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x67, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47,
+ 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x12, 0x29, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f,
+ 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65,
+ 0x61, 0x74, 0x65, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64,
+ 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x75,
+ 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64,
+ 0x0a, 0x0d, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12,
+ 0x28, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x4c, 0x6f, 0x67,
+ 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x77, 0x68, 0x65, 0x72,
+ 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47,
+ 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70,
+ 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x47, 0x75, 0x61, 0x72, 0x64,
+ 0x69, 0x61, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x42, 0x75, 0x73, 0x49, 0x64, 0x12, 0x31,
+ 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73,
+ 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x4c,
+ 0x69, 0x73, 0x74, 0x42, 0x79, 0x42, 0x75, 0x73, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+ 0x74, 0x1a, 0x32, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f,
+ 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69,
+ 0x61, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x42, 0x75, 0x73, 0x49, 0x64, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x47, 0x75, 0x61, 0x72,
+ 0x64, 0x69, 0x61, 0x6e, 0x42, 0x79, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x12, 0x2f, 0x2e,
+ 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e,
+ 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x42, 0x79,
+ 0x43, 0x68, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30,
+ 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73,
+ 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x42,
+ 0x79, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x12, 0x8b, 0x01, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e,
+ 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12,
+ 0x35, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e,
+ 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49, 0x64, 0x52,
+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x47,
+ 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x75, 0x72,
+ 0x73, 0x65, 0x72, 0x79, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67,
+ 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e,
+ 0x12, 0x29, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62,
+ 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x75, 0x61, 0x72,
+ 0x64, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x77, 0x68,
+ 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31,
+ 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x52,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xf0, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e,
+ 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e,
+ 0x76, 0x31, 0x42, 0x0d, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x50, 0x72, 0x6f, 0x74,
+ 0x6f, 0x50, 0x01, 0x5a, 0x66, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
+ 0x47, 0x72, 0x65, 0x65, 0x6e, 0x54, 0x65, 0x61, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x6d,
+ 0x65, 0x72, 0x73, 0x2f, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75,
+ 0x73, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2d,
+ 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f,
+ 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x57, 0x58,
+ 0x58, 0xaa, 0x02, 0x10, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75,
+ 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c,
+ 0x64, 0x42, 0x75, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43,
+ 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65,
+ 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68,
+ 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x33,
+}
+
+var (
+ file_where_child_bus_v1_guardian_proto_rawDescOnce sync.Once
+ file_where_child_bus_v1_guardian_proto_rawDescData = file_where_child_bus_v1_guardian_proto_rawDesc
+)
+
+func file_where_child_bus_v1_guardian_proto_rawDescGZIP() []byte {
+ file_where_child_bus_v1_guardian_proto_rawDescOnce.Do(func() {
+ file_where_child_bus_v1_guardian_proto_rawDescData = protoimpl.X.CompressGZIP(file_where_child_bus_v1_guardian_proto_rawDescData)
+ })
+ return file_where_child_bus_v1_guardian_proto_rawDescData
+}
+
+var file_where_child_bus_v1_guardian_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
+var file_where_child_bus_v1_guardian_proto_goTypes = []interface{}{
+ (*CreateGuardianRequest)(nil), // 0: where_child_bus.v1.CreateGuardianRequest
+ (*CreateGuardianResponse)(nil), // 1: where_child_bus.v1.CreateGuardianResponse
+ (*GuardianLoginRequest)(nil), // 2: where_child_bus.v1.GuardianLoginRequest
+ (*GuardianLoginResponse)(nil), // 3: where_child_bus.v1.GuardianLoginResponse
+ (*GetGuardianListByBusIdRequest)(nil), // 4: where_child_bus.v1.GetGuardianListByBusIdRequest
+ (*GetGuardianListByBusIdResponse)(nil), // 5: where_child_bus.v1.GetGuardianListByBusIdResponse
+ (*GetGuardianByChildIdRequest)(nil), // 6: where_child_bus.v1.GetGuardianByChildIdRequest
+ (*GetGuardianByChildIdResponse)(nil), // 7: where_child_bus.v1.GetGuardianByChildIdResponse
+ (*GetGuardianListByNurseryIdRequest)(nil), // 8: where_child_bus.v1.GetGuardianListByNurseryIdRequest
+ (*GetGuardianListByNurseryIdResponse)(nil), // 9: where_child_bus.v1.GetGuardianListByNurseryIdResponse
+ (*UpdateGuardianRequest)(nil), // 10: where_child_bus.v1.UpdateGuardianRequest
+ (*UpdateGuardianResponse)(nil), // 11: where_child_bus.v1.UpdateGuardianResponse
+ (*GuardianResponse)(nil), // 12: where_child_bus.v1.GuardianResponse
+ (*NurseryResponse)(nil), // 13: where_child_bus.v1.NurseryResponse
+ (*fieldmaskpb.FieldMask)(nil), // 14: google.protobuf.FieldMask
+}
+var file_where_child_bus_v1_guardian_proto_depIdxs = []int32{
+ 12, // 0: where_child_bus.v1.CreateGuardianResponse.guardian:type_name -> where_child_bus.v1.GuardianResponse
+ 12, // 1: where_child_bus.v1.GuardianLoginResponse.guardian:type_name -> where_child_bus.v1.GuardianResponse
+ 13, // 2: where_child_bus.v1.GuardianLoginResponse.nursery:type_name -> where_child_bus.v1.NurseryResponse
+ 12, // 3: where_child_bus.v1.GetGuardianListByBusIdResponse.guardians:type_name -> where_child_bus.v1.GuardianResponse
+ 12, // 4: where_child_bus.v1.GetGuardianByChildIdResponse.guardian:type_name -> where_child_bus.v1.GuardianResponse
+ 12, // 5: where_child_bus.v1.GetGuardianListByNurseryIdResponse.guardians:type_name -> where_child_bus.v1.GuardianResponse
+ 14, // 6: where_child_bus.v1.UpdateGuardianRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 12, // 7: where_child_bus.v1.UpdateGuardianResponse.guardian:type_name -> where_child_bus.v1.GuardianResponse
+ 0, // 8: where_child_bus.v1.GuardianService.CreateGuardian:input_type -> where_child_bus.v1.CreateGuardianRequest
+ 2, // 9: where_child_bus.v1.GuardianService.GuardianLogin:input_type -> where_child_bus.v1.GuardianLoginRequest
+ 4, // 10: where_child_bus.v1.GuardianService.GetGuardianListByBusId:input_type -> where_child_bus.v1.GetGuardianListByBusIdRequest
+ 6, // 11: where_child_bus.v1.GuardianService.GetGuardianByChildId:input_type -> where_child_bus.v1.GetGuardianByChildIdRequest
+ 8, // 12: where_child_bus.v1.GuardianService.GetGuardianListByNurseryId:input_type -> where_child_bus.v1.GetGuardianListByNurseryIdRequest
+ 10, // 13: where_child_bus.v1.GuardianService.UpdateGuardian:input_type -> where_child_bus.v1.UpdateGuardianRequest
+ 1, // 14: where_child_bus.v1.GuardianService.CreateGuardian:output_type -> where_child_bus.v1.CreateGuardianResponse
+ 3, // 15: where_child_bus.v1.GuardianService.GuardianLogin:output_type -> where_child_bus.v1.GuardianLoginResponse
+ 5, // 16: where_child_bus.v1.GuardianService.GetGuardianListByBusId:output_type -> where_child_bus.v1.GetGuardianListByBusIdResponse
+ 7, // 17: where_child_bus.v1.GuardianService.GetGuardianByChildId:output_type -> where_child_bus.v1.GetGuardianByChildIdResponse
+ 9, // 18: where_child_bus.v1.GuardianService.GetGuardianListByNurseryId:output_type -> where_child_bus.v1.GetGuardianListByNurseryIdResponse
+ 11, // 19: where_child_bus.v1.GuardianService.UpdateGuardian:output_type -> where_child_bus.v1.UpdateGuardianResponse
+ 14, // [14:20] is the sub-list for method output_type
+ 8, // [8:14] is the sub-list for method input_type
+ 8, // [8:8] is the sub-list for extension type_name
+ 8, // [8:8] is the sub-list for extension extendee
+ 0, // [0:8] is the sub-list for field type_name
+}
+
+func init() { file_where_child_bus_v1_guardian_proto_init() }
+func file_where_child_bus_v1_guardian_proto_init() {
+ if File_where_child_bus_v1_guardian_proto != nil {
+ return
+ }
+ file_where_child_bus_v1_resources_proto_init()
+ if !protoimpl.UnsafeEnabled {
+ file_where_child_bus_v1_guardian_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CreateGuardianRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_guardian_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CreateGuardianResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_guardian_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GuardianLoginRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_guardian_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GuardianLoginResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_guardian_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetGuardianListByBusIdRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_guardian_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetGuardianListByBusIdResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_guardian_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetGuardianByChildIdRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_guardian_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetGuardianByChildIdResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_guardian_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetGuardianListByNurseryIdRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_guardian_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetGuardianListByNurseryIdResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_guardian_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*UpdateGuardianRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_guardian_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*UpdateGuardianResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_where_child_bus_v1_guardian_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 12,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_where_child_bus_v1_guardian_proto_goTypes,
+ DependencyIndexes: file_where_child_bus_v1_guardian_proto_depIdxs,
+ MessageInfos: file_where_child_bus_v1_guardian_proto_msgTypes,
+ }.Build()
+ File_where_child_bus_v1_guardian_proto = out.File
+ file_where_child_bus_v1_guardian_proto_rawDesc = nil
+ file_where_child_bus_v1_guardian_proto_goTypes = nil
+ file_where_child_bus_v1_guardian_proto_depIdxs = nil
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/guardian_grpc.pb.go b/backend/proto-gen/go/where_child_bus/v1/guardian_grpc.pb.go
new file mode 100644
index 00000000..32ca6380
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/guardian_grpc.pb.go
@@ -0,0 +1,292 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.3.0
+// - protoc (unknown)
+// source: where_child_bus/v1/guardian.proto
+
+package where_child_busv1
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+const (
+ GuardianService_CreateGuardian_FullMethodName = "/where_child_bus.v1.GuardianService/CreateGuardian"
+ GuardianService_GuardianLogin_FullMethodName = "/where_child_bus.v1.GuardianService/GuardianLogin"
+ GuardianService_GetGuardianListByBusId_FullMethodName = "/where_child_bus.v1.GuardianService/GetGuardianListByBusId"
+ GuardianService_GetGuardianByChildId_FullMethodName = "/where_child_bus.v1.GuardianService/GetGuardianByChildId"
+ GuardianService_GetGuardianListByNurseryId_FullMethodName = "/where_child_bus.v1.GuardianService/GetGuardianListByNurseryId"
+ GuardianService_UpdateGuardian_FullMethodName = "/where_child_bus.v1.GuardianService/UpdateGuardian"
+)
+
+// GuardianServiceClient is the client API for GuardianService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type GuardianServiceClient interface {
+ CreateGuardian(ctx context.Context, in *CreateGuardianRequest, opts ...grpc.CallOption) (*CreateGuardianResponse, error)
+ GuardianLogin(ctx context.Context, in *GuardianLoginRequest, opts ...grpc.CallOption) (*GuardianLoginResponse, error)
+ GetGuardianListByBusId(ctx context.Context, in *GetGuardianListByBusIdRequest, opts ...grpc.CallOption) (*GetGuardianListByBusIdResponse, error)
+ GetGuardianByChildId(ctx context.Context, in *GetGuardianByChildIdRequest, opts ...grpc.CallOption) (*GetGuardianByChildIdResponse, error)
+ GetGuardianListByNurseryId(ctx context.Context, in *GetGuardianListByNurseryIdRequest, opts ...grpc.CallOption) (*GetGuardianListByNurseryIdResponse, error)
+ UpdateGuardian(ctx context.Context, in *UpdateGuardianRequest, opts ...grpc.CallOption) (*UpdateGuardianResponse, error)
+}
+
+type guardianServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewGuardianServiceClient(cc grpc.ClientConnInterface) GuardianServiceClient {
+ return &guardianServiceClient{cc}
+}
+
+func (c *guardianServiceClient) CreateGuardian(ctx context.Context, in *CreateGuardianRequest, opts ...grpc.CallOption) (*CreateGuardianResponse, error) {
+ out := new(CreateGuardianResponse)
+ err := c.cc.Invoke(ctx, GuardianService_CreateGuardian_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *guardianServiceClient) GuardianLogin(ctx context.Context, in *GuardianLoginRequest, opts ...grpc.CallOption) (*GuardianLoginResponse, error) {
+ out := new(GuardianLoginResponse)
+ err := c.cc.Invoke(ctx, GuardianService_GuardianLogin_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *guardianServiceClient) GetGuardianListByBusId(ctx context.Context, in *GetGuardianListByBusIdRequest, opts ...grpc.CallOption) (*GetGuardianListByBusIdResponse, error) {
+ out := new(GetGuardianListByBusIdResponse)
+ err := c.cc.Invoke(ctx, GuardianService_GetGuardianListByBusId_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *guardianServiceClient) GetGuardianByChildId(ctx context.Context, in *GetGuardianByChildIdRequest, opts ...grpc.CallOption) (*GetGuardianByChildIdResponse, error) {
+ out := new(GetGuardianByChildIdResponse)
+ err := c.cc.Invoke(ctx, GuardianService_GetGuardianByChildId_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *guardianServiceClient) GetGuardianListByNurseryId(ctx context.Context, in *GetGuardianListByNurseryIdRequest, opts ...grpc.CallOption) (*GetGuardianListByNurseryIdResponse, error) {
+ out := new(GetGuardianListByNurseryIdResponse)
+ err := c.cc.Invoke(ctx, GuardianService_GetGuardianListByNurseryId_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *guardianServiceClient) UpdateGuardian(ctx context.Context, in *UpdateGuardianRequest, opts ...grpc.CallOption) (*UpdateGuardianResponse, error) {
+ out := new(UpdateGuardianResponse)
+ err := c.cc.Invoke(ctx, GuardianService_UpdateGuardian_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// GuardianServiceServer is the server API for GuardianService service.
+// All implementations should embed UnimplementedGuardianServiceServer
+// for forward compatibility
+type GuardianServiceServer interface {
+ CreateGuardian(context.Context, *CreateGuardianRequest) (*CreateGuardianResponse, error)
+ GuardianLogin(context.Context, *GuardianLoginRequest) (*GuardianLoginResponse, error)
+ GetGuardianListByBusId(context.Context, *GetGuardianListByBusIdRequest) (*GetGuardianListByBusIdResponse, error)
+ GetGuardianByChildId(context.Context, *GetGuardianByChildIdRequest) (*GetGuardianByChildIdResponse, error)
+ GetGuardianListByNurseryId(context.Context, *GetGuardianListByNurseryIdRequest) (*GetGuardianListByNurseryIdResponse, error)
+ UpdateGuardian(context.Context, *UpdateGuardianRequest) (*UpdateGuardianResponse, error)
+}
+
+// UnimplementedGuardianServiceServer should be embedded to have forward compatible implementations.
+type UnimplementedGuardianServiceServer struct {
+}
+
+func (UnimplementedGuardianServiceServer) CreateGuardian(context.Context, *CreateGuardianRequest) (*CreateGuardianResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CreateGuardian not implemented")
+}
+func (UnimplementedGuardianServiceServer) GuardianLogin(context.Context, *GuardianLoginRequest) (*GuardianLoginResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GuardianLogin not implemented")
+}
+func (UnimplementedGuardianServiceServer) GetGuardianListByBusId(context.Context, *GetGuardianListByBusIdRequest) (*GetGuardianListByBusIdResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetGuardianListByBusId not implemented")
+}
+func (UnimplementedGuardianServiceServer) GetGuardianByChildId(context.Context, *GetGuardianByChildIdRequest) (*GetGuardianByChildIdResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetGuardianByChildId not implemented")
+}
+func (UnimplementedGuardianServiceServer) GetGuardianListByNurseryId(context.Context, *GetGuardianListByNurseryIdRequest) (*GetGuardianListByNurseryIdResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetGuardianListByNurseryId not implemented")
+}
+func (UnimplementedGuardianServiceServer) UpdateGuardian(context.Context, *UpdateGuardianRequest) (*UpdateGuardianResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdateGuardian not implemented")
+}
+
+// UnsafeGuardianServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to GuardianServiceServer will
+// result in compilation errors.
+type UnsafeGuardianServiceServer interface {
+ mustEmbedUnimplementedGuardianServiceServer()
+}
+
+func RegisterGuardianServiceServer(s grpc.ServiceRegistrar, srv GuardianServiceServer) {
+ s.RegisterService(&GuardianService_ServiceDesc, srv)
+}
+
+func _GuardianService_CreateGuardian_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CreateGuardianRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(GuardianServiceServer).CreateGuardian(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: GuardianService_CreateGuardian_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(GuardianServiceServer).CreateGuardian(ctx, req.(*CreateGuardianRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _GuardianService_GuardianLogin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GuardianLoginRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(GuardianServiceServer).GuardianLogin(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: GuardianService_GuardianLogin_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(GuardianServiceServer).GuardianLogin(ctx, req.(*GuardianLoginRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _GuardianService_GetGuardianListByBusId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetGuardianListByBusIdRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(GuardianServiceServer).GetGuardianListByBusId(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: GuardianService_GetGuardianListByBusId_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(GuardianServiceServer).GetGuardianListByBusId(ctx, req.(*GetGuardianListByBusIdRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _GuardianService_GetGuardianByChildId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetGuardianByChildIdRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(GuardianServiceServer).GetGuardianByChildId(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: GuardianService_GetGuardianByChildId_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(GuardianServiceServer).GetGuardianByChildId(ctx, req.(*GetGuardianByChildIdRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _GuardianService_GetGuardianListByNurseryId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetGuardianListByNurseryIdRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(GuardianServiceServer).GetGuardianListByNurseryId(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: GuardianService_GetGuardianListByNurseryId_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(GuardianServiceServer).GetGuardianListByNurseryId(ctx, req.(*GetGuardianListByNurseryIdRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _GuardianService_UpdateGuardian_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(UpdateGuardianRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(GuardianServiceServer).UpdateGuardian(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: GuardianService_UpdateGuardian_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(GuardianServiceServer).UpdateGuardian(ctx, req.(*UpdateGuardianRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// GuardianService_ServiceDesc is the grpc.ServiceDesc for GuardianService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var GuardianService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "where_child_bus.v1.GuardianService",
+ HandlerType: (*GuardianServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "CreateGuardian",
+ Handler: _GuardianService_CreateGuardian_Handler,
+ },
+ {
+ MethodName: "GuardianLogin",
+ Handler: _GuardianService_GuardianLogin_Handler,
+ },
+ {
+ MethodName: "GetGuardianListByBusId",
+ Handler: _GuardianService_GetGuardianListByBusId_Handler,
+ },
+ {
+ MethodName: "GetGuardianByChildId",
+ Handler: _GuardianService_GetGuardianByChildId_Handler,
+ },
+ {
+ MethodName: "GetGuardianListByNurseryId",
+ Handler: _GuardianService_GetGuardianListByNurseryId_Handler,
+ },
+ {
+ MethodName: "UpdateGuardian",
+ Handler: _GuardianService_UpdateGuardian_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "where_child_bus/v1/guardian.proto",
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/health_check.pb.go b/backend/proto-gen/go/where_child_bus/v1/health_check.pb.go
new file mode 100644
index 00000000..78d644b1
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/health_check.pb.go
@@ -0,0 +1,229 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.32.0
+// protoc (unknown)
+// source: where_child_bus/v1/health_check.proto
+
+package where_child_busv1
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type PingRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+}
+
+func (x *PingRequest) Reset() {
+ *x = PingRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_health_check_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PingRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PingRequest) ProtoMessage() {}
+
+func (x *PingRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_health_check_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PingRequest.ProtoReflect.Descriptor instead.
+func (*PingRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_health_check_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *PingRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+type PingResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
+}
+
+func (x *PingResponse) Reset() {
+ *x = PingResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_health_check_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PingResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PingResponse) ProtoMessage() {}
+
+func (x *PingResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_health_check_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PingResponse.ProtoReflect.Descriptor instead.
+func (*PingResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_health_check_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *PingResponse) GetMessage() string {
+ if x != nil {
+ return x.Message
+ }
+ return ""
+}
+
+var File_where_child_bus_v1_health_check_proto protoreflect.FileDescriptor
+
+var file_where_child_bus_v1_health_check_proto_rawDesc = []byte{
+ 0x0a, 0x25, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x63, 0x68, 0x65, 0x63,
+ 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x22, 0x21, 0x0a, 0x0b, 0x50,
+ 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
+ 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x28,
+ 0x0a, 0x0c, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18,
+ 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x5f, 0x0a, 0x12, 0x48, 0x65, 0x61, 0x6c,
+ 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x49,
+ 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x1f, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x69, 0x6e, 0x67,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f,
+ 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x69, 0x6e,
+ 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xf3, 0x01, 0x0a, 0x16, 0x63, 0x6f,
+ 0x6d, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63,
+ 0x6b, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x66, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
+ 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x65, 0x6e, 0x54, 0x65, 0x61, 0x50, 0x72, 0x6f,
+ 0x67, 0x72, 0x61, 0x6d, 0x6d, 0x65, 0x72, 0x73, 0x2f, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68,
+ 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2f, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x77, 0x68, 0x65, 0x72,
+ 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x77,
+ 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x76, 0x31,
+ 0xa2, 0x02, 0x03, 0x57, 0x58, 0x58, 0xaa, 0x02, 0x10, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68,
+ 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x57, 0x68, 0x65, 0x72,
+ 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x57,
+ 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x5c, 0x56, 0x31, 0x5c,
+ 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x57, 0x68,
+ 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62,
+ 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_where_child_bus_v1_health_check_proto_rawDescOnce sync.Once
+ file_where_child_bus_v1_health_check_proto_rawDescData = file_where_child_bus_v1_health_check_proto_rawDesc
+)
+
+func file_where_child_bus_v1_health_check_proto_rawDescGZIP() []byte {
+ file_where_child_bus_v1_health_check_proto_rawDescOnce.Do(func() {
+ file_where_child_bus_v1_health_check_proto_rawDescData = protoimpl.X.CompressGZIP(file_where_child_bus_v1_health_check_proto_rawDescData)
+ })
+ return file_where_child_bus_v1_health_check_proto_rawDescData
+}
+
+var file_where_child_bus_v1_health_check_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
+var file_where_child_bus_v1_health_check_proto_goTypes = []interface{}{
+ (*PingRequest)(nil), // 0: where_child_bus.v1.PingRequest
+ (*PingResponse)(nil), // 1: where_child_bus.v1.PingResponse
+}
+var file_where_child_bus_v1_health_check_proto_depIdxs = []int32{
+ 0, // 0: where_child_bus.v1.HealthcheckService.Ping:input_type -> where_child_bus.v1.PingRequest
+ 1, // 1: where_child_bus.v1.HealthcheckService.Ping:output_type -> where_child_bus.v1.PingResponse
+ 1, // [1:2] is the sub-list for method output_type
+ 0, // [0:1] is the sub-list for method input_type
+ 0, // [0:0] is the sub-list for extension type_name
+ 0, // [0:0] is the sub-list for extension extendee
+ 0, // [0:0] is the sub-list for field type_name
+}
+
+func init() { file_where_child_bus_v1_health_check_proto_init() }
+func file_where_child_bus_v1_health_check_proto_init() {
+ if File_where_child_bus_v1_health_check_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_where_child_bus_v1_health_check_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PingRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_health_check_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PingResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_where_child_bus_v1_health_check_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 2,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_where_child_bus_v1_health_check_proto_goTypes,
+ DependencyIndexes: file_where_child_bus_v1_health_check_proto_depIdxs,
+ MessageInfos: file_where_child_bus_v1_health_check_proto_msgTypes,
+ }.Build()
+ File_where_child_bus_v1_health_check_proto = out.File
+ file_where_child_bus_v1_health_check_proto_rawDesc = nil
+ file_where_child_bus_v1_health_check_proto_goTypes = nil
+ file_where_child_bus_v1_health_check_proto_depIdxs = nil
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/health_check_grpc.pb.go b/backend/proto-gen/go/where_child_bus/v1/health_check_grpc.pb.go
new file mode 100644
index 00000000..44529239
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/health_check_grpc.pb.go
@@ -0,0 +1,107 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.3.0
+// - protoc (unknown)
+// source: where_child_bus/v1/health_check.proto
+
+package where_child_busv1
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+const (
+ HealthcheckService_Ping_FullMethodName = "/where_child_bus.v1.HealthcheckService/Ping"
+)
+
+// HealthcheckServiceClient is the client API for HealthcheckService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type HealthcheckServiceClient interface {
+ Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error)
+}
+
+type healthcheckServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewHealthcheckServiceClient(cc grpc.ClientConnInterface) HealthcheckServiceClient {
+ return &healthcheckServiceClient{cc}
+}
+
+func (c *healthcheckServiceClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) {
+ out := new(PingResponse)
+ err := c.cc.Invoke(ctx, HealthcheckService_Ping_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// HealthcheckServiceServer is the server API for HealthcheckService service.
+// All implementations should embed UnimplementedHealthcheckServiceServer
+// for forward compatibility
+type HealthcheckServiceServer interface {
+ Ping(context.Context, *PingRequest) (*PingResponse, error)
+}
+
+// UnimplementedHealthcheckServiceServer should be embedded to have forward compatible implementations.
+type UnimplementedHealthcheckServiceServer struct {
+}
+
+func (UnimplementedHealthcheckServiceServer) Ping(context.Context, *PingRequest) (*PingResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
+}
+
+// UnsafeHealthcheckServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to HealthcheckServiceServer will
+// result in compilation errors.
+type UnsafeHealthcheckServiceServer interface {
+ mustEmbedUnimplementedHealthcheckServiceServer()
+}
+
+func RegisterHealthcheckServiceServer(s grpc.ServiceRegistrar, srv HealthcheckServiceServer) {
+ s.RegisterService(&HealthcheckService_ServiceDesc, srv)
+}
+
+func _HealthcheckService_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(PingRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(HealthcheckServiceServer).Ping(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: HealthcheckService_Ping_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(HealthcheckServiceServer).Ping(ctx, req.(*PingRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// HealthcheckService_ServiceDesc is the grpc.ServiceDesc for HealthcheckService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var HealthcheckService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "where_child_bus.v1.HealthcheckService",
+ HandlerType: (*HealthcheckServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "Ping",
+ Handler: _HealthcheckService_Ping_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "where_child_bus/v1/health_check.proto",
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/nursery.pb.go b/backend/proto-gen/go/where_child_bus/v1/nursery.pb.go
new file mode 100644
index 00000000..fd1e1f64
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/nursery.pb.go
@@ -0,0 +1,778 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.32.0
+// protoc (unknown)
+// source: where_child_bus/v1/nursery.proto
+
+package where_child_busv1
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type GetNurseryByGuardianIdRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ GuardianId string `protobuf:"bytes,1,opt,name=guardian_id,json=guardianId,proto3" json:"guardian_id,omitempty"`
+}
+
+func (x *GetNurseryByGuardianIdRequest) Reset() {
+ *x = GetNurseryByGuardianIdRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_nursery_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetNurseryByGuardianIdRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetNurseryByGuardianIdRequest) ProtoMessage() {}
+
+func (x *GetNurseryByGuardianIdRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_nursery_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetNurseryByGuardianIdRequest.ProtoReflect.Descriptor instead.
+func (*GetNurseryByGuardianIdRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_nursery_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *GetNurseryByGuardianIdRequest) GetGuardianId() string {
+ if x != nil {
+ return x.GuardianId
+ }
+ return ""
+}
+
+type GetNurseryByGuardianIdResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Nurseries *NurseryResponse `protobuf:"bytes,1,opt,name=nurseries,proto3" json:"nurseries,omitempty"`
+}
+
+func (x *GetNurseryByGuardianIdResponse) Reset() {
+ *x = GetNurseryByGuardianIdResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_nursery_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetNurseryByGuardianIdResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetNurseryByGuardianIdResponse) ProtoMessage() {}
+
+func (x *GetNurseryByGuardianIdResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_nursery_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetNurseryByGuardianIdResponse.ProtoReflect.Descriptor instead.
+func (*GetNurseryByGuardianIdResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_nursery_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *GetNurseryByGuardianIdResponse) GetNurseries() *NurseryResponse {
+ if x != nil {
+ return x.Nurseries
+ }
+ return nil
+}
+
+type CreateNurseryRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
+ Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
+ Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
+ PhoneNumber string `protobuf:"bytes,4,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"`
+ Address string `protobuf:"bytes,5,opt,name=address,proto3" json:"address,omitempty"`
+}
+
+func (x *CreateNurseryRequest) Reset() {
+ *x = CreateNurseryRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_nursery_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreateNurseryRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateNurseryRequest) ProtoMessage() {}
+
+func (x *CreateNurseryRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_nursery_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateNurseryRequest.ProtoReflect.Descriptor instead.
+func (*CreateNurseryRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_nursery_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *CreateNurseryRequest) GetEmail() string {
+ if x != nil {
+ return x.Email
+ }
+ return ""
+}
+
+func (x *CreateNurseryRequest) GetPassword() string {
+ if x != nil {
+ return x.Password
+ }
+ return ""
+}
+
+func (x *CreateNurseryRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *CreateNurseryRequest) GetPhoneNumber() string {
+ if x != nil {
+ return x.PhoneNumber
+ }
+ return ""
+}
+
+func (x *CreateNurseryRequest) GetAddress() string {
+ if x != nil {
+ return x.Address
+ }
+ return ""
+}
+
+type CreateNurseryResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Nursery *NurseryResponse `protobuf:"bytes,1,opt,name=nursery,proto3" json:"nursery,omitempty"`
+}
+
+func (x *CreateNurseryResponse) Reset() {
+ *x = CreateNurseryResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_nursery_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreateNurseryResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateNurseryResponse) ProtoMessage() {}
+
+func (x *CreateNurseryResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_nursery_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateNurseryResponse.ProtoReflect.Descriptor instead.
+func (*CreateNurseryResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_nursery_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *CreateNurseryResponse) GetNursery() *NurseryResponse {
+ if x != nil {
+ return x.Nursery
+ }
+ return nil
+}
+
+type NurseryLoginRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
+ Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
+}
+
+func (x *NurseryLoginRequest) Reset() {
+ *x = NurseryLoginRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_nursery_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NurseryLoginRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NurseryLoginRequest) ProtoMessage() {}
+
+func (x *NurseryLoginRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_nursery_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NurseryLoginRequest.ProtoReflect.Descriptor instead.
+func (*NurseryLoginRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_nursery_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *NurseryLoginRequest) GetEmail() string {
+ if x != nil {
+ return x.Email
+ }
+ return ""
+}
+
+func (x *NurseryLoginRequest) GetPassword() string {
+ if x != nil {
+ return x.Password
+ }
+ return ""
+}
+
+type NurseryLoginResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
+ Nursery *NurseryResponse `protobuf:"bytes,2,opt,name=nursery,proto3" json:"nursery,omitempty"`
+}
+
+func (x *NurseryLoginResponse) Reset() {
+ *x = NurseryLoginResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_nursery_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NurseryLoginResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NurseryLoginResponse) ProtoMessage() {}
+
+func (x *NurseryLoginResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_nursery_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NurseryLoginResponse.ProtoReflect.Descriptor instead.
+func (*NurseryLoginResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_nursery_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *NurseryLoginResponse) GetSuccess() bool {
+ if x != nil {
+ return x.Success
+ }
+ return false
+}
+
+func (x *NurseryLoginResponse) GetNursery() *NurseryResponse {
+ if x != nil {
+ return x.Nursery
+ }
+ return nil
+}
+
+type UpdateNurseryRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
+ Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
+ Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"`
+ PhoneNumber string `protobuf:"bytes,4,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"`
+ Email string `protobuf:"bytes,5,opt,name=email,proto3" json:"email,omitempty"`
+ Password string `protobuf:"bytes,6,opt,name=password,proto3" json:"password,omitempty"`
+ UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,7,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
+}
+
+func (x *UpdateNurseryRequest) Reset() {
+ *x = UpdateNurseryRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_nursery_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateNurseryRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateNurseryRequest) ProtoMessage() {}
+
+func (x *UpdateNurseryRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_nursery_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateNurseryRequest.ProtoReflect.Descriptor instead.
+func (*UpdateNurseryRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_nursery_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *UpdateNurseryRequest) GetId() string {
+ if x != nil {
+ return x.Id
+ }
+ return ""
+}
+
+func (x *UpdateNurseryRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *UpdateNurseryRequest) GetAddress() string {
+ if x != nil {
+ return x.Address
+ }
+ return ""
+}
+
+func (x *UpdateNurseryRequest) GetPhoneNumber() string {
+ if x != nil {
+ return x.PhoneNumber
+ }
+ return ""
+}
+
+func (x *UpdateNurseryRequest) GetEmail() string {
+ if x != nil {
+ return x.Email
+ }
+ return ""
+}
+
+func (x *UpdateNurseryRequest) GetPassword() string {
+ if x != nil {
+ return x.Password
+ }
+ return ""
+}
+
+func (x *UpdateNurseryRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
+ if x != nil {
+ return x.UpdateMask
+ }
+ return nil
+}
+
+type UpdateNurseryResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Nursery *NurseryResponse `protobuf:"bytes,1,opt,name=nursery,proto3" json:"nursery,omitempty"`
+}
+
+func (x *UpdateNurseryResponse) Reset() {
+ *x = UpdateNurseryResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_nursery_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateNurseryResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateNurseryResponse) ProtoMessage() {}
+
+func (x *UpdateNurseryResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_nursery_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateNurseryResponse.ProtoReflect.Descriptor instead.
+func (*UpdateNurseryResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_nursery_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *UpdateNurseryResponse) GetNursery() *NurseryResponse {
+ if x != nil {
+ return x.Nursery
+ }
+ return nil
+}
+
+var File_where_child_bus_v1_nursery_proto protoreflect.FileDescriptor
+
+var file_where_child_bus_v1_nursery_proto_rawDesc = []byte{
+ 0x0a, 0x20, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f,
+ 0x74, 0x6f, 0x12, 0x12, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f,
+ 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x22, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68,
+ 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75,
+ 0x72, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67,
+ 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c,
+ 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x40, 0x0a, 0x1d,
+ 0x47, 0x65, 0x74, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x42, 0x79, 0x47, 0x75, 0x61, 0x72,
+ 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a,
+ 0x0b, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x0a, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x22, 0x63,
+ 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x42, 0x79, 0x47, 0x75,
+ 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x12, 0x41, 0x0a, 0x09, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c,
+ 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x09, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72,
+ 0x69, 0x65, 0x73, 0x22, 0x99, 0x01, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x75,
+ 0x72, 0x73, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05,
+ 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61,
+ 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x12,
+ 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
+ 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62,
+ 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e,
+ 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
+ 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22,
+ 0x56, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x07, 0x6e, 0x75, 0x72, 0x73,
+ 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x77, 0x68, 0x65, 0x72,
+ 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4e,
+ 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x07,
+ 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x22, 0x47, 0x0a, 0x13, 0x4e, 0x75, 0x72, 0x73, 0x65,
+ 0x72, 0x79, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14,
+ 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65,
+ 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
+ 0x22, 0x6f, 0x0a, 0x14, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x4c, 0x6f, 0x67, 0x69, 0x6e,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63,
+ 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65,
+ 0x73, 0x73, 0x12, 0x3d, 0x0a, 0x07, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x18, 0x02, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c,
+ 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x07, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72,
+ 0x79, 0x22, 0xe6, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x75, 0x72, 0x73,
+ 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
+ 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18,
+ 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e,
+ 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
+ 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x65,
+ 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69,
+ 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x06, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x3b, 0x0a,
+ 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x07, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a,
+ 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x56, 0x0a, 0x15, 0x55, 0x70,
+ 0x64, 0x61, 0x74, 0x65, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f,
+ 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x07, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72,
+ 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x07, 0x6e, 0x75, 0x72, 0x73, 0x65,
+ 0x72, 0x79, 0x32, 0xc0, 0x03, 0x0a, 0x0e, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x53, 0x65,
+ 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7f, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4e, 0x75, 0x72, 0x73,
+ 0x65, 0x72, 0x79, 0x42, 0x79, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x12,
+ 0x31, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x42,
+ 0x79, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64,
+ 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x75, 0x72, 0x73, 0x65,
+ 0x72, 0x79, 0x42, 0x79, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
+ 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x12, 0x28, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f,
+ 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65,
+ 0x61, 0x74, 0x65, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+ 0x74, 0x1a, 0x29, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f,
+ 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x75, 0x72,
+ 0x73, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0c,
+ 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x27, 0x2e, 0x77,
+ 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76,
+ 0x31, 0x2e, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65,
+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68,
+ 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x75, 0x72, 0x73, 0x65,
+ 0x72, 0x79, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+ 0x64, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79,
+ 0x12, 0x28, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62,
+ 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x75, 0x72, 0x73,
+ 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x77, 0x68, 0x65,
+ 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e,
+ 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xef, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x77, 0x68,
+ 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31,
+ 0x42, 0x0c, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
+ 0x5a, 0x66, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65,
+ 0x65, 0x6e, 0x54, 0x65, 0x61, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x6d, 0x65, 0x72, 0x73,
+ 0x2f, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x2f, 0x62,
+ 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x67, 0x65, 0x6e,
+ 0x2f, 0x67, 0x6f, 0x2f, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f,
+ 0x62, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x57, 0x58, 0x58, 0xaa, 0x02,
+ 0x10, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x2e, 0x56,
+ 0x31, 0xca, 0x02, 0x10, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75,
+ 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c,
+ 0x64, 0x42, 0x75, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64,
+ 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64,
+ 0x42, 0x75, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_where_child_bus_v1_nursery_proto_rawDescOnce sync.Once
+ file_where_child_bus_v1_nursery_proto_rawDescData = file_where_child_bus_v1_nursery_proto_rawDesc
+)
+
+func file_where_child_bus_v1_nursery_proto_rawDescGZIP() []byte {
+ file_where_child_bus_v1_nursery_proto_rawDescOnce.Do(func() {
+ file_where_child_bus_v1_nursery_proto_rawDescData = protoimpl.X.CompressGZIP(file_where_child_bus_v1_nursery_proto_rawDescData)
+ })
+ return file_where_child_bus_v1_nursery_proto_rawDescData
+}
+
+var file_where_child_bus_v1_nursery_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
+var file_where_child_bus_v1_nursery_proto_goTypes = []interface{}{
+ (*GetNurseryByGuardianIdRequest)(nil), // 0: where_child_bus.v1.GetNurseryByGuardianIdRequest
+ (*GetNurseryByGuardianIdResponse)(nil), // 1: where_child_bus.v1.GetNurseryByGuardianIdResponse
+ (*CreateNurseryRequest)(nil), // 2: where_child_bus.v1.CreateNurseryRequest
+ (*CreateNurseryResponse)(nil), // 3: where_child_bus.v1.CreateNurseryResponse
+ (*NurseryLoginRequest)(nil), // 4: where_child_bus.v1.NurseryLoginRequest
+ (*NurseryLoginResponse)(nil), // 5: where_child_bus.v1.NurseryLoginResponse
+ (*UpdateNurseryRequest)(nil), // 6: where_child_bus.v1.UpdateNurseryRequest
+ (*UpdateNurseryResponse)(nil), // 7: where_child_bus.v1.UpdateNurseryResponse
+ (*NurseryResponse)(nil), // 8: where_child_bus.v1.NurseryResponse
+ (*fieldmaskpb.FieldMask)(nil), // 9: google.protobuf.FieldMask
+}
+var file_where_child_bus_v1_nursery_proto_depIdxs = []int32{
+ 8, // 0: where_child_bus.v1.GetNurseryByGuardianIdResponse.nurseries:type_name -> where_child_bus.v1.NurseryResponse
+ 8, // 1: where_child_bus.v1.CreateNurseryResponse.nursery:type_name -> where_child_bus.v1.NurseryResponse
+ 8, // 2: where_child_bus.v1.NurseryLoginResponse.nursery:type_name -> where_child_bus.v1.NurseryResponse
+ 9, // 3: where_child_bus.v1.UpdateNurseryRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 8, // 4: where_child_bus.v1.UpdateNurseryResponse.nursery:type_name -> where_child_bus.v1.NurseryResponse
+ 0, // 5: where_child_bus.v1.NurseryService.GetNurseryByGuardianId:input_type -> where_child_bus.v1.GetNurseryByGuardianIdRequest
+ 2, // 6: where_child_bus.v1.NurseryService.CreateNursery:input_type -> where_child_bus.v1.CreateNurseryRequest
+ 4, // 7: where_child_bus.v1.NurseryService.NurseryLogin:input_type -> where_child_bus.v1.NurseryLoginRequest
+ 6, // 8: where_child_bus.v1.NurseryService.UpdateNursery:input_type -> where_child_bus.v1.UpdateNurseryRequest
+ 1, // 9: where_child_bus.v1.NurseryService.GetNurseryByGuardianId:output_type -> where_child_bus.v1.GetNurseryByGuardianIdResponse
+ 3, // 10: where_child_bus.v1.NurseryService.CreateNursery:output_type -> where_child_bus.v1.CreateNurseryResponse
+ 5, // 11: where_child_bus.v1.NurseryService.NurseryLogin:output_type -> where_child_bus.v1.NurseryLoginResponse
+ 7, // 12: where_child_bus.v1.NurseryService.UpdateNursery:output_type -> where_child_bus.v1.UpdateNurseryResponse
+ 9, // [9:13] is the sub-list for method output_type
+ 5, // [5:9] is the sub-list for method input_type
+ 5, // [5:5] is the sub-list for extension type_name
+ 5, // [5:5] is the sub-list for extension extendee
+ 0, // [0:5] is the sub-list for field type_name
+}
+
+func init() { file_where_child_bus_v1_nursery_proto_init() }
+func file_where_child_bus_v1_nursery_proto_init() {
+ if File_where_child_bus_v1_nursery_proto != nil {
+ return
+ }
+ file_where_child_bus_v1_resources_proto_init()
+ if !protoimpl.UnsafeEnabled {
+ file_where_child_bus_v1_nursery_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetNurseryByGuardianIdRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_nursery_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetNurseryByGuardianIdResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_nursery_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CreateNurseryRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_nursery_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CreateNurseryResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_nursery_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NurseryLoginRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_nursery_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NurseryLoginResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_nursery_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*UpdateNurseryRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_nursery_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*UpdateNurseryResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_where_child_bus_v1_nursery_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 8,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_where_child_bus_v1_nursery_proto_goTypes,
+ DependencyIndexes: file_where_child_bus_v1_nursery_proto_depIdxs,
+ MessageInfos: file_where_child_bus_v1_nursery_proto_msgTypes,
+ }.Build()
+ File_where_child_bus_v1_nursery_proto = out.File
+ file_where_child_bus_v1_nursery_proto_rawDesc = nil
+ file_where_child_bus_v1_nursery_proto_goTypes = nil
+ file_where_child_bus_v1_nursery_proto_depIdxs = nil
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/nursery_grpc.pb.go b/backend/proto-gen/go/where_child_bus/v1/nursery_grpc.pb.go
new file mode 100644
index 00000000..7a45b357
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/nursery_grpc.pb.go
@@ -0,0 +1,218 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.3.0
+// - protoc (unknown)
+// source: where_child_bus/v1/nursery.proto
+
+package where_child_busv1
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+const (
+ NurseryService_GetNurseryByGuardianId_FullMethodName = "/where_child_bus.v1.NurseryService/GetNurseryByGuardianId"
+ NurseryService_CreateNursery_FullMethodName = "/where_child_bus.v1.NurseryService/CreateNursery"
+ NurseryService_NurseryLogin_FullMethodName = "/where_child_bus.v1.NurseryService/NurseryLogin"
+ NurseryService_UpdateNursery_FullMethodName = "/where_child_bus.v1.NurseryService/UpdateNursery"
+)
+
+// NurseryServiceClient is the client API for NurseryService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type NurseryServiceClient interface {
+ GetNurseryByGuardianId(ctx context.Context, in *GetNurseryByGuardianIdRequest, opts ...grpc.CallOption) (*GetNurseryByGuardianIdResponse, error)
+ CreateNursery(ctx context.Context, in *CreateNurseryRequest, opts ...grpc.CallOption) (*CreateNurseryResponse, error)
+ NurseryLogin(ctx context.Context, in *NurseryLoginRequest, opts ...grpc.CallOption) (*NurseryLoginResponse, error)
+ UpdateNursery(ctx context.Context, in *UpdateNurseryRequest, opts ...grpc.CallOption) (*UpdateNurseryResponse, error)
+}
+
+type nurseryServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewNurseryServiceClient(cc grpc.ClientConnInterface) NurseryServiceClient {
+ return &nurseryServiceClient{cc}
+}
+
+func (c *nurseryServiceClient) GetNurseryByGuardianId(ctx context.Context, in *GetNurseryByGuardianIdRequest, opts ...grpc.CallOption) (*GetNurseryByGuardianIdResponse, error) {
+ out := new(GetNurseryByGuardianIdResponse)
+ err := c.cc.Invoke(ctx, NurseryService_GetNurseryByGuardianId_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *nurseryServiceClient) CreateNursery(ctx context.Context, in *CreateNurseryRequest, opts ...grpc.CallOption) (*CreateNurseryResponse, error) {
+ out := new(CreateNurseryResponse)
+ err := c.cc.Invoke(ctx, NurseryService_CreateNursery_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *nurseryServiceClient) NurseryLogin(ctx context.Context, in *NurseryLoginRequest, opts ...grpc.CallOption) (*NurseryLoginResponse, error) {
+ out := new(NurseryLoginResponse)
+ err := c.cc.Invoke(ctx, NurseryService_NurseryLogin_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *nurseryServiceClient) UpdateNursery(ctx context.Context, in *UpdateNurseryRequest, opts ...grpc.CallOption) (*UpdateNurseryResponse, error) {
+ out := new(UpdateNurseryResponse)
+ err := c.cc.Invoke(ctx, NurseryService_UpdateNursery_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// NurseryServiceServer is the server API for NurseryService service.
+// All implementations should embed UnimplementedNurseryServiceServer
+// for forward compatibility
+type NurseryServiceServer interface {
+ GetNurseryByGuardianId(context.Context, *GetNurseryByGuardianIdRequest) (*GetNurseryByGuardianIdResponse, error)
+ CreateNursery(context.Context, *CreateNurseryRequest) (*CreateNurseryResponse, error)
+ NurseryLogin(context.Context, *NurseryLoginRequest) (*NurseryLoginResponse, error)
+ UpdateNursery(context.Context, *UpdateNurseryRequest) (*UpdateNurseryResponse, error)
+}
+
+// UnimplementedNurseryServiceServer should be embedded to have forward compatible implementations.
+type UnimplementedNurseryServiceServer struct {
+}
+
+func (UnimplementedNurseryServiceServer) GetNurseryByGuardianId(context.Context, *GetNurseryByGuardianIdRequest) (*GetNurseryByGuardianIdResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetNurseryByGuardianId not implemented")
+}
+func (UnimplementedNurseryServiceServer) CreateNursery(context.Context, *CreateNurseryRequest) (*CreateNurseryResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CreateNursery not implemented")
+}
+func (UnimplementedNurseryServiceServer) NurseryLogin(context.Context, *NurseryLoginRequest) (*NurseryLoginResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method NurseryLogin not implemented")
+}
+func (UnimplementedNurseryServiceServer) UpdateNursery(context.Context, *UpdateNurseryRequest) (*UpdateNurseryResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdateNursery not implemented")
+}
+
+// UnsafeNurseryServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to NurseryServiceServer will
+// result in compilation errors.
+type UnsafeNurseryServiceServer interface {
+ mustEmbedUnimplementedNurseryServiceServer()
+}
+
+func RegisterNurseryServiceServer(s grpc.ServiceRegistrar, srv NurseryServiceServer) {
+ s.RegisterService(&NurseryService_ServiceDesc, srv)
+}
+
+func _NurseryService_GetNurseryByGuardianId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetNurseryByGuardianIdRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(NurseryServiceServer).GetNurseryByGuardianId(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: NurseryService_GetNurseryByGuardianId_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(NurseryServiceServer).GetNurseryByGuardianId(ctx, req.(*GetNurseryByGuardianIdRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _NurseryService_CreateNursery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CreateNurseryRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(NurseryServiceServer).CreateNursery(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: NurseryService_CreateNursery_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(NurseryServiceServer).CreateNursery(ctx, req.(*CreateNurseryRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _NurseryService_NurseryLogin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(NurseryLoginRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(NurseryServiceServer).NurseryLogin(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: NurseryService_NurseryLogin_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(NurseryServiceServer).NurseryLogin(ctx, req.(*NurseryLoginRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _NurseryService_UpdateNursery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(UpdateNurseryRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(NurseryServiceServer).UpdateNursery(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: NurseryService_UpdateNursery_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(NurseryServiceServer).UpdateNursery(ctx, req.(*UpdateNurseryRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// NurseryService_ServiceDesc is the grpc.ServiceDesc for NurseryService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var NurseryService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "where_child_bus.v1.NurseryService",
+ HandlerType: (*NurseryServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "GetNurseryByGuardianId",
+ Handler: _NurseryService_GetNurseryByGuardianId_Handler,
+ },
+ {
+ MethodName: "CreateNursery",
+ Handler: _NurseryService_CreateNursery_Handler,
+ },
+ {
+ MethodName: "NurseryLogin",
+ Handler: _NurseryService_NurseryLogin_Handler,
+ },
+ {
+ MethodName: "UpdateNursery",
+ Handler: _NurseryService_UpdateNursery_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "where_child_bus/v1/nursery.proto",
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/resources.pb.go b/backend/proto-gen/go/where_child_bus/v1/resources.pb.go
new file mode 100644
index 00000000..6dfaef38
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/resources.pb.go
@@ -0,0 +1,1813 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.32.0
+// protoc (unknown)
+// source: where_child_bus/v1/resources.proto
+
+package where_child_busv1
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ timestamppb "google.golang.org/protobuf/types/known/timestamppb"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type BusStatus int32
+
+const (
+ BusStatus_BUS_STATUS_UNSPECIFIED BusStatus = 0
+ BusStatus_BUS_STATUS_STOPPED BusStatus = 1
+ BusStatus_BUS_STATUS_RUNNING BusStatus = 2
+ BusStatus_BUS_STATUS_MAINTENANCE BusStatus = 3
+)
+
+// Enum value maps for BusStatus.
+var (
+ BusStatus_name = map[int32]string{
+ 0: "BUS_STATUS_UNSPECIFIED",
+ 1: "BUS_STATUS_STOPPED",
+ 2: "BUS_STATUS_RUNNING",
+ 3: "BUS_STATUS_MAINTENANCE",
+ }
+ BusStatus_value = map[string]int32{
+ "BUS_STATUS_UNSPECIFIED": 0,
+ "BUS_STATUS_STOPPED": 1,
+ "BUS_STATUS_RUNNING": 2,
+ "BUS_STATUS_MAINTENANCE": 3,
+ }
+)
+
+func (x BusStatus) Enum() *BusStatus {
+ p := new(BusStatus)
+ *p = x
+ return p
+}
+
+func (x BusStatus) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (BusStatus) Descriptor() protoreflect.EnumDescriptor {
+ return file_where_child_bus_v1_resources_proto_enumTypes[0].Descriptor()
+}
+
+func (BusStatus) Type() protoreflect.EnumType {
+ return &file_where_child_bus_v1_resources_proto_enumTypes[0]
+}
+
+func (x BusStatus) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use BusStatus.Descriptor instead.
+func (BusStatus) EnumDescriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_resources_proto_rawDescGZIP(), []int{0}
+}
+
+type VehicleEvent int32
+
+const (
+ VehicleEvent_VEHICLE_EVENT_UNSPECIFIED VehicleEvent = 0
+ VehicleEvent_VEHICLE_EVENT_GET_ON VehicleEvent = 1
+ VehicleEvent_VEHICLE_EVENT_GET_OFF VehicleEvent = 2
+)
+
+// Enum value maps for VehicleEvent.
+var (
+ VehicleEvent_name = map[int32]string{
+ 0: "VEHICLE_EVENT_UNSPECIFIED",
+ 1: "VEHICLE_EVENT_GET_ON",
+ 2: "VEHICLE_EVENT_GET_OFF",
+ }
+ VehicleEvent_value = map[string]int32{
+ "VEHICLE_EVENT_UNSPECIFIED": 0,
+ "VEHICLE_EVENT_GET_ON": 1,
+ "VEHICLE_EVENT_GET_OFF": 2,
+ }
+)
+
+func (x VehicleEvent) Enum() *VehicleEvent {
+ p := new(VehicleEvent)
+ *p = x
+ return p
+}
+
+func (x VehicleEvent) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (VehicleEvent) Descriptor() protoreflect.EnumDescriptor {
+ return file_where_child_bus_v1_resources_proto_enumTypes[1].Descriptor()
+}
+
+func (VehicleEvent) Type() protoreflect.EnumType {
+ return &file_where_child_bus_v1_resources_proto_enumTypes[1]
+}
+
+func (x VehicleEvent) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use VehicleEvent.Descriptor instead.
+func (VehicleEvent) EnumDescriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_resources_proto_rawDescGZIP(), []int{1}
+}
+
+type Sex int32
+
+const (
+ Sex_SEX_UNSPECIFIED Sex = 0
+ Sex_SEX_MAN Sex = 1
+ Sex_SEX_WOMAN Sex = 2
+ Sex_SEX_OTHER Sex = 3
+)
+
+// Enum value maps for Sex.
+var (
+ Sex_name = map[int32]string{
+ 0: "SEX_UNSPECIFIED",
+ 1: "SEX_MAN",
+ 2: "SEX_WOMAN",
+ 3: "SEX_OTHER",
+ }
+ Sex_value = map[string]int32{
+ "SEX_UNSPECIFIED": 0,
+ "SEX_MAN": 1,
+ "SEX_WOMAN": 2,
+ "SEX_OTHER": 3,
+ }
+)
+
+func (x Sex) Enum() *Sex {
+ p := new(Sex)
+ *p = x
+ return p
+}
+
+func (x Sex) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (Sex) Descriptor() protoreflect.EnumDescriptor {
+ return file_where_child_bus_v1_resources_proto_enumTypes[2].Descriptor()
+}
+
+func (Sex) Type() protoreflect.EnumType {
+ return &file_where_child_bus_v1_resources_proto_enumTypes[2]
+}
+
+func (x Sex) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use Sex.Descriptor instead.
+func (Sex) EnumDescriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_resources_proto_rawDescGZIP(), []int{2}
+}
+
+type BusType int32
+
+const (
+ BusType_BUS_TYPE_UNSPECIFIED BusType = 0
+ BusType_BUS_TYPE_MORNING BusType = 1
+ BusType_BUS_TYPE_EVENING BusType = 2
+)
+
+// Enum value maps for BusType.
+var (
+ BusType_name = map[int32]string{
+ 0: "BUS_TYPE_UNSPECIFIED",
+ 1: "BUS_TYPE_MORNING",
+ 2: "BUS_TYPE_EVENING",
+ }
+ BusType_value = map[string]int32{
+ "BUS_TYPE_UNSPECIFIED": 0,
+ "BUS_TYPE_MORNING": 1,
+ "BUS_TYPE_EVENING": 2,
+ }
+)
+
+func (x BusType) Enum() *BusType {
+ p := new(BusType)
+ *p = x
+ return p
+}
+
+func (x BusType) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (BusType) Descriptor() protoreflect.EnumDescriptor {
+ return file_where_child_bus_v1_resources_proto_enumTypes[3].Descriptor()
+}
+
+func (BusType) Type() protoreflect.EnumType {
+ return &file_where_child_bus_v1_resources_proto_enumTypes[3]
+}
+
+func (x BusType) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use BusType.Descriptor instead.
+func (BusType) EnumDescriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_resources_proto_rawDescGZIP(), []int{3}
+}
+
+type Nursery struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
+ NurseryCode string `protobuf:"bytes,2,opt,name=nursery_code,json=nurseryCode,proto3" json:"nursery_code,omitempty"`
+ Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
+ Address string `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty"`
+ PhoneNumber string `protobuf:"bytes,5,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"`
+ Email string `protobuf:"bytes,6,opt,name=email,proto3" json:"email,omitempty"`
+ HashedPassword string `protobuf:"bytes,7,opt,name=hashed_password,json=hashedPassword,proto3" json:"hashed_password,omitempty"`
+ CreatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
+ UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
+}
+
+func (x *Nursery) Reset() {
+ *x = Nursery{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Nursery) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Nursery) ProtoMessage() {}
+
+func (x *Nursery) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Nursery.ProtoReflect.Descriptor instead.
+func (*Nursery) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_resources_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *Nursery) GetId() string {
+ if x != nil {
+ return x.Id
+ }
+ return ""
+}
+
+func (x *Nursery) GetNurseryCode() string {
+ if x != nil {
+ return x.NurseryCode
+ }
+ return ""
+}
+
+func (x *Nursery) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *Nursery) GetAddress() string {
+ if x != nil {
+ return x.Address
+ }
+ return ""
+}
+
+func (x *Nursery) GetPhoneNumber() string {
+ if x != nil {
+ return x.PhoneNumber
+ }
+ return ""
+}
+
+func (x *Nursery) GetEmail() string {
+ if x != nil {
+ return x.Email
+ }
+ return ""
+}
+
+func (x *Nursery) GetHashedPassword() string {
+ if x != nil {
+ return x.HashedPassword
+ }
+ return ""
+}
+
+func (x *Nursery) GetCreatedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.CreatedAt
+ }
+ return nil
+}
+
+func (x *Nursery) GetUpdatedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.UpdatedAt
+ }
+ return nil
+}
+
+type NurseryResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
+ NurseryCode string `protobuf:"bytes,2,opt,name=nursery_code,json=nurseryCode,proto3" json:"nursery_code,omitempty"`
+ Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
+ Address string `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty"`
+ PhoneNumber string `protobuf:"bytes,5,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"`
+ Email string `protobuf:"bytes,6,opt,name=email,proto3" json:"email,omitempty"`
+ // ハッシュ化されたパスワードは除外
+ CreatedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
+ UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
+}
+
+func (x *NurseryResponse) Reset() {
+ *x = NurseryResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NurseryResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NurseryResponse) ProtoMessage() {}
+
+func (x *NurseryResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NurseryResponse.ProtoReflect.Descriptor instead.
+func (*NurseryResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_resources_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *NurseryResponse) GetId() string {
+ if x != nil {
+ return x.Id
+ }
+ return ""
+}
+
+func (x *NurseryResponse) GetNurseryCode() string {
+ if x != nil {
+ return x.NurseryCode
+ }
+ return ""
+}
+
+func (x *NurseryResponse) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NurseryResponse) GetAddress() string {
+ if x != nil {
+ return x.Address
+ }
+ return ""
+}
+
+func (x *NurseryResponse) GetPhoneNumber() string {
+ if x != nil {
+ return x.PhoneNumber
+ }
+ return ""
+}
+
+func (x *NurseryResponse) GetEmail() string {
+ if x != nil {
+ return x.Email
+ }
+ return ""
+}
+
+func (x *NurseryResponse) GetCreatedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.CreatedAt
+ }
+ return nil
+}
+
+func (x *NurseryResponse) GetUpdatedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.UpdatedAt
+ }
+ return nil
+}
+
+type Guardian struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
+ NurseryId string `protobuf:"bytes,2,opt,name=nursery_id,json=nurseryId,proto3" json:"nursery_id,omitempty"`
+ Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
+ Email string `protobuf:"bytes,4,opt,name=email,proto3" json:"email,omitempty"`
+ PhoneNumber string `protobuf:"bytes,5,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"`
+ HashedPassword string `protobuf:"bytes,6,opt,name=hashed_password,json=hashedPassword,proto3" json:"hashed_password,omitempty"`
+ IsUseMorningBus bool `protobuf:"varint,7,opt,name=is_use_morning_bus,json=isUseMorningBus,proto3" json:"is_use_morning_bus,omitempty"`
+ IsUseEveningBus bool `protobuf:"varint,8,opt,name=is_use_evening_bus,json=isUseEveningBus,proto3" json:"is_use_evening_bus,omitempty"`
+ CreatedAt *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
+ UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
+}
+
+func (x *Guardian) Reset() {
+ *x = Guardian{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Guardian) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Guardian) ProtoMessage() {}
+
+func (x *Guardian) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Guardian.ProtoReflect.Descriptor instead.
+func (*Guardian) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_resources_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *Guardian) GetId() string {
+ if x != nil {
+ return x.Id
+ }
+ return ""
+}
+
+func (x *Guardian) GetNurseryId() string {
+ if x != nil {
+ return x.NurseryId
+ }
+ return ""
+}
+
+func (x *Guardian) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *Guardian) GetEmail() string {
+ if x != nil {
+ return x.Email
+ }
+ return ""
+}
+
+func (x *Guardian) GetPhoneNumber() string {
+ if x != nil {
+ return x.PhoneNumber
+ }
+ return ""
+}
+
+func (x *Guardian) GetHashedPassword() string {
+ if x != nil {
+ return x.HashedPassword
+ }
+ return ""
+}
+
+func (x *Guardian) GetIsUseMorningBus() bool {
+ if x != nil {
+ return x.IsUseMorningBus
+ }
+ return false
+}
+
+func (x *Guardian) GetIsUseEveningBus() bool {
+ if x != nil {
+ return x.IsUseEveningBus
+ }
+ return false
+}
+
+func (x *Guardian) GetCreatedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.CreatedAt
+ }
+ return nil
+}
+
+func (x *Guardian) GetUpdatedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.UpdatedAt
+ }
+ return nil
+}
+
+type GuardianResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
+ NurseryId string `protobuf:"bytes,2,opt,name=nursery_id,json=nurseryId,proto3" json:"nursery_id,omitempty"`
+ Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
+ Email string `protobuf:"bytes,4,opt,name=email,proto3" json:"email,omitempty"`
+ PhoneNumber string `protobuf:"bytes,5,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"`
+ // ハッシュ化されたパスワードは除外
+ IsUseMorningBus bool `protobuf:"varint,6,opt,name=is_use_morning_bus,json=isUseMorningBus,proto3" json:"is_use_morning_bus,omitempty"`
+ IsUseEveningBus bool `protobuf:"varint,7,opt,name=is_use_evening_bus,json=isUseEveningBus,proto3" json:"is_use_evening_bus,omitempty"`
+ CreatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
+ UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
+}
+
+func (x *GuardianResponse) Reset() {
+ *x = GuardianResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GuardianResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GuardianResponse) ProtoMessage() {}
+
+func (x *GuardianResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GuardianResponse.ProtoReflect.Descriptor instead.
+func (*GuardianResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_resources_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *GuardianResponse) GetId() string {
+ if x != nil {
+ return x.Id
+ }
+ return ""
+}
+
+func (x *GuardianResponse) GetNurseryId() string {
+ if x != nil {
+ return x.NurseryId
+ }
+ return ""
+}
+
+func (x *GuardianResponse) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *GuardianResponse) GetEmail() string {
+ if x != nil {
+ return x.Email
+ }
+ return ""
+}
+
+func (x *GuardianResponse) GetPhoneNumber() string {
+ if x != nil {
+ return x.PhoneNumber
+ }
+ return ""
+}
+
+func (x *GuardianResponse) GetIsUseMorningBus() bool {
+ if x != nil {
+ return x.IsUseMorningBus
+ }
+ return false
+}
+
+func (x *GuardianResponse) GetIsUseEveningBus() bool {
+ if x != nil {
+ return x.IsUseEveningBus
+ }
+ return false
+}
+
+func (x *GuardianResponse) GetCreatedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.CreatedAt
+ }
+ return nil
+}
+
+func (x *GuardianResponse) GetUpdatedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.UpdatedAt
+ }
+ return nil
+}
+
+type Bus struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
+ NurseryId string `protobuf:"bytes,2,opt,name=nursery_id,json=nurseryId,proto3" json:"nursery_id,omitempty"`
+ Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
+ PlateNumber string `protobuf:"bytes,4,opt,name=plate_number,json=plateNumber,proto3" json:"plate_number,omitempty"`
+ BusStatus BusStatus `protobuf:"varint,5,opt,name=bus_status,json=busStatus,proto3,enum=where_child_bus.v1.BusStatus" json:"bus_status,omitempty"`
+ // 緯度経度
+ Latitude float64 `protobuf:"fixed64,6,opt,name=latitude,proto3" json:"latitude,omitempty"`
+ Longitude float64 `protobuf:"fixed64,7,opt,name=longitude,proto3" json:"longitude,omitempty"`
+ EnableFaceRecognition bool `protobuf:"varint,8,opt,name=enable_face_recognition,json=enableFaceRecognition,proto3" json:"enable_face_recognition,omitempty"`
+ NextStationId string `protobuf:"bytes,11,opt,name=next_station_id,json=nextStationId,proto3" json:"next_station_id,omitempty"`
+ LatestMorningRouteId string `protobuf:"bytes,14,opt,name=latest_morning_route_id,json=latestMorningRouteId,proto3" json:"latest_morning_route_id,omitempty"`
+ LatestEveningRouteId string `protobuf:"bytes,15,opt,name=latest_evening_route_id,json=latestEveningRouteId,proto3" json:"latest_evening_route_id,omitempty"`
+ CreatedAt *timestamppb.Timestamp `protobuf:"bytes,12,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
+ UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,13,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
+}
+
+func (x *Bus) Reset() {
+ *x = Bus{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Bus) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Bus) ProtoMessage() {}
+
+func (x *Bus) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Bus.ProtoReflect.Descriptor instead.
+func (*Bus) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_resources_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *Bus) GetId() string {
+ if x != nil {
+ return x.Id
+ }
+ return ""
+}
+
+func (x *Bus) GetNurseryId() string {
+ if x != nil {
+ return x.NurseryId
+ }
+ return ""
+}
+
+func (x *Bus) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *Bus) GetPlateNumber() string {
+ if x != nil {
+ return x.PlateNumber
+ }
+ return ""
+}
+
+func (x *Bus) GetBusStatus() BusStatus {
+ if x != nil {
+ return x.BusStatus
+ }
+ return BusStatus_BUS_STATUS_UNSPECIFIED
+}
+
+func (x *Bus) GetLatitude() float64 {
+ if x != nil {
+ return x.Latitude
+ }
+ return 0
+}
+
+func (x *Bus) GetLongitude() float64 {
+ if x != nil {
+ return x.Longitude
+ }
+ return 0
+}
+
+func (x *Bus) GetEnableFaceRecognition() bool {
+ if x != nil {
+ return x.EnableFaceRecognition
+ }
+ return false
+}
+
+func (x *Bus) GetNextStationId() string {
+ if x != nil {
+ return x.NextStationId
+ }
+ return ""
+}
+
+func (x *Bus) GetLatestMorningRouteId() string {
+ if x != nil {
+ return x.LatestMorningRouteId
+ }
+ return ""
+}
+
+func (x *Bus) GetLatestEveningRouteId() string {
+ if x != nil {
+ return x.LatestEveningRouteId
+ }
+ return ""
+}
+
+func (x *Bus) GetCreatedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.CreatedAt
+ }
+ return nil
+}
+
+func (x *Bus) GetUpdatedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.UpdatedAt
+ }
+ return nil
+}
+
+type Child struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
+ NurseryId string `protobuf:"bytes,2,opt,name=nursery_id,json=nurseryId,proto3" json:"nursery_id,omitempty"`
+ GuardianId string `protobuf:"bytes,3,opt,name=guardian_id,json=guardianId,proto3" json:"guardian_id,omitempty"`
+ Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
+ Age int32 `protobuf:"varint,5,opt,name=age,proto3" json:"age,omitempty"`
+ Sex Sex `protobuf:"varint,6,opt,name=sex,proto3,enum=where_child_bus.v1.Sex" json:"sex,omitempty"`
+ CheckForMissingItems bool `protobuf:"varint,7,opt,name=check_for_missing_items,json=checkForMissingItems,proto3" json:"check_for_missing_items,omitempty"`
+ HasBag bool `protobuf:"varint,8,opt,name=has_bag,json=hasBag,proto3" json:"has_bag,omitempty"`
+ HasLunchBox bool `protobuf:"varint,9,opt,name=has_lunch_box,json=hasLunchBox,proto3" json:"has_lunch_box,omitempty"`
+ HasWaterBottle bool `protobuf:"varint,10,opt,name=has_water_bottle,json=hasWaterBottle,proto3" json:"has_water_bottle,omitempty"`
+ HasUmbrella bool `protobuf:"varint,11,opt,name=has_umbrella,json=hasUmbrella,proto3" json:"has_umbrella,omitempty"`
+ HasOther bool `protobuf:"varint,12,opt,name=has_other,json=hasOther,proto3" json:"has_other,omitempty"`
+ CreatedAt *timestamppb.Timestamp `protobuf:"bytes,13,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
+ UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,14,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
+}
+
+func (x *Child) Reset() {
+ *x = Child{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Child) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Child) ProtoMessage() {}
+
+func (x *Child) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Child.ProtoReflect.Descriptor instead.
+func (*Child) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_resources_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *Child) GetId() string {
+ if x != nil {
+ return x.Id
+ }
+ return ""
+}
+
+func (x *Child) GetNurseryId() string {
+ if x != nil {
+ return x.NurseryId
+ }
+ return ""
+}
+
+func (x *Child) GetGuardianId() string {
+ if x != nil {
+ return x.GuardianId
+ }
+ return ""
+}
+
+func (x *Child) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *Child) GetAge() int32 {
+ if x != nil {
+ return x.Age
+ }
+ return 0
+}
+
+func (x *Child) GetSex() Sex {
+ if x != nil {
+ return x.Sex
+ }
+ return Sex_SEX_UNSPECIFIED
+}
+
+func (x *Child) GetCheckForMissingItems() bool {
+ if x != nil {
+ return x.CheckForMissingItems
+ }
+ return false
+}
+
+func (x *Child) GetHasBag() bool {
+ if x != nil {
+ return x.HasBag
+ }
+ return false
+}
+
+func (x *Child) GetHasLunchBox() bool {
+ if x != nil {
+ return x.HasLunchBox
+ }
+ return false
+}
+
+func (x *Child) GetHasWaterBottle() bool {
+ if x != nil {
+ return x.HasWaterBottle
+ }
+ return false
+}
+
+func (x *Child) GetHasUmbrella() bool {
+ if x != nil {
+ return x.HasUmbrella
+ }
+ return false
+}
+
+func (x *Child) GetHasOther() bool {
+ if x != nil {
+ return x.HasOther
+ }
+ return false
+}
+
+func (x *Child) GetCreatedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.CreatedAt
+ }
+ return nil
+}
+
+func (x *Child) GetUpdatedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.UpdatedAt
+ }
+ return nil
+}
+
+type Station struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
+ GuardianId string `protobuf:"bytes,2,opt,name=guardian_id,json=guardianId,proto3" json:"guardian_id,omitempty"`
+ Latitude float64 `protobuf:"fixed64,5,opt,name=latitude,proto3" json:"latitude,omitempty"`
+ Longitude float64 `protobuf:"fixed64,6,opt,name=longitude,proto3" json:"longitude,omitempty"`
+ CreatedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
+ UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
+}
+
+func (x *Station) Reset() {
+ *x = Station{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Station) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Station) ProtoMessage() {}
+
+func (x *Station) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Station.ProtoReflect.Descriptor instead.
+func (*Station) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_resources_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *Station) GetId() string {
+ if x != nil {
+ return x.Id
+ }
+ return ""
+}
+
+func (x *Station) GetGuardianId() string {
+ if x != nil {
+ return x.GuardianId
+ }
+ return ""
+}
+
+func (x *Station) GetLatitude() float64 {
+ if x != nil {
+ return x.Latitude
+ }
+ return 0
+}
+
+func (x *Station) GetLongitude() float64 {
+ if x != nil {
+ return x.Longitude
+ }
+ return 0
+}
+
+func (x *Station) GetCreatedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.CreatedAt
+ }
+ return nil
+}
+
+func (x *Station) GetUpdatedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.UpdatedAt
+ }
+ return nil
+}
+
+type ChildBusAssociation struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusRouteId string `protobuf:"bytes,1,opt,name=bus_route_id,json=busRouteId,proto3" json:"bus_route_id,omitempty"`
+ ChildId string `protobuf:"bytes,2,opt,name=child_id,json=childId,proto3" json:"child_id,omitempty"`
+}
+
+func (x *ChildBusAssociation) Reset() {
+ *x = ChildBusAssociation{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ChildBusAssociation) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ChildBusAssociation) ProtoMessage() {}
+
+func (x *ChildBusAssociation) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ChildBusAssociation.ProtoReflect.Descriptor instead.
+func (*ChildBusAssociation) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_resources_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *ChildBusAssociation) GetBusRouteId() string {
+ if x != nil {
+ return x.BusRouteId
+ }
+ return ""
+}
+
+func (x *ChildBusAssociation) GetChildId() string {
+ if x != nil {
+ return x.ChildId
+ }
+ return ""
+}
+
+type ChildPhoto struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
+ ChildId string `protobuf:"bytes,2,opt,name=child_id,json=childId,proto3" json:"child_id,omitempty"`
+ PhotoData []byte `protobuf:"bytes,3,opt,name=photo_data,json=photoData,proto3" json:"photo_data,omitempty"`
+ CreatedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
+ UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
+}
+
+func (x *ChildPhoto) Reset() {
+ *x = ChildPhoto{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ChildPhoto) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ChildPhoto) ProtoMessage() {}
+
+func (x *ChildPhoto) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[8]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ChildPhoto.ProtoReflect.Descriptor instead.
+func (*ChildPhoto) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_resources_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *ChildPhoto) GetId() string {
+ if x != nil {
+ return x.Id
+ }
+ return ""
+}
+
+func (x *ChildPhoto) GetChildId() string {
+ if x != nil {
+ return x.ChildId
+ }
+ return ""
+}
+
+func (x *ChildPhoto) GetPhotoData() []byte {
+ if x != nil {
+ return x.PhotoData
+ }
+ return nil
+}
+
+func (x *ChildPhoto) GetCreatedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.CreatedAt
+ }
+ return nil
+}
+
+func (x *ChildPhoto) GetUpdatedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.UpdatedAt
+ }
+ return nil
+}
+
+type BoardingRecord struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
+ ChildId string `protobuf:"bytes,2,opt,name=child_id,json=childId,proto3" json:"child_id,omitempty"`
+ BusId string `protobuf:"bytes,3,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+ IsBoarding bool `protobuf:"varint,4,opt,name=is_boarding,json=isBoarding,proto3" json:"is_boarding,omitempty"`
+ Timestamp *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
+}
+
+func (x *BoardingRecord) Reset() {
+ *x = BoardingRecord{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *BoardingRecord) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*BoardingRecord) ProtoMessage() {}
+
+func (x *BoardingRecord) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[9]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use BoardingRecord.ProtoReflect.Descriptor instead.
+func (*BoardingRecord) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_resources_proto_rawDescGZIP(), []int{9}
+}
+
+func (x *BoardingRecord) GetId() string {
+ if x != nil {
+ return x.Id
+ }
+ return ""
+}
+
+func (x *BoardingRecord) GetChildId() string {
+ if x != nil {
+ return x.ChildId
+ }
+ return ""
+}
+
+func (x *BoardingRecord) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+func (x *BoardingRecord) GetIsBoarding() bool {
+ if x != nil {
+ return x.IsBoarding
+ }
+ return false
+}
+
+func (x *BoardingRecord) GetTimestamp() *timestamppb.Timestamp {
+ if x != nil {
+ return x.Timestamp
+ }
+ return nil
+}
+
+type BusRoute struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
+ BusId string `protobuf:"bytes,2,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+ OrderedStations []*Station `protobuf:"bytes,3,rep,name=ordered_stations,json=orderedStations,proto3" json:"ordered_stations,omitempty"`
+ BusType BusType `protobuf:"varint,4,opt,name=bus_type,json=busType,proto3,enum=where_child_bus.v1.BusType" json:"bus_type,omitempty"`
+}
+
+func (x *BusRoute) Reset() {
+ *x = BusRoute{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *BusRoute) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*BusRoute) ProtoMessage() {}
+
+func (x *BusRoute) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_resources_proto_msgTypes[10]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use BusRoute.ProtoReflect.Descriptor instead.
+func (*BusRoute) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_resources_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *BusRoute) GetId() string {
+ if x != nil {
+ return x.Id
+ }
+ return ""
+}
+
+func (x *BusRoute) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+func (x *BusRoute) GetOrderedStations() []*Station {
+ if x != nil {
+ return x.OrderedStations
+ }
+ return nil
+}
+
+func (x *BusRoute) GetBusType() BusType {
+ if x != nil {
+ return x.BusType
+ }
+ return BusType_BUS_TYPE_UNSPECIFIED
+}
+
+var File_where_child_bus_v1_resources_proto protoreflect.FileDescriptor
+
+var file_where_child_bus_v1_resources_proto_rawDesc = []byte{
+ 0x0a, 0x22, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c,
+ 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+ 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74,
+ 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc2, 0x02, 0x0a, 0x07, 0x4e, 0x75,
+ 0x72, 0x73, 0x65, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79,
+ 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x75, 0x72,
+ 0x73, 0x65, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07,
+ 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61,
+ 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x5f,
+ 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x68,
+ 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61,
+ 0x69, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12,
+ 0x27, 0x0a, 0x0f, 0x68, 0x61, 0x73, 0x68, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f,
+ 0x72, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x68, 0x61, 0x73, 0x68, 0x65, 0x64,
+ 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61,
+ 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67,
+ 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54,
+ 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65,
+ 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61,
+ 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74,
+ 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0xa1,
+ 0x02, 0x0a, 0x0f, 0x4e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+ 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
+ 0x69, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x5f, 0x63, 0x6f,
+ 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72,
+ 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64,
+ 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72,
+ 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d,
+ 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65,
+ 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18,
+ 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x39, 0x0a, 0x0a,
+ 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
+ 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72,
+ 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74,
+ 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f,
+ 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69,
+ 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64,
+ 0x41, 0x74, 0x22, 0xff, 0x02, 0x0a, 0x08, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x12,
+ 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12,
+ 0x1d, 0x0a, 0x0a, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x12,
+ 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
+ 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e,
+ 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
+ 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x68,
+ 0x61, 0x73, 0x68, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x06,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x68, 0x61, 0x73, 0x68, 0x65, 0x64, 0x50, 0x61, 0x73, 0x73,
+ 0x77, 0x6f, 0x72, 0x64, 0x12, 0x2b, 0x0a, 0x12, 0x69, 0x73, 0x5f, 0x75, 0x73, 0x65, 0x5f, 0x6d,
+ 0x6f, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08,
+ 0x52, 0x0f, 0x69, 0x73, 0x55, 0x73, 0x65, 0x4d, 0x6f, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x42, 0x75,
+ 0x73, 0x12, 0x2b, 0x0a, 0x12, 0x69, 0x73, 0x5f, 0x75, 0x73, 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e,
+ 0x69, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x69,
+ 0x73, 0x55, 0x73, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x73, 0x12, 0x39,
+ 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09,
+ 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64,
+ 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
+ 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
+ 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74,
+ 0x65, 0x64, 0x41, 0x74, 0x22, 0xde, 0x02, 0x0a, 0x10, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61,
+ 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x75, 0x72,
+ 0x73, 0x65, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e,
+ 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05,
+ 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61,
+ 0x69, 0x6c, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62,
+ 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e,
+ 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x12, 0x69, 0x73, 0x5f, 0x75, 0x73, 0x65, 0x5f,
+ 0x6d, 0x6f, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28,
+ 0x08, 0x52, 0x0f, 0x69, 0x73, 0x55, 0x73, 0x65, 0x4d, 0x6f, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x42,
+ 0x75, 0x73, 0x12, 0x2b, 0x0a, 0x12, 0x69, 0x73, 0x5f, 0x75, 0x73, 0x65, 0x5f, 0x65, 0x76, 0x65,
+ 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f,
+ 0x69, 0x73, 0x55, 0x73, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x73, 0x12,
+ 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x08, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
+ 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52,
+ 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70,
+ 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a,
+ 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
+ 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61,
+ 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0xa7, 0x04, 0x0a, 0x03, 0x42, 0x75, 0x73, 0x12, 0x0e, 0x0a,
+ 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a,
+ 0x0a, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x09, 0x6e, 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04,
+ 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
+ 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72,
+ 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4e, 0x75, 0x6d,
+ 0x62, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x0a, 0x62, 0x75, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75,
+ 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f,
+ 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x73,
+ 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x62, 0x75, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75,
+ 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x06, 0x20,
+ 0x01, 0x28, 0x01, 0x52, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1c, 0x0a,
+ 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x01,
+ 0x52, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x36, 0x0a, 0x17, 0x65,
+ 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x66, 0x61, 0x63, 0x65, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x67,
+ 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x65, 0x6e,
+ 0x61, 0x62, 0x6c, 0x65, 0x46, 0x61, 0x63, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65,
+ 0x78, 0x74, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x17, 0x6c,
+ 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x6f, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x6f,
+ 0x75, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x6c, 0x61,
+ 0x74, 0x65, 0x73, 0x74, 0x4d, 0x6f, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x6f, 0x75, 0x74, 0x65,
+ 0x49, 0x64, 0x12, 0x35, 0x0a, 0x17, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x65, 0x76, 0x65,
+ 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x0f, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x14, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x69,
+ 0x6e, 0x67, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65,
+ 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
+ 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
+ 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74,
+ 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f,
+ 0x61, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
+ 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73,
+ 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22,
+ 0xfc, 0x03, 0x0a, 0x05, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x75, 0x72,
+ 0x73, 0x65, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e,
+ 0x75, 0x72, 0x73, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x67, 0x75, 0x61, 0x72,
+ 0x64, 0x69, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x67,
+ 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a,
+ 0x03, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x61, 0x67, 0x65, 0x12,
+ 0x29, 0x0a, 0x03, 0x73, 0x65, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x77,
+ 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76,
+ 0x31, 0x2e, 0x53, 0x65, 0x78, 0x52, 0x03, 0x73, 0x65, 0x78, 0x12, 0x35, 0x0a, 0x17, 0x63, 0x68,
+ 0x65, 0x63, 0x6b, 0x5f, 0x66, 0x6f, 0x72, 0x5f, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x5f,
+ 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x63, 0x68, 0x65,
+ 0x63, 0x6b, 0x46, 0x6f, 0x72, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x49, 0x74, 0x65, 0x6d,
+ 0x73, 0x12, 0x17, 0x0a, 0x07, 0x68, 0x61, 0x73, 0x5f, 0x62, 0x61, 0x67, 0x18, 0x08, 0x20, 0x01,
+ 0x28, 0x08, 0x52, 0x06, 0x68, 0x61, 0x73, 0x42, 0x61, 0x67, 0x12, 0x22, 0x0a, 0x0d, 0x68, 0x61,
+ 0x73, 0x5f, 0x6c, 0x75, 0x6e, 0x63, 0x68, 0x5f, 0x62, 0x6f, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28,
+ 0x08, 0x52, 0x0b, 0x68, 0x61, 0x73, 0x4c, 0x75, 0x6e, 0x63, 0x68, 0x42, 0x6f, 0x78, 0x12, 0x28,
+ 0x0a, 0x10, 0x68, 0x61, 0x73, 0x5f, 0x77, 0x61, 0x74, 0x65, 0x72, 0x5f, 0x62, 0x6f, 0x74, 0x74,
+ 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x68, 0x61, 0x73, 0x57, 0x61, 0x74,
+ 0x65, 0x72, 0x42, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x68, 0x61, 0x73, 0x5f,
+ 0x75, 0x6d, 0x62, 0x72, 0x65, 0x6c, 0x6c, 0x61, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b,
+ 0x68, 0x61, 0x73, 0x55, 0x6d, 0x62, 0x72, 0x65, 0x6c, 0x6c, 0x61, 0x12, 0x1b, 0x0a, 0x09, 0x68,
+ 0x61, 0x73, 0x5f, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08,
+ 0x68, 0x61, 0x73, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61,
+ 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67,
+ 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54,
+ 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65,
+ 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61,
+ 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74,
+ 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0xea,
+ 0x01, 0x0a, 0x07, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x67, 0x75,
+ 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x0a, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6c,
+ 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x6c,
+ 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69,
+ 0x74, 0x75, 0x64, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x6c, 0x6f, 0x6e, 0x67,
+ 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64,
+ 0x5f, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
+ 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65,
+ 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74,
+ 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x08,
+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
+ 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x52, 0x0a, 0x13, 0x43,
+ 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0c, 0x62, 0x75, 0x73, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x5f,
+ 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x75, 0x73, 0x52, 0x6f, 0x75,
+ 0x74, 0x65, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x69, 0x64,
+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x22,
+ 0xcc, 0x01, 0x0a, 0x0a, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x0e,
+ 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19,
+ 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x07, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x68, 0x6f,
+ 0x74, 0x6f, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70,
+ 0x68, 0x6f, 0x74, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61,
+ 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67,
+ 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54,
+ 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65,
+ 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61,
+ 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74,
+ 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0xad,
+ 0x01, 0x0a, 0x0e, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72,
+ 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69,
+ 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06,
+ 0x62, 0x75, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x75,
+ 0x73, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x73, 0x5f, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69,
+ 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x42, 0x6f, 0x61, 0x72,
+ 0x64, 0x69, 0x6e, 0x67, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
+ 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74,
+ 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0xb1,
+ 0x01, 0x0a, 0x08, 0x42, 0x75, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69,
+ 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x62,
+ 0x75, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x75, 0x73,
+ 0x49, 0x64, 0x12, 0x46, 0x0a, 0x10, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x73, 0x74,
+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x77,
+ 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76,
+ 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0f, 0x6f, 0x72, 0x64, 0x65, 0x72,
+ 0x65, 0x64, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x36, 0x0a, 0x08, 0x62, 0x75,
+ 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x77,
+ 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76,
+ 0x31, 0x2e, 0x42, 0x75, 0x73, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x62, 0x75, 0x73, 0x54, 0x79,
+ 0x70, 0x65, 0x2a, 0x73, 0x0a, 0x09, 0x42, 0x75, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12,
+ 0x1a, 0x0a, 0x16, 0x42, 0x55, 0x53, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e,
+ 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x42,
+ 0x55, 0x53, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x53, 0x54, 0x4f, 0x50, 0x50, 0x45,
+ 0x44, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x42, 0x55, 0x53, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55,
+ 0x53, 0x5f, 0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x42,
+ 0x55, 0x53, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x4d, 0x41, 0x49, 0x4e, 0x54, 0x45,
+ 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x2a, 0x62, 0x0a, 0x0c, 0x56, 0x65, 0x68, 0x69, 0x63,
+ 0x6c, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x19, 0x56, 0x45, 0x48, 0x49, 0x43,
+ 0x4c, 0x45, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49,
+ 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x56, 0x45, 0x48, 0x49, 0x43, 0x4c,
+ 0x45, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x47, 0x45, 0x54, 0x5f, 0x4f, 0x4e, 0x10, 0x01,
+ 0x12, 0x19, 0x0a, 0x15, 0x56, 0x45, 0x48, 0x49, 0x43, 0x4c, 0x45, 0x5f, 0x45, 0x56, 0x45, 0x4e,
+ 0x54, 0x5f, 0x47, 0x45, 0x54, 0x5f, 0x4f, 0x46, 0x46, 0x10, 0x02, 0x2a, 0x45, 0x0a, 0x03, 0x53,
+ 0x65, 0x78, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x58, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43,
+ 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x58, 0x5f, 0x4d,
+ 0x41, 0x4e, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x45, 0x58, 0x5f, 0x57, 0x4f, 0x4d, 0x41,
+ 0x4e, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x45, 0x58, 0x5f, 0x4f, 0x54, 0x48, 0x45, 0x52,
+ 0x10, 0x03, 0x2a, 0x4f, 0x0a, 0x07, 0x42, 0x75, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a,
+ 0x14, 0x42, 0x55, 0x53, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43,
+ 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x42, 0x55, 0x53, 0x5f, 0x54,
+ 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x4f, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x14, 0x0a,
+ 0x10, 0x42, 0x55, 0x53, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x49, 0x4e,
+ 0x47, 0x10, 0x02, 0x42, 0xf1, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x77, 0x68, 0x65, 0x72,
+ 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0e,
+ 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
+ 0x5a, 0x66, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65,
+ 0x65, 0x6e, 0x54, 0x65, 0x61, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x6d, 0x65, 0x72, 0x73,
+ 0x2f, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x2f, 0x62,
+ 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x67, 0x65, 0x6e,
+ 0x2f, 0x67, 0x6f, 0x2f, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f,
+ 0x62, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x57, 0x58, 0x58, 0xaa, 0x02,
+ 0x10, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x2e, 0x56,
+ 0x31, 0xca, 0x02, 0x10, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75,
+ 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c,
+ 0x64, 0x42, 0x75, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64,
+ 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64,
+ 0x42, 0x75, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_where_child_bus_v1_resources_proto_rawDescOnce sync.Once
+ file_where_child_bus_v1_resources_proto_rawDescData = file_where_child_bus_v1_resources_proto_rawDesc
+)
+
+func file_where_child_bus_v1_resources_proto_rawDescGZIP() []byte {
+ file_where_child_bus_v1_resources_proto_rawDescOnce.Do(func() {
+ file_where_child_bus_v1_resources_proto_rawDescData = protoimpl.X.CompressGZIP(file_where_child_bus_v1_resources_proto_rawDescData)
+ })
+ return file_where_child_bus_v1_resources_proto_rawDescData
+}
+
+var file_where_child_bus_v1_resources_proto_enumTypes = make([]protoimpl.EnumInfo, 4)
+var file_where_child_bus_v1_resources_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
+var file_where_child_bus_v1_resources_proto_goTypes = []interface{}{
+ (BusStatus)(0), // 0: where_child_bus.v1.BusStatus
+ (VehicleEvent)(0), // 1: where_child_bus.v1.VehicleEvent
+ (Sex)(0), // 2: where_child_bus.v1.Sex
+ (BusType)(0), // 3: where_child_bus.v1.BusType
+ (*Nursery)(nil), // 4: where_child_bus.v1.Nursery
+ (*NurseryResponse)(nil), // 5: where_child_bus.v1.NurseryResponse
+ (*Guardian)(nil), // 6: where_child_bus.v1.Guardian
+ (*GuardianResponse)(nil), // 7: where_child_bus.v1.GuardianResponse
+ (*Bus)(nil), // 8: where_child_bus.v1.Bus
+ (*Child)(nil), // 9: where_child_bus.v1.Child
+ (*Station)(nil), // 10: where_child_bus.v1.Station
+ (*ChildBusAssociation)(nil), // 11: where_child_bus.v1.ChildBusAssociation
+ (*ChildPhoto)(nil), // 12: where_child_bus.v1.ChildPhoto
+ (*BoardingRecord)(nil), // 13: where_child_bus.v1.BoardingRecord
+ (*BusRoute)(nil), // 14: where_child_bus.v1.BusRoute
+ (*timestamppb.Timestamp)(nil), // 15: google.protobuf.Timestamp
+}
+var file_where_child_bus_v1_resources_proto_depIdxs = []int32{
+ 15, // 0: where_child_bus.v1.Nursery.created_at:type_name -> google.protobuf.Timestamp
+ 15, // 1: where_child_bus.v1.Nursery.updated_at:type_name -> google.protobuf.Timestamp
+ 15, // 2: where_child_bus.v1.NurseryResponse.created_at:type_name -> google.protobuf.Timestamp
+ 15, // 3: where_child_bus.v1.NurseryResponse.updated_at:type_name -> google.protobuf.Timestamp
+ 15, // 4: where_child_bus.v1.Guardian.created_at:type_name -> google.protobuf.Timestamp
+ 15, // 5: where_child_bus.v1.Guardian.updated_at:type_name -> google.protobuf.Timestamp
+ 15, // 6: where_child_bus.v1.GuardianResponse.created_at:type_name -> google.protobuf.Timestamp
+ 15, // 7: where_child_bus.v1.GuardianResponse.updated_at:type_name -> google.protobuf.Timestamp
+ 0, // 8: where_child_bus.v1.Bus.bus_status:type_name -> where_child_bus.v1.BusStatus
+ 15, // 9: where_child_bus.v1.Bus.created_at:type_name -> google.protobuf.Timestamp
+ 15, // 10: where_child_bus.v1.Bus.updated_at:type_name -> google.protobuf.Timestamp
+ 2, // 11: where_child_bus.v1.Child.sex:type_name -> where_child_bus.v1.Sex
+ 15, // 12: where_child_bus.v1.Child.created_at:type_name -> google.protobuf.Timestamp
+ 15, // 13: where_child_bus.v1.Child.updated_at:type_name -> google.protobuf.Timestamp
+ 15, // 14: where_child_bus.v1.Station.created_at:type_name -> google.protobuf.Timestamp
+ 15, // 15: where_child_bus.v1.Station.updated_at:type_name -> google.protobuf.Timestamp
+ 15, // 16: where_child_bus.v1.ChildPhoto.created_at:type_name -> google.protobuf.Timestamp
+ 15, // 17: where_child_bus.v1.ChildPhoto.updated_at:type_name -> google.protobuf.Timestamp
+ 15, // 18: where_child_bus.v1.BoardingRecord.timestamp:type_name -> google.protobuf.Timestamp
+ 10, // 19: where_child_bus.v1.BusRoute.ordered_stations:type_name -> where_child_bus.v1.Station
+ 3, // 20: where_child_bus.v1.BusRoute.bus_type:type_name -> where_child_bus.v1.BusType
+ 21, // [21:21] is the sub-list for method output_type
+ 21, // [21:21] is the sub-list for method input_type
+ 21, // [21:21] is the sub-list for extension type_name
+ 21, // [21:21] is the sub-list for extension extendee
+ 0, // [0:21] is the sub-list for field type_name
+}
+
+func init() { file_where_child_bus_v1_resources_proto_init() }
+func file_where_child_bus_v1_resources_proto_init() {
+ if File_where_child_bus_v1_resources_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_where_child_bus_v1_resources_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Nursery); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_resources_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NurseryResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_resources_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Guardian); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_resources_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GuardianResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_resources_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Bus); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_resources_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Child); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_resources_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Station); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_resources_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ChildBusAssociation); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_resources_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ChildPhoto); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_resources_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*BoardingRecord); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_resources_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*BusRoute); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_where_child_bus_v1_resources_proto_rawDesc,
+ NumEnums: 4,
+ NumMessages: 11,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_where_child_bus_v1_resources_proto_goTypes,
+ DependencyIndexes: file_where_child_bus_v1_resources_proto_depIdxs,
+ EnumInfos: file_where_child_bus_v1_resources_proto_enumTypes,
+ MessageInfos: file_where_child_bus_v1_resources_proto_msgTypes,
+ }.Build()
+ File_where_child_bus_v1_resources_proto = out.File
+ file_where_child_bus_v1_resources_proto_rawDesc = nil
+ file_where_child_bus_v1_resources_proto_goTypes = nil
+ file_where_child_bus_v1_resources_proto_depIdxs = nil
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/station.pb.go b/backend/proto-gen/go/where_child_bus/v1/station.pb.go
new file mode 100644
index 00000000..0cb63b5c
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/station.pb.go
@@ -0,0 +1,930 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.32.0
+// protoc (unknown)
+// source: where_child_bus/v1/station.proto
+
+package where_child_busv1
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type UpdateStationLocationByGuardianIdRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ GuardianId string `protobuf:"bytes,1,opt,name=guardian_id,json=guardianId,proto3" json:"guardian_id,omitempty"`
+ Longitude float64 `protobuf:"fixed64,2,opt,name=longitude,proto3" json:"longitude,omitempty"`
+ Latitude float64 `protobuf:"fixed64,3,opt,name=latitude,proto3" json:"latitude,omitempty"`
+}
+
+func (x *UpdateStationLocationByGuardianIdRequest) Reset() {
+ *x = UpdateStationLocationByGuardianIdRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateStationLocationByGuardianIdRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateStationLocationByGuardianIdRequest) ProtoMessage() {}
+
+func (x *UpdateStationLocationByGuardianIdRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateStationLocationByGuardianIdRequest.ProtoReflect.Descriptor instead.
+func (*UpdateStationLocationByGuardianIdRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_station_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *UpdateStationLocationByGuardianIdRequest) GetGuardianId() string {
+ if x != nil {
+ return x.GuardianId
+ }
+ return ""
+}
+
+func (x *UpdateStationLocationByGuardianIdRequest) GetLongitude() float64 {
+ if x != nil {
+ return x.Longitude
+ }
+ return 0
+}
+
+func (x *UpdateStationLocationByGuardianIdRequest) GetLatitude() float64 {
+ if x != nil {
+ return x.Latitude
+ }
+ return 0
+}
+
+type UpdateStationLocationByGuardianIdResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Station *Station `protobuf:"bytes,1,opt,name=station,proto3" json:"station,omitempty"`
+}
+
+func (x *UpdateStationLocationByGuardianIdResponse) Reset() {
+ *x = UpdateStationLocationByGuardianIdResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateStationLocationByGuardianIdResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateStationLocationByGuardianIdResponse) ProtoMessage() {}
+
+func (x *UpdateStationLocationByGuardianIdResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateStationLocationByGuardianIdResponse.ProtoReflect.Descriptor instead.
+func (*UpdateStationLocationByGuardianIdResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_station_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *UpdateStationLocationByGuardianIdResponse) GetStation() *Station {
+ if x != nil {
+ return x.Station
+ }
+ return nil
+}
+
+type GetStationListByBusIdRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusId string `protobuf:"bytes,1,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+}
+
+func (x *GetStationListByBusIdRequest) Reset() {
+ *x = GetStationListByBusIdRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetStationListByBusIdRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetStationListByBusIdRequest) ProtoMessage() {}
+
+func (x *GetStationListByBusIdRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetStationListByBusIdRequest.ProtoReflect.Descriptor instead.
+func (*GetStationListByBusIdRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_station_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *GetStationListByBusIdRequest) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+type GetStationListByBusIdResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Stations []*Station `protobuf:"bytes,1,rep,name=stations,proto3" json:"stations,omitempty"`
+ Guardians []*GuardianResponse `protobuf:"bytes,2,rep,name=guardians,proto3" json:"guardians,omitempty"`
+ Children []*Child `protobuf:"bytes,3,rep,name=children,proto3" json:"children,omitempty"`
+ Photos []*ChildPhoto `protobuf:"bytes,4,rep,name=photos,proto3" json:"photos,omitempty"`
+}
+
+func (x *GetStationListByBusIdResponse) Reset() {
+ *x = GetStationListByBusIdResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetStationListByBusIdResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetStationListByBusIdResponse) ProtoMessage() {}
+
+func (x *GetStationListByBusIdResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetStationListByBusIdResponse.ProtoReflect.Descriptor instead.
+func (*GetStationListByBusIdResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_station_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *GetStationListByBusIdResponse) GetStations() []*Station {
+ if x != nil {
+ return x.Stations
+ }
+ return nil
+}
+
+func (x *GetStationListByBusIdResponse) GetGuardians() []*GuardianResponse {
+ if x != nil {
+ return x.Guardians
+ }
+ return nil
+}
+
+func (x *GetStationListByBusIdResponse) GetChildren() []*Child {
+ if x != nil {
+ return x.Children
+ }
+ return nil
+}
+
+func (x *GetStationListByBusIdResponse) GetPhotos() []*ChildPhoto {
+ if x != nil {
+ return x.Photos
+ }
+ return nil
+}
+
+type GetUnregisteredStationListRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusId string `protobuf:"bytes,1,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+}
+
+func (x *GetUnregisteredStationListRequest) Reset() {
+ *x = GetUnregisteredStationListRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetUnregisteredStationListRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetUnregisteredStationListRequest) ProtoMessage() {}
+
+func (x *GetUnregisteredStationListRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetUnregisteredStationListRequest.ProtoReflect.Descriptor instead.
+func (*GetUnregisteredStationListRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_station_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *GetUnregisteredStationListRequest) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+type GetUnregisteredStationListResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Stations []*Station `protobuf:"bytes,1,rep,name=stations,proto3" json:"stations,omitempty"`
+ Guardians []*GuardianResponse `protobuf:"bytes,2,rep,name=guardians,proto3" json:"guardians,omitempty"`
+}
+
+func (x *GetUnregisteredStationListResponse) Reset() {
+ *x = GetUnregisteredStationListResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetUnregisteredStationListResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetUnregisteredStationListResponse) ProtoMessage() {}
+
+func (x *GetUnregisteredStationListResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetUnregisteredStationListResponse.ProtoReflect.Descriptor instead.
+func (*GetUnregisteredStationListResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_station_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *GetUnregisteredStationListResponse) GetStations() []*Station {
+ if x != nil {
+ return x.Stations
+ }
+ return nil
+}
+
+func (x *GetUnregisteredStationListResponse) GetGuardians() []*GuardianResponse {
+ if x != nil {
+ return x.Guardians
+ }
+ return nil
+}
+
+type GetCorrectOrderStationListByBusIdRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusId string `protobuf:"bytes,1,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+ BusType BusType `protobuf:"varint,2,opt,name=bus_type,json=busType,proto3,enum=where_child_bus.v1.BusType" json:"bus_type,omitempty"`
+}
+
+func (x *GetCorrectOrderStationListByBusIdRequest) Reset() {
+ *x = GetCorrectOrderStationListByBusIdRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetCorrectOrderStationListByBusIdRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetCorrectOrderStationListByBusIdRequest) ProtoMessage() {}
+
+func (x *GetCorrectOrderStationListByBusIdRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetCorrectOrderStationListByBusIdRequest.ProtoReflect.Descriptor instead.
+func (*GetCorrectOrderStationListByBusIdRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_station_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *GetCorrectOrderStationListByBusIdRequest) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+func (x *GetCorrectOrderStationListByBusIdRequest) GetBusType() BusType {
+ if x != nil {
+ return x.BusType
+ }
+ return BusType_BUS_TYPE_UNSPECIFIED
+}
+
+type GetCorrectOrderStationListByBusIdResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ BusRoute *BusRoute `protobuf:"bytes,1,opt,name=bus_route,json=busRoute,proto3" json:"bus_route,omitempty"`
+}
+
+func (x *GetCorrectOrderStationListByBusIdResponse) Reset() {
+ *x = GetCorrectOrderStationListByBusIdResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetCorrectOrderStationListByBusIdResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetCorrectOrderStationListByBusIdResponse) ProtoMessage() {}
+
+func (x *GetCorrectOrderStationListByBusIdResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetCorrectOrderStationListByBusIdResponse.ProtoReflect.Descriptor instead.
+func (*GetCorrectOrderStationListByBusIdResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_station_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *GetCorrectOrderStationListByBusIdResponse) GetBusRoute() *BusRoute {
+ if x != nil {
+ return x.BusRoute
+ }
+ return nil
+}
+
+type UpdateStationRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
+ BusId string `protobuf:"bytes,2,opt,name=bus_id,json=busId,proto3" json:"bus_id,omitempty"`
+ Latitude float64 `protobuf:"fixed64,3,opt,name=latitude,proto3" json:"latitude,omitempty"`
+ Longitude float64 `protobuf:"fixed64,4,opt,name=longitude,proto3" json:"longitude,omitempty"`
+ UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,5,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
+}
+
+func (x *UpdateStationRequest) Reset() {
+ *x = UpdateStationRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateStationRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateStationRequest) ProtoMessage() {}
+
+func (x *UpdateStationRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[8]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateStationRequest.ProtoReflect.Descriptor instead.
+func (*UpdateStationRequest) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_station_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *UpdateStationRequest) GetId() string {
+ if x != nil {
+ return x.Id
+ }
+ return ""
+}
+
+func (x *UpdateStationRequest) GetBusId() string {
+ if x != nil {
+ return x.BusId
+ }
+ return ""
+}
+
+func (x *UpdateStationRequest) GetLatitude() float64 {
+ if x != nil {
+ return x.Latitude
+ }
+ return 0
+}
+
+func (x *UpdateStationRequest) GetLongitude() float64 {
+ if x != nil {
+ return x.Longitude
+ }
+ return 0
+}
+
+func (x *UpdateStationRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
+ if x != nil {
+ return x.UpdateMask
+ }
+ return nil
+}
+
+type UpdateStationResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Station *Station `protobuf:"bytes,1,opt,name=station,proto3" json:"station,omitempty"`
+}
+
+func (x *UpdateStationResponse) Reset() {
+ *x = UpdateStationResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateStationResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateStationResponse) ProtoMessage() {}
+
+func (x *UpdateStationResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_where_child_bus_v1_station_proto_msgTypes[9]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateStationResponse.ProtoReflect.Descriptor instead.
+func (*UpdateStationResponse) Descriptor() ([]byte, []int) {
+ return file_where_child_bus_v1_station_proto_rawDescGZIP(), []int{9}
+}
+
+func (x *UpdateStationResponse) GetStation() *Station {
+ if x != nil {
+ return x.Station
+ }
+ return nil
+}
+
+var File_where_child_bus_v1_station_proto protoreflect.FileDescriptor
+
+var file_where_child_bus_v1_station_proto_rawDesc = []byte{
+ 0x0a, 0x20, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75,
+ 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f,
+ 0x74, 0x6f, 0x12, 0x12, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f,
+ 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x22, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68,
+ 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75,
+ 0x72, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67,
+ 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c,
+ 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x01, 0x0a,
+ 0x28, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x6f,
+ 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e,
+ 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x67, 0x75, 0x61,
+ 0x72, 0x64, 0x69, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
+ 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f,
+ 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x6c,
+ 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x74, 0x69,
+ 0x74, 0x75, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x6c, 0x61, 0x74, 0x69,
+ 0x74, 0x75, 0x64, 0x65, 0x22, 0x62, 0x0a, 0x29, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74,
+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x47,
+ 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+ 0x65, 0x12, 0x35, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64,
+ 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
+ 0x07, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x35, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x53,
+ 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x42, 0x75, 0x73, 0x49,
+ 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x62, 0x75, 0x73, 0x5f,
+ 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x75, 0x73, 0x49, 0x64, 0x22,
+ 0x8b, 0x02, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69,
+ 0x73, 0x74, 0x42, 0x79, 0x42, 0x75, 0x73, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+ 0x65, 0x12, 0x37, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c,
+ 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
+ 0x52, 0x08, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x67, 0x75,
+ 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e,
+ 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e,
+ 0x76, 0x31, 0x2e, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f,
+ 0x6e, 0x73, 0x65, 0x52, 0x09, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x73, 0x12, 0x35,
+ 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x19, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62,
+ 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x52, 0x08, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x36, 0x0a, 0x06, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x18,
+ 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68,
+ 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x69, 0x6c, 0x64,
+ 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x06, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x22, 0x3a, 0x0a,
+ 0x21, 0x47, 0x65, 0x74, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64,
+ 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x62, 0x75, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x05, 0x62, 0x75, 0x73, 0x49, 0x64, 0x22, 0xa1, 0x01, 0x0a, 0x22, 0x47, 0x65,
+ 0x74, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x53, 0x74, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x12, 0x37, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64,
+ 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
+ 0x08, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x67, 0x75, 0x61,
+ 0x72, 0x64, 0x69, 0x61, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x77,
+ 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76,
+ 0x31, 0x2e, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+ 0x73, 0x65, 0x52, 0x09, 0x67, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x73, 0x22, 0x79, 0x0a,
+ 0x28, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x72, 0x72, 0x65, 0x63, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72,
+ 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x42, 0x75, 0x73,
+ 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x62, 0x75, 0x73,
+ 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x75, 0x73, 0x49, 0x64,
+ 0x12, 0x36, 0x0a, 0x08, 0x62, 0x75, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64,
+ 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x73, 0x54, 0x79, 0x70, 0x65, 0x52,
+ 0x07, 0x62, 0x75, 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x66, 0x0a, 0x29, 0x47, 0x65, 0x74, 0x43,
+ 0x6f, 0x72, 0x72, 0x65, 0x63, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x42, 0x75, 0x73, 0x49, 0x64, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x09, 0x62, 0x75, 0x73, 0x5f, 0x72, 0x6f, 0x75,
+ 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65,
+ 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75,
+ 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x08, 0x62, 0x75, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65,
+ 0x22, 0xb4, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x62, 0x75, 0x73,
+ 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x75, 0x73, 0x49, 0x64,
+ 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01,
+ 0x28, 0x01, 0x52, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09,
+ 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52,
+ 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70,
+ 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
+ 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64,
+ 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x4e, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74,
+ 0x65, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x12, 0x35, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x1b, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f,
+ 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07,
+ 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xa5, 0x04, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa0, 0x01, 0x0a, 0x21, 0x55,
+ 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x6f, 0x63, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x47, 0x75, 0x61, 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64,
+ 0x12, 0x3c, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62,
+ 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x47, 0x75, 0x61,
+ 0x72, 0x64, 0x69, 0x61, 0x6e, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3d,
+ 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73,
+ 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f,
+ 0x6e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x47, 0x75, 0x61, 0x72, 0x64,
+ 0x69, 0x61, 0x6e, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7c, 0x0a,
+ 0x15, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x42,
+ 0x79, 0x42, 0x75, 0x73, 0x49, 0x64, 0x12, 0x30, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63,
+ 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53,
+ 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x42, 0x75, 0x73, 0x49,
+ 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65,
+ 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65,
+ 0x74, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x42, 0x75,
+ 0x73, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8b, 0x01, 0x0a, 0x1a,
+ 0x47, 0x65, 0x74, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x53,
+ 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x35, 0x2e, 0x77, 0x68, 0x65,
+ 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e,
+ 0x47, 0x65, 0x74, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x53,
+ 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+ 0x74, 0x1a, 0x36, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f,
+ 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69,
+ 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73,
+ 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x0d, 0x55, 0x70, 0x64,
+ 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x2e, 0x77, 0x68, 0x65,
+ 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e,
+ 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71,
+ 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69,
+ 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
+ 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42,
+ 0xef, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68,
+ 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x53, 0x74, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x66, 0x67, 0x69, 0x74, 0x68,
+ 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x65, 0x6e, 0x54, 0x65, 0x61, 0x50,
+ 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x6d, 0x65, 0x72, 0x73, 0x2f, 0x57, 0x68, 0x65, 0x72, 0x65,
+ 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64,
+ 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x77, 0x68,
+ 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73, 0x2f, 0x76, 0x31,
+ 0x3b, 0x77, 0x68, 0x65, 0x72, 0x65, 0x5f, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x75, 0x73,
+ 0x76, 0x31, 0xa2, 0x02, 0x03, 0x57, 0x58, 0x58, 0xaa, 0x02, 0x10, 0x57, 0x68, 0x65, 0x72, 0x65,
+ 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x57, 0x68,
+ 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02,
+ 0x1c, 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x5c, 0x56,
+ 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11,
+ 0x57, 0x68, 0x65, 0x72, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x75, 0x73, 0x3a, 0x3a, 0x56,
+ 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_where_child_bus_v1_station_proto_rawDescOnce sync.Once
+ file_where_child_bus_v1_station_proto_rawDescData = file_where_child_bus_v1_station_proto_rawDesc
+)
+
+func file_where_child_bus_v1_station_proto_rawDescGZIP() []byte {
+ file_where_child_bus_v1_station_proto_rawDescOnce.Do(func() {
+ file_where_child_bus_v1_station_proto_rawDescData = protoimpl.X.CompressGZIP(file_where_child_bus_v1_station_proto_rawDescData)
+ })
+ return file_where_child_bus_v1_station_proto_rawDescData
+}
+
+var file_where_child_bus_v1_station_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
+var file_where_child_bus_v1_station_proto_goTypes = []interface{}{
+ (*UpdateStationLocationByGuardianIdRequest)(nil), // 0: where_child_bus.v1.UpdateStationLocationByGuardianIdRequest
+ (*UpdateStationLocationByGuardianIdResponse)(nil), // 1: where_child_bus.v1.UpdateStationLocationByGuardianIdResponse
+ (*GetStationListByBusIdRequest)(nil), // 2: where_child_bus.v1.GetStationListByBusIdRequest
+ (*GetStationListByBusIdResponse)(nil), // 3: where_child_bus.v1.GetStationListByBusIdResponse
+ (*GetUnregisteredStationListRequest)(nil), // 4: where_child_bus.v1.GetUnregisteredStationListRequest
+ (*GetUnregisteredStationListResponse)(nil), // 5: where_child_bus.v1.GetUnregisteredStationListResponse
+ (*GetCorrectOrderStationListByBusIdRequest)(nil), // 6: where_child_bus.v1.GetCorrectOrderStationListByBusIdRequest
+ (*GetCorrectOrderStationListByBusIdResponse)(nil), // 7: where_child_bus.v1.GetCorrectOrderStationListByBusIdResponse
+ (*UpdateStationRequest)(nil), // 8: where_child_bus.v1.UpdateStationRequest
+ (*UpdateStationResponse)(nil), // 9: where_child_bus.v1.UpdateStationResponse
+ (*Station)(nil), // 10: where_child_bus.v1.Station
+ (*GuardianResponse)(nil), // 11: where_child_bus.v1.GuardianResponse
+ (*Child)(nil), // 12: where_child_bus.v1.Child
+ (*ChildPhoto)(nil), // 13: where_child_bus.v1.ChildPhoto
+ (BusType)(0), // 14: where_child_bus.v1.BusType
+ (*BusRoute)(nil), // 15: where_child_bus.v1.BusRoute
+ (*fieldmaskpb.FieldMask)(nil), // 16: google.protobuf.FieldMask
+}
+var file_where_child_bus_v1_station_proto_depIdxs = []int32{
+ 10, // 0: where_child_bus.v1.UpdateStationLocationByGuardianIdResponse.station:type_name -> where_child_bus.v1.Station
+ 10, // 1: where_child_bus.v1.GetStationListByBusIdResponse.stations:type_name -> where_child_bus.v1.Station
+ 11, // 2: where_child_bus.v1.GetStationListByBusIdResponse.guardians:type_name -> where_child_bus.v1.GuardianResponse
+ 12, // 3: where_child_bus.v1.GetStationListByBusIdResponse.children:type_name -> where_child_bus.v1.Child
+ 13, // 4: where_child_bus.v1.GetStationListByBusIdResponse.photos:type_name -> where_child_bus.v1.ChildPhoto
+ 10, // 5: where_child_bus.v1.GetUnregisteredStationListResponse.stations:type_name -> where_child_bus.v1.Station
+ 11, // 6: where_child_bus.v1.GetUnregisteredStationListResponse.guardians:type_name -> where_child_bus.v1.GuardianResponse
+ 14, // 7: where_child_bus.v1.GetCorrectOrderStationListByBusIdRequest.bus_type:type_name -> where_child_bus.v1.BusType
+ 15, // 8: where_child_bus.v1.GetCorrectOrderStationListByBusIdResponse.bus_route:type_name -> where_child_bus.v1.BusRoute
+ 16, // 9: where_child_bus.v1.UpdateStationRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 10, // 10: where_child_bus.v1.UpdateStationResponse.station:type_name -> where_child_bus.v1.Station
+ 0, // 11: where_child_bus.v1.StationService.UpdateStationLocationByGuardianId:input_type -> where_child_bus.v1.UpdateStationLocationByGuardianIdRequest
+ 2, // 12: where_child_bus.v1.StationService.GetStationListByBusId:input_type -> where_child_bus.v1.GetStationListByBusIdRequest
+ 4, // 13: where_child_bus.v1.StationService.GetUnregisteredStationList:input_type -> where_child_bus.v1.GetUnregisteredStationListRequest
+ 8, // 14: where_child_bus.v1.StationService.UpdateStation:input_type -> where_child_bus.v1.UpdateStationRequest
+ 1, // 15: where_child_bus.v1.StationService.UpdateStationLocationByGuardianId:output_type -> where_child_bus.v1.UpdateStationLocationByGuardianIdResponse
+ 3, // 16: where_child_bus.v1.StationService.GetStationListByBusId:output_type -> where_child_bus.v1.GetStationListByBusIdResponse
+ 5, // 17: where_child_bus.v1.StationService.GetUnregisteredStationList:output_type -> where_child_bus.v1.GetUnregisteredStationListResponse
+ 9, // 18: where_child_bus.v1.StationService.UpdateStation:output_type -> where_child_bus.v1.UpdateStationResponse
+ 15, // [15:19] is the sub-list for method output_type
+ 11, // [11:15] is the sub-list for method input_type
+ 11, // [11:11] is the sub-list for extension type_name
+ 11, // [11:11] is the sub-list for extension extendee
+ 0, // [0:11] is the sub-list for field type_name
+}
+
+func init() { file_where_child_bus_v1_station_proto_init() }
+func file_where_child_bus_v1_station_proto_init() {
+ if File_where_child_bus_v1_station_proto != nil {
+ return
+ }
+ file_where_child_bus_v1_resources_proto_init()
+ if !protoimpl.UnsafeEnabled {
+ file_where_child_bus_v1_station_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*UpdateStationLocationByGuardianIdRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_station_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*UpdateStationLocationByGuardianIdResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_station_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetStationListByBusIdRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_station_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetStationListByBusIdResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_station_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetUnregisteredStationListRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_station_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetUnregisteredStationListResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_station_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetCorrectOrderStationListByBusIdRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_station_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetCorrectOrderStationListByBusIdResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_station_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*UpdateStationRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_where_child_bus_v1_station_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*UpdateStationResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_where_child_bus_v1_station_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 10,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_where_child_bus_v1_station_proto_goTypes,
+ DependencyIndexes: file_where_child_bus_v1_station_proto_depIdxs,
+ MessageInfos: file_where_child_bus_v1_station_proto_msgTypes,
+ }.Build()
+ File_where_child_bus_v1_station_proto = out.File
+ file_where_child_bus_v1_station_proto_rawDesc = nil
+ file_where_child_bus_v1_station_proto_goTypes = nil
+ file_where_child_bus_v1_station_proto_depIdxs = nil
+}
diff --git a/backend/proto-gen/go/where_child_bus/v1/station_grpc.pb.go b/backend/proto-gen/go/where_child_bus/v1/station_grpc.pb.go
new file mode 100644
index 00000000..7ac2fac7
--- /dev/null
+++ b/backend/proto-gen/go/where_child_bus/v1/station_grpc.pb.go
@@ -0,0 +1,218 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.3.0
+// - protoc (unknown)
+// source: where_child_bus/v1/station.proto
+
+package where_child_busv1
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+const (
+ StationService_UpdateStationLocationByGuardianId_FullMethodName = "/where_child_bus.v1.StationService/UpdateStationLocationByGuardianId"
+ StationService_GetStationListByBusId_FullMethodName = "/where_child_bus.v1.StationService/GetStationListByBusId"
+ StationService_GetUnregisteredStationList_FullMethodName = "/where_child_bus.v1.StationService/GetUnregisteredStationList"
+ StationService_UpdateStation_FullMethodName = "/where_child_bus.v1.StationService/UpdateStation"
+)
+
+// StationServiceClient is the client API for StationService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type StationServiceClient interface {
+ UpdateStationLocationByGuardianId(ctx context.Context, in *UpdateStationLocationByGuardianIdRequest, opts ...grpc.CallOption) (*UpdateStationLocationByGuardianIdResponse, error)
+ GetStationListByBusId(ctx context.Context, in *GetStationListByBusIdRequest, opts ...grpc.CallOption) (*GetStationListByBusIdResponse, error)
+ GetUnregisteredStationList(ctx context.Context, in *GetUnregisteredStationListRequest, opts ...grpc.CallOption) (*GetUnregisteredStationListResponse, error)
+ UpdateStation(ctx context.Context, in *UpdateStationRequest, opts ...grpc.CallOption) (*UpdateStationResponse, error)
+}
+
+type stationServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewStationServiceClient(cc grpc.ClientConnInterface) StationServiceClient {
+ return &stationServiceClient{cc}
+}
+
+func (c *stationServiceClient) UpdateStationLocationByGuardianId(ctx context.Context, in *UpdateStationLocationByGuardianIdRequest, opts ...grpc.CallOption) (*UpdateStationLocationByGuardianIdResponse, error) {
+ out := new(UpdateStationLocationByGuardianIdResponse)
+ err := c.cc.Invoke(ctx, StationService_UpdateStationLocationByGuardianId_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *stationServiceClient) GetStationListByBusId(ctx context.Context, in *GetStationListByBusIdRequest, opts ...grpc.CallOption) (*GetStationListByBusIdResponse, error) {
+ out := new(GetStationListByBusIdResponse)
+ err := c.cc.Invoke(ctx, StationService_GetStationListByBusId_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *stationServiceClient) GetUnregisteredStationList(ctx context.Context, in *GetUnregisteredStationListRequest, opts ...grpc.CallOption) (*GetUnregisteredStationListResponse, error) {
+ out := new(GetUnregisteredStationListResponse)
+ err := c.cc.Invoke(ctx, StationService_GetUnregisteredStationList_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *stationServiceClient) UpdateStation(ctx context.Context, in *UpdateStationRequest, opts ...grpc.CallOption) (*UpdateStationResponse, error) {
+ out := new(UpdateStationResponse)
+ err := c.cc.Invoke(ctx, StationService_UpdateStation_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// StationServiceServer is the server API for StationService service.
+// All implementations should embed UnimplementedStationServiceServer
+// for forward compatibility
+type StationServiceServer interface {
+ UpdateStationLocationByGuardianId(context.Context, *UpdateStationLocationByGuardianIdRequest) (*UpdateStationLocationByGuardianIdResponse, error)
+ GetStationListByBusId(context.Context, *GetStationListByBusIdRequest) (*GetStationListByBusIdResponse, error)
+ GetUnregisteredStationList(context.Context, *GetUnregisteredStationListRequest) (*GetUnregisteredStationListResponse, error)
+ UpdateStation(context.Context, *UpdateStationRequest) (*UpdateStationResponse, error)
+}
+
+// UnimplementedStationServiceServer should be embedded to have forward compatible implementations.
+type UnimplementedStationServiceServer struct {
+}
+
+func (UnimplementedStationServiceServer) UpdateStationLocationByGuardianId(context.Context, *UpdateStationLocationByGuardianIdRequest) (*UpdateStationLocationByGuardianIdResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdateStationLocationByGuardianId not implemented")
+}
+func (UnimplementedStationServiceServer) GetStationListByBusId(context.Context, *GetStationListByBusIdRequest) (*GetStationListByBusIdResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetStationListByBusId not implemented")
+}
+func (UnimplementedStationServiceServer) GetUnregisteredStationList(context.Context, *GetUnregisteredStationListRequest) (*GetUnregisteredStationListResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetUnregisteredStationList not implemented")
+}
+func (UnimplementedStationServiceServer) UpdateStation(context.Context, *UpdateStationRequest) (*UpdateStationResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdateStation not implemented")
+}
+
+// UnsafeStationServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to StationServiceServer will
+// result in compilation errors.
+type UnsafeStationServiceServer interface {
+ mustEmbedUnimplementedStationServiceServer()
+}
+
+func RegisterStationServiceServer(s grpc.ServiceRegistrar, srv StationServiceServer) {
+ s.RegisterService(&StationService_ServiceDesc, srv)
+}
+
+func _StationService_UpdateStationLocationByGuardianId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(UpdateStationLocationByGuardianIdRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(StationServiceServer).UpdateStationLocationByGuardianId(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: StationService_UpdateStationLocationByGuardianId_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(StationServiceServer).UpdateStationLocationByGuardianId(ctx, req.(*UpdateStationLocationByGuardianIdRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _StationService_GetStationListByBusId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetStationListByBusIdRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(StationServiceServer).GetStationListByBusId(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: StationService_GetStationListByBusId_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(StationServiceServer).GetStationListByBusId(ctx, req.(*GetStationListByBusIdRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _StationService_GetUnregisteredStationList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetUnregisteredStationListRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(StationServiceServer).GetUnregisteredStationList(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: StationService_GetUnregisteredStationList_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(StationServiceServer).GetUnregisteredStationList(ctx, req.(*GetUnregisteredStationListRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _StationService_UpdateStation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(UpdateStationRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(StationServiceServer).UpdateStation(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: StationService_UpdateStation_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(StationServiceServer).UpdateStation(ctx, req.(*UpdateStationRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// StationService_ServiceDesc is the grpc.ServiceDesc for StationService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var StationService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "where_child_bus.v1.StationService",
+ HandlerType: (*StationServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "UpdateStationLocationByGuardianId",
+ Handler: _StationService_UpdateStationLocationByGuardianId_Handler,
+ },
+ {
+ MethodName: "GetStationListByBusId",
+ Handler: _StationService_GetStationListByBusId_Handler,
+ },
+ {
+ MethodName: "GetUnregisteredStationList",
+ Handler: _StationService_GetUnregisteredStationList_Handler,
+ },
+ {
+ MethodName: "UpdateStation",
+ Handler: _StationService_UpdateStation_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "where_child_bus/v1/station.proto",
+}
diff --git a/backend/secrets/gcp-credentials.json.enc b/backend/secrets/gcp-credentials.json.enc
new file mode 100644
index 00000000..8afbbafc
Binary files /dev/null and b/backend/secrets/gcp-credentials.json.enc differ
diff --git a/backend/usecases/bus/bus.go b/backend/usecases/bus/bus.go
new file mode 100644
index 00000000..3c9db913
--- /dev/null
+++ b/backend/usecases/bus/bus.go
@@ -0,0 +1,723 @@
+package bus
+
+import (
+ "errors"
+ "fmt"
+ "io"
+ "sync"
+ "time"
+
+ "context"
+
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/utils"
+ "github.com/google/uuid"
+ "golang.org/x/exp/slog"
+
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent"
+ boardingrecordRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ busRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ childRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ guardianRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ nurseryRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ stationRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ mlv1 "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/machine_learning/v1"
+)
+
+type Interactor struct {
+ entClient *ent.Client
+ logger *slog.Logger
+ MLServiceClient mlv1.MachineLearningServiceClient
+}
+
+func NewInteractor(entClient *ent.Client, logger *slog.Logger, mlClient mlv1.MachineLearningServiceClient) *Interactor {
+ return &Interactor{entClient, logger, mlClient}
+}
+
+func (i *Interactor) CreateBus(ctx context.Context, req *pb.CreateBusRequest) (*pb.CreateBusResponse, error) {
+ nurseryID, err := uuid.Parse(req.NurseryId)
+ if err != nil {
+ i.logger.Error("failed to parse nursery ID", "error", err)
+ return nil, err
+ }
+
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ defer utils.RollbackTx(tx, i.logger)
+ if err != nil {
+ i.logger.Error("failed to get evening first station", "error", err)
+ return nil, err
+ }
+ bus, err := tx.Bus.Create().
+ SetNurseryID(nurseryID).
+ SetName(req.Name).
+ SetPlateNumber(req.PlateNumber).
+ Save(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to create bus", "error", err)
+ return nil, err
+ }
+
+ // TODO: もう少し簡潔に
+ _, err = utils.CheckAndFixBusStationCoordinates(*i.logger, ctx, bus)
+ if err != nil {
+ i.logger.Error("failed to check and fix bus station coordinates", "error", err)
+ return nil, err
+ }
+
+ // Nurseryエッジを持つBusを取得
+ bus, err = tx.Bus.Query().
+ Where(busRepo.IDEQ(bus.ID)).
+ WithNursery().
+ WithNextStation().
+ Only(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get bus", "error", err)
+ return nil, err
+ }
+
+ nextStationID, err := getStationIDs(i.logger, ctx, bus)
+
+ if err != nil {
+ i.logger.Error("failed to get station IDs", "error", err)
+ return nil, err
+ }
+
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ return &pb.CreateBusResponse{
+ Bus: utils.ToPbBus(bus, nextStationID),
+ }, nil
+}
+
+func (i *Interactor) GetBusListByNurseryID(ctx context.Context, req *pb.GetBusListByNurseryIdRequest) (*pb.GetBusListByNurseryIdResponse, error) {
+ nurseryID, err := uuid.Parse(req.NurseryId)
+ if err != nil {
+ i.logger.Error("failed to parse nursery ID", "error", err)
+ return nil, err
+ }
+
+ buses, err := i.getBusList(ctx, func(tx *ent.Tx) (*ent.BusQuery, error) {
+ return tx.Bus.Query().
+ Where(busRepo.HasNurseryWith(nurseryRepo.IDEQ(nurseryID))).
+ WithNextStation().
+ WithNursery(), nil
+ })
+
+ if err != nil {
+ i.logger.Error("failed to get bus list", "error", err)
+ return nil, err
+ }
+
+ return &pb.GetBusListByNurseryIdResponse{Buses: buses}, nil
+}
+
+func (i *Interactor) GetRunningBusByGuardianID(ctx context.Context, req *pb.GetRunningBusByGuardianIdRequest) (*pb.GetRunningBusByGuardianIdResponse, error) {
+ guardianID, err := uuid.Parse(req.GuardianId)
+ if err != nil {
+ i.logger.Error("failed to parse guardian ID", "error", err)
+ return nil, err
+ }
+
+ bus, err := i.entClient.Bus.Query().
+ Where(busRepo.HasNurseryWith(nurseryRepo.HasGuardiansWith(guardianRepo.ID(guardianID)))).
+ Where(busRepo.StatusEQ(busRepo.StatusRunning)).
+ WithNursery().
+ WithNextStation().
+ Only(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get bus list", "error", err)
+ return nil, err
+ }
+
+ nextStationID, err := getStationIDs(i.logger, ctx, bus)
+ if err != nil {
+ i.logger.Error("failed to get station IDs", "error", err)
+ return nil, err
+ }
+
+ return &pb.GetRunningBusByGuardianIdResponse{Bus: utils.ToPbBus(bus, nextStationID)}, nil
+}
+
+func (i *Interactor) ChangeBusStatus(ctx context.Context, req *pb.ChangeBusStatusRequest) (*pb.ChangeBusStatusResponse, error) {
+ busID, err := uuid.Parse(req.BusId)
+ if err != nil {
+ i.logger.Error("failed to parse bus ID", "error", err)
+ return nil, err
+ }
+
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+
+ status, err := utils.ConvertPbStatusToEntStatus(req.BusStatus)
+ if err != nil {
+ i.logger.Error("failed to convert status", "error", err)
+ return nil, err
+ }
+
+ bus, err := tx.Bus.Query().Where(busRepo.IDEQ(busID)).
+ WithNursery().
+ Only(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get bus", "error", err)
+ return nil, err
+
+ }
+
+ // TODO :後で関数化
+ update := tx.Bus.UpdateOneID(busID)
+ // バスを停止に変更する場合、次のステーションをクリア
+ switch req.BusStatus {
+ case pb.BusStatus_BUS_STATUS_STOPPED:
+ update.ClearNextStation()
+ case pb.BusStatus_BUS_STATUS_RUNNING:
+ switch req.BusType {
+ case pb.BusType_BUS_TYPE_MORNING:
+ firstStation, err := i.getFirstStation(bus, pb.BusType_BUS_TYPE_MORNING)
+ if err != nil {
+ i.logger.Error("failed to get first station", "error", err)
+ return nil, err
+ }
+ update.SetNextStation(firstStation)
+ case pb.BusType_BUS_TYPE_EVENING:
+ firstStation, err := i.getFirstStation(bus, pb.BusType_BUS_TYPE_MORNING)
+ if err != nil {
+ i.logger.Error("failed to get first station", "error", err)
+ return nil, err
+ }
+ update.SetNextStation(firstStation)
+ }
+ }
+
+ bus, err = update.SetStatus(*status).Save(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to update bus", "error", err)
+ return nil, err
+ }
+
+ // TODO: もう少し簡潔に
+ is_ready, err := utils.CheckAndFixBusStationCoordinates(*i.logger, ctx, bus)
+ if err != nil {
+ i.logger.Error("failed to check and fix bus station coordinates", "error", err)
+ return nil, err
+ }
+
+ if !is_ready {
+ i.logger.Error("bus station coordinates are not ready")
+ return nil, errors.New("bus station coordinates are not ready")
+ }
+
+ // Nurseryエッジを持つBusを取得
+ bus, err = tx.Bus.Query().
+ Where(busRepo.IDEQ(bus.ID)).
+ WithNursery().
+ WithNextStation().
+ Only(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get bus", "error", err)
+ return nil, err
+ }
+
+ nextStationID, err := getStationIDs(i.logger, ctx, bus)
+ if err != nil {
+ i.logger.Error("failed to get station IDs", "error", err)
+ return nil, err
+ }
+
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+ return &pb.ChangeBusStatusResponse{Bus: utils.ToPbBus(bus, nextStationID)}, nil
+}
+
+func (i *Interactor) UpdateBus(ctx context.Context, req *pb.UpdateBusRequest) (*pb.UpdateBusResponse, error) {
+ // bus_idのパース
+ busID, err := uuid.Parse(req.BusId)
+ if err != nil {
+ i.logger.Error("failed to parse bus ID", "error", err)
+ return nil, err
+ }
+
+ // トランザクションの開始
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ defer utils.RollbackTx(tx, i.logger)
+
+ // 更新処理のビルダー
+ update := tx.Bus.Update().Where(busRepo.IDEQ(busID))
+ for _, path := range req.UpdateMask.Paths {
+ switch path {
+ case "name":
+ update.SetName(req.Name)
+ case "plate_number":
+ update.SetPlateNumber(req.PlateNumber)
+ case "latitude":
+ update.SetLatitude(req.Latitude)
+ case "longitude":
+ update.SetLongitude(req.Longitude)
+ case "enable_face_recognition":
+ update.SetEnableFaceRecognition(req.EnableFaceRecognition)
+ case "next_station_id":
+ nextStationID, err := uuid.Parse(req.NextStationId)
+ if err != nil {
+ i.logger.Error("failed to parse next station ID", "error", err)
+ return nil, err
+ }
+ update.ClearNextStation()
+ update.SetNextStationID(nextStationID)
+ }
+ }
+
+ // 更新の実行
+ _, err = update.Save(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to update bus", "error", err)
+ return nil, err
+ }
+
+ updatedBus, err := tx.Bus.Query().Where(busRepo.IDEQ(busID)).
+ WithNursery().
+ Only(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to update bus", "error", err)
+ return nil, err
+ }
+
+ // TODO: もう少し簡潔に
+ _, err = utils.CheckAndFixBusStationCoordinates(*i.logger, ctx, updatedBus)
+ if err != nil {
+ i.logger.Error("failed to check and fix bus station coordinates", "error", err)
+ return nil, err
+ }
+
+ // 更新されたバスを取得
+ updatedBus, err = tx.Bus.Query().Where(busRepo.ID(busID)).
+ WithNursery().
+ Only(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to retrieve updated bus", "error", err)
+ }
+
+ nextStationID, err := getStationIDs(i.logger, ctx, updatedBus)
+
+ if err != nil {
+ i.logger.Error("failed to get station IDs", "error", err)
+ return nil, err
+ }
+
+ // トランザクションのコミット
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ // レスポンスの生成と返却
+ return &pb.UpdateBusResponse{
+ Bus: utils.ToPbBus(updatedBus, nextStationID),
+ }, nil
+}
+
+func (i *Interactor) SendLocationContinuous(stream pb.BusService_SendLocationContinuousServer) error {
+ ctx := stream.Context()
+ retryDelay := 1 * time.Second // リトライの間隔を10秒に設定
+ maxRetries := 5 // 最大リトライ回数
+
+ ticker := time.NewTicker(retryDelay)
+ defer ticker.Stop()
+
+ retryCount := 0
+
+ for {
+ select {
+ case <-ctx.Done(): // クライアントの切断またはその他のキャンセルシグナルを受信
+ return ctx.Err()
+ case <-ticker.C: // 定期的にリトライを実施
+ req, err := stream.Recv()
+ if errors.Is(err, io.EOF) {
+ // ストリームの終了
+ return stream.SendAndClose(&pb.SendLocationContinuousResponse{})
+ }
+
+ if err != nil {
+ i.logger.Error("failed to receive location", err)
+ retryCount++
+ if retryCount >= maxRetries {
+ i.logger.Error("max retries reached, stopping", err)
+ return err // 最大リトライ回数に達したので中断
+ }
+ continue // 次のリトライを待つ
+ }
+
+ // リセットリトライカウント
+ retryCount = 0
+
+ busID, err := uuid.Parse(req.BusId)
+ if err != nil {
+ i.logger.Error("failed to parse bus ID", err)
+ continue // バスIDの解析に失敗した場合は、次のリクエストの処理を試みる
+ }
+
+ _, err = i.entClient.Bus.UpdateOneID(busID).
+ SetLatitude(req.Latitude).
+ SetLongitude(req.Longitude).
+ Save(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to update bus location", err)
+ continue // データベース更新に失敗した場合は、次のリクエストの処理を試みる
+ }
+
+ i.logger.Info("updated bus location", "bus_id", busID, "latitude", req.Latitude, "longitude", req.Longitude)
+ }
+ }
+}
+
+func (i *Interactor) TrackBusContinuous(req *pb.TrackBusContinuousRequest, stream pb.BusService_TrackBusContinuousServer) error {
+ ctx := stream.Context()
+ busID, err := uuid.Parse(req.BusId)
+ if err != nil {
+ return fmt.Errorf("failed to parse bus ID '%s': %w", req.BusId, err)
+ }
+
+ // 送信間隔の設定(例えば、5秒ごと)
+ ticker := time.NewTicker(1 * time.Second)
+ defer ticker.Stop()
+
+ for {
+ select {
+ case <-ctx.Done(): // クライアントの切断またはその他のキャンセルシグナルを受信
+ return ctx.Err()
+ case <-ticker.C: // 定期的にデータを送信
+ bus, err := i.entClient.Bus.Query().
+ Where(busRepo.IDEQ(busID)).
+ WithNursery().
+ Only(ctx)
+ if err != nil {
+ return fmt.Errorf("failed to get bus: %w", err)
+ }
+
+ nextStation, err := bus.QueryNextStation().Only(ctx)
+ if err != nil {
+ return err
+ }
+
+ if err := stream.Send(&pb.TrackBusContinuousResponse{
+ BusId: req.BusId,
+ Latitude: bus.Latitude,
+ Longitude: bus.Longitude,
+ NextStationId: nextStation.ID.String(),
+ }); err != nil {
+ return fmt.Errorf("failed to send bus: %w", err)
+ }
+ }
+ }
+}
+
+func (i *Interactor) StreamBusVideo(stream pb.BusService_StreamBusVideoServer) error {
+ ctx, cancel := context.WithCancel(stream.Context()) // ゴルーチンの管理用にキャンセル可能なコンテキストを作成
+ defer cancel() // 関数終了時にゴルーチンをキャンセル
+
+ MLStream, err := i.MLServiceClient.Pred(ctx)
+ if err != nil {
+ return err
+ }
+
+ var busID string
+ var vehicleEvent pb.VehicleEvent
+ errChan := make(chan error, 1)
+
+ wg := sync.WaitGroup{}
+ wg.Add(1)
+ go func() {
+ defer wg.Done()
+ for {
+ in, err := stream.Recv()
+ if err != nil {
+ if err == io.EOF {
+ cancel() // EOF の場合はコンテキストをキャンセルしてゴルーチンを終了
+ return
+ }
+ errChan <- err
+ return
+ }
+
+ busID = in.BusId
+ vehicleEvent = in.VehicleEvent
+
+ if err := MLStream.Send(in); err != nil {
+ errChan <- err
+ return
+ }
+ }
+ }()
+
+ for {
+ select {
+ case err := <-errChan:
+ return err
+ default:
+ resp, err := MLStream.Recv()
+ if err != nil {
+ if err == io.EOF {
+ wg.Wait() // ゴルーチンの完了を待つ
+ return nil
+ }
+ return err
+ }
+
+ if !resp.IsDetected {
+ continue
+ }
+
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ return err
+ }
+
+ i.logger.Info("processing detected children", "bus_id", busID, "vehicle_event", vehicleEvent)
+ err = i.processDetectedChildren(tx, ctx, stream, resp, busID, vehicleEvent)
+ if err != nil {
+ utils.RollbackTx(tx, i.logger)
+ return err
+ }
+
+ if err := tx.Commit(); err != nil {
+ return err
+ }
+ }
+ }
+}
+
+// processDetectedChildren は検出された子供たちを処理するためのヘルパー関数です。
+func (i *Interactor) processDetectedChildren(tx *ent.Tx, ctx context.Context, stream pb.BusService_StreamBusVideoServer, resp *mlv1.PredResponse, busID string, vehicleEvent pb.VehicleEvent) error {
+ i.logger.Info("called processDetectedChildren")
+ var pbChildren []*pb.Child
+ busUUID := uuid.MustParse(busID)
+ for _, childId := range resp.ChildIds {
+ childUUID := uuid.MustParse(childId)
+
+ i.logger.Info("start searching boarding record", "child_id", childUUID, "bus_id", busUUID)
+ // 既存のレコードを検索
+ exists, err := tx.BoardingRecord.Query().
+ Where(boardingrecordRepo.HasChildWith(childRepo.IDEQ(childUUID))).
+ Where(boardingrecordRepo.HasBusWith(busRepo.IDEQ(busUUID))).
+ Exist(ctx)
+ if err != nil {
+ return err
+ }
+ i.logger.Info("exists", exists, "child_id", childUUID, "bus_id", busUUID)
+
+ if !exists {
+ _, err = tx.BoardingRecord.Create().
+ SetChildID(childUUID).
+ SetBusID(busUUID).
+ SetIsBoarding(false).
+ SetTimestamp(time.Now()).
+ Save(ctx)
+ if err != nil {
+ return err
+ }
+ i.logger.Info("created new boarding record", "child_id", childUUID, "bus_id", busUUID)
+ }
+
+ boardingrecord, err := tx.BoardingRecord.Query().
+ Where(boardingrecordRepo.HasChildWith(childRepo.IDEQ(childUUID))).
+ Where(boardingrecordRepo.HasBusWith(busRepo.IDEQ(busUUID))).
+ Only(ctx)
+ if err != nil {
+ return err
+ }
+
+ // 乗車または降車の処理
+ switch vehicleEvent {
+ case pb.VehicleEvent_VEHICLE_EVENT_GET_ON:
+ if boardingrecord.IsBoarding {
+ continue
+ }
+ _, err = tx.BoardingRecord.UpdateOneID(boardingrecord.ID).
+ SetIsBoarding(true).
+ SetTimestamp(time.Now()).
+ Save(ctx)
+ case pb.VehicleEvent_VEHICLE_EVENT_GET_OFF:
+ if !boardingrecord.IsBoarding {
+ continue
+ }
+ _, err = tx.BoardingRecord.UpdateOneID(boardingrecord.ID).
+ SetIsBoarding(false).
+ SetTimestamp(time.Now()).
+ Save(ctx)
+ default:
+ return fmt.Errorf("invalid vehicle event: %v", vehicleEvent)
+ }
+ if err != nil {
+ return err
+ }
+
+ i.logger.Info("updated boarding record", "child_id", childUUID, "bus_id", busUUID, "is_boarding", boardingrecord.IsBoarding, "vehicle_event", vehicleEvent)
+
+ // 子供の情報を取得してレスポンスに追加
+ child, err := tx.Child.Query().
+ Where(childRepo.IDEQ(childUUID)).
+ WithGuardian().
+ Only(ctx)
+ if err != nil {
+ return err
+ }
+ pbChildren = append(pbChildren, utils.ToPbChild(child))
+ }
+
+ i.logger.Info("sending response to client", "bus_id", busUUID, "vehicle_event", vehicleEvent, "children", pbChildren)
+
+ // 元のクライアントにレスポンスを返す
+ err := stream.Send(&pb.StreamBusVideoResponse{
+ IsDetected: resp.IsDetected,
+ Children: pbChildren,
+ })
+ if err != nil {
+ return err
+ }
+ return nil
+}
+
+func (i *Interactor) getBusList(ctx context.Context, queryFunc func(*ent.Tx) (*ent.BusQuery, error)) ([]*pb.Bus, error) {
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ defer utils.RollbackTx(tx, i.logger)
+
+ query, err := queryFunc(tx)
+ if err != nil {
+ i.logger.Error("failed to create query", "error", err)
+ return nil, err
+ }
+
+ entBuses, err := query.All(ctx)
+ if err != nil {
+ i.logger.Error("failed to execute query", "error", err)
+ return nil, err
+ }
+
+ // TODO: もう少し簡潔に書ける
+ for _, bus := range entBuses {
+ _, err = utils.CheckAndFixBusStationCoordinates(*i.logger, ctx, bus)
+ if err != nil {
+ i.logger.Error("failed to check and fix bus station coordinates", "error", err)
+ return nil, err
+ }
+ }
+
+ entBuses, err = query.All(ctx)
+ if err != nil {
+ i.logger.Error("failed to execute query", "error", err)
+ return nil, err
+ }
+
+ pbBuses := make([]*pb.Bus, len(entBuses))
+ for index, b := range entBuses {
+ nextStationID, err := getStationIDs(i.logger, ctx, b)
+ if err != nil {
+ i.logger.Error("failed to get station IDs", "error", err)
+ return nil, err
+ }
+ pbBuses[index] = utils.ToPbBus(b, nextStationID)
+ }
+
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ return pbBuses, nil
+}
+
+func getStationIDs(logger *slog.Logger, ctx context.Context, bus *ent.Bus) (nextStationId string, err error) {
+ nextStation, err := bus.QueryNextStation().Only(ctx)
+ if err != nil && !ent.IsNotFound(err) {
+ logger.Error("failed to query next station", "error", err)
+ return "", err
+ }
+ if nextStation != nil {
+ nextStationId = nextStation.ID.String()
+ }
+
+ return nextStationId, nil
+}
+
+func (i *Interactor) getFirstStation(bus *ent.Bus, busType pb.BusType) (*ent.Station, error) {
+ var firstStation *ent.Station
+ var busRoute *ent.BusRoute
+ var err error
+
+ if busType == pb.BusType_BUS_TYPE_MORNING {
+ busRoute, err = bus.QueryLatestMorningRoute().Only(context.Background())
+ } else if busType == pb.BusType_BUS_TYPE_EVENING {
+ busRoute, err = bus.QueryLatestEveningRoute().Only(context.Background())
+ } else {
+ return nil, fmt.Errorf("invalid bus type")
+ }
+
+ if err != nil {
+ i.logger.Error("failed to get bus route", "error", err)
+ return nil, err
+ }
+
+ stations, err := busRoute.
+ QueryBusRouteAssociations().
+ QueryStation().
+ All(context.Background())
+ if err != nil {
+ i.logger.Error("failed to get stations", "error", err)
+ return nil, err
+ }
+
+ for _, station := range stations {
+ guardian, err := station.QueryGuardian().
+ Where(guardianRepo.HasStationWith(stationRepo.ID(station.ID))).
+ Only(context.Background())
+ if err != nil {
+ i.logger.Error("failed to get guardian", "error", err)
+ return nil, err
+ }
+ if busType == pb.BusType_BUS_TYPE_MORNING {
+ if !guardian.IsUseMorningBus {
+ continue
+ }
+ } else if busType == pb.BusType_BUS_TYPE_EVENING {
+ if !guardian.IsUseEveningBus {
+ continue
+ }
+ }
+ firstStation = station
+ break
+ }
+
+ if firstStation == nil {
+ return nil, fmt.Errorf("no station found")
+ }
+
+ return firstStation, nil
+}
diff --git a/backend/usecases/busroute/bus_route.go b/backend/usecases/busroute/bus_route.go
new file mode 100644
index 00000000..f59ce8a9
--- /dev/null
+++ b/backend/usecases/busroute/bus_route.go
@@ -0,0 +1,318 @@
+package busroute
+
+import (
+ "context"
+ "io"
+
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent"
+ busRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ busRouteRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ childRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ stationRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ mlv1 "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/machine_learning/v1"
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/utils"
+ "github.com/google/uuid"
+ "golang.org/x/exp/slog"
+)
+
+type Interactor struct {
+ entClient *ent.Client
+ logger *slog.Logger
+ MLServiceClient mlv1.MachineLearningServiceClient
+}
+
+func NewInteractor(entClient *ent.Client, logger *slog.Logger, mlClient mlv1.MachineLearningServiceClient) *Interactor {
+ return &Interactor{entClient, logger, mlClient}
+}
+
+func (i *Interactor) CreateBusRoute(ctx context.Context, req *pb.CreateBusRouteRequest) (*pb.CreateBusRouteResponse, error) {
+ busID, err := uuid.Parse(req.BusId)
+ if err != nil {
+ i.logger.Error("failed to parse bus id", "error", err)
+ return nil, err
+ }
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ defer utils.RollbackTx(tx, i.logger)
+
+ busType, err := utils.ConvertPbBusTypeToEntBusType(req.BusType)
+ if err != nil {
+ i.logger.Error("failed to convert bus type", "error", err)
+ return nil, err
+ }
+
+ // busを取得
+ bus, err := tx.Bus.Query().Where(busRepo.ID(busID)).Only(ctx)
+ if err != nil {
+ i.logger.Error("failed to get bus", "error", err)
+ return nil, err
+ }
+
+ busRoute, err := tx.BusRoute.Create().
+ SetBusType(*busType).
+ AddBus(bus).
+ Save(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to create bus route", "error", err)
+ return nil, err
+ }
+
+ if *busType == busRouteRepo.BusTypeMorning {
+ _, err := tx.Bus.UpdateOneID(busID).
+ ClearLatestMorningRoute().
+ SetLatestMorningRoute(busRoute).
+ Save(ctx)
+ if err != nil {
+ i.logger.Error("failed to update bus", "error", err)
+ return nil, err
+ }
+ } else if *busType == busRouteRepo.BusTypeEvening {
+ _, err := tx.Bus.UpdateOneID(busID).
+ ClearLatestEveningRoute().
+ SetLatestEveningRoute(busRoute).
+ Save(ctx)
+ if err != nil {
+ i.logger.Error("failed to update bus", "error", err)
+ return nil, err
+ }
+ }
+
+ pbChildren, err := i.createAssociation(ctx, tx, req.GuardianIds, busRoute)
+ if err != nil {
+ return nil, err
+ }
+
+ ChildIds := make([]string, len(pbChildren))
+ for index := range pbChildren {
+ childCopy := &pb.Child{
+ Id: pbChildren[index].Id,
+ }
+ ChildIds[index] = childCopy.Id
+ }
+
+ // バックグラウンドでストリーミングを継続するためのゴルーチン
+ go func() {
+ // MLトレーニングのための新しいコンテクストを作成します。これは、元のリクエストのコンテクストとは独立しています。
+ trainCtx, cancel := context.WithCancel(context.Background())
+ defer cancel() // ストリームが完了またはエラーに遭遇したらコンテクストをキャンセル
+
+ stream, err := i.MLServiceClient.Train(trainCtx, &mlv1.TrainRequest{
+ BusId: req.BusId,
+ ChildIds: ChildIds,
+ NurseryId: req.NurseryId,
+ BusType: req.BusType,
+ })
+ if err != nil {
+ i.logger.Error("failed to transport to train server", "error", err)
+ return
+ }
+
+ // 最初のレスポンスを待つ
+ response, err := stream.Recv()
+ if err != nil {
+ i.logger.Error("error receiving from stream", "error", err)
+ return
+ }
+
+ if response.Status == mlv1.Status_STATUS_FAILED {
+ i.logger.Error("training was not started", "error", err)
+ return
+ }
+
+ i.logger.Info("Training started")
+ for {
+ i.logger.Info("stream still connected")
+ _, err := stream.Recv()
+ if err == io.EOF {
+ // ストリームの終了
+ i.logger.Info("Training stream ended")
+ break
+ }
+ if err != nil {
+ i.logger.Error("error receiving from stream", "error", err)
+ // エラーが発生した場合でも適切にリソースを解放します。
+ return
+ }
+ }
+ i.logger.Info("Training stream completed")
+ }()
+
+ pbBusRoute, err := i.CreateBusRouteResponse(ctx, tx, busRoute)
+ if err != nil {
+ i.logger.Error("failed to create bus route response", "error", err)
+ return nil, err
+ }
+
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ if err != nil {
+ i.logger.Error("failed to create bus route response", "error", err)
+ return nil, err
+ }
+ return &pb.CreateBusRouteResponse{BusRoute: pbBusRoute}, nil
+}
+func (i *Interactor) createAssociation(ctx context.Context, tx *ent.Tx, guardianIdList []string, busRoute *ent.BusRoute) ([]*pb.Child, error) {
+ var pbChildren []*pb.Child
+ for index, guardianId := range guardianIdList {
+ guardianId, err := uuid.Parse(guardianId)
+ if err != nil {
+ i.logger.Error("failed to parse guardian id", "error", err)
+ return nil, err
+ }
+
+ station, err := tx.Station.Query().
+ Where(stationRepo.HasGuardianWith(guardian.ID(guardianId))).
+ Only(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get station", "error", err)
+ return nil, err
+ }
+
+ _, err = tx.BusRouteAssociation.Create().
+ SetBusRoute(busRoute).
+ SetStation(station).
+ SetOrder(int32(index)).
+ Save(ctx)
+ if err != nil {
+ i.logger.Error("failed to update guardian", "error", err)
+ return nil, err
+ }
+
+ children, err := tx.Child.Query().
+ Where(childRepo.HasGuardianWith(guardian.ID(guardianId))).
+ WithGuardian().
+ All(ctx)
+ if err != nil {
+ i.logger.Error("failed to get children", "error", err)
+ return nil, err
+ }
+
+ for _, child := range children {
+ _, err := tx.ChildBusAssociation.Create().
+ SetChild(child).
+ SetBusRoute(busRoute).
+ Save(ctx)
+ if err != nil {
+ i.logger.Error("failed to create child bus route association", "error", err)
+ return nil, err
+ }
+ pbChildren = append(pbChildren, utils.ToPbChild(child))
+ }
+ }
+ return pbChildren, nil
+}
+
+func (i Interactor) GetBusRouteByBusID(ctx context.Context, req *pb.GetBusRouteByBusIDRequest) (*pb.GetBusRouteByBusIDResponse, error) {
+ busID, err := uuid.Parse(req.BusId)
+ if err != nil {
+ i.logger.Error("failed to parse bus route id", "error", err)
+ return nil, err
+ }
+
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+
+ bus, err := tx.Bus.Query().
+ Where(busRepo.ID(busID)).
+ Only(ctx)
+
+ var busRoute *ent.BusRoute
+ if req.BusType == pb.BusType_BUS_TYPE_MORNING {
+ busRoute, err = bus.QueryLatestMorningRoute().Only(ctx)
+ if err != nil {
+ i.logger.Error("failed to get bus route", "error", err)
+ return nil, err
+ }
+ } else if req.BusType == pb.BusType_BUS_TYPE_EVENING {
+ busRoute, err = bus.QueryLatestEveningRoute().Only(ctx)
+ if err != nil {
+ i.logger.Error("failed to get bus route", "error", err)
+ return nil, err
+ }
+ }
+
+ i.logger.Info("busRoute", "busRoute", busRoute)
+
+ if err != nil {
+ i.logger.Error("failed to get bus route", "error", err)
+ return nil, err
+ }
+
+ pbBusRoute, err := i.CreateBusRouteResponse(ctx, tx, busRoute)
+ if err != nil {
+ i.logger.Error("failed to create bus route response", "error", err)
+ return nil, err
+ }
+
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ return &pb.GetBusRouteByBusIDResponse{BusRoute: pbBusRoute}, nil
+}
+
+func (i Interactor) CreateBusRouteResponse(ctx context.Context, tx *ent.Tx, busRoute *ent.BusRoute) (*pb.BusRoute, error) {
+ busType := utils.ConvertBusTypeToPbBusType(busRoute.BusType)
+ bus, err := tx.Bus.Query().Where(
+ busRepo.HasBusRouteWith(
+ busRouteRepo.ID(busRoute.ID),
+ ),
+ ).Only(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get bus", "error", err)
+ return nil, err
+
+ }
+
+ var orderedStations []*pb.Station
+ stations, err := busRoute.
+ QueryBusRouteAssociations().
+ Order(ent.Asc("order")). // !要チェック
+ QueryStation().
+ WithGuardian().
+ All(ctx)
+ if err != nil {
+ i.logger.Error("failed to get stations", "error", err)
+ return nil, err
+ }
+
+ for _, station := range stations {
+ guardian, err := station.QueryGuardian().Where(guardian.HasStationWith(stationRepo.ID(station.ID))).Only(ctx)
+ if err != nil {
+ i.logger.Error("failed to get guardian", "error", err)
+ return nil, err
+ }
+ if busType == pb.BusType_BUS_TYPE_MORNING {
+ if !guardian.IsUseMorningBus {
+ continue
+ }
+ } else if busType == pb.BusType_BUS_TYPE_EVENING {
+ if !guardian.IsUseEveningBus {
+ continue
+ }
+ }
+ orderedStations = append(orderedStations, utils.ToPbStation(station))
+ }
+
+ return &pb.BusRoute{
+ Id: busRoute.ID.String(),
+ BusId: bus.ID.String(),
+ BusType: busType,
+ OrderedStations: orderedStations,
+ }, nil
+}
diff --git a/backend/usecases/child/child.go b/backend/usecases/child/child.go
new file mode 100644
index 00000000..8913a695
--- /dev/null
+++ b/backend/usecases/child/child.go
@@ -0,0 +1,530 @@
+package child
+
+import (
+ "fmt"
+ "io"
+
+ "cloud.google.com/go/storage"
+ "github.com/google/uuid"
+ "golang.org/x/exp/slog"
+
+ "context"
+
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/utils"
+
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent"
+ boardingRecordRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/boardingrecord"
+ busRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ busRouteRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ childRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ childBusAssociationRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childbusassociation"
+ childPhotoRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/childphoto"
+ guardianRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ nurseryRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+
+ mlv1 "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/machine_learning/v1"
+)
+
+type Interactor struct {
+ entClient *ent.Client
+ logger *slog.Logger
+ StorageClient *storage.Client
+ MLServiceClient mlv1.MachineLearningServiceClient
+ BucketName string
+}
+
+func NewInteractor(entClient *ent.Client, logger *slog.Logger, storageClient *storage.Client, mlClient mlv1.MachineLearningServiceClient, bucketName string) *Interactor {
+ return &Interactor{entClient, logger, storageClient, mlClient, bucketName}
+}
+
+func (i *Interactor) CreateChild(ctx context.Context, req *pb.CreateChildRequest) (*pb.CreateChildResponse, error) {
+ nurseryID, err := uuid.Parse(req.NurseryId)
+ if err != nil {
+ i.logger.Error("failed to parse nursery ID", "error", err)
+ return nil, err
+ }
+
+ guardianID, err := uuid.Parse(req.GuardianId)
+ if err != nil {
+ i.logger.Error("failed to parse guardian ID", "error", err)
+ return nil, err
+ }
+
+ // トランザクションの開始
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ // 成功した場合にロールバックを防ぐためのフラグ
+ defer utils.RollbackTx(tx, i.logger)
+
+ sex, err := utils.ConvertPbSexToEntSex(req.Sex)
+ if err != nil {
+ i.logger.Error("failed to convert sex", "error", err)
+ return nil, err
+ }
+ age := int(req.Age)
+
+ // 子供のレコードを作成
+ child, err := tx.Child.
+ Create().
+ SetGuardianID(guardianID).
+ SetName(req.Name).
+ SetAge(age).
+ SetSex(*sex).
+ Save(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to create child", "error", err)
+ return nil, err
+ }
+
+ child, err = tx.Child.Query().
+ Where(childRepo.IDEQ(child.ID)).
+ WithGuardian().
+ Only(ctx)
+
+ // アップロードされた写真のIDを追跡するスライス
+ var uploadedPhotoIDs []uuid.UUID
+
+ // 関数終了時にアップロードされたすべての写真をクリーンアップ
+ defer func() {
+ // エラーが発生した場合のみクリーンアップを実行
+ if err != nil {
+ for _, photoID := range uploadedPhotoIDs {
+ // 写真の削除に失敗した場合のエラーはログに記録するのみで、
+ // 元のエラーには影響させない
+ if delErr := i.deletePhotoFromGCS(ctx, nurseryID.String(), child.ID.String(), photoID.String()); delErr != nil {
+ i.logger.Error("failed to delete photo from GCS", "photoID", photoID, "error", delErr)
+ }
+ }
+ }
+ }()
+
+ // 写真のアップロードとchildPhotoレコードの作成
+ for _, photoData := range req.Photos {
+ photoID := uuid.New() // 写真に一意のIDを生成
+ uploadedPhotoIDs = append(uploadedPhotoIDs, photoID) // アップロードされた写真のIDを追跡
+
+ // 写真をGCSにアップロード
+ if err := i.uploadPhotoToGCS(ctx, nurseryID.String(), child.ID.String(), photoID.String(), photoData); err != nil {
+ i.logger.Error("failed to upload photo to GCS", "error", err)
+ return nil, err
+ }
+ i.logger.Info("Byte data of photo", "photoData", photoData)
+ // childPhotoレコードをデータベースに作成
+ _, err := tx.ChildPhoto.
+ Create().
+ SetID(photoID).
+ SetChildID(child.ID).
+ Save(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to create child photo record", "error", err)
+ return nil, err
+ }
+ }
+
+ // NOTE: ここでPythonRPCを呼び出して、顔検出と切り抜きを行う
+ res, err := i.MLServiceClient.FaceDetectAndClip(ctx, &mlv1.FaceDetectAndClipRequest{
+ NurseryId: nurseryID.String(),
+ ChildId: child.ID.String(),
+ })
+
+ if err != nil {
+ i.logger.Error("failed to call FaceDetectAndClip RPC", "error", err)
+ return nil, err
+ }
+
+ if !res.IsStarted {
+ i.logger.Error("failed to start face detection and clipping", "error", err)
+ return nil, err
+ }
+
+ // トランザクションのコミット
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ return &pb.CreateChildResponse{
+ Child: utils.ToPbChild(child),
+ }, nil
+}
+
+func (i *Interactor) CheckIsChildInBus(ctx context.Context, req *pb.CheckIsChildInBusRequest) (*pb.CheckIsChildInBusResponse, error) {
+ childID, err := uuid.Parse(req.ChildId)
+ if err != nil {
+ i.logger.Error("failed to parse child ID", "error", err)
+ return nil, err
+
+ }
+
+ boardingRecord, err := i.entClient.BoardingRecord.Query().
+ Where(boardingRecordRepo.HasChildWith(childRepo.IDEQ(childID))).
+ Only(ctx)
+
+ if err != nil {
+ if ent.IsNotFound(err) {
+ return &pb.CheckIsChildInBusResponse{
+ IsInBus: false,
+ }, nil
+ } else {
+ i.logger.Error("failed to check if child is in bus", "error", err)
+ return nil, err
+ }
+ }
+
+ return &pb.CheckIsChildInBusResponse{
+ IsInBus: boardingRecord.IsBoarding,
+ }, nil
+}
+
+func (i *Interactor) GetChildListByGuardianID(ctx context.Context, req *pb.GetChildListByGuardianIDRequest) (*pb.GetChildListByGuardianIDResponse, error) {
+ guardianID, err := uuid.Parse(req.GuardianId)
+ if err != nil {
+ i.logger.Error("failed to parse guardian ID", "error", err)
+ return nil, err
+ }
+
+ children, err := i.getChildList(ctx, func(tx *ent.Tx) (*ent.ChildQuery, error) {
+ return tx.Child.Query().
+ Where(childRepo.HasGuardianWith(guardianRepo.IDEQ(guardianID))).
+ WithGuardian(), nil
+ })
+
+ if err != nil {
+ i.logger.Error("failed to get children by guardian ID", "error", err)
+ return nil, err
+ }
+
+ nursery, err := i.entClient.Nursery.Query().
+ Where(nurseryRepo.HasGuardiansWith(guardianRepo.ID(guardianID))).
+ Only(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get nursery by guardian ID", "error", err)
+ return nil, err
+ }
+
+ nurseryID := nursery.ID.String()
+ var childPhotoList []*pb.ChildPhoto
+
+ // 子供ごとに処理
+ for _, child := range children {
+ // データベースから子供の写真のメタデータを取得
+ childPhotoRecordList, err := i.entClient.ChildPhoto.Query().
+ Where(childPhotoRepo.HasChildWith(childRepo.IDEQ(uuid.MustParse(child.Id)))).
+ All(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get child photo list", "error", err)
+ return nil, err
+ }
+
+ // 写真メタデータリストをループ
+ for _, photoMetadata := range childPhotoRecordList {
+ // GCSから写真を取得するためのIDを使用
+ photo_data, err := i.getPhotoFromGCS(ctx, nurseryID, child.Id, photoMetadata.ID.String())
+ if err != nil {
+ i.logger.Error("failed to get photo from GCS", "error", err)
+ return nil, err
+ }
+
+ // 結果リストに追加
+ childPhotoList = append(childPhotoList, &pb.ChildPhoto{
+ ChildId: child.Id,
+ Id: photoMetadata.ID.String(), // 修正: GCSから取得した写真のIDではなく、メタデータのIDを使用
+ PhotoData: photo_data,
+ })
+ }
+ }
+
+ return &pb.GetChildListByGuardianIDResponse{
+ Children: children,
+ Photos: childPhotoList,
+ }, nil
+}
+
+func (i *Interactor) GetChildListByNurseryID(ctx context.Context, req *pb.GetChildListByNurseryIDRequest) (*pb.GetChildListByNurseryIDResponse, error) {
+ nurseryID, err := uuid.Parse(req.NurseryId)
+ if err != nil {
+ i.logger.Error("failed to parse nursery ID", "error", err)
+ return nil, err
+ }
+
+ // 子供と保育園の間に親を介在させるためのクエリを修正
+ children, err := i.getChildList(ctx, func(tx *ent.Tx) (*ent.ChildQuery, error) {
+ // 子供のクエリを作成する際に、親を介した保育園の条件を追加
+ return tx.Child.Query().
+ Where(childRepo.HasGuardianWith(guardianRepo.HasNurseryWith(nurseryRepo.IDEQ(nurseryID)))).
+ WithGuardian(), nil
+ })
+
+ if err != nil {
+ i.logger.Error("failed to get children by nursery ID", "error", err)
+ return nil, err
+ }
+
+ // 子供の写真を取得
+ var photos []*pb.ChildPhoto
+ for _, child := range children {
+ // 子供の写真のメタデータを取得
+ childPhotoRecordList, err := i.entClient.ChildPhoto.Query().
+ Where(childPhotoRepo.HasChildWith(childRepo.IDEQ(uuid.MustParse(child.Id)))).All(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get child photo list", "error", err)
+ return nil, err
+ }
+
+ // 写真メタデータリストをループ
+ for _, photoMetadata := range childPhotoRecordList {
+ // GCSから写真を取得するためのIDを使用
+ photo_data, err := i.getPhotoFromGCS(ctx, nurseryID.String(), child.Id, photoMetadata.ID.String())
+ if err != nil {
+ i.logger.Error("failed to get photo from GCS", "error", err)
+ return nil, err
+ }
+
+ // 結果リストに追加
+ photos = append(photos, &pb.ChildPhoto{
+ ChildId: child.Id,
+ Id: photoMetadata.ID.String(), // 修正: GCSから取得した写真のIDではなく、メタデータのIDを使用
+ PhotoData: photo_data,
+ })
+ }
+ }
+
+ return &pb.GetChildListByNurseryIDResponse{
+ Children: children,
+ Photos: photos,
+ }, nil
+}
+
+func (i *Interactor) GetChildListByBusID(ctx context.Context, req *pb.GetChildListByBusIDRequest) (*pb.GetChildListByBusIDResponse, error) {
+ busID, err := uuid.Parse(req.BusId)
+ if err != nil {
+ i.logger.Error("failed to parse bus ID", "error", err)
+ return nil, err
+ }
+
+ children, err := i.getChildList(ctx, func(tx *ent.Tx) (*ent.ChildQuery, error) {
+ // Guardianの先のNurseryまで取得
+ return tx.Child.Query().
+ Where(
+ childRepo.HasChildBusAssociationsWith(
+ childBusAssociationRepo.HasBusRouteWith(
+ busRouteRepo.HasBusWith(
+ busRepo.IDEQ(busID),
+ ),
+ ),
+ ),
+ ).
+ WithGuardian(), nil
+ })
+
+ if err != nil {
+ i.logger.Error("failed to get children by bus ID", "error", err)
+ return nil, err
+ }
+
+ nursery := i.entClient.Nursery.Query().
+ Where(nurseryRepo.HasBusesWith(busRepo.ID(busID))).
+ OnlyX(ctx)
+
+ // 子供の写真を取得
+ var photos []*pb.ChildPhoto
+ for _, child := range children {
+ photoRecordList, err := i.entClient.ChildPhoto.Query().
+ Where(childPhotoRepo.HasChildWith(childRepo.IDEQ(uuid.MustParse(child.Id)))).All(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get child photo list", "error", err)
+ return nil, err
+ }
+
+ for _, photo := range photoRecordList {
+ photo_data, err := i.getPhotoFromGCS(ctx, nursery.ID.String(), child.Id, photo.ID.String())
+ if err != nil {
+ i.logger.Error("failed to get photo from GCS", "error", err)
+ return nil, err
+ }
+
+ photos = append(photos, &pb.ChildPhoto{
+ ChildId: child.Id,
+ Id: photo.ID.String(),
+ PhotoData: photo_data,
+ })
+ }
+ }
+
+ return &pb.GetChildListByBusIDResponse{
+ Children: children,
+ Photos: photos,
+ }, nil
+}
+
+func (i *Interactor) UpdateChild(ctx context.Context, req *pb.UpdateChildRequest) (*pb.UpdateChildResponse, error) {
+ // child_idのパース
+ childID, err := uuid.Parse(req.ChildId)
+ if err != nil {
+ i.logger.Error("failed to parse child ID", "error", err)
+ return nil, err
+ }
+
+ // トランザクションの開始
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ defer utils.RollbackTx(tx, i.logger)
+
+ // 更新処理のビルダー
+ update := tx.Child.Update().Where(child.IDEQ(childID))
+ for _, path := range req.UpdateMask.Paths {
+ switch path {
+ case "name":
+ update.SetName(req.Name)
+ case "age":
+ update.SetAge(int(req.Age))
+ case "sex":
+ sex, err := utils.ConvertPbSexToEntSex(req.Sex) // 仮に性別変換用の関数を想定
+ if err != nil {
+ i.logger.Error("failed to convert sex", "error", err)
+ return nil, err
+ }
+ update.SetSex(*sex)
+ case "check_for_missing_items":
+ update.SetCheckForMissingItems(req.CheckForMissingItems)
+ case "has_bag":
+ update.SetHasBag(req.HasBag)
+ case "has_lunch_box":
+ update.SetHasLunchBox(req.HasLunchBox)
+ case "has_water_bottle":
+ update.SetHasWaterBottle(req.HasWaterBottle)
+ case "has_umbrella":
+ update.SetHasUmbrella(req.HasUmbrella)
+ case "has_other":
+ update.SetHasOther(req.HasOther)
+ }
+ }
+
+ // 更新の実行
+ _, err = update.Save(ctx)
+ if err != nil {
+ i.logger.Error("failed to update child", "error", err)
+ return nil, err
+ }
+
+ // 更新されたエンティティの取得
+ updatedChild, err := tx.Child.Query().
+ Where(child.IDEQ(childID)).
+ WithGuardian().
+ Only(ctx)
+ if err != nil {
+ i.logger.Error("failed to retrieve updated child", "error", err)
+ return nil, err
+ }
+
+ // トランザクションのコミット
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ // レスポンスの生成と返却
+ return &pb.UpdateChildResponse{
+ Child: utils.ToPbChild(updatedChild), // 仮にエンティティをProtobufメッセージに変換する関数を想定
+ }, nil
+}
+
+// getChildList abstracts the common logic for fetching child lists.
+func (i *Interactor) getChildList(ctx context.Context, queryFunc func(*ent.Tx) (*ent.ChildQuery, error)) ([]*pb.Child, error) {
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ defer utils.RollbackTx(tx, i.logger)
+
+ query, err := queryFunc(tx)
+ if err != nil {
+ i.logger.Error("failed to create query", "error", err)
+ return nil, err
+ }
+
+ entChildren, err := query.All(ctx)
+ if err != nil {
+ i.logger.Error("failed to get children", "error", err)
+ return nil, err
+ }
+
+ pbChildren := make([]*pb.Child, len(entChildren))
+ for i, c := range entChildren {
+ pbChildren[i] = utils.ToPbChild(c)
+ }
+
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ return pbChildren, nil
+}
+
+func (i *Interactor) getPhotoFromGCS(ctx context.Context, nurseryID, childID, photoID string) ([]byte, error) {
+ // Cloud Storage上の写真のパスを生成
+ objectName := fmt.Sprintf("%s/%s/raw/%s.png", nurseryID, childID, photoID)
+
+ // 指定したバケット内のオブジェクトを取得
+ rc, err := i.StorageClient.Bucket(i.BucketName).Object(objectName).NewReader(ctx)
+ if err != nil {
+ return nil, err
+ }
+ defer rc.Close()
+
+ // バイトデータを読み込む
+ return io.ReadAll(rc)
+}
+
+// uploadPhotoToGCS は写真をGCPのCloud Storageにアップロードします。
+func (i *Interactor) uploadPhotoToGCS(ctx context.Context, nurseryID, childID, photoID string, photo []byte) error {
+ // Cloud Storage上の写真のパスを生成
+ objectName := fmt.Sprintf("%s/%s/raw/%s.png", nurseryID, childID, photoID)
+
+ // 指定したバケットにオブジェクトを作成
+ wc := i.StorageClient.Bucket(i.BucketName).Object(objectName).NewWriter(ctx)
+
+ // 写真のバイトデータを書き込む
+ if _, err := wc.Write(photo); err != nil {
+ i.logger.Error("failed to write photo to GCS", "error", err)
+ return err
+ }
+
+ // ライターを閉じて、アップロードを完了させる
+ if err := wc.Close(); err != nil {
+ i.logger.Error("failed to close writer", "error", err)
+ return err
+ }
+ return nil
+}
+
+// deletePhotoFromGCS は指定された写真IDに対応する写真をGCSから削除します。
+func (i *Interactor) deletePhotoFromGCS(ctx context.Context, nurseryID, childID, photoID string) error {
+ // Cloud Storage上の写真のパスを生成
+ objectName := fmt.Sprintf("%s/%s/raw/%s.png", nurseryID, childID, photoID)
+
+ // 指定したバケット内のオブジェクトを削除
+ o := i.StorageClient.Bucket(i.BucketName).Object(objectName)
+ if err := o.Delete(ctx); err != nil {
+ i.logger.Error("failed to delete photo from GCS", "error", err)
+ return err
+ }
+
+ return nil
+}
diff --git a/backend/usecases/guardian/guardian.go b/backend/usecases/guardian/guardian.go
new file mode 100644
index 00000000..6db57747
--- /dev/null
+++ b/backend/usecases/guardian/guardian.go
@@ -0,0 +1,313 @@
+package guardian
+
+import (
+ "golang.org/x/exp/slog"
+
+ "context"
+
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent"
+ busRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ childRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ guardianRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ nurseryRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/utils"
+ "github.com/google/uuid"
+)
+
+type Interactor struct {
+ entClient *ent.Client
+ logger *slog.Logger
+}
+
+func NewInteractor(entClient *ent.Client, logger *slog.Logger) *Interactor {
+ return &Interactor{entClient, logger}
+}
+
+func (i *Interactor) CreateGuardian(ctx context.Context, req *pb.CreateGuardianRequest) (*pb.CreateGuardianResponse, error) {
+ // パスワードをハッシュ化
+ hashedPassword, err := utils.HashPassword(req.Password)
+ if err != nil {
+ // エラーハンドリング
+ i.logger.Error("failed to hash password", "error", err)
+ return nil, err
+ }
+
+ // トランザクションを開始
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ defer utils.RollbackTx(tx, i.logger)
+ // req.nurseryCodeからnurseryを取得
+ nursery, err := tx.Nursery.Query().
+ Where(nurseryRepo.NurseryCode(req.NurseryCode)).
+ Only(ctx)
+ if err != nil {
+ i.logger.Error("failed to get nursery", "error", err)
+ return nil, err
+ }
+
+ // Guardianを作成
+ guardian, err := tx.Guardian.Create().
+ SetEmail(req.Email).
+ SetHashedPassword(string(hashedPassword)).
+ SetName(req.Name).
+ SetPhoneNumber(req.PhoneNumber).
+ SetNursery(nursery).
+ Save(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to create guardian", "error", err)
+ return nil, err
+ }
+
+ guardian, err = tx.Guardian.Query().
+ Where(guardianRepo.IDEQ(guardian.ID)).
+ WithNursery().
+ Only(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get guardian", "error", err)
+ return nil, err
+ }
+
+ // Stationを作成
+ _, err = tx.Station.Create().
+ SetGuardian(guardian).
+ Save(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to create station", "error", err)
+ return nil, err
+ }
+
+ // トランザクションをコミット
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ // レスポンスを返す
+ return &pb.CreateGuardianResponse{
+ Guardian: utils.ToPbGuardianResponse(guardian),
+ }, nil
+}
+
+func (i *Interactor) GuardianLogin(ctx context.Context, req *pb.GuardianLoginRequest) (*pb.GuardianLoginResponse, error) {
+ // トランザクションを開始
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ defer utils.RollbackTx(tx, i.logger)
+ // Guardianを取得
+ guardian, err := tx.Guardian.Query().
+ Where(guardianRepo.Email(req.Email)).
+ WithNursery().
+ Only(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get guardian", "error", err)
+ return nil, err
+ }
+
+ // フロントエンドから送られてきたパスワードとデータベースのハッシュ値を比較
+ if !utils.CheckPassword(guardian.HashedPassword, req.Password) {
+ i.logger.Error("password is incorrect")
+ return nil, err
+ }
+
+ // トランザクションをコミット
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ // レスポンスを返す
+ return &pb.GuardianLoginResponse{
+ Success: true,
+ Guardian: utils.ToPbGuardianResponse(guardian), // NurseryID を引数として渡す
+ Nursery: utils.ToPbNurseryResponse(guardian.Edges.Nursery),
+ }, nil
+}
+
+func (i *Interactor) GetGuardianListByBusID(ctx context.Context, req *pb.GetGuardianListByBusIdRequest) (*pb.GetGuardianListByBusIdResponse, error) {
+ busID, err := uuid.Parse(req.BusId)
+ if err != nil {
+ i.logger.Error("failed to parse bus ID", "error", err)
+ return nil, err
+ }
+ // トランザクションを開始
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ defer utils.RollbackTx(tx, i.logger)
+
+ // Guardianを取得
+ guardians, err := tx.Guardian.Query().
+ Where(guardianRepo.HasNurseryWith(nurseryRepo.HasBusesWith(busRepo.IDEQ(busID)))).
+ WithNursery().
+ All(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get guardians by bus ID", "error", err)
+ return nil, err
+ }
+
+ // トランザクションをコミット
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ var pbGuardians []*pb.GuardianResponse
+ for _, guardian := range guardians {
+ pbGuardians = append(pbGuardians, utils.ToPbGuardianResponse(guardian))
+ }
+
+ return &pb.GetGuardianListByBusIdResponse{Guardians: pbGuardians}, nil
+}
+
+func (i *Interactor) GetGuardianByChildID(ctx context.Context, req *pb.GetGuardianByChildIdRequest) (*pb.GetGuardianByChildIdResponse, error) {
+ childID, err := uuid.Parse(req.ChildId)
+ if err != nil {
+ i.logger.Error("failed to parse child ID", "error", err)
+ return nil, err
+ }
+ // トランザクションを開始
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ defer utils.RollbackTx(tx, i.logger)
+
+ // Guardianを取得
+ guardians, err := tx.Guardian.Query().
+ Where(guardianRepo.HasChildrenWith(childRepo.ID(childID))).
+ WithNursery().
+ Only(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get guardians by child ID", "error", err)
+ return nil, err
+ }
+
+ // トランザクションをコミット
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ pbGuardian := utils.ToPbGuardianResponse(guardians)
+ return &pb.GetGuardianByChildIdResponse{Guardian: pbGuardian}, nil
+}
+
+func (i *Interactor) GetGuardianListByNurseryID(ctx context.Context, req *pb.GetGuardianListByNurseryIdRequest) (*pb.GetGuardianListByNurseryIdResponse, error) {
+ nurseryID, err := uuid.Parse(req.NurseryId)
+ if err != nil {
+ i.logger.Error("failed to parse nursery ID", "error", err)
+ return nil, err
+ }
+
+ // トランザクションを開始
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+
+ defer utils.RollbackTx(tx, i.logger)
+
+ // Guardianを取得
+ guardians, err := tx.Guardian.Query().
+ Where(guardianRepo.HasNurseryWith(nurseryRepo.IDEQ(nurseryID))).
+ WithNursery().
+ All(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get guardians by nursery ID", "error", err)
+ return nil, err
+ }
+
+ // トランザクションをコミット
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ var pbGuardians []*pb.GuardianResponse
+ for _, guardian := range guardians {
+ pbGuardians = append(pbGuardians, utils.ToPbGuardianResponse(guardian))
+ }
+
+ return &pb.GetGuardianListByNurseryIdResponse{Guardians: pbGuardians}, nil
+}
+
+func (i *Interactor) UpdateGuardian(ctx context.Context, req *pb.UpdateGuardianRequest) (*pb.UpdateGuardianResponse, error) {
+ guardianID, err := uuid.Parse(req.GuardianId)
+ if err != nil {
+ i.logger.Error("failed to parse guardian ID", "error", err)
+ return nil, err
+ }
+
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ defer utils.RollbackTx(tx, i.logger)
+
+ // 更新処理のビルダー
+ update := tx.Guardian.UpdateOneID(guardianID)
+
+ // FieldMaskの解析とフィールドの更新
+ for _, path := range req.UpdateMask.Paths {
+ switch path {
+ case "name":
+ update.SetName(req.Name)
+ case "email":
+ update.SetEmail(req.Email)
+ case "phone_number":
+ update.SetPhoneNumber(req.PhoneNumber)
+ case "is_use_morning_bus":
+ update.SetIsUseMorningBus(req.IsUseMorningBus)
+ case "is_use_evening_bus":
+ update.SetIsUseEveningBus(req.IsUseEveningBus)
+ }
+ }
+
+ // 更新の実行
+ _, err = update.Save(ctx)
+ if err != nil {
+ i.logger.Error("failed to update guardian", "error", err)
+ return nil, err
+ }
+
+ // 更新されたエンティティの取得
+ guardian, err := tx.Guardian.Query().
+ Where(guardian.IDEQ(guardianID)).
+ WithNursery().
+ Only(ctx)
+ if err != nil {
+ i.logger.Error("failed to get guardian", "error", err)
+ return nil, err
+ }
+
+ // トランザクションのコミット
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ // レスポンスの生成と返却
+ return &pb.UpdateGuardianResponse{
+ Guardian: utils.ToPbGuardianResponse(guardian), // 仮にエンティティをProtobufメッセージに変換する関数を想定
+ }, nil
+}
diff --git a/backend/usecases/healthcheck/healthcheck.go b/backend/usecases/healthcheck/healthcheck.go
new file mode 100644
index 00000000..962d9f28
--- /dev/null
+++ b/backend/usecases/healthcheck/healthcheck.go
@@ -0,0 +1,17 @@
+package healthcheck
+
+import (
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+)
+
+type Interactor struct{}
+
+func NewInteractor() *Interactor {
+ return &Interactor{}
+}
+
+func (i *Interactor) Ping(req *pb.PingRequest) *pb.PingResponse {
+ return &pb.PingResponse{
+ Message: req.Name + " pong:)",
+ }
+}
diff --git a/backend/usecases/nursery/nursery.go b/backend/usecases/nursery/nursery.go
new file mode 100644
index 00000000..5de7c1dd
--- /dev/null
+++ b/backend/usecases/nursery/nursery.go
@@ -0,0 +1,219 @@
+package nursery
+
+import (
+ "fmt"
+ "math/rand"
+ "time"
+
+ "golang.org/x/exp/slog"
+
+ "context"
+
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ guardianRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ nurseryRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/nursery"
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/utils"
+ "github.com/google/uuid"
+)
+
+type Interactor struct {
+ entClient *ent.Client
+ logger *slog.Logger
+}
+
+func NewInteractor(entClient *ent.Client, logger *slog.Logger) *Interactor {
+ return &Interactor{entClient, logger}
+}
+
+func (i *Interactor) GetNurseryByGuardianID(ctx context.Context, req *pb.GetNurseryByGuardianIdRequest) (*pb.GetNurseryByGuardianIdResponse, error) {
+ // guardianIDをuuidに変換
+ guardianID, err := uuid.Parse(req.GuardianId)
+ if err != nil {
+ i.logger.Error("failed to parse uuid", "error", err)
+ return nil, err
+ }
+
+ // guardianIDに紐づくnurseryを取得
+ nurseries, err := i.entClient.Nursery.Query().
+ Where(nursery.HasGuardiansWith(guardianRepo.IDEQ(guardianID))).
+ Only(ctx)
+ if err != nil {
+ i.logger.Error("failed to get nurseries", "error", err)
+ return nil, err
+ }
+
+ return &pb.GetNurseryByGuardianIdResponse{
+ Nurseries: utils.ToPbNurseryResponse(nurseries),
+ }, nil
+}
+
+func (i *Interactor) CreateNursery(ctx context.Context, req *pb.CreateNurseryRequest) (*pb.CreateNurseryResponse, error) {
+ //パスワードをハッシュ化
+ hashedPassword, err := utils.HashPassword(req.Password)
+ if err != nil {
+ i.logger.Error("failed to hash password", "error", err)
+ return nil, err
+ }
+
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ defer utils.RollbackTx(tx, i.logger)
+
+ // nurseryコード(レコードに存在しない)
+ // 生成したコードが既存のコードと重複していないか確認
+ var code string
+ for {
+ code = generateCode()
+ _, err := tx.Nursery.Query().Where(nurseryRepo.NurseryCode(code)).Only(ctx)
+ if err != nil {
+ break
+ }
+ i.logger.Warn("code is already exists", "code", code)
+ }
+
+ //Nurseryを作成
+ nursery, err := tx.Nursery.Create().
+ SetName(req.Name).
+ SetEmail(req.Email).
+ SetHashedPassword(string(hashedPassword)).
+ SetNurseryCode(code).
+ SetPhoneNumber(req.PhoneNumber).
+ SetAddress(req.Address).
+ Save(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to create nursery", "error", err)
+ return nil, err
+ }
+
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ return &pb.CreateNurseryResponse{
+ Nursery: utils.ToPbNurseryResponse(nursery),
+ }, nil
+}
+
+func (i *Interactor) NurseryLogin(ctx context.Context, req *pb.NurseryLoginRequest) (*pb.NurseryLoginResponse, error) {
+ // トランザクションを開始
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ defer utils.RollbackTx(tx, i.logger)
+
+ // Nurseryを取得
+ nursery, err := tx.Nursery.Query().
+ Where(nurseryRepo.Email(req.Email)).
+ Only(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get nursery", "error", err)
+ return nil, err
+ }
+
+ // フロントエンドから送られてきたパスワードとデータベースのハッシュ値を比較
+ if !utils.CheckPassword(nursery.HashedPassword, req.Password) {
+ i.logger.Info("password is incorrect")
+ return nil, err
+ }
+
+ // トランザクションをコミット
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ return &pb.NurseryLoginResponse{
+ Success: true,
+ Nursery: utils.ToPbNurseryResponse(nursery),
+ }, nil
+}
+
+func (i *Interactor) UpdateNursery(ctx context.Context, req *pb.UpdateNurseryRequest) (*pb.UpdateNurseryResponse, error) {
+ // requestからnurseryIDを取得
+ nurseryID, err := uuid.Parse(req.Id)
+ if err != nil {
+ i.logger.Error("failed to parse uuid", "error", err)
+ return nil, err
+ }
+
+ // トランザクションを開始
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ defer utils.RollbackTx(tx, i.logger)
+
+ // 更新処理を行うためのビルダーを構築
+ update := tx.Nursery.Update().Where(nursery.IDEQ(nurseryID))
+ for _, path := range req.UpdateMask.Paths {
+ switch path {
+ case "name":
+ update.SetName(req.Name)
+ case "email":
+ update.SetEmail(req.Email)
+ case "phoneNumber":
+ update.SetPhoneNumber(req.PhoneNumber)
+ case "address":
+ update.SetAddress(req.Address)
+ case "password":
+ hashedPassword, err := utils.HashPassword(req.Password)
+ if err != nil {
+ i.logger.Error("failed to hash password", "error", err)
+ return nil, err
+ }
+ update.SetHashedPassword(hashedPassword)
+ }
+ }
+
+ // 更新の実行
+ _, err = update.Save(ctx)
+ if err != nil {
+ i.logger.Error("failed to update nursery", "error", err)
+ return nil, err
+ }
+
+ // 更新されたエンティティの取得
+ uodatedNursery, err := tx.Nursery.Query().
+ Where(nursery.IDEQ(nurseryID)).
+ Only(ctx)
+ if err != nil {
+ i.logger.Error("failed to get nursery", "error", err)
+ return nil, err
+ }
+
+ // トランザクションをコミット
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ // レスポンスの生成と返却
+ return &pb.UpdateNurseryResponse{
+ Nursery: utils.ToPbNurseryResponse(uodatedNursery),
+ }, nil
+}
+
+// コード生成
+func generateCode() string {
+ rnd := rand.New(rand.NewSource(time.Now().UnixNano()))
+
+ code := "" // 空の文字列でコードを初期化
+ for i := 0; i < 7; i++ { // 7桁のコードを生成
+ // `rand.Intn` の代わりに `rnd.Intn` を使用する
+ digit := rnd.Intn(10)
+ code += fmt.Sprintf("%d", digit) // 数字を文字列に変換してコードに追加
+ }
+
+ return code
+}
diff --git a/backend/usecases/station/station.go b/backend/usecases/station/station.go
new file mode 100644
index 00000000..e8dc88fa
--- /dev/null
+++ b/backend/usecases/station/station.go
@@ -0,0 +1,284 @@
+package station
+
+import (
+ "context"
+
+ "golang.org/x/exp/slog"
+
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent"
+ busRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ busRouteRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ busRouteAssociationRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busrouteassociation"
+ guardianRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/guardian"
+ stationRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/station"
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/usecases/utils"
+ "github.com/google/uuid"
+)
+
+type Interactor struct {
+ entClient *ent.Client
+ logger *slog.Logger
+}
+
+func NewInteractor(entClient *ent.Client, logger *slog.Logger) *Interactor {
+ return &Interactor{entClient, logger}
+}
+
+func (i *Interactor) UpdateStationLocationByGuardianID(ctx context.Context, req *pb.UpdateStationLocationByGuardianIdRequest) (*pb.UpdateStationLocationByGuardianIdResponse, error) {
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ defer utils.RollbackTx(tx, i.logger)
+
+ guardianID, err := uuid.Parse(req.GuardianId)
+ if err != nil {
+ i.logger.Error("failed to parse guardian ID", "error", err)
+ return nil, err
+ }
+
+ station, err := tx.Station.Query().
+ Where(stationRepo.HasGuardianWith(guardianRepo.ID(guardianID))).
+ Only(ctx)
+
+ if ent.IsNotFound(err) {
+ // エンティティが見つからない場合、新しく作成します。
+ station, err = tx.Station.Create().
+ SetGuardianID(guardianID).
+ SetLatitude(req.Latitude).
+ SetLongitude(req.Longitude).
+ Save(ctx)
+ if err != nil {
+ i.logger.Error("failed to create station", "error", err)
+ return nil, err
+ }
+ } else if err != nil {
+ i.logger.Error("failed to get station", "error", err)
+ return nil, err
+ } else {
+ // エンティティが見つかった場合、更新します。
+ station, err = station.Update().
+ SetLatitude(req.Latitude).
+ SetLongitude(req.Longitude).
+ Save(ctx)
+ if err != nil {
+ i.logger.Error("failed to update station", "error", err)
+ return nil, err
+ }
+ }
+ if err != nil {
+ i.logger.Error("failed to create or update station", "error", err)
+ return nil, err
+ }
+
+ // トランザクションをコミットします。
+ if err := tx.Commit(); err != nil {
+ i.logger.Error(("failed to commit transaction"), "error", err)
+ return nil, err
+ }
+
+ // レスポンスを作成します。
+ return &pb.UpdateStationLocationByGuardianIdResponse{
+ Station: utils.ToPbStation(station),
+ }, nil
+}
+
+func (i *Interactor) UpdateStation(ctx context.Context, req *pb.UpdateStationRequest) (*pb.UpdateStationResponse, error) {
+ // station_idのパース
+ stationID, err := uuid.Parse(req.Id)
+ if err != nil {
+ i.logger.Error("failed to parse station ID", "error", err)
+ return nil, err
+ }
+
+ // トランザクションの開始
+ tx, err := i.entClient.Tx(ctx)
+ if err != nil {
+ i.logger.Error("failed to start transaction", "error", err)
+ return nil, err
+ }
+ defer utils.RollbackTx(tx, i.logger)
+
+ // 更新処理のビルダー
+ update := tx.Station.Update().Where(stationRepo.IDEQ(stationID))
+ for _, path := range req.UpdateMask.Paths {
+ switch path {
+ case "latitude":
+ update = update.SetLatitude(req.Latitude)
+ case "longitude":
+ update = update.SetLongitude(req.Longitude)
+ }
+ }
+
+ // 更新の実行
+ _, err = update.Save(ctx)
+ if err != nil {
+ i.logger.Error("failed to update station", "error", err)
+ return nil, err
+ }
+
+ // 更新されたエンティティの取得
+ updateStation, err := tx.Station.Query().
+ Where(stationRepo.IDEQ(stationID)).
+ WithGuardian().
+ Only(ctx)
+ if err != nil {
+ i.logger.Error("failed to get updated station", "error", err)
+ return nil, err
+ }
+
+ if req.BusId != "" {
+ bus, err := tx.Bus.Query().
+ Where(busRepo.IDEQ(uuid.MustParse(req.BusId))).
+ Only(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get bus", "error", err)
+ return nil, err
+ }
+
+ _, err = utils.CheckAndFixBusStationCoordinates(*i.logger, ctx, bus)
+ if err != nil {
+ i.logger.Error("failed to check and fix bus station coordinates", "error", err)
+ return nil, err
+ }
+ }
+
+ // トランザクションのコミット
+ if err := tx.Commit(); err != nil {
+ i.logger.Error("failed to commit transaction", "error", err)
+ return nil, err
+ }
+
+ // レスポンスの作成と返却
+ return &pb.UpdateStationResponse{
+ Station: utils.ToPbStation(updateStation),
+ }, nil
+}
+
+func (i *Interactor) GetStationListByBusId(ctx context.Context, req *pb.GetStationListByBusIdRequest) (*pb.GetStationListByBusIdResponse, error) {
+ busID, err := uuid.Parse(req.BusId)
+ if err != nil {
+ i.logger.Error("failed to parse bus ID", "error", err)
+ return nil, err
+ }
+
+ stations, err := i.entClient.Station.Query().
+ Where( // !要チェック
+ stationRepo.HasBusRouteAssociationsWith(
+ busRouteAssociationRepo.HasBusRouteWith(
+ busRouteRepo.HasBusWith(
+ busRepo.IDEQ(busID),
+ ),
+ ),
+ ),
+ ).
+ WithGuardian(func(q *ent.GuardianQuery) {
+ q.WithNursery()
+ q.WithChildren(
+ func(q *ent.ChildQuery) {
+ q.WithGuardian()
+ },
+ )
+ }).
+ All(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get stations by bus ID", "error", err)
+ return nil, err
+ }
+
+ pbStations := make([]*pb.Station, 0, len(stations))
+ uniqueGuardians := make(map[string]*pb.GuardianResponse)
+ uniqueChildren := make(map[string]*pb.Child)
+
+ for _, station := range stations {
+ if err != nil {
+ // エラーメッセージにステーションIDを追加して明確にする
+ i.logger.Error("failed to get next station IDs", "error", err)
+ return nil, err
+ }
+
+ pbStation := utils.ToPbStation(station)
+ pbStations = append(pbStations, pbStation)
+
+ if station.Edges.Guardian != nil {
+ guardian := station.Edges.Guardian
+ if err != nil {
+ // 適切なエラーハンドリング
+ i.logger.Error("failed to get guardian", "error", err)
+ return nil, err
+ }
+ guardianID := guardian.ID.String()
+ pbGuardian := utils.ToPbGuardianResponse(guardian)
+ uniqueGuardians[guardianID] = pbGuardian
+
+ for _, child := range guardian.Edges.Children {
+ childID := child.ID.String()
+ pbChild := utils.ToPbChild(child)
+ uniqueChildren[childID] = pbChild
+ }
+ }
+ }
+
+ // マップからスライスへの変換
+ pbGuardians := make([]*pb.GuardianResponse, 0, len(uniqueGuardians))
+ for _, guardian := range uniqueGuardians {
+ pbGuardians = append(pbGuardians, guardian)
+ }
+
+ pbChildren := make([]*pb.Child, 0, len(uniqueChildren))
+ for _, child := range uniqueChildren {
+ pbChildren = append(pbChildren, child)
+ }
+
+ return &pb.GetStationListByBusIdResponse{
+ Stations: pbStations,
+ Guardians: pbGuardians,
+ Children: pbChildren,
+ }, nil
+}
+
+func (i Interactor) GetUnregisteredStationList(ctx context.Context, req *pb.GetUnregisteredStationListRequest) (*pb.GetUnregisteredStationListResponse, error) {
+ busID, err := uuid.Parse(req.BusId)
+ if err != nil {
+ i.logger.Error("failed to parse bus ID", "error", err)
+ return nil, err
+ }
+
+ stations, err := i.entClient.Station.Query(). // !要チェック
+ Where(
+ stationRepo.HasBusRouteAssociationsWith(
+ busRouteAssociationRepo.HasBusRouteWith(
+ busRouteRepo.HasBusWith(
+ busRepo.IDEQ(busID),
+ ),
+ ),
+ ),
+ ).
+ Where(stationRepo.Latitude(0)).
+ Where(stationRepo.Longitude(0)).
+ WithGuardian(func(q *ent.GuardianQuery) {
+ q.WithNursery()
+ }).
+ All(ctx)
+
+ if err != nil {
+ i.logger.Error("failed to get unregistered stations", "error", err)
+ return nil, err
+ }
+
+ var pbStations []*pb.Station
+ var pbGuardians []*pb.GuardianResponse
+ for _, station := range stations {
+ pbStations = append(pbStations, utils.ToPbStation(station))
+ pbGuardians = append(pbGuardians, utils.ToPbGuardianResponse(station.Edges.Guardian)) // !要チェック
+ }
+
+ return &pb.GetUnregisteredStationListResponse{
+ Stations: pbStations,
+ Guardians: pbGuardians,
+ }, nil
+}
diff --git a/backend/usecases/utils/utils.go b/backend/usecases/utils/utils.go
new file mode 100644
index 00000000..f2607745
--- /dev/null
+++ b/backend/usecases/utils/utils.go
@@ -0,0 +1,270 @@
+package utils
+
+import (
+ "context"
+ "database/sql"
+ "fmt"
+
+ "golang.org/x/exp/slog"
+
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/config"
+ pb "github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1"
+ "golang.org/x/crypto/bcrypt"
+ "google.golang.org/protobuf/types/known/timestamppb"
+
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent"
+ busRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/bus"
+ busRouteRepo "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/busroute"
+ "github.com/GreenTeaProgrammers/WhereChildBus/backend/domain/repository/ent/child"
+)
+
+func ToPbChild(t *ent.Child) *pb.Child {
+ sex := convertSexToPbSex(t.Sex)
+ return &pb.Child{
+ Id: t.ID.String(),
+ GuardianId: t.Edges.Guardian.ID.String(),
+ Name: t.Name,
+ Age: int32(t.Age),
+ Sex: sex,
+ CheckForMissingItems: t.CheckForMissingItems,
+ HasBag: t.HasBag,
+ HasLunchBox: t.HasLunchBox,
+ HasWaterBottle: t.HasWaterBottle,
+ HasUmbrella: t.HasUmbrella,
+ HasOther: t.HasOther,
+ CreatedAt: ×tamppb.Timestamp{Seconds: t.CreatedAt.Unix()},
+ UpdatedAt: ×tamppb.Timestamp{Seconds: t.UpdatedAt.Unix()},
+ }
+}
+
+func convertSexToPbSex(sex child.Sex) pb.Sex {
+ switch sex {
+ case child.SexMan:
+ return pb.Sex_SEX_MAN
+ case child.SexWoman:
+ return pb.Sex_SEX_WOMAN
+ case child.SexOther:
+ return pb.Sex_SEX_OTHER
+ default:
+ return pb.Sex_SEX_UNSPECIFIED
+ }
+}
+
+func ConvertPbStatusToEntStatus(pbStatus pb.BusStatus) (*busRepo.Status, error) {
+ switch pbStatus {
+ case pb.BusStatus_BUS_STATUS_RUNNING:
+ status := busRepo.StatusRunning
+ return &status, nil
+ case pb.BusStatus_BUS_STATUS_STOPPED:
+ status := busRepo.StatusStopped
+ return &status, nil
+ case pb.BusStatus_BUS_STATUS_MAINTENANCE:
+ status := busRepo.StatusMaintenance
+ return &status, nil
+ default:
+ // 不正な値の場合はエラーを返す
+ return nil, fmt.Errorf("invalid Status value: %v", pbStatus)
+ }
+}
+
+func ToPbBus(t *ent.Bus, nextStationID string) *pb.Bus {
+ busStatus := convertStatusToPbStatus(t.Status)
+ return &pb.Bus{
+ Id: t.ID.String(),
+ NurseryId: t.Edges.Nursery.ID.String(),
+ Name: t.Name,
+ PlateNumber: t.PlateNumber,
+ BusStatus: busStatus,
+ Latitude: t.Latitude,
+ Longitude: t.Longitude,
+ EnableFaceRecognition: t.EnableFaceRecognition,
+ NextStationId: nextStationID,
+ CreatedAt: ×tamppb.Timestamp{Seconds: t.CreatedAt.Unix()},
+ UpdatedAt: ×tamppb.Timestamp{Seconds: t.UpdatedAt.Unix()},
+ // ? 最新のバスルートも含める?
+ }
+}
+
+func ConvertPbSexToEntSex(pbSex pb.Sex) (*child.Sex, error) {
+ switch pbSex {
+ case pb.Sex_SEX_MAN:
+ sex := child.SexMan
+ return &sex, nil
+ case pb.Sex_SEX_WOMAN:
+ sex := child.SexWoman
+ return &sex, nil
+ case pb.Sex_SEX_OTHER:
+ sex := child.SexOther
+ return &sex, nil
+ default:
+ // 不正な値の場合はエラーを返す
+ return nil, fmt.Errorf("invalid Sex value: %v", pbSex)
+ }
+}
+
+func convertStatusToPbStatus(status busRepo.Status) pb.BusStatus {
+ switch status {
+ case busRepo.StatusRunning:
+ return pb.BusStatus_BUS_STATUS_RUNNING
+ case busRepo.StatusStopped:
+ return pb.BusStatus_BUS_STATUS_STOPPED
+ case busRepo.StatusMaintenance:
+ return pb.BusStatus_BUS_STATUS_MAINTENANCE
+ default:
+ return pb.BusStatus_BUS_STATUS_UNSPECIFIED
+ }
+}
+
+func ToPbGuardianResponse(t *ent.Guardian) *pb.GuardianResponse {
+ return &pb.GuardianResponse{
+ Id: t.ID.String(),
+ NurseryId: t.Edges.Nursery.ID.String(),
+ Email: t.Email,
+ PhoneNumber: t.PhoneNumber,
+ Name: t.Name,
+ IsUseMorningBus: t.IsUseMorningBus,
+ IsUseEveningBus: t.IsUseEveningBus,
+ CreatedAt: ×tamppb.Timestamp{Seconds: t.CreatedAt.Unix()},
+ UpdatedAt: ×tamppb.Timestamp{Seconds: t.UpdatedAt.Unix()},
+ }
+}
+
+func ToPbNurseryResponse(t *ent.Nursery) *pb.NurseryResponse {
+ return &pb.NurseryResponse{
+ Id: t.ID.String(),
+ NurseryCode: t.NurseryCode,
+ Name: t.Name,
+ Email: t.Email,
+ Address: t.Address,
+ PhoneNumber: t.PhoneNumber,
+ CreatedAt: ×tamppb.Timestamp{Seconds: t.CreatedAt.Unix()},
+ UpdatedAt: ×tamppb.Timestamp{Seconds: t.UpdatedAt.Unix()},
+ }
+}
+
+func ToPbStation(t *ent.Station) *pb.Station {
+ return &pb.Station{
+ Id: t.ID.String(),
+ GuardianId: t.Edges.Guardian.ID.String(),
+ Latitude: t.Latitude,
+ Longitude: t.Longitude,
+ CreatedAt: ×tamppb.Timestamp{Seconds: t.CreatedAt.Unix()},
+ UpdatedAt: ×tamppb.Timestamp{Seconds: t.UpdatedAt.Unix()},
+ }
+}
+
+func ToPbBusRoute(t *ent.BusRoute) *pb.BusRoute {
+ busType := ConvertBusTypeToPbBusType(t.BusType)
+ return &pb.BusRoute{
+ Id: t.ID.String(),
+ BusType: busType,
+ }
+}
+
+func ConvertBusTypeToPbBusType(busType busRouteRepo.BusType) pb.BusType {
+ switch busType {
+ case busRouteRepo.BusTypeMorning:
+ return pb.BusType_BUS_TYPE_MORNING
+ case busRouteRepo.BusTypeEvening:
+ return pb.BusType_BUS_TYPE_EVENING
+ default:
+ return pb.BusType_BUS_TYPE_UNSPECIFIED
+ }
+}
+
+func ConvertPbBusTypeToEntBusType(pbBusType pb.BusType) (*busRouteRepo.BusType, error) {
+ switch pbBusType {
+ case pb.BusType_BUS_TYPE_MORNING:
+ busType := busRouteRepo.BusTypeMorning
+ return &busType, nil
+ case pb.BusType_BUS_TYPE_EVENING:
+ busType := busRouteRepo.BusTypeEvening
+ return &busType, nil
+ default:
+ // 不正な値の場合はエラーを返す
+ return nil, fmt.Errorf("invalid BusType value: %v", pbBusType)
+ }
+}
+
+func HashPassword(password string) (string, error) {
+ // 環境変数からペッパーを取得
+ config, _ := config.New()
+ pepper := config.PasswordPepper
+
+ // パスワードにペッパーを追加
+ passwordWithPepper := password + pepper
+
+ // ハッシュ計算のコストを増やす(例: bcrypt.MinCost + 5)
+ cost := bcrypt.MinCost + 5
+ if cost > bcrypt.MaxCost {
+ cost = bcrypt.MaxCost
+ }
+
+ // ペッパーを追加したパスワードをハッシュ化
+ hashedPassword, err := bcrypt.GenerateFromPassword([]byte(passwordWithPepper), cost)
+ if err != nil {
+ return "", fmt.Errorf("failed to hash password: %w", err)
+ }
+ return string(hashedPassword), nil
+}
+
+// ハッシュ化されたパスワードと送られてきたパスワードを比較
+func CheckPassword(hashedPassword string, plainPassword string) bool {
+ config, _ := config.New()
+ pepper := config.PasswordPepper
+
+ //パスワードにペッパーを追加
+ passwordWithPepper := plainPassword + pepper
+
+ err := bcrypt.CompareHashAndPassword([]byte(hashedPassword), []byte(passwordWithPepper))
+ return err == nil
+}
+
+// RollbackTx はトランザクションのロールバックを試み、エラーがあればロギングします。
+func RollbackTx(tx *ent.Tx, logger *slog.Logger) {
+ // txがコミット済みの場合はロールバックしない
+ if tx == nil {
+ logger.Error("failed to rollback transaction", "error", "tx is nil")
+ return
+ }
+ if err := tx.Rollback(); err != nil {
+ if err != sql.ErrTxDone {
+ logger.Error("failed to rollback transaction", "error", err)
+ }
+ }
+}
+
+func CheckAndFixBusStationCoordinates(logger slog.Logger, ctx context.Context, bus *ent.Bus) (is_ready bool, err error) {
+ // バスのステーションを取得
+ stations, err := bus.QueryBusRoute().QueryBusRouteAssociations().QueryStation().All(ctx) // !要チェック
+ if err != nil {
+ logger.Error("failed to get stations", "error", err)
+ return false, err
+ }
+
+ // ステーションの座標を修正
+ for _, station := range stations {
+ // ステーションの座標が登録されていない場合は、バスのステータスをメンテナンスに設定
+ if station.Latitude == 0 || station.Longitude == 0 {
+ _, err := bus.Update().
+ SetStatus(busRepo.StatusMaintenance).
+ Save(ctx)
+ if err != nil {
+ logger.Error("failed to update bus status to maintenance due to missing station coordinates", "error", err)
+ return false, err
+ }
+ return false, nil
+ }
+
+ }
+ // Stationは正しく設定されているので、バスのステータスを訂正
+ if bus.Status == busRepo.StatusMaintenance {
+ print("バスのステータスを訂正します")
+ _, err := bus.Update().SetStatus(busRepo.StatusStopped).Save(ctx)
+ if err != nil {
+ logger.Error("failed to update bus", "error", err)
+ return false, err
+ }
+ }
+ return true, nil
+}
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 00000000..a0315191
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,8 @@
+# DocumentFor-WhereChildBus
+
+## コンテンツ一覧
+
+- 💻 [Get Started](get-started.md)
+- 🗄️ [ディレクトリ構成](directory-strategy.md)
+- 📝 [コミット戦略](commit-strategy.md)
+- 🌲 [ブランチ戦略](branch-strategy.md)
diff --git a/docs/branch-strategy.md b/docs/branch-strategy.md
new file mode 100644
index 00000000..e0b07d68
--- /dev/null
+++ b/docs/branch-strategy.md
@@ -0,0 +1,96 @@
+# ブランチ戦略ガイド
+
+このガイドでは、効率的で整理された開発フローを促進し、コードベースの安定性を保持するためにチームが従うべきブランチ戦略を定義します。
+
+## メインブランチ
+
+- **main**: 本番環境にデプロイ可能な状態を常に保ちます。変更はプルリクエストを通じてのみマージされます。
+
+## 開発ブランチ
+
+- **develop**: 新機能、バグ修正、リファクタリングなどの開発作業用の主要ブランチです。`main`から分岐し、開発が完了した機能はこのブランチにマージされます。
+
+## 機能ブランチ (`feature/(scope)/(feature-name)`)
+
+機能ブランチは、新しい機能の開発や既存機能の大幅な改善を行うために使用されます。これらのブランチは、特定の機能や目的に集中することで、開発プロセスをより管理しやすくすることを目的としています。
+
+#### 命名規則
+
+機能ブランチの名前は、`feature/`の接頭辞で始まり、その後にスコープと機能名を含めます。
+
+- **スコープ**: 機能の種類や関連する領域を示すために使用されます
+
+- `feature/frontend`
+- `feature/backend`
+- `feature/machine-learning`
+
+- **機能名**: ブランチが実装する機能の名前を含めます
+
+- `feature/backend/user-authentication`
+- `feature/frontend/payment-integration`
+- `feature/machine-learning/image-recognition`
+
+#### 開発フロー
+
+1. **分岐**: 新しい機能の開発を開始する際には、常に最新の`develop`ブランチから`feature/`ブランチを分岐させます。
+2. **開発**: 機能ブランチ内で必要な全ての開発作業を行います。これには、コーディング、単体テストの作成、ドキュメントの更新などが含まれます。
+3. **定期的な更新**: 開発中に`develop`ブランチが更新された場合は、変更を機能ブランチに取り込むために定期的にリベースするかマージします。これにより、最終的なマージプロセスを容易にし、衝突の可能性を減らします。
+4. **コードレビュー**: 機能が完成し、テストをパスしたら、プルリクエストを作成して`develop`ブランチにマージする前にチームメンバーのコードレビューを受けます。
+5. **マージ**: レビューが完了し、プルリクエストが承認されたら、機能ブランチを`develop`にマージします。マージ後、ブランチはクローズされ、必要に応じて削除されます。
+
+#### ベストプラクティス
+
+- **小さな単位でのコミット**: 機能ブランチ内の作業を小さな単位に分割し、各変更に対して明確なコミットメッセージを使用してコミットします。
+- **機能の単一性**: 一つの機能ブランチは一つの主要な機能に焦点を当てるべきです。複数の機能を同時に開発する場合は、それぞれに対して別々のブランチを使用します。
+- **透明性の維持**: プルリクエストやブランチの説明には、変更の目的や機能の概要、テストケース、特に注意が必要な点など、十分な情報を含めて他のチームメンバーとの透明性を確保します。
+
+機能ブランチ戦略を適切に使用することで、チームはより効率的に機能を開発し、プロジェクトの全体的な品質とコラボレーションを向上させることができます。
+
+## タイプ別ブランチ
+
+### CI ブランチ (`ci/`)
+
+- **目的**: CI (Continuous Integration) 設定ファイルやスクリプトへの変更。
+- **命名規則**: `ci/update-pipeline`, `ci/add-linting`
+- **マージ先**: `develop`
+
+### ドキュメントブランチ (`docs/`)
+
+- **目的**: ドキュメントの作成や更新。
+- **命名規則**: `docs/update-readme`, `docs/add-contributing-guide`
+- **マージ先**: `develop`
+
+### バグ修正ブランチ (`fix/`)
+
+- **目的**: バグの修正。
+- **命名規則**: `fix/login-error`, `fix/memory-leak`
+- **マージ先**: `develop`
+
+### リファクタリングブランチ (`refactor/`)
+
+- **目的**: コードの構造を改善するが、外部に見える挙動には影響を与えない。
+- **命名規則**: `refactor/cleanup-service`, `refactor/optimize-function`
+- **マージ先**: `develop`
+
+### スタイル調整ブランチ (`style/`)
+
+- **目的**: コードフォーマットやコーディング規約の遵守。
+- **命名規則**: `style/fix-indentation`, `style/apply-lint-rules`
+- **マージ先**: `develop`
+
+### テストブランチ (`test/`)
+
+- **目的**: 新しいテストの追加や既存テストの修正。
+- **命名規則**: `test/add-login-tests`, `test/fix-cart-tests`
+- **マージ先**: `develop`
+
+## マージ戦略
+
+- 全てのマージはプルリクエストを通じて行われ、コードレビューが必要です。
+- スクワッシュマージを使用して履歴を整理することが推奨されます。
+- 必要に応じて、`develop`や`main`からのリベースを使用してブランチを最新の状態に保ちます。
+
+## ブランチの維持
+
+- マージが完了したブランチは、その作業が`develop`または`main`に統合された後に削除することが推奨されます。
+- 定期的にブランチをレビューし、もはや使用されていない古いブランチをクリーンアップします。
diff --git a/docs/commit-strategy.md b/docs/commit-strategy.md
new file mode 100644
index 00000000..4b0a4ed8
--- /dev/null
+++ b/docs/commit-strategy.md
@@ -0,0 +1,48 @@
+# コミットメッセージの形式
+
+コミットメッセージは以下の形式に従うべきです:
+
+```
+<型>(任意 スコープ): <タイトル>
+
+[任意 本文]
+
+[任意 フッター]
+```
+
+- **型**: コミットの種類を表します。
+- **スコープ**: コミットが影響を与える範囲(オプション)。
+- **タイトル**: コミットの主な変更点を簡潔に説明します。
+- **本文**: 変更内容の詳細な説明(オプション)。
+- **フッター**: 関連する Issue や Merge Request の参照など、追加情報(オプション)。
+
+## コミットの型
+
+コミットメッセージで使用できる「型」は以下の通りです:
+
+- **build**: ビルドシステムや外部依存関係に影響を与える変更。
+- **ci**: CI(Continuous Integration)設定ファイルやスクリプトへの変更。
+- **chore**: 開発者の補助ツールやライブラリの更新など、補助的な変更。
+- **docs**: ドキュメントのみの変更。
+- **feat**: 新しい機能の追加。
+- **fix**: バグの修正。
+- **perf**: パフォーマンスを向上させるコード変更。
+- **refactor**: バグ修正や新機能追加を行わずに、既存コードの改善・整理。
+- **style**: コードの意味に影響を与えない変更(空白、フォーマット、セミコロンの欠落など)。
+- **test**: テストの追加や既存テストの修正。
+
+## ベストプラクティス
+
+- **タイトルは明確で簡潔に**: タイトル行は 50 文字以内で変更の要約を述べるべきです。
+- **本文で詳細を説明**: タイトルだけでは伝えきれない変更の動機やコンテキストを本文で説明してください。本文は 72 文字ごとに改行するのが一般的です。
+- **フッターで参照を追加**: 関連する Issue や Merge Request がある場合は、フッターにその参照を追加してください。
+
+## 実践例
+
+```
+feat[ログイン機能]: 二要素認証を追加
+
+ユーザーのセキュリティを向上させるため、ログインプロセスに二要素認証を追加しました。ユーザーは、パスワードに加えて、モバイルデバイスに送信されたコードを入力する必要があります。
+
+Closes #123
+```
diff --git a/docs/directory-strategy.md b/docs/directory-strategy.md
new file mode 100644
index 00000000..4f9ba683
--- /dev/null
+++ b/docs/directory-strategy.md
@@ -0,0 +1,23 @@
+# ディレクトリ戦略ガイド
+
+このガイドは、プロジェクトのルートディレクトリ内に存在する`frontend`と`backend`ディレクトリの構造と目的を定義します。適切なディレクトリ構造は、プロジェクトの可読性、拡張性、およびメンテナンスのしやすさを高めます。
+
+## ルートディレクトリ
+
+プロジェクトのルートディレクトリには、主に二つのディレクトリ、`frontend`と`backend`が含まれます。これにより、フロントエンドとバックエンドのコードが明確に分離され、開発の効率化と専門化が促進されます。
+
+### `frontend/`
+
+フロントエンドディレクトリは、ユーザーインターフェースとクライアントサイドのロジックを含むファイル群を格納します。このディレクトリ内では、さらに詳細なサブディレクトリ構造を定義して、ウィジェット、サービス、ユーティリティ、スタイルなどを整理します。
+
+### `backend/`
+
+バックエンドディレクトリは、サーバーサイドのロジック、データベースの操作、API エンドポイントなどを管理します。このディレクトリもまた、機能や役割に基づいてサブディレクトリに分けることが推奨されます。
+
+### `docs/`
+
+ディレクトリは、プロジェクトのドキュメントを格納するためのものです。これには、開発ガイド、コードリファレンス、API ドキュメント、貢献ガイドなどが含まれます。ドキュメントは、プロジェクトの透明性とコラボレーションを向上させるために重要な役割を果たします。
+
+## サブディレクトリ
+
+それぞれのディレクトリに docs/ディレクトリが用意されているので、それぞれのディレクトリの詳細についてはそちらを参照してください。
diff --git a/docs/get-started.md b/docs/get-started.md
new file mode 100644
index 00000000..9e540952
--- /dev/null
+++ b/docs/get-started.md
@@ -0,0 +1,17 @@
+# 💻 Get Started
+
+## 事前にインストールするソフトウェア
+
+**Comming soon...**
+
+## ソースコードのクローン
+
+以下のコマンドを入力して任意のディレクトリにレポジトリを clone してください。
+
+```
+$ git clone https://github.com/su-its/typing.git
+```
+
+## アプリケーションの立ち上げ
+
+**Comming soon...**
diff --git a/frontend/where_child_bus/.gitignore b/frontend/where_child_bus/.gitignore
new file mode 100644
index 00000000..290a0606
--- /dev/null
+++ b/frontend/where_child_bus/.gitignore
@@ -0,0 +1,148 @@
+# Created by https://www.toptal.com/developers/gitignore/api/flutter,visualstudiocode,macos,windows
+# Edit at https://www.toptal.com/developers/gitignore?templates=flutter,visualstudiocode,macos,windows
+
+### Flutter ###
+# Flutter/Dart/Pub related
+**/doc/api/
+.dart_tool/
+.flutter-plugins
+.flutter-plugins-dependencies
+.fvm/flutter_sdk
+.packages
+.pub-cache/
+.pub/
+build/
+coverage/
+lib/generated_plugin_registrant.dart
+.env
+# For library packages, don’t commit the pubspec.lock file.
+# Regenerating the pubspec.lock file lets you test your package against the latest compatible versions of its dependencies.
+# See https://dart.dev/guides/libraries/private-files#pubspeclock
+#pubspec.lock
+
+# Android related
+**/android/**/gradle-wrapper.jar
+**/android/.gradle
+**/android/captures/
+**/android/gradlew
+**/android/gradlew.bat
+**/android/key.properties
+**/android/local.properties
+**/android/**/GeneratedPluginRegistrant.java
+**/android/secret.properties
+
+# iOS/XCode related
+**/ios/**/*.mode1v3
+**/ios/**/*.mode2v3
+**/ios/**/*.moved-aside
+**/ios/**/*.pbxuser
+**/ios/**/*.perspectivev3
+**/ios/**/*sync/
+**/ios/**/.sconsign.dblite
+**/ios/**/.tags*
+**/ios/**/.vagrant/
+**/ios/**/DerivedData/
+**/ios/**/Icon?
+**/ios/**/Pods/
+**/ios/**/.symlinks/
+**/ios/**/profile
+**/ios/**/xcuserdata
+**/ios/.generated/
+**/ios/Flutter/.last_build_id
+**/ios/Flutter/App.framework
+**/ios/Flutter/Flutter.framework
+**/ios/Flutter/Flutter.podspec
+**/ios/Flutter/Generated.xcconfig
+**/ios/Flutter/app.flx
+**/ios/Flutter/app.zip
+**/ios/Flutter/flutter_assets/
+**/ios/Flutter/flutter_export_environment.sh
+**/ios/ServiceDefinitions.json
+**/ios/Runner/GeneratedPluginRegistrant.*
+
+# Exceptions to above rules.
+!**/ios/**/default.mode1v3
+!**/ios/**/default.mode2v3
+!**/ios/**/default.pbxuser
+!**/ios/**/default.perspectivev3
+!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
+
+### macOS ###
+# General
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+### macOS Patch ###
+# iCloud generated files
+*.icloud
+
+### VisualStudioCode ###
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+!.vscode/*.code-snippets
+
+# Local History for Visual Studio Code
+.history/
+
+# Built Visual Studio Code Extensions
+*.vsix
+
+### VisualStudioCode Patch ###
+# Ignore all local history of files
+.history
+.ionide
+
+### Windows ###
+# Windows thumbnail cache files
+Thumbs.db
+Thumbs.db:encryptable
+ehthumbs.db
+ehthumbs_vista.db
+
+# Dump file
+*.stackdump
+
+# Folder config file
+[Dd]esktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
+
+# End of https://www.toptal.com/developers/gitignore/api/flutter,visualstudiocode,macos,windows
\ No newline at end of file
diff --git a/frontend/where_child_bus/.idea/libraries/Dart_SDK.xml b/frontend/where_child_bus/.idea/libraries/Dart_SDK.xml
new file mode 100644
index 00000000..35ac1da9
--- /dev/null
+++ b/frontend/where_child_bus/.idea/libraries/Dart_SDK.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/where_child_bus/.idea/libraries/KotlinJavaRuntime.xml b/frontend/where_child_bus/.idea/libraries/KotlinJavaRuntime.xml
new file mode 100644
index 00000000..2b96ac4b
--- /dev/null
+++ b/frontend/where_child_bus/.idea/libraries/KotlinJavaRuntime.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/where_child_bus/.idea/modules.xml b/frontend/where_child_bus/.idea/modules.xml
new file mode 100644
index 00000000..bacc96bd
--- /dev/null
+++ b/frontend/where_child_bus/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/frontend/where_child_bus/.idea/runConfigurations/main_dart.xml b/frontend/where_child_bus/.idea/runConfigurations/main_dart.xml
new file mode 100644
index 00000000..aab7b5cd
--- /dev/null
+++ b/frontend/where_child_bus/.idea/runConfigurations/main_dart.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/where_child_bus/.idea/workspace.xml b/frontend/where_child_bus/.idea/workspace.xml
new file mode 100644
index 00000000..5b3388cc
--- /dev/null
+++ b/frontend/where_child_bus/.idea/workspace.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/where_child_bus/.metadata b/frontend/where_child_bus/.metadata
new file mode 100644
index 00000000..b5c370f3
--- /dev/null
+++ b/frontend/where_child_bus/.metadata
@@ -0,0 +1,45 @@
+# This file tracks properties of this Flutter project.
+# Used by Flutter tool to assess capabilities and perform upgrades etc.
+#
+# This file should be version controlled and should not be manually edited.
+
+version:
+ revision: "41456452f29d64e8deb623a3c927524bcf9f111b"
+ channel: "stable"
+
+project_type: app
+
+# Tracks metadata for the flutter migrate command
+migration:
+ platforms:
+ - platform: root
+ create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
+ base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
+ - platform: android
+ create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
+ base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
+ - platform: ios
+ create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
+ base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
+ - platform: linux
+ create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
+ base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
+ - platform: macos
+ create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
+ base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
+ - platform: web
+ create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
+ base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
+ - platform: windows
+ create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
+ base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
+
+ # User provided section
+
+ # List of Local paths (relative to this file) that should be
+ # ignored by the migrate tool.
+ #
+ # Files that are not part of the templates will be ignored by default.
+ unmanaged_files:
+ - 'lib/main.dart'
+ - 'ios/Runner.xcodeproj/project.pbxproj'
diff --git a/frontend/where_child_bus/README.md b/frontend/where_child_bus/README.md
new file mode 100644
index 00000000..b9edeb30
--- /dev/null
+++ b/frontend/where_child_bus/README.md
@@ -0,0 +1,16 @@
+# where_child_bus
+
+A new Flutter project.
+
+## Getting Started
+
+This project is a starting point for a Flutter application.
+
+A few resources to get you started if this is your first Flutter project:
+
+- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
+- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
+
+For help getting started with Flutter development, view the
+[online documentation](https://docs.flutter.dev/), which offers tutorials,
+samples, guidance on mobile development, and a full API reference.
diff --git a/frontend/where_child_bus/analysis_options.yaml b/frontend/where_child_bus/analysis_options.yaml
new file mode 100644
index 00000000..0bd999bf
--- /dev/null
+++ b/frontend/where_child_bus/analysis_options.yaml
@@ -0,0 +1,4 @@
+include: package:flutter_lints/flutter.yaml
+
+linter:
+ rules:
diff --git a/frontend/where_child_bus/android/.gitignore b/frontend/where_child_bus/android/.gitignore
new file mode 100644
index 00000000..6f568019
--- /dev/null
+++ b/frontend/where_child_bus/android/.gitignore
@@ -0,0 +1,13 @@
+gradle-wrapper.jar
+/.gradle
+/captures/
+/gradlew
+/gradlew.bat
+/local.properties
+GeneratedPluginRegistrant.java
+
+# Remember to never publicly share your keystore.
+# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
+key.properties
+**/*.keystore
+**/*.jks
diff --git a/frontend/where_child_bus/android/app/build.gradle b/frontend/where_child_bus/android/app/build.gradle
new file mode 100644
index 00000000..c9141e90
--- /dev/null
+++ b/frontend/where_child_bus/android/app/build.gradle
@@ -0,0 +1,76 @@
+plugins {
+ id "com.android.application"
+ id "kotlin-android"
+ id "dev.flutter.flutter-gradle-plugin"
+}
+
+def localProperties = new Properties()
+def localPropertiesFile = rootProject.file('local.properties')
+if (localPropertiesFile.exists()) {
+ localPropertiesFile.withReader('UTF-8') { reader ->
+ localProperties.load(reader)
+ }
+}
+
+def secretProperties = new Properties()
+def secretPropertiesFile = rootProject.file('secret.properties')
+if (secretPropertiesFile.exists()) {
+ secretPropertiesFile.withReader('UTF-8') { reader ->
+ secretProperties.load(reader)
+ }
+}
+
+def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
+if (flutterVersionCode == null) {
+ flutterVersionCode = '1'
+}
+
+def flutterVersionName = localProperties.getProperty('flutter.versionName')
+if (flutterVersionName == null) {
+ flutterVersionName = '1.0'
+}
+
+android {
+ namespace "com.example.where_child_bus"
+ compileSdkVersion flutter.compileSdkVersion
+ ndkVersion flutter.ndkVersion
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
+
+ sourceSets {
+ main.java.srcDirs += 'src/main/kotlin'
+ }
+
+ defaultConfig {
+ // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
+ applicationId "com.example.where_child_bus"
+ // You can update the following values to match your application needs.
+ // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
+ targetSdkVersion flutter.targetSdkVersion
+ versionCode flutterVersionCode.toInteger()
+ versionName flutterVersionName
+ minSdkVersion 21 //cameraパッケージの使用に必要
+ manifestPlaceholders = [googleMapApiKey: secretProperties.getProperty('googleMapApiKey'),]
+ }
+
+ buildTypes {
+ release {
+ // TODO: Add your own signing config for the release build.
+ // Signing with the debug keys for now, so `flutter run --release` works.
+ signingConfig signingConfigs.debug
+ }
+ }
+}
+
+flutter {
+ source '../..'
+}
+
+dependencies {}
diff --git a/frontend/where_child_bus/android/app/src/debug/AndroidManifest.xml b/frontend/where_child_bus/android/app/src/debug/AndroidManifest.xml
new file mode 100644
index 00000000..399f6981
--- /dev/null
+++ b/frontend/where_child_bus/android/app/src/debug/AndroidManifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/frontend/where_child_bus/android/app/src/main/AndroidManifest.xml b/frontend/where_child_bus/android/app/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..a43c6cbc
--- /dev/null
+++ b/frontend/where_child_bus/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/where_child_bus/android/app/src/main/kotlin/com/example/where_child_bus/MainActivity.kt b/frontend/where_child_bus/android/app/src/main/kotlin/com/example/where_child_bus/MainActivity.kt
new file mode 100644
index 00000000..02bb4025
--- /dev/null
+++ b/frontend/where_child_bus/android/app/src/main/kotlin/com/example/where_child_bus/MainActivity.kt
@@ -0,0 +1,6 @@
+package com.example.where_child_bus
+
+import io.flutter.embedding.android.FlutterActivity
+
+class MainActivity: FlutterActivity() {
+}
diff --git a/frontend/where_child_bus/android/app/src/main/res/drawable-v21/launch_background.xml b/frontend/where_child_bus/android/app/src/main/res/drawable-v21/launch_background.xml
new file mode 100644
index 00000000..f74085f3
--- /dev/null
+++ b/frontend/where_child_bus/android/app/src/main/res/drawable-v21/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/frontend/where_child_bus/android/app/src/main/res/drawable/launch_background.xml b/frontend/where_child_bus/android/app/src/main/res/drawable/launch_background.xml
new file mode 100644
index 00000000..304732f8
--- /dev/null
+++ b/frontend/where_child_bus/android/app/src/main/res/drawable/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/frontend/where_child_bus/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/frontend/where_child_bus/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 00000000..db77bb4b
Binary files /dev/null and b/frontend/where_child_bus/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/frontend/where_child_bus/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/frontend/where_child_bus/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 00000000..17987b79
Binary files /dev/null and b/frontend/where_child_bus/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/frontend/where_child_bus/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/frontend/where_child_bus/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 00000000..09d43914
Binary files /dev/null and b/frontend/where_child_bus/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/frontend/where_child_bus/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/frontend/where_child_bus/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 00000000..d5f1c8d3
Binary files /dev/null and b/frontend/where_child_bus/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/frontend/where_child_bus/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/frontend/where_child_bus/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 00000000..4d6372ee
Binary files /dev/null and b/frontend/where_child_bus/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/frontend/where_child_bus/android/app/src/main/res/values-night/styles.xml b/frontend/where_child_bus/android/app/src/main/res/values-night/styles.xml
new file mode 100644
index 00000000..06952be7
--- /dev/null
+++ b/frontend/where_child_bus/android/app/src/main/res/values-night/styles.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/frontend/where_child_bus/android/app/src/main/res/values/styles.xml b/frontend/where_child_bus/android/app/src/main/res/values/styles.xml
new file mode 100644
index 00000000..cb1ef880
--- /dev/null
+++ b/frontend/where_child_bus/android/app/src/main/res/values/styles.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/frontend/where_child_bus/android/app/src/profile/AndroidManifest.xml b/frontend/where_child_bus/android/app/src/profile/AndroidManifest.xml
new file mode 100644
index 00000000..399f6981
--- /dev/null
+++ b/frontend/where_child_bus/android/app/src/profile/AndroidManifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/frontend/where_child_bus/android/build.gradle b/frontend/where_child_bus/android/build.gradle
new file mode 100644
index 00000000..802640d0
--- /dev/null
+++ b/frontend/where_child_bus/android/build.gradle
@@ -0,0 +1,30 @@
+buildscript {
+ ext.kotlin_version = '1.9.22'
+ repositories {
+ google()
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+rootProject.buildDir = '../build'
+subprojects {
+ project.buildDir = "${rootProject.buildDir}/${project.name}"
+}
+subprojects {
+ project.evaluationDependsOn(':app')
+}
+
+tasks.register("clean", Delete) {
+ delete rootProject.buildDir
+}
diff --git a/frontend/where_child_bus/android/gradle.properties b/frontend/where_child_bus/android/gradle.properties
new file mode 100644
index 00000000..598d13fe
--- /dev/null
+++ b/frontend/where_child_bus/android/gradle.properties
@@ -0,0 +1,3 @@
+org.gradle.jvmargs=-Xmx4G
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/frontend/where_child_bus/android/gradle/wrapper/gradle-wrapper.properties b/frontend/where_child_bus/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..3c472b99
--- /dev/null
+++ b/frontend/where_child_bus/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
diff --git a/frontend/where_child_bus/android/settings.gradle b/frontend/where_child_bus/android/settings.gradle
new file mode 100644
index 00000000..7cd71285
--- /dev/null
+++ b/frontend/where_child_bus/android/settings.gradle
@@ -0,0 +1,29 @@
+pluginManagement {
+ def flutterSdkPath = {
+ def properties = new Properties()
+ file("local.properties").withInputStream { properties.load(it) }
+ def flutterSdkPath = properties.getProperty("flutter.sdk")
+ assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
+ return flutterSdkPath
+ }
+ settings.ext.flutterSdkPath = flutterSdkPath()
+
+ includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
+
+ repositories {
+ google()
+ mavenCentral()
+ gradlePluginPortal()
+ }
+
+ plugins {
+ id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
+ }
+}
+
+plugins {
+ id "dev.flutter.flutter-plugin-loader" version "1.0.0"
+ id "com.android.application" version "7.3.0" apply false
+}
+
+include ":app"
diff --git a/frontend/where_child_bus/android/where_child_bus_android.iml b/frontend/where_child_bus/android/where_child_bus_android.iml
new file mode 100644
index 00000000..18999696
--- /dev/null
+++ b/frontend/where_child_bus/android/where_child_bus_android.iml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/where_child_bus/assets/images/bus_maintenance.png b/frontend/where_child_bus/assets/images/bus_maintenance.png
new file mode 100644
index 00000000..47a89f5c
Binary files /dev/null and b/frontend/where_child_bus/assets/images/bus_maintenance.png differ
diff --git a/frontend/where_child_bus/assets/images/bus_not_operating.png b/frontend/where_child_bus/assets/images/bus_not_operating.png
new file mode 100644
index 00000000..8e9d4f49
Binary files /dev/null and b/frontend/where_child_bus/assets/images/bus_not_operating.png differ
diff --git a/frontend/where_child_bus/assets/images/bus_operating.png b/frontend/where_child_bus/assets/images/bus_operating.png
new file mode 100644
index 00000000..ee7ff44f
Binary files /dev/null and b/frontend/where_child_bus/assets/images/bus_operating.png differ
diff --git a/frontend/where_child_bus/assets/images/face_1.png b/frontend/where_child_bus/assets/images/face_1.png
new file mode 100644
index 00000000..4cfdbcae
Binary files /dev/null and b/frontend/where_child_bus/assets/images/face_1.png differ
diff --git a/frontend/where_child_bus/assets/images/face_2.png b/frontend/where_child_bus/assets/images/face_2.png
new file mode 100644
index 00000000..4cf7c337
Binary files /dev/null and b/frontend/where_child_bus/assets/images/face_2.png differ
diff --git a/frontend/where_child_bus/assets/sounds/bag.wav b/frontend/where_child_bus/assets/sounds/bag.wav
new file mode 100644
index 00000000..905d219f
Binary files /dev/null and b/frontend/where_child_bus/assets/sounds/bag.wav differ
diff --git a/frontend/where_child_bus/assets/sounds/lunchBox.wav b/frontend/where_child_bus/assets/sounds/lunchBox.wav
new file mode 100644
index 00000000..ac854d1a
Binary files /dev/null and b/frontend/where_child_bus/assets/sounds/lunchBox.wav differ
diff --git a/frontend/where_child_bus/assets/sounds/umbrella.wav b/frontend/where_child_bus/assets/sounds/umbrella.wav
new file mode 100644
index 00000000..ed73af0f
Binary files /dev/null and b/frontend/where_child_bus/assets/sounds/umbrella.wav differ
diff --git a/frontend/where_child_bus/assets/sounds/water_bottle.wav b/frontend/where_child_bus/assets/sounds/water_bottle.wav
new file mode 100644
index 00000000..e7c86a60
Binary files /dev/null and b/frontend/where_child_bus/assets/sounds/water_bottle.wav differ
diff --git a/frontend/where_child_bus/ios/.gitignore b/frontend/where_child_bus/ios/.gitignore
new file mode 100644
index 00000000..7a7f9873
--- /dev/null
+++ b/frontend/where_child_bus/ios/.gitignore
@@ -0,0 +1,34 @@
+**/dgph
+*.mode1v3
+*.mode2v3
+*.moved-aside
+*.pbxuser
+*.perspectivev3
+**/*sync/
+.sconsign.dblite
+.tags*
+**/.vagrant/
+**/DerivedData/
+Icon?
+**/Pods/
+**/.symlinks/
+profile
+xcuserdata
+**/.generated/
+Flutter/App.framework
+Flutter/Flutter.framework
+Flutter/Flutter.podspec
+Flutter/Generated.xcconfig
+Flutter/ephemeral/
+Flutter/app.flx
+Flutter/app.zip
+Flutter/flutter_assets/
+Flutter/flutter_export_environment.sh
+ServiceDefinitions.json
+Runner/GeneratedPluginRegistrant.*
+
+# Exceptions to above rules.
+!default.mode1v3
+!default.mode2v3
+!default.pbxuser
+!default.perspectivev3
diff --git a/frontend/where_child_bus/ios/Flutter/AppFrameworkInfo.plist b/frontend/where_child_bus/ios/Flutter/AppFrameworkInfo.plist
new file mode 100644
index 00000000..7c569640
--- /dev/null
+++ b/frontend/where_child_bus/ios/Flutter/AppFrameworkInfo.plist
@@ -0,0 +1,26 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+ App
+ CFBundleIdentifier
+ io.flutter.flutter.app
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ App
+ CFBundlePackageType
+ FMWK
+ CFBundleShortVersionString
+ 1.0
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ 1.0
+ MinimumOSVersion
+ 12.0
+
+
diff --git a/frontend/where_child_bus/ios/Flutter/Debug.xcconfig b/frontend/where_child_bus/ios/Flutter/Debug.xcconfig
new file mode 100644
index 00000000..592ceee8
--- /dev/null
+++ b/frontend/where_child_bus/ios/Flutter/Debug.xcconfig
@@ -0,0 +1 @@
+#include "Generated.xcconfig"
diff --git a/frontend/where_child_bus/ios/Flutter/Release.xcconfig b/frontend/where_child_bus/ios/Flutter/Release.xcconfig
new file mode 100644
index 00000000..592ceee8
--- /dev/null
+++ b/frontend/where_child_bus/ios/Flutter/Release.xcconfig
@@ -0,0 +1 @@
+#include "Generated.xcconfig"
diff --git a/frontend/where_child_bus/ios/Runner.xcodeproj/project.pbxproj b/frontend/where_child_bus/ios/Runner.xcodeproj/project.pbxproj
new file mode 100644
index 00000000..e332995e
--- /dev/null
+++ b/frontend/where_child_bus/ios/Runner.xcodeproj/project.pbxproj
@@ -0,0 +1,617 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 54;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
+ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
+ 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
+ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
+ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
+ 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
+ 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 97C146E61CF9000F007C117D /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 97C146ED1CF9000F007C117D;
+ remoteInfo = Runner;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
+ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
+ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
+ 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
+ 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
+ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
+ 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
+ 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
+ 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
+ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
+ 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
+ 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; };
+ 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 97C146EB1CF9000F007C117D /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 9740EEB11CF90186004384FC /* Flutter */ = {
+ isa = PBXGroup;
+ children = (
+ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
+ 9740EEB21CF90195004384FC /* Debug.xcconfig */,
+ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
+ 9740EEB31CF90195004384FC /* Generated.xcconfig */,
+ );
+ name = Flutter;
+ sourceTree = "";
+ };
+ 331C8082294A63A400263BE5 /* RunnerTests */ = {
+ isa = PBXGroup;
+ children = (
+ 331C807B294A618700263BE5 /* RunnerTests.swift */,
+ );
+ path = RunnerTests;
+ sourceTree = "";
+ };
+ 97C146E51CF9000F007C117D = {
+ isa = PBXGroup;
+ children = (
+ 9740EEB11CF90186004384FC /* Flutter */,
+ 97C146F01CF9000F007C117D /* Runner */,
+ 97C146EF1CF9000F007C117D /* Products */,
+ 331C8082294A63A400263BE5 /* RunnerTests */,
+ );
+ sourceTree = "";
+ };
+ 97C146EF1CF9000F007C117D /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 97C146EE1CF9000F007C117D /* Runner.app */,
+ 331C8081294A63A400263BE5 /* RunnerTests.xctest */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
+ 97C146F01CF9000F007C117D /* Runner */ = {
+ isa = PBXGroup;
+ children = (
+ 97C146FA1CF9000F007C117D /* Main.storyboard */,
+ 97C146FD1CF9000F007C117D /* Assets.xcassets */,
+ 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
+ 97C147021CF9000F007C117D /* Info.plist */,
+ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
+ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
+ 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
+ 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
+ );
+ path = Runner;
+ sourceTree = "";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 331C8080294A63A400263BE5 /* RunnerTests */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
+ buildPhases = (
+ 331C807D294A63A400263BE5 /* Sources */,
+ 331C807E294A63A400263BE5 /* Frameworks */,
+ 331C807F294A63A400263BE5 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 331C8086294A63A400263BE5 /* PBXTargetDependency */,
+ );
+ name = RunnerTests;
+ productName = RunnerTests;
+ productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */;
+ productType = "com.apple.product-type.bundle.unit-test";
+ };
+ 97C146ED1CF9000F007C117D /* Runner */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
+ buildPhases = (
+ 9740EEB61CF901F6004384FC /* Run Script */,
+ 97C146EA1CF9000F007C117D /* Sources */,
+ 97C146EB1CF9000F007C117D /* Frameworks */,
+ 97C146EC1CF9000F007C117D /* Resources */,
+ 9705A1C41CF9048500538489 /* Embed Frameworks */,
+ 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = Runner;
+ productName = Runner;
+ productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 97C146E61CF9000F007C117D /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ BuildIndependentTargetsInParallel = YES;
+ LastUpgradeCheck = 1430;
+ ORGANIZATIONNAME = "";
+ TargetAttributes = {
+ 331C8080294A63A400263BE5 = {
+ CreatedOnToolsVersion = 14.0;
+ TestTargetID = 97C146ED1CF9000F007C117D;
+ };
+ 97C146ED1CF9000F007C117D = {
+ CreatedOnToolsVersion = 7.3.1;
+ LastSwiftMigration = 1100;
+ };
+ };
+ };
+ buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
+ compatibilityVersion = "Xcode 9.3";
+ developmentRegion = en;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 97C146E51CF9000F007C117D;
+ productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 97C146ED1CF9000F007C117D /* Runner */,
+ 331C8080294A63A400263BE5 /* RunnerTests */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 331C807F294A63A400263BE5 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 97C146EC1CF9000F007C117D /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
+ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
+ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
+ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
+ isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
+ );
+ name = "Thin Binary";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
+ };
+ 9740EEB61CF901F6004384FC /* Run Script */ = {
+ isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Run Script";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 331C807D294A63A400263BE5 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 97C146EA1CF9000F007C117D /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
+ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 331C8086294A63A400263BE5 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 97C146ED1CF9000F007C117D /* Runner */;
+ targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+ 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 97C146FB1CF9000F007C117D /* Base */,
+ );
+ name = Main.storyboard;
+ sourceTree = "";
+ };
+ 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 97C147001CF9000F007C117D /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 249021D3217E4FDB00AE95B9 /* Profile */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ SUPPORTED_PLATFORMS = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Profile;
+ };
+ 249021D4217E4FDB00AE95B9 /* Profile */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ DEVELOPMENT_TEAM = Y43PZADGA4;
+ ENABLE_BITCODE = NO;
+ INFOPLIST_FILE = Runner/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.whereChildBus;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+ SWIFT_VERSION = 5.0;
+ VERSIONING_SYSTEM = "apple-generic";
+ };
+ name = Profile;
+ };
+ 331C8088294A63A400263BE5 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = AE0B7B92F70575B8D7E0D07E /* Pods-RunnerTests.debug.xcconfig */;
+ buildSettings = {
+ BUNDLE_LOADER = "$(TEST_HOST)";
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ GENERATE_INFOPLIST_FILE = YES;
+ MARKETING_VERSION = 1.0;
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.whereChildBus.RunnerTests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
+ };
+ name = Debug;
+ };
+ 331C8089294A63A400263BE5 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 89B67EB44CE7B6631473024E /* Pods-RunnerTests.release.xcconfig */;
+ buildSettings = {
+ BUNDLE_LOADER = "$(TEST_HOST)";
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ GENERATE_INFOPLIST_FILE = YES;
+ MARKETING_VERSION = 1.0;
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.whereChildBus.RunnerTests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_VERSION = 5.0;
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
+ };
+ name = Release;
+ };
+ 331C808A294A63A400263BE5 /* Profile */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 640959BDD8F10B91D80A66BE /* Pods-RunnerTests.profile.xcconfig */;
+ buildSettings = {
+ BUNDLE_LOADER = "$(TEST_HOST)";
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ GENERATE_INFOPLIST_FILE = YES;
+ MARKETING_VERSION = 1.0;
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.whereChildBus.RunnerTests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_VERSION = 5.0;
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
+ };
+ name = Profile;
+ };
+ 97C147031CF9000F007C117D /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 97C147041CF9000F007C117D /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ SUPPORTED_PLATFORMS = iphoneos;
+ SWIFT_COMPILATION_MODE = wholemodule;
+ SWIFT_OPTIMIZATION_LEVEL = "-O";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 97C147061CF9000F007C117D /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ DEVELOPMENT_TEAM = Y43PZADGA4;
+ ENABLE_BITCODE = NO;
+ INFOPLIST_FILE = Runner/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.whereChildBus;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
+ VERSIONING_SYSTEM = "apple-generic";
+ };
+ name = Debug;
+ };
+ 97C147071CF9000F007C117D /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ DEVELOPMENT_TEAM = Y43PZADGA4;
+ ENABLE_BITCODE = NO;
+ INFOPLIST_FILE = Runner/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.whereChildBus;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+ SWIFT_VERSION = 5.0;
+ VERSIONING_SYSTEM = "apple-generic";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 331C8088294A63A400263BE5 /* Debug */,
+ 331C8089294A63A400263BE5 /* Release */,
+ 331C808A294A63A400263BE5 /* Profile */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 97C147031CF9000F007C117D /* Debug */,
+ 97C147041CF9000F007C117D /* Release */,
+ 249021D3217E4FDB00AE95B9 /* Profile */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 97C147061CF9000F007C117D /* Debug */,
+ 97C147071CF9000F007C117D /* Release */,
+ 249021D4217E4FDB00AE95B9 /* Profile */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 97C146E61CF9000F007C117D /* Project object */;
+}
diff --git a/frontend/where_child_bus/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/frontend/where_child_bus/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 00000000..919434a6
--- /dev/null
+++ b/frontend/where_child_bus/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/frontend/where_child_bus/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/frontend/where_child_bus/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 00000000..18d98100
--- /dev/null
+++ b/frontend/where_child_bus/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/frontend/where_child_bus/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/frontend/where_child_bus/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
new file mode 100644
index 00000000..f9b0d7c5
--- /dev/null
+++ b/frontend/where_child_bus/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
@@ -0,0 +1,8 @@
+
+
+
+
+ PreviewsEnabled
+
+
+
diff --git a/frontend/where_child_bus/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/frontend/where_child_bus/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
new file mode 100644
index 00000000..87131a09
--- /dev/null
+++ b/frontend/where_child_bus/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/where_child_bus/ios/Runner.xcworkspace/contents.xcworkspacedata b/frontend/where_child_bus/ios/Runner.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 00000000..1d526a16
--- /dev/null
+++ b/frontend/where_child_bus/ios/Runner.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/frontend/where_child_bus/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/frontend/where_child_bus/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 00000000..18d98100
--- /dev/null
+++ b/frontend/where_child_bus/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/frontend/where_child_bus/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/frontend/where_child_bus/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
new file mode 100644
index 00000000..f9b0d7c5
--- /dev/null
+++ b/frontend/where_child_bus/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
@@ -0,0 +1,8 @@
+
+
+
+
+ PreviewsEnabled
+
+
+
diff --git a/frontend/where_child_bus/ios/Runner/AppDelegate.swift b/frontend/where_child_bus/ios/Runner/AppDelegate.swift
new file mode 100644
index 00000000..880498e6
--- /dev/null
+++ b/frontend/where_child_bus/ios/Runner/AppDelegate.swift
@@ -0,0 +1,17 @@
+import UIKit
+import Flutter
+import GoogleMaps
+import flutter_config
+
+@UIApplicationMain
+@objc class AppDelegate: FlutterAppDelegate {
+ override func application(
+ _ application: UIApplication,
+ didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
+ ) -> Bool {
+ GMSServices.provideAPIKey(FlutterConfigPlugin.env(for: "IOS_GOOGLE_MAP_API_KEY"))
+ // GMSServices.setMetalRendererEnabled(true)
+ GeneratedPluginRegistrant.register(with: self)
+ return super.application(application, didFinishLaunchingWithOptions: launchOptions)
+ }
+}
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 00000000..d36b1fab
--- /dev/null
+++ b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,122 @@
+{
+ "images" : [
+ {
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-20x20@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-20x20@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-29x29@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-29x29@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-29x29@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-40x40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-40x40@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-60x60@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-60x60@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-20x20@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-20x20@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-29x29@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-29x29@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-40x40@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-40x40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-76x76@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-76x76@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "83.5x83.5",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-83.5x83.5@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "1024x1024",
+ "idiom" : "ios-marketing",
+ "filename" : "Icon-App-1024x1024@1x.png",
+ "scale" : "1x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
new file mode 100644
index 00000000..dc9ada47
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
new file mode 100644
index 00000000..7353c41e
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
new file mode 100644
index 00000000..797d452e
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
new file mode 100644
index 00000000..6ed2d933
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
new file mode 100644
index 00000000..4cd7b009
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
new file mode 100644
index 00000000..fe730945
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
new file mode 100644
index 00000000..321773cd
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
new file mode 100644
index 00000000..797d452e
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
new file mode 100644
index 00000000..502f463a
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
new file mode 100644
index 00000000..0ec30343
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
new file mode 100644
index 00000000..0ec30343
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
new file mode 100644
index 00000000..e9f5fea2
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
new file mode 100644
index 00000000..84ac32ae
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
new file mode 100644
index 00000000..8953cba0
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
new file mode 100644
index 00000000..0467bf12
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/frontend/where_child_bus/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
new file mode 100644
index 00000000..0bedcf2f
--- /dev/null
+++ b/frontend/where_child_bus/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
@@ -0,0 +1,23 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchImage.png",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchImage@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchImage@3x.png",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
new file mode 100644
index 00000000..9da19eac
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
new file mode 100644
index 00000000..9da19eac
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/frontend/where_child_bus/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
new file mode 100644
index 00000000..9da19eac
Binary files /dev/null and b/frontend/where_child_bus/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ
diff --git a/frontend/where_child_bus/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/frontend/where_child_bus/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
new file mode 100644
index 00000000..89c2725b
--- /dev/null
+++ b/frontend/where_child_bus/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
@@ -0,0 +1,5 @@
+# Launch Screen Assets
+
+You can customize the launch screen with your own desired assets by replacing the image files in this directory.
+
+You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
\ No newline at end of file
diff --git a/frontend/where_child_bus/ios/Runner/Base.lproj/LaunchScreen.storyboard b/frontend/where_child_bus/ios/Runner/Base.lproj/LaunchScreen.storyboard
new file mode 100644
index 00000000..f2e259c7
--- /dev/null
+++ b/frontend/where_child_bus/ios/Runner/Base.lproj/LaunchScreen.storyboard
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/where_child_bus/ios/Runner/Base.lproj/Main.storyboard b/frontend/where_child_bus/ios/Runner/Base.lproj/Main.storyboard
new file mode 100644
index 00000000..f3c28516
--- /dev/null
+++ b/frontend/where_child_bus/ios/Runner/Base.lproj/Main.storyboard
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/where_child_bus/ios/Runner/Info.plist b/frontend/where_child_bus/ios/Runner/Info.plist
new file mode 100644
index 00000000..af24fcb3
--- /dev/null
+++ b/frontend/where_child_bus/ios/Runner/Info.plist
@@ -0,0 +1,70 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ $(DEVELOPMENT_LANGUAGE)
+
+
+ NSPhotoLibraryUsageDescription
+ Photo Library Access Warning
+ NSCameraUsageDescription
+ Camera Library Access Warning
+
+
+ CFBundleDisplayName
+ Where Child Bus
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ where_child_bus
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ $(FLUTTER_BUILD_NAME)
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ $(FLUTTER_BUILD_NUMBER)
+ LSRequiresIPhoneOS
+
+ UILaunchStoryboardName
+ LaunchScreen
+ UIMainStoryboardFile
+ Main
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ CADisableMinimumFrameDurationOnPhone
+
+ UIApplicationSupportsIndirectInputEvents
+
+
+ NSCameraUsageDescription
+ カメラを使う理由・用途を記述(ここをちゃんと書かないと、Appleのレビューでリジェクトされます)
+ NSMicrophoneUsageDescription
+ マイクを使う理由・用途を記述(ここをちゃんと書かないと、Appleのレビューでリジェクトされます)
+
+
+
+ NSLocationWhenInUseUsageDescription
+ This app needs access to location when open.
+ NSLocationAlwaysUsageDescription
+ This app needs access to location when in the background.
+
+
+
diff --git a/frontend/where_child_bus/ios/Runner/Runner-Bridging-Header.h b/frontend/where_child_bus/ios/Runner/Runner-Bridging-Header.h
new file mode 100644
index 00000000..308a2a56
--- /dev/null
+++ b/frontend/where_child_bus/ios/Runner/Runner-Bridging-Header.h
@@ -0,0 +1 @@
+#import "GeneratedPluginRegistrant.h"
diff --git a/frontend/where_child_bus/ios/RunnerTests/RunnerTests.swift b/frontend/where_child_bus/ios/RunnerTests/RunnerTests.swift
new file mode 100644
index 00000000..86a7c3b1
--- /dev/null
+++ b/frontend/where_child_bus/ios/RunnerTests/RunnerTests.swift
@@ -0,0 +1,12 @@
+import Flutter
+import UIKit
+import XCTest
+
+class RunnerTests: XCTestCase {
+
+ func testExample() {
+ // If you add code to the Runner application, consider adding tests here.
+ // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
+ }
+
+}
diff --git a/frontend/where_child_bus/lib/app.dart b/frontend/where_child_bus/lib/app.dart
new file mode 100644
index 00000000..adb472d9
--- /dev/null
+++ b/frontend/where_child_bus/lib/app.dart
@@ -0,0 +1,67 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/pages/auth_page/auth_page.dart';
+import 'package:where_child_bus/pages/bus_list_page/bus_list_page.dart';
+import 'package:where_child_bus/pages/camera_page/camera_bus_select_page.dart';
+import 'package:where_child_bus/pages/notification_page/notification_page.dart';
+import 'package:where_child_bus/pages/student_list_page/child_list_page.dart';
+
+class App extends StatefulWidget {
+ const App({
+ super.key,
+ });
+
+ @override
+ State createState() => _AppState();
+}
+
+class _AppState extends State {
+ int _selectedIndex = 0;
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ title: Text(['園児一覧', '送迎バスコース一覧', '連絡情報設定', 'カメラ'][_selectedIndex]),
+ actions: [
+ IconButton(
+ icon: const Icon(Icons.logout),
+ onPressed: () => {
+ Navigator.pushReplacement(
+ context,
+ MaterialPageRoute(
+ builder: (context) => const AuthPage()))
+ }),
+ ],
+ ),
+ body: [
+ const ChildListPage(),
+ const BusListPage(),
+ const NotificationPage(),
+ const BusSelectPage(),
+ ][_selectedIndex],
+ bottomNavigationBar: BottomNavigationBar(
+ type: BottomNavigationBarType.fixed,
+ currentIndex: _selectedIndex,
+ onTap: (int index) => setState(() => _selectedIndex = index),
+ items: const [
+ BottomNavigationBarItem(
+ icon: Icon(Icons.people),
+ label: '園児一覧',
+ ),
+ BottomNavigationBarItem(
+ icon: Icon(Icons.directions_bus),
+ label: '送迎バスコース一覧',
+ ),
+ BottomNavigationBarItem(
+ icon: Icon(Icons.notifications),
+ label: '連絡情報設定',
+ ),
+ BottomNavigationBarItem(
+ icon: Icon(Icons.camera),
+ label: 'カメラ',
+ ),
+ ],
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/components/child_list/child_list.dart b/frontend/where_child_bus/lib/components/child_list/child_list.dart
new file mode 100644
index 00000000..8824dfe0
--- /dev/null
+++ b/frontend/where_child_bus/lib/components/child_list/child_list.dart
@@ -0,0 +1,58 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/components/child_list/element/child_list_element.dart';
+import 'package:where_child_bus/pages/student_list_page/child_detail_sheet.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class ChildList extends StatefulWidget {
+ final List children;
+ final List images;
+ final VoidCallback? callback;
+
+ const ChildList({
+ Key? key,
+ required this.children,
+ required this.images,
+ this.callback,
+ }) : super(key: key);
+
+ @override
+ _ChildListState createState() => _ChildListState();
+}
+
+class _ChildListState extends State {
+ @override
+ Widget build(BuildContext context) {
+ return ListView.separated(
+ itemCount: widget.children.length,
+ separatorBuilder: (BuildContext context, int index) =>
+ const Divider(height: 20, color: Colors.transparent),
+ itemBuilder: (BuildContext context, int index) =>
+ _createChildListElements(context, index),
+ );
+ }
+
+ Widget _createChildListElements(BuildContext context, int index) {
+ return ChildListElement(
+ title: widget.children[index].name,
+ subtitle: "${widget.children[index].age.toString()}歳",
+ image: widget.images[index],
+ onTap: () {
+ if (widget.callback == null) {
+ childDetailModal(index);
+ } else {
+ widget.callback!();
+ }
+ });
+ }
+
+ Future childDetailModal(int index) async {
+ await showModalBottomSheet(
+ context: context,
+ builder: (BuildContext context) {
+ return StudentDetailSheet(
+ child: widget.children[index],
+ image: widget.images[index],
+ );
+ });
+ }
+}
diff --git a/frontend/where_child_bus/lib/components/child_list/child_list_with_button.dart b/frontend/where_child_bus/lib/components/child_list/child_list_with_button.dart
new file mode 100644
index 00000000..5c9fd418
--- /dev/null
+++ b/frontend/where_child_bus/lib/components/child_list/child_list_with_button.dart
@@ -0,0 +1,54 @@
+import "dart:developer" as developer;
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/components/child_list/element/child_list_element_with_button.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+enum ButtonIconType { add, remove }
+
+class ChildListWithButton extends StatefulWidget {
+ final List childNames;
+ final List groupNames;
+ final List images;
+ final List buttonIconTypes; // 各アイテムのボタンアイコンタイプ
+ final VoidCallback? callback;
+
+ ChildListWithButton({
+ Key? key,
+ required this.childNames,
+ required this.groupNames,
+ required this.images,
+ required this.buttonIconTypes, // コンストラクタでボタンアイコンタイプを受け取る
+ this.callback,
+ }) : super(key: key);
+
+ @override
+ _ChildListWithButtonState createState() => _ChildListWithButtonState();
+}
+
+class _ChildListWithButtonState extends State {
+ @override
+ Widget build(BuildContext context) {
+ return ListView.separated(
+ itemCount: widget.childNames.length,
+ separatorBuilder: (BuildContext context, int index) =>
+ const Divider(height: 20, color: Colors.transparent),
+ itemBuilder: (BuildContext context, int index) {
+ // ChildListElementWithButtonに必要な情報を渡す
+ return ChildListElementWithButton(
+ childName: widget.childNames[index],
+ groupName: widget.groupNames[index],
+ image: widget.images[index],
+ buttonIconType: widget.buttonIconTypes[index], // 各アイテムに対応するアイコンタイプ
+ onTap: () {
+ // ここでリストアイテムがタップされたときの動作を定義
+ developer.log("${widget.childNames[index]}がタップされました");
+ },
+ onButtonTap: () {
+ // ここでアイコンボタンがタップされたときの動作を定義
+ developer.log("${widget.childNames[index]}のボタンがタップされました");
+ },
+ );
+ },
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/components/child_list/child_list_with_mark.dart b/frontend/where_child_bus/lib/components/child_list/child_list_with_mark.dart
new file mode 100644
index 00000000..fabdf3d3
--- /dev/null
+++ b/frontend/where_child_bus/lib/components/child_list/child_list_with_mark.dart
@@ -0,0 +1,49 @@
+import "package:flutter/material.dart";
+import "package:where_child_bus/components/child_list/element/child_list_element_with_mark.dart";
+import "package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart";
+
+class ChildListWithMark extends StatefulWidget {
+ final List childNames;
+ final List isInBus;
+ final List groupNames;
+ final List images;
+ final VoidCallback? callback;
+
+ const ChildListWithMark({
+ Key? key,
+ required this.childNames,
+ required this.groupNames,
+ required this.isInBus,
+ required this.images,
+ this.callback,
+ }) : super(key: key);
+
+ @override
+ State createState() {
+ return _ChildListWithMarkState();
+ }
+}
+
+class _ChildListWithMarkState extends State {
+ @override
+ Widget build(BuildContext context) {
+ return ListView.separated(
+ itemCount: widget.childNames.length,
+ separatorBuilder: (BuildContext context, int index) =>
+ const Divider(height: 20, color: Colors.transparent),
+ itemBuilder: (BuildContext context, int index) =>
+ childListElement(context, index),
+ );
+ }
+
+ Widget childListElement(BuildContext context, int index) {
+ return ChildListElementWithMark(
+ title: widget.childNames[index],
+ subtitle: widget.groupNames[index],
+ image: widget.images[index],
+ isInBus: widget.isInBus[index],
+ onTap: () {
+ widget.callback!();
+ });
+ }
+}
diff --git a/frontend/where_child_bus/lib/components/child_list/element/child_list_element.dart b/frontend/where_child_bus/lib/components/child_list/element/child_list_element.dart
new file mode 100644
index 00000000..909dd8a9
--- /dev/null
+++ b/frontend/where_child_bus/lib/components/child_list/element/child_list_element.dart
@@ -0,0 +1,80 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/components/util/image_from_byte.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class ChildListElement extends StatelessWidget {
+ final String title;
+ final String subtitle;
+ final ChildPhoto image;
+ final VoidCallback? onTap;
+ final Widget? actionButton;
+
+ const ChildListElement({
+ Key? key,
+ required this.title,
+ required this.subtitle,
+ required this.image,
+ this.onTap,
+ this.actionButton,
+ }) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ return _listElementPadding(
+ Card(
+ elevation: 8,
+ clipBehavior: Clip.antiAliasWithSaveLayer,
+ child: Material(
+ color: Colors.white,
+ child: InkWell(
+ onTap: onTap,
+ child: Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: Row(
+ children: [
+ ImageFromBytes(
+ imageData: image.photoData, height: 100, width: 100),
+ const SizedBox(width: 16),
+ Expanded(
+ child: _createTitleAndSubTitle(title, subtitle),
+ ),
+ if (actionButton != null) actionButton!,
+ ],
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+
+ Column _createTitleAndSubTitle(String title, String subtitle) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ _createTitleText(title),
+ _createSubTitleText(subtitle),
+ ],
+ );
+ }
+
+ Text _createTitleText(String title) {
+ return Text(title,
+ style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold));
+ }
+
+ Widget _createSubTitleText(String subtitle) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(vertical: 8),
+ child: Text(subtitle),
+ );
+ }
+
+ Padding _listElementPadding(Widget child) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 20),
+ child: child,
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/components/child_list/element/child_list_element_with_button.dart b/frontend/where_child_bus/lib/components/child_list/element/child_list_element_with_button.dart
new file mode 100644
index 00000000..2f429f66
--- /dev/null
+++ b/frontend/where_child_bus/lib/components/child_list/element/child_list_element_with_button.dart
@@ -0,0 +1,83 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/components/child_list/child_list_with_button.dart';
+import 'package:where_child_bus/components/child_list/element/child_list_element.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class ChildListElementWithButton extends StatefulWidget {
+ final String childName;
+ final String groupName;
+ final ChildPhoto image;
+ final VoidCallback? onTap;
+ final VoidCallback? onButtonTap;
+ final ButtonIconType buttonIconType;
+
+ const ChildListElementWithButton({
+ Key? key,
+ required this.childName,
+ required this.groupName,
+ required this.image,
+ this.onTap,
+ this.onButtonTap,
+ this.buttonIconType = ButtonIconType.add, // デフォルト値を提供
+ }) : super(key: key);
+
+ @override
+ _ChildListElementWithButtonState createState() =>
+ _ChildListElementWithButtonState();
+}
+
+class _ChildListElementWithButtonState
+ extends State {
+ ButtonIconType? currentButtonType;
+
+ @override
+ void initState() {
+ super.initState();
+ currentButtonType = widget.buttonIconType; // 初期アイコンタイプを設定
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Padding(
+ padding: const EdgeInsets.all(10),
+ child: Stack(
+ children: [
+ ChildListElement(
+ title: widget.childName,
+ subtitle: widget.groupName,
+ image: widget.image,
+ onTap: widget.onTap,
+ ),
+ Positioned(
+ right: 25,
+ bottom: 2,
+ child: IconButton(
+ icon: Icon(
+ currentButtonType == ButtonIconType.add
+ ? Icons.add
+ : Icons.remove,
+ // アイコンの色を動的に変更
+ color: currentButtonType == ButtonIconType.add
+ ? Colors.green
+ : Colors.red,
+ size: 50.0, // アイコンサイズの指定もここで行う
+ ),
+ onPressed: () {
+ if (widget.onButtonTap != null) {
+ widget.onButtonTap!();
+ }
+ // アイコンタイプの切り替え
+ setState(() {
+ currentButtonType = currentButtonType == ButtonIconType.add
+ ? ButtonIconType.remove
+ : ButtonIconType.add;
+ });
+ },
+ // IconButton自体の色指定は不要になるため削除
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/components/child_list/element/child_list_element_with_mark.dart b/frontend/where_child_bus/lib/components/child_list/element/child_list_element_with_mark.dart
new file mode 100644
index 00000000..44693b5c
--- /dev/null
+++ b/frontend/where_child_bus/lib/components/child_list/element/child_list_element_with_mark.dart
@@ -0,0 +1,73 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/components/child_list/element/child_list_element.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class ChildListElementWithMark extends StatefulWidget {
+ final String title;
+ final String subtitle;
+ final ChildPhoto image;
+ final bool isInBus;
+ final VoidCallback? onTap;
+
+ const ChildListElementWithMark({
+ Key? key,
+ required this.title,
+ required this.subtitle,
+ required this.image,
+ required this.isInBus,
+ this.onTap,
+ }) : super(key: key);
+
+ @override
+ State createState() =>
+ _ChildListElementWithMarkState();
+}
+
+class _ChildListElementWithMarkState extends State {
+ @override
+ Widget build(BuildContext context) {
+ // ChildListElementを再利用して、actionButtonとしてmarkを渡す
+ return ChildListElement(
+ title: widget.title,
+ subtitle: widget.subtitle,
+ image: widget.image,
+ onTap: widget.onTap,
+ actionButton: Padding(
+ padding: const EdgeInsets.only(left: 16), // マークと他の要素との間隔を調整
+ child: widget.isInBus ? markRide() : markNotRide(),
+ ),
+ );
+ }
+
+ Widget markRide() {
+ return const SizedBox(
+ width: 100,
+ height: 100,
+ child: Card(
+ child: Center(
+ child: Icon(
+ Icons.circle,
+ size: 50,
+ color: Colors.green,
+ ),
+ ),
+ ),
+ );
+ }
+
+ Widget markNotRide() {
+ return const SizedBox(
+ width: 100,
+ height: 100,
+ child: Card(
+ child: Center(
+ child: Icon(
+ Icons.close,
+ size: 50,
+ color: Colors.red,
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/components/guardian_list/guardian_list.dart b/frontend/where_child_bus/lib/components/guardian_list/guardian_list.dart
new file mode 100644
index 00000000..05cb8876
--- /dev/null
+++ b/frontend/where_child_bus/lib/components/guardian_list/guardian_list.dart
@@ -0,0 +1,168 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/components/guardian_list/guardian_list_element/guardian_list_element.dart';
+import 'package:where_child_bus/components/guardian_list/guardian_list_element/selected_guardian_list_element.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class GuardianList extends StatefulWidget {
+ final VoidCallback? callback;
+
+ final List guardians;
+ final List selectedGuardians;
+
+ const GuardianList({
+ Key? key,
+ required this.guardians,
+ required this.selectedGuardians,
+ this.callback,
+ }) : super(key: key);
+
+ @override
+ _GuardiansListState createState() => _GuardiansListState();
+}
+
+class _GuardiansListState extends State {
+ @override
+ Widget build(BuildContext context) {
+ return body();
+ }
+
+ Widget body() {
+ return SingleChildScrollView(
+ child: Column(
+ children: [
+ SizedBox(
+ height: calculateAddedGuardiansHeight(),
+ child: ReorderableListView(
+ onReorder: (int oldIndex, int newIndex) =>
+ onReorder(oldIndex, newIndex),
+ shrinkWrap: true,
+ physics: const NeverScrollableScrollPhysics(),
+ children: widget.selectedGuardians.map((item) {
+ int index = widget.selectedGuardians.indexOf(item);
+ return SelectedGuardianListElement(
+ key: ValueKey(item),
+ title: item.name,
+ subtitle: "サブタイトル ${index + 1}",
+ order: index + 1,
+ onButtonPressed: () => removeGuardians(index),
+ );
+ }).toList(),
+ ),
+ ),
+ const SizedBox(height: 15),
+ for (int index = 0; index < widget.guardians.length; index++)
+ guardianListElement(context, index),
+ ],
+ ),
+ );
+ }
+
+ void onReorder(int oldIndex, int newIndex) {
+ setState(() {
+ if (newIndex > oldIndex) {
+ newIndex -= 1;
+ }
+ final item = widget.selectedGuardians.removeAt(oldIndex);
+ widget.selectedGuardians.insert(newIndex, item);
+ });
+ }
+
+ double calculateAddedGuardiansHeight() {
+ // 項目の高さ、項目間のスペース、その他のマージンなどを考慮して高さを計算
+ double itemHeight = 110.0;
+ int itemCount = widget.selectedGuardians.length;
+ return itemHeight * itemCount;
+ }
+
+ Widget addedGuardiansListViewContent() {
+ return ListView.builder(
+ itemCount: widget.selectedGuardians.length,
+ itemBuilder: (context, index) {
+ String item = widget.selectedGuardians[index].name;
+ // 追加された保護者リストの項目を構築
+ return SelectedGuardianListElement(
+ title: item,
+ subtitle: "サブタイトル",
+ order: index + 1,
+ onButtonPressed: () => removeGuardians(index),
+ );
+ },
+ );
+ }
+
+ Widget unSelectedGuardiansListView() {
+ return Expanded(
+ child: ListView.separated(
+ itemCount: widget.guardians.length,
+ separatorBuilder: (BuildContext context, int index) =>
+ const Divider(height: 20, color: Colors.transparent),
+ itemBuilder: (BuildContext context, int index) {
+ // orderIndexesに基づいて項目を表示
+ return guardianListElement(context, index);
+ },
+ ),
+ );
+ }
+
+ Widget addedGuardiansListView() {
+ double screenHeight = MediaQuery.of(context).size.height;
+ double maxHeight = screenHeight * 0.5;
+
+ double itemHeight = 110.0;
+ double actualHeight = widget.selectedGuardians.length * itemHeight;
+
+ double listViewHeight = actualHeight > maxHeight ? maxHeight : actualHeight;
+
+ return SizedBox(
+ height: listViewHeight, // ReorderableListViewの高さを100に設定
+ child: ReorderableListView(
+ onReorder: (int oldIndex, int newIndex) {
+ setState(() {
+ if (newIndex > oldIndex) {
+ newIndex -= 1;
+ }
+ final item = widget.selectedGuardians.removeAt(oldIndex);
+ widget.selectedGuardians.insert(newIndex, item);
+ });
+ },
+ children: widget.selectedGuardians.asMap().entries.map((entry) {
+ int index = entry.key;
+ String item = entry.value.name;
+ return SelectedGuardianListElement(
+ key: ValueKey(item), // 一意のキーを指定
+ title: item, // 保護者の名前
+ subtitle: "サブタイトル",
+ order: index + 1, // 順序番号(1から始まるように+1をしている)
+ onButtonPressed: () => removeGuardians(index),
+ );
+ }).toList(),
+ ),
+ );
+ }
+
+ Widget guardianListElement(BuildContext context, int index) {
+ return GuardianListElement(
+ title: widget.guardians[index].name,
+ subtitle: widget.guardians[index].phoneNumber,
+ onButtonPressed: () => addGuardians(index),
+ );
+ }
+
+ void addGuardians(int index) {
+ setState(() {
+ var selected = widget.guardians.removeAt(index);
+ widget.selectedGuardians.add(selected);
+ });
+ }
+
+ void removeGuardians(int index) {
+ setState(() {
+ // 追加された保護者リストから保護者を取得し削除
+ GuardianResponse removedGuardian =
+ widget.selectedGuardians.removeAt(index);
+
+ //戻すときは、先頭に配置
+ widget.guardians.insert(0, removedGuardian);
+ });
+ }
+}
diff --git a/frontend/where_child_bus/lib/components/guardian_list/guardian_list_element/guardian_list_element.dart b/frontend/where_child_bus/lib/components/guardian_list/guardian_list_element/guardian_list_element.dart
new file mode 100644
index 00000000..a1924fb2
--- /dev/null
+++ b/frontend/where_child_bus/lib/components/guardian_list/guardian_list_element/guardian_list_element.dart
@@ -0,0 +1,84 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/components/util/number_icon.dart';
+
+class GuardianListElement extends StatefulWidget {
+ final String title;
+ final String subtitle;
+ final VoidCallback? onButtonPressed;
+
+ const GuardianListElement({
+ Key? key,
+ required this.title,
+ required this.subtitle,
+ this.onButtonPressed,
+ }) : super(key: key);
+
+ @override
+ _GuardianListElementState createState() => _GuardianListElementState();
+}
+
+class _GuardianListElementState extends State {
+ @override
+ Widget build(BuildContext context) {
+ return listElementPadding(
+ Card(
+ elevation: 8,
+ clipBehavior: Clip.antiAliasWithSaveLayer,
+ child: Material(
+ color: Colors.white, // Cardの背景色
+ child: Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: Row(
+ children: [
+ titleAndSubTitle(widget.title, widget.subtitle),
+ addButton(),
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+
+ Widget addButton() {
+ return IconButton(
+ onPressed: widget.onButtonPressed,
+ icon: const Icon(Icons.add),
+ );
+ }
+
+ Widget orderIcon(int number) {
+ return NumberIcon(number: number);
+ }
+
+ Widget titleAndSubTitle(String title, String subtitle) {
+ return Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ titleText(title),
+ subTitleText(subtitle),
+ ],
+ ),
+ );
+ }
+
+ Text titleText(String title) {
+ return Text(
+ title,
+ style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
+ );
+ }
+
+ Text subTitleText(String subtitle) {
+ return Text(subtitle);
+ }
+
+ Padding listElementPadding(Widget child) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 20),
+ child: child,
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/components/guardian_list/guardian_list_element/selected_guardian_list_element.dart b/frontend/where_child_bus/lib/components/guardian_list/guardian_list_element/selected_guardian_list_element.dart
new file mode 100644
index 00000000..91cdc5c6
--- /dev/null
+++ b/frontend/where_child_bus/lib/components/guardian_list/guardian_list_element/selected_guardian_list_element.dart
@@ -0,0 +1,93 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/components/util/number_icon.dart';
+
+class SelectedGuardianListElement extends StatefulWidget {
+ final String title;
+ final String subtitle;
+ final int order; // 追加: リスト内の順序を表示するための順序番号
+ final VoidCallback? onButtonPressed;
+
+ const SelectedGuardianListElement({
+ Key? key,
+ required this.title,
+ required this.subtitle,
+ required this.order, // 順序番号を必須引数として追加
+ this.onButtonPressed,
+ }) : super(key: key);
+
+ @override
+ _SelectedGuardianListElementState createState() => _SelectedGuardianListElementState();
+}
+
+class _SelectedGuardianListElementState extends State {
+ @override
+ Widget build(BuildContext context) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
+ child: Card(
+ elevation: 8,
+ clipBehavior: Clip.antiAliasWithSaveLayer,
+ child: InkWell(
+ onTap: widget.onButtonPressed,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal:8.0, vertical: 16),
+ child: Row(
+ children: [
+ // 並び替え用のドラッグハンドルアイコンを追加
+ ReorderableDragStartListener(
+ index: widget.order - 1, // orderは1ベースなので、0ベースのindexに変換
+ child: const Padding(
+ padding: EdgeInsets.symmetric(horizontal: 8.0),
+ child: Icon(Icons.drag_handle),
+ ),
+ ),
+ NumberIcon(number: widget.order, color: Colors.indigo,), // 順序番号アイコン
+ const SizedBox(width: 16),
+ Expanded(child: titleAndSubTitle(widget.title, widget.subtitle)),
+ removeButton(),
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+
+ Widget removeButton() {
+ return IconButton(
+ onPressed: widget.onButtonPressed,
+ icon: const Icon(Icons.remove),
+ );
+ }
+
+ Widget titleAndSubTitle(String title, String subtitle) {
+ return Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ titleText(title),
+ subTitleText(subtitle),
+ ],
+ ),
+ );
+ }
+
+ Text titleText(String title) {
+ return Text(
+ title,
+ style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
+ );
+ }
+
+ Text subTitleText(String subtitle) {
+ return Text(subtitle);
+ }
+
+ Padding listElementPadding(Widget child) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 20),
+ child: child,
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/components/util/audio_manager.dart b/frontend/where_child_bus/lib/components/util/audio_manager.dart
new file mode 100644
index 00000000..953e0cda
--- /dev/null
+++ b/frontend/where_child_bus/lib/components/util/audio_manager.dart
@@ -0,0 +1,35 @@
+import 'package:audioplayers/audioplayers.dart';
+
+class AudioManager {
+ final AudioPlayer audioPlayer = AudioPlayer();
+ final List audioFiles; // 再生する音声ファイルのリスト
+ int _currentAudioIndex = 0; // 現在再生中の音声ファイルのインデックス
+
+ AudioManager({required this.audioFiles});
+
+ // 音声を順番に再生するメソッド
+ Future playSequentially() async {
+ if (audioFiles.isEmpty) return; // 再生する音声がない場合は何もしない
+
+ _currentAudioIndex = 0; // 最初の音声から再生を開始
+ await _playAudioFile(audioFiles[_currentAudioIndex]);
+ }
+
+ // 特定の音声ファイルを再生し、終了したら次の音声を再生するメソッド
+ Future _playAudioFile(String filePath) async {
+ await audioPlayer.setVolume(1);
+ await audioPlayer.play(AssetSource(filePath));
+
+ // 音声再生が完了したら次の音声を再生
+ audioPlayer.onPlayerComplete.listen((event) {
+ _currentAudioIndex++;
+ if (_currentAudioIndex < audioFiles.length) {
+ _playAudioFile(audioFiles[_currentAudioIndex]);
+ }
+ });
+ }
+
+ void dispose() {
+ audioPlayer.dispose();
+ }
+}
diff --git a/frontend/where_child_bus/lib/components/util/image_from_byte.dart b/frontend/where_child_bus/lib/components/util/image_from_byte.dart
new file mode 100644
index 00000000..98af072a
--- /dev/null
+++ b/frontend/where_child_bus/lib/components/util/image_from_byte.dart
@@ -0,0 +1,25 @@
+import 'package:flutter/material.dart';
+import 'dart:typed_data'; // Uint8Listを使用するために必要
+
+class ImageFromBytes extends StatelessWidget {
+ final List imageData;
+ final int height;
+ final int width;
+
+ const ImageFromBytes(
+ {Key? key,
+ required this.imageData,
+ required this.height,
+ required this.width})
+ : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ // int配列をUint8Listに変換
+ final Uint8List bytes = Uint8List.fromList(imageData);
+ return SizedBox(
+ height: height.toDouble(),
+ width: width.toDouble(),
+ child: Image.memory(bytes));
+ }
+}
diff --git a/frontend/where_child_bus/lib/components/util/input_value_label.dart b/frontend/where_child_bus/lib/components/util/input_value_label.dart
new file mode 100644
index 00000000..546803ca
--- /dev/null
+++ b/frontend/where_child_bus/lib/components/util/input_value_label.dart
@@ -0,0 +1,17 @@
+import 'package:flutter/material.dart';
+
+class InputValueLabel extends StatelessWidget {
+ final String label;
+
+ const InputValueLabel({required this.label, super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ return Padding(
+ padding: const EdgeInsets.only(top: 10, bottom: 4),
+ child: Text(
+ label,
+ style: const TextStyle(color: Colors.black, fontSize: 16),
+ ));
+ }
+}
diff --git a/frontend/where_child_bus/lib/components/util/number_icon.dart b/frontend/where_child_bus/lib/components/util/number_icon.dart
new file mode 100644
index 00000000..6fff330b
--- /dev/null
+++ b/frontend/where_child_bus/lib/components/util/number_icon.dart
@@ -0,0 +1,40 @@
+import 'package:flutter/material.dart';
+
+class NumberIcon extends StatelessWidget {
+ final int number; // 表示する数字
+ final Color color; // テキストの色
+ final double size; // テキストのサイズ
+
+ const NumberIcon({
+ Key? key,
+ required this.number,
+ this.color = Colors.blue, // デフォルトの色
+ this.size = 24.0, // デフォルトのサイズ
+ }) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ // 円形にするためにサイズを計算
+ double circleDiameter = size + 16; // sizeに基づいて適切な直径を計算
+
+ return Container(
+ width: circleDiameter, // 幅と高さを同じにして正方形に
+ height: circleDiameter,
+ decoration: BoxDecoration(
+ color: color.withOpacity(0.2), // 背景色
+ borderRadius: BorderRadius.circular(circleDiameter / 2), // 角を完全に丸くして円形に
+ ),
+ child: Center( // Textウィジェットを中央に配置
+ child: Text(
+ '$number',
+ style: TextStyle(
+ color: color,
+ fontSize: size,
+ fontWeight: FontWeight.bold,
+ ),
+ textAlign: TextAlign.center,
+ ),
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/components/util/select_value_box.dart b/frontend/where_child_bus/lib/components/util/select_value_box.dart
new file mode 100644
index 00000000..1f549bea
--- /dev/null
+++ b/frontend/where_child_bus/lib/components/util/select_value_box.dart
@@ -0,0 +1,34 @@
+import 'package:flutter/material.dart';
+
+class SelectValueBox extends StatefulWidget {
+ final List lists;
+ String? selectedValue;
+ Function? onChanged;
+
+ SelectValueBox(
+ {required this.lists, super.key, this.selectedValue, this.onChanged});
+ @override
+ State createState() => _SelectValueBox();
+}
+
+class _SelectValueBox extends State {
+ @override
+ Widget build(BuildContext context) {
+ return SizedBox(
+ width: MediaQuery.of(context).size.width * 0.8,
+ height: 50,
+ child: DropdownButton(
+ value: widget.selectedValue ?? widget.lists.first,
+ items: widget.lists
+ .map((String list) =>
+ DropdownMenuItem(value: list, child: Text(list)))
+ .toList(),
+ onChanged: (String? value) {
+ setState(() {
+ widget.selectedValue = value;
+ });
+ widget.onChanged?.call(value);
+ }),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/config/config.dart b/frontend/where_child_bus/lib/config/config.dart
new file mode 100644
index 00000000..b7f1b3cc
--- /dev/null
+++ b/frontend/where_child_bus/lib/config/config.dart
@@ -0,0 +1,28 @@
+import "dart:developer" as developer;
+import 'package:flutter_dotenv/flutter_dotenv.dart';
+
+class AppConfig {
+ static final AppConfig _instance = AppConfig._internal();
+
+ factory AppConfig() {
+ return _instance;
+ }
+
+ AppConfig._internal();
+
+ late String grpcEndpoint;
+ late int grpcPort;
+
+ Future loadConfig() async {
+ await dotenv.load();
+
+ try {
+ grpcEndpoint = dotenv.get("GRPC_ENDPOINT");
+ grpcPort = int.tryParse(dotenv.get("GRPC_PORT")) ?? 0;
+ } catch (e) {
+ developer.log("設定の読み込みにエラーが発生しました", error: e, name: "AppConfigError");
+ }
+ }
+}
+
+final appConfig = AppConfig();
diff --git a/frontend/where_child_bus/lib/main.dart b/frontend/where_child_bus/lib/main.dart
new file mode 100644
index 00000000..5ca4a209
--- /dev/null
+++ b/frontend/where_child_bus/lib/main.dart
@@ -0,0 +1,45 @@
+import "dart:developer" as developer;
+import 'package:camera/camera.dart';
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/config/config.dart';
+import 'package:where_child_bus/pages/auth_page/auth_page.dart';
+import 'package:where_child_bus/util/api/health_check.dart';
+
+List cameras = [];
+
+Future main() async {
+ WidgetsFlutterBinding.ensureInitialized();
+
+ try {
+ await appConfig.loadConfig();
+ await serviceHealthCheck();
+ } catch (e) {
+ developer.log("Failed to initialize the app", error: e, name: "main");
+ }
+
+ //カメラを取得
+ cameras = await availableCameras();
+
+ runApp(const MyApp());
+}
+
+class MyApp extends StatefulWidget {
+ const MyApp({super.key});
+
+ @override
+ State createState() => _MyAppState();
+}
+
+class _MyAppState extends State {
+ @override
+ Widget build(BuildContext context) {
+ return MaterialApp(
+ title: 'hoicruise',
+ theme: ThemeData(
+ colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
+ useMaterial3: true,
+ ),
+ home: const AuthPage(),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/models/bus_edit_page_type.dart b/frontend/where_child_bus/lib/models/bus_edit_page_type.dart
new file mode 100644
index 00000000..2ee8765e
--- /dev/null
+++ b/frontend/where_child_bus/lib/models/bus_edit_page_type.dart
@@ -0,0 +1,4 @@
+enum BusEditPageType {
+ create,
+ update,
+}
diff --git a/frontend/where_child_bus/lib/models/create_bus_error.dart b/frontend/where_child_bus/lib/models/create_bus_error.dart
new file mode 100644
index 00000000..c50e9143
--- /dev/null
+++ b/frontend/where_child_bus/lib/models/create_bus_error.dart
@@ -0,0 +1,6 @@
+enum CreateBusError {
+ fieldsNotFilled,
+ noGuardiansSelected,
+ networkError,
+ nameTooLong,
+}
diff --git a/frontend/where_child_bus/lib/models/create_nursery_error.dart b/frontend/where_child_bus/lib/models/create_nursery_error.dart
new file mode 100644
index 00000000..2c63a6e6
--- /dev/null
+++ b/frontend/where_child_bus/lib/models/create_nursery_error.dart
@@ -0,0 +1,8 @@
+enum CreateNurseryError {
+ unknown,
+ invalidEmail,
+ emailAlreadyExist,
+ networkError,
+ passwordsDoNotMatch,
+ fieldsDoNotFilled,
+}
diff --git a/frontend/where_child_bus/lib/models/nursery_bus_data.dart b/frontend/where_child_bus/lib/models/nursery_bus_data.dart
new file mode 100644
index 00000000..9e96719b
--- /dev/null
+++ b/frontend/where_child_bus/lib/models/nursery_bus_data.dart
@@ -0,0 +1,21 @@
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/bus.pb.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class NurseryBusData {
+ static final NurseryBusData _singleton = NurseryBusData._internal();
+ GetBusListByNurseryIdResponse? _busList;
+
+ NurseryBusData._internal();
+
+ factory NurseryBusData() {
+ return _singleton;
+ }
+
+ void setBusListResponse(GetBusListByNurseryIdResponse res) {
+ _busList = res;
+ }
+
+ List getBusList() {
+ return _busList?.buses ?? [];
+ }
+}
diff --git a/frontend/where_child_bus/lib/models/nursery_child_data.dart b/frontend/where_child_bus/lib/models/nursery_child_data.dart
new file mode 100644
index 00000000..2fffa338
--- /dev/null
+++ b/frontend/where_child_bus/lib/models/nursery_child_data.dart
@@ -0,0 +1,26 @@
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/child.pbgrpc.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class NurseryChildListData {
+ static final NurseryChildListData _singleton =
+ NurseryChildListData._internal();
+ GetChildListByNurseryIDResponse? _childList;
+
+ factory NurseryChildListData() {
+ return _singleton;
+ }
+
+ NurseryChildListData._internal();
+
+ void setChildListResponse(res) {
+ _childList = res;
+ }
+
+ List getChildList() {
+ return _childList?.children ?? [];
+ }
+
+ List getPhotos() {
+ return _childList?.photos ?? [];
+ }
+}
diff --git a/frontend/where_child_bus/lib/models/nursery_data.dart b/frontend/where_child_bus/lib/models/nursery_data.dart
new file mode 100644
index 00000000..1d56d12b
--- /dev/null
+++ b/frontend/where_child_bus/lib/models/nursery_data.dart
@@ -0,0 +1,20 @@
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class NurseryData {
+ static final NurseryData _singleton = NurseryData._internal();
+ late NurseryResponse _nursery;
+
+ factory NurseryData() {
+ return _singleton;
+ }
+
+ NurseryData._internal();
+
+ void setNursery(NurseryResponse nursery) {
+ _nursery = nursery;
+ }
+
+ NurseryResponse getNursery() {
+ return _nursery;
+ }
+}
diff --git a/frontend/where_child_bus/lib/models/nursery_guardian_data.dart b/frontend/where_child_bus/lib/models/nursery_guardian_data.dart
new file mode 100644
index 00000000..65990bc8
--- /dev/null
+++ b/frontend/where_child_bus/lib/models/nursery_guardian_data.dart
@@ -0,0 +1,34 @@
+import 'package:protobuf/protobuf.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/guardian.pbgrpc.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class NurseryGuardianData {
+ static final NurseryGuardianData _singleton = NurseryGuardianData._internal();
+ GetGuardianListByNurseryIdResponse? _guardianList;
+
+ factory NurseryGuardianData() {
+ return _singleton;
+ }
+
+ NurseryGuardianData._internal();
+
+ void setGuardianListResponse(GetGuardianListByNurseryIdResponse res) {
+ _guardianList = res;
+ }
+
+ // List getGuardianList() {
+ // return _guardianList?.guardians ?? [];
+ // }
+
+ List getGuardianList() {
+ // _guardianListのguardiansリストの各要素をクローンして新しいリストを作成
+ return _guardianList?.guardians
+ .map((guardian) => guardian.deepCopy())
+ .toList() ??
+ [];
+ }
+
+ void clearGuardianList() {
+ _guardianList = null;
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/auth_page/auth_page.dart b/frontend/where_child_bus/lib/pages/auth_page/auth_page.dart
new file mode 100644
index 00000000..a99f6c6e
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/auth_page/auth_page.dart
@@ -0,0 +1,169 @@
+import 'dart:developer' as developer;
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/app.dart';
+import 'package:where_child_bus/pages/register_page/register_page.dart';
+import 'package:where_child_bus/util/api/nursery_login.dart';
+import 'package:where_child_bus/models/nursery_data.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/nursery.pb.dart';
+
+import 'widget/register_button.dart';
+
+enum NurseryLoginError {
+ unknown,
+ invalidCredentials,
+ serverError,
+ networkError,
+ databaseError,
+ // 他のエラータイプをここに追加
+}
+
+class AuthPage extends StatefulWidget {
+ const AuthPage({super.key});
+
+ @override
+ State createState() => _AuthPageState();
+}
+
+class _AuthPageState extends State {
+ final _emailController = TextEditingController();
+ final _passwordController = TextEditingController();
+
+ NurseryLoginError? _loginError;
+
+ @override
+ Widget build(BuildContext context) {
+ return GestureDetector(
+ onTap: () => FocusScope.of(context).unfocus(),
+ child: Scaffold(
+ body: pageBody(),
+ ),
+ );
+ }
+
+ Widget pageBody() {
+ List columnChildren = [
+ titleText(),
+ mailInputField(),
+ passwordInputField(),
+ spacer32(),
+ if (_loginError != null &&
+ _loginError == NurseryLoginError.invalidCredentials)
+ emailOrPasswordNotFound(),
+ loginButton(),
+ RegisterButton(context: context),
+ ];
+
+ return Center(
+ child: Padding(
+ padding: const EdgeInsets.all(32),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: columnChildren,
+ ),
+ ),
+ );
+ }
+
+ Widget titleText() {
+ return const Padding(
+ padding: EdgeInsets.only(bottom: 32),
+ child: Text(
+ 'ほいくるーず',
+ style: TextStyle(fontSize: 32, fontWeight: FontWeight.bold),
+ ),
+ );
+ }
+
+ Widget mailInputField() {
+ return Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: TextField(
+ decoration: const InputDecoration(
+ border: OutlineInputBorder(),
+ labelText: 'メールアドレス',
+ ),
+ controller: _emailController,
+ keyboardType: TextInputType.emailAddress,
+ ),
+ );
+ }
+
+ Widget passwordInputField() {
+ return Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: TextField(
+ decoration: const InputDecoration(
+ border: OutlineInputBorder(),
+ labelText: 'パスワード',
+ ),
+ controller: _passwordController,
+ obscureText: true,
+ keyboardType: TextInputType.visiblePassword,
+ ),
+ );
+ }
+
+ Widget loginButton() {
+ return SizedBox(
+ width: MediaQuery.of(context).size.width * 0.6,
+ child: ElevatedButton(
+ onPressed: () => login(),
+ child: const Text('ログイン'),
+ ),
+ );
+ }
+
+ Widget emailOrPasswordNotFound() {
+ return const Padding(
+ padding: EdgeInsets.all(8.0),
+ child: Text(
+ "メールアドレスかパスワードが間違っています",
+ style: TextStyle(
+ color: Colors.red,
+ fontSize: 13,
+ ),
+ ),
+ );
+ }
+
+ login() async {
+ BuildContext currentContext = context;
+ NurseryLoginResponse res;
+ try {
+ if (kDebugMode) {
+ res = await nurseryLogin("paopao@example.com", "password");
+ } else {
+ res =
+ await nurseryLogin(_emailController.text, _passwordController.text);
+ }
+
+ if (res.success) {
+ developer.log("${res.success}");
+ developer.log(res.nursery.name);
+ NurseryData().setNursery(res.nursery);
+ Navigator.pushReplacement(
+ currentContext,
+ MaterialPageRoute(
+ builder: (BuildContext context) => App(),
+ ),
+ );
+ } else {
+ // ログイン失敗時の処理をここに記述
+ developer.log('Login failed');
+ }
+ } catch (e) {
+ if (mounted) {
+ setState(() {
+ _loginError = NurseryLoginError.invalidCredentials;
+ });
+ }
+ }
+ }
+
+ Widget spacer32() {
+ return const SizedBox(
+ height: 32,
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/auth_page/widget/register_button.dart b/frontend/where_child_bus/lib/pages/auth_page/widget/register_button.dart
new file mode 100644
index 00000000..228a743c
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/auth_page/widget/register_button.dart
@@ -0,0 +1,32 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/pages/register_page/register_page.dart';
+
+class RegisterButton extends StatelessWidget {
+ const RegisterButton({
+ super.key,
+ required this.context,
+ });
+
+ final BuildContext context;
+
+ @override
+ Widget build(BuildContext context) {
+ return Padding(
+ padding: const EdgeInsets.all(15),
+ child: SizedBox(
+ width: MediaQuery.of(context).size.width * 0.6,
+ child: ElevatedButton(
+ onPressed: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => const RegisterPage(),
+ ),
+ );
+ },
+ child: const Text('新規登録はこちら'),
+ ),
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/bottom_sheet.dart b/frontend/where_child_bus/lib/pages/bus_list_page/bottom_sheet.dart
new file mode 100644
index 00000000..97f00e84
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/bottom_sheet.dart
@@ -0,0 +1,209 @@
+import "dart:developer" as developer;
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/models/bus_edit_page_type.dart';
+import 'package:where_child_bus/pages/bus_list_page/bus_edit_page/bus_edit_page.dart';
+import 'package:where_child_bus/pages/bus_list_page/bus_edit_page/components/confirm_button.dart';
+import 'package:where_child_bus/pages/bus_list_page/bus_edit_page/components/guardians_list.dart';
+import 'package:where_child_bus/pages/bus_list_page/bus_edit_page/styles/styles.dart';
+import 'package:where_child_bus/pages/bus_list_page/bus_passenger_page/bus_passenger_page.dart';
+import 'package:where_child_bus/service/get_guardians_list_by_bus_id.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class BottomSheetWidget extends StatefulWidget {
+ final Bus bus;
+
+ const BottomSheetWidget({super.key, required this.bus});
+
+ @override
+ _BottomSheetWidgetState createState() => _BottomSheetWidgetState();
+}
+
+class _BottomSheetWidgetState extends State {
+ List guardians = [];
+ bool _isLoading = true;
+ bool _isFailLoading = false;
+
+ @override
+ void initState() {
+ super.initState();
+ _loadGuardians();
+ }
+
+ Future _loadGuardians() async {
+ try {
+ var res = await getGuardiansListByBusIdService(widget.bus.id);
+ if (mounted) {
+ setState(() {
+ guardians = res.guardians;
+ _isLoading = false;
+ });
+ }
+ } catch (e) {
+ if (kDebugMode) {
+ developer.log("保護者リストのロード中にエラーが発生しました: $e");
+ }
+ if (mounted) {
+ setState(() => {_isLoading = false, _isFailLoading = true});
+ }
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ height: double.infinity,
+ decoration: const BoxDecoration(
+ color: Colors.white,
+ borderRadius: BorderRadius.only(
+ topLeft: Radius.circular(10),
+ topRight: Radius.circular(10),
+ ),
+ ),
+ child: Stack(children: [
+ modalBody(context),
+ editButton(context),
+ ]),
+ );
+ }
+
+ Widget modalBody(BuildContext context) {
+ return Center(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ modalHeader(widget.bus.name, "test"),
+ _isFailLoading ? loadingFailText() : guardiansListView(),
+ ConfirmButton(
+ buttonText: "乗客情報",
+ onTap: () => moveToBusPassengerPage(context),
+ ),
+ ],
+ ));
+ }
+
+ Widget guardiansListView() {
+ return _isLoading
+ ? const Padding(
+ padding: EdgeInsets.all(20),
+ child: Center(
+ child: CircularProgressIndicator(),
+ ),
+ )
+ : GuardiansList(
+ guardiansList: guardians,
+ );
+ }
+
+ moveToBusPassengerPage(BuildContext context) {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => BusPassengerPage(bus: widget.bus)));
+ }
+
+ Widget editButton(BuildContext context) {
+ return Align(
+ alignment: const Alignment(1, -0.98),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 5),
+ child: ElevatedButton(
+ onPressed: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => BusEditPage(
+ bus: widget.bus,
+ busEditPageType: BusEditPageType.update,
+ )));
+ },
+ style: editButtonStyle(),
+ child: const Text("Edit",
+ style: TextStyle(
+ color: Colors.black,
+ fontSize: 15,
+ )),
+ ),
+ ),
+ );
+ }
+
+ Widget modalHeader(String busCourseName, String busOperatorName) {
+ return Padding(
+ padding: const EdgeInsets.fromLTRB(20, 50, 0, 10),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ busThumbnail(widget.bus.busStatus),
+ courseAndOperator(busCourseName, busOperatorName),
+ ],
+ ),
+ );
+ }
+
+ Widget courseAndOperator(String courseName, String operatorName) {
+ return Padding(
+ padding: const EdgeInsets.only(left: 20),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ courseNameText(courseName),
+ operatorNameText(operatorName),
+ ],
+ ),
+ );
+ }
+
+ Widget loadingFailText() {
+ return const Text(
+ "保護者リストの読み込みに失敗しました",
+ style: TextStyle(
+ color: Colors.red,
+ fontSize: 16,
+ ),
+ );
+ }
+
+ Widget courseNameText(String name) {
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 10),
+ child: Container(
+ width: MediaQuery.of(context).size.width - 150,
+ child: Text(
+ name,
+ overflow: TextOverflow.ellipsis,
+ style: const TextStyle(
+ fontSize: 30,
+ ),
+ ),
+ ),
+ );
+ }
+
+ Widget operatorNameText(String name) {
+ return Text("担当:$name",
+ style: const TextStyle(
+ color: Colors.grey,
+ ));
+ }
+
+ Widget busThumbnail(BusStatus busStatus) {
+ late String imagePath;
+ if (busStatus == BusStatus.BUS_STATUS_RUNNING) {
+ imagePath = "assets/images/bus_operating.png";
+ } else {
+ imagePath = "assets/images/bus_not_operating.png";
+ }
+
+ return SizedBox(
+ width: 100,
+ height: 100,
+ child: Padding(
+ padding: const EdgeInsets.all(12.0),
+ child: Image.asset(
+ imagePath,
+ fit: BoxFit.cover,
+ ),
+ ));
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/bus_child_manage_page/bus_guardian_manage_page.dart b/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/bus_child_manage_page/bus_guardian_manage_page.dart
new file mode 100644
index 00000000..d437ceb9
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/bus_child_manage_page/bus_guardian_manage_page.dart
@@ -0,0 +1,176 @@
+import "dart:developer" as developer;
+import "package:flutter/foundation.dart";
+import 'package:collection/collection.dart';
+import "package:flutter/material.dart";
+import "package:where_child_bus/components/guardian_list/guardian_list.dart";
+import "package:where_child_bus/models/nursery_data.dart";
+import "package:where_child_bus/models/nursery_guardian_data.dart";
+import "package:where_child_bus/pages/bus_list_page/bus_edit_page/components/confirm_button.dart";
+import "package:where_child_bus/service/get_guardian_list_by_nursery_id.dart";
+import "package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart";
+
+class BusGuardianManagePage extends StatefulWidget {
+ final Bus? bus;
+ final List? morningSelectedGuardiansId;
+ final List? eveningSelectedGuardiansId;
+
+ const BusGuardianManagePage(
+ {Key? key,
+ this.bus,
+ this.morningSelectedGuardiansId,
+ this.eveningSelectedGuardiansId})
+ : super(key: key);
+
+ @override
+ _BusGuardianManagePageState createState() => _BusGuardianManagePageState();
+}
+
+class _BusGuardianManagePageState extends State {
+ bool _isLoading = false;
+ bool _isFailLoading = false;
+ List morningGuardians = [];
+ List eveningGuardians = [];
+ List morningSelectedGuardians = [];
+ List eveningSelectedGuardians = [];
+
+ @override
+ void initState() {
+ super.initState();
+ _loadGuardians();
+ }
+
+ void _setSelectedGuardians() {
+ if (widget.morningSelectedGuardiansId != null) {
+ morningSelectedGuardians = widget.morningSelectedGuardiansId!
+ .map((id) => morningGuardians
+ .firstWhereOrNull((guardian) => guardian.id == id))
+ .where((element) => element != null)
+ .cast()
+ .toList();
+
+ morningGuardians.removeWhere((guardian) =>
+ widget.morningSelectedGuardiansId!.contains(guardian.id));
+ }
+
+ if (widget.eveningSelectedGuardiansId != null) {
+ eveningSelectedGuardians = widget.eveningSelectedGuardiansId!
+ .map((id) => eveningGuardians
+ .firstWhereOrNull((guardian) => guardian.id == id))
+ .where((element) => element != null)
+ .cast()
+ .toList();
+
+ eveningGuardians.removeWhere((guardian) =>
+ widget.eveningSelectedGuardiansId!.contains(guardian.id));
+ }
+ }
+
+ Future _loadGuardians() async {
+ _isLoading = true;
+
+ if (NurseryGuardianData().getGuardianList().isNotEmpty) {
+ if (mounted) {
+ setState(() {
+ morningGuardians = NurseryGuardianData().getGuardianList();
+ eveningGuardians = NurseryGuardianData().getGuardianList();
+ _setSelectedGuardians();
+ _isLoading = false;
+ });
+ }
+ return;
+ } else {
+ try {
+ var res = await getGuardianListByNurseryIdService(
+ NurseryData().getNursery().id);
+ NurseryGuardianData().setGuardianListResponse(res);
+ setState(() {
+ morningGuardians = NurseryGuardianData().getGuardianList();
+ eveningGuardians = NurseryGuardianData().getGuardianList();
+ _isLoading = false;
+ });
+ } catch (e) {
+ if (kDebugMode) {
+ developer.log("保護者リストのロード中にエラーが発生しました: $e");
+ }
+ setState(() => {
+ _setSelectedGuardians(),
+ _isLoading = false,
+ _isFailLoading = true
+ });
+ }
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return DefaultTabController(
+ length: 2,
+ child: Scaffold(
+ appBar: _createPageAppBar(),
+ body: _createPageBody(),
+ ),
+ );
+ }
+
+ AppBar _createPageAppBar() {
+ return AppBar(
+ bottom: const TabBar(
+ tabs: [
+ Tab(
+ text: "昼",
+ ),
+ Tab(
+ text: "夜",
+ ),
+ ],
+ ));
+ }
+
+ Widget _createPageBody() {
+ if (_isLoading) {
+ return const Center(
+ child: CircularProgressIndicator(),
+ );
+ } else if (_isFailLoading) {
+ return const Center(
+ child: Text("データの取得に失敗しました"),
+ );
+ } else {
+ return Column(
+ children: [
+ Expanded(
+ child: TabBarView(
+ children: [
+ _createMorningGuardianList(),
+ _createEveningGuardianList(),
+ ],
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.only(bottom: 8),
+ child: ConfirmButton(
+ buttonText: "保存",
+ onTap: () => {
+ Navigator.pop(context, {
+ "morning": morningSelectedGuardians,
+ "evening": eveningSelectedGuardians
+ }),
+ },
+ )),
+ ],
+ );
+ }
+ }
+
+ Widget _createMorningGuardianList() {
+ return GuardianList(
+ guardians: morningGuardians,
+ selectedGuardians: morningSelectedGuardians);
+ }
+
+ Widget _createEveningGuardianList() {
+ return GuardianList(
+ guardians: eveningGuardians,
+ selectedGuardians: eveningSelectedGuardians);
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/bus_edit_page.dart b/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/bus_edit_page.dart
new file mode 100644
index 00000000..57fddf00
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/bus_edit_page.dart
@@ -0,0 +1,328 @@
+import 'dart:io';
+import "dart:developer" as developer;
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:image_picker/image_picker.dart';
+import 'package:where_child_bus/models/bus_edit_page_type.dart';
+import 'package:where_child_bus/models/create_bus_error.dart';
+import 'package:where_child_bus/models/nursery_data.dart';
+import 'package:where_child_bus/pages/bus_list_page/bus_edit_page/bus_child_manage_page/bus_guardian_manage_page.dart';
+import 'package:where_child_bus/pages/bus_list_page/bus_edit_page/components/confirm_button.dart';
+import 'package:where_child_bus/pages/bus_list_page/bus_edit_page/components/input_element.dart';
+import 'package:where_child_bus/service/create_bus.dart';
+import 'package:where_child_bus/service/update_bus.dart';
+import 'package:where_child_bus/util/validation/create_bus_validation.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class BusEditPage extends StatefulWidget {
+ final Bus? bus;
+ final BusEditPageType busEditPageType;
+
+ const BusEditPage({super.key, this.bus, required this.busEditPageType});
+
+ @override
+ _BusEditPageState createState() => _BusEditPageState();
+}
+
+class _BusEditPageState extends State {
+ final ImagePicker _picker = ImagePicker();
+ final TextEditingController _busNameController = TextEditingController();
+ final TextEditingController _busNumberController = TextEditingController();
+ List morningSelectedGuardiansId = [];
+ List eveningSelectedGuardiansId = [];
+
+ String? _selectedImagePath;
+ bool _isPickingImage = false;
+ bool _isCreatingBus = false;
+ CreateBusError? _createBusError;
+
+ @override
+ void initState() {
+ super.initState();
+ if (widget.bus != null) {
+ setState(() {
+ _busNameController.text = widget.bus!.name;
+ _busNumberController.text = widget.bus!.plateNumber;
+ });
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return GestureDetector(
+ onTap: () => primaryFocus?.unfocus(),
+ child: Scaffold(appBar: AppBar(), body: pageBody(context)),
+ );
+ }
+
+ bool validation() {
+ if (CreateBusValidator.validateFields(
+ _busNameController.text, _busNumberController.text)) {
+ developer.log("バス名とナンバーを入力してください");
+ setState(() {
+ _createBusError = CreateBusError.fieldsNotFilled;
+ });
+ return true;
+ }
+ //Note 今のところ保護者が選択されていなくても作成できる
+ // } else if (CreateBusValidator.validateGuardians(
+ // morningSelectedGuardiansId, eveningSelectedGuardiansId)) {
+ // setState(() {
+ // _createBusError = CreateBusError.noGuardiansSelected;
+ // });
+ // return true;
+
+ //Todo 将来的に修正する
+ // } else if (CreateBusValidator.validateNameLength(_busNameController.text)) {
+ // setState(() {
+ // _createBusError = CreateBusError.nameTooLong;
+ // });
+ // return true;
+ // }
+
+ return false;
+ }
+
+ Future _updateBus() async {
+ // throw UnimplementedError();
+
+ if (validation()) {
+ return;
+ }
+
+ try {
+ if (mounted) {
+ setState(() {
+ _isCreatingBus = true;
+ });
+ }
+
+ var res = await updateBusService(
+ NurseryData().getNursery().id,
+ _busNameController.text,
+ _busNumberController.text,
+ morningSelectedGuardiansId,
+ eveningSelectedGuardiansId,
+ );
+ developer.log("バスの更新に成功しました $res", name: "BusUpdateButton");
+ Navigator.pop(context);
+ } catch (e) {
+ if (kDebugMode) {
+ developer.log("バスの更新中にエラーが発生しました",
+ error: e, name: "BusUpdateButtonError");
+ }
+ } finally {
+ if (mounted) {
+ setState(() {
+ _isCreatingBus = false;
+ });
+ }
+ }
+ }
+
+ Future _createBus() async {
+ if (validation()) {
+ return;
+ }
+
+ try {
+ if (mounted) {
+ setState(() {
+ _isCreatingBus = true;
+ });
+ }
+
+ var res = await createBusService(
+ NurseryData().getNursery().id,
+ _busNameController.text,
+ _busNumberController.text,
+ morningSelectedGuardiansId,
+ eveningSelectedGuardiansId,
+ );
+ developer.log("バスの作成に成功しました: $res", name: "BusEditPage");
+ Navigator.pop(context);
+ } catch (e) {
+ if (kDebugMode) {
+ developer.log("バスの作成中にエラーが発生しました: $e");
+ }
+ } finally {
+ if (mounted) {
+ setState(() {
+ _isCreatingBus = false;
+ });
+ }
+ }
+ }
+
+ Widget pageBody(BuildContext context) {
+ return Center(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ // inputFieldsAndThumbnail(context),
+ inputFields(),
+ manageChildrenButton(),
+ _createErrorMessage(),
+ _isCreatingBus
+ ? const Center(
+ child: CircularProgressIndicator(),
+ )
+ : ConfirmButton(
+ buttonText: "保存",
+ onTap: widget.busEditPageType == BusEditPageType.update
+ ? _updateBus
+ : _createBus,
+ ),
+ ],
+ ),
+ );
+ }
+
+ Widget _createErrorMessage() {
+ String errorMessage;
+ if (_createBusError == CreateBusError.fieldsNotFilled) {
+ errorMessage = "バス名とナンバーを入力してください";
+ } else if (_createBusError == CreateBusError.noGuardiansSelected) {
+ errorMessage = "保護者を選択してください";
+ } else if (_createBusError == CreateBusError.nameTooLong) {
+ errorMessage = "バス名は20文字以内で入力してください";
+ } else {
+ errorMessage = "";
+ }
+
+ if (_createBusError == null) {
+ return const SizedBox();
+ }
+
+ return Padding(
+ padding: const EdgeInsets.all(8),
+ child: Text(
+ errorMessage,
+ style: const TextStyle(color: Colors.red),
+ ),
+ );
+ }
+
+ Widget inputFieldsAndThumbnail(BuildContext context) {
+ return Padding(
+ padding: EdgeInsets.symmetric(
+ horizontal: MediaQuery.of(context).size.width * 0.08),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ busThumbnail(context),
+ inputFields(),
+ ],
+ ),
+ );
+ }
+
+ Widget inputFields() {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ InputElement(
+ inputFieldTitle: "バス名",
+ labelText: "バス名を入力してください",
+ hintText: "バス名を入力してください",
+ controller: _busNameController,
+ ),
+ InputElement(
+ inputFieldTitle: "ナンバー",
+ labelText: "ナンバーを入力してください",
+ hintText: "ナンバーを入力してください",
+ controller: _busNumberController,
+ ),
+ ],
+ );
+ }
+
+ Widget busThumbnail(BuildContext context) {
+ return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ const Padding(
+ padding: EdgeInsets.all(8),
+ child: Text("サムネイル"),
+ ),
+ GestureDetector(
+ onTap: () => pickImage(),
+ child: _selectedImagePath != null
+ ? SizedBox(
+ width: MediaQuery.of(context).size.width * 0.3,
+ height: MediaQuery.of(context).size.width * 0.3,
+ child: Image.file(File(_selectedImagePath!)),
+ )
+ : Center(
+ child: unselectedImageButton(),
+ ),
+ ),
+ ]);
+ }
+
+ Widget unselectedImageButton() {
+ return ElevatedButton(
+ onPressed: () => pickImage(),
+ child: const Text(
+ "画像が選択されていません",
+ ),
+ );
+ }
+
+ Widget manageChildrenButton() {
+ return Center(
+ child: Padding(
+ padding: const EdgeInsets.all(10),
+ child: ElevatedButton(
+ onPressed: () async {
+ var res = await Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => BusGuardianManagePage(
+ morningSelectedGuardiansId:
+ morningSelectedGuardiansId,
+ eveningSelectedGuardiansId:
+ eveningSelectedGuardiansId,
+ )));
+ if (res != null && res is Map>) {
+ developer.log("${res["morning"]}");
+ morningSelectedGuardiansId =
+ res["morning"]?.map((e) => e.id).toList() ?? [];
+ eveningSelectedGuardiansId =
+ res["evening"]?.map((e) => e.id).toList() ?? [];
+ }
+ },
+ child: const Text("バスを利用する保護者を変更"),
+ ),
+ ),
+ );
+ }
+
+ Future pickImage() async {
+ if (_isPickingImage) {
+ // 画像選択が既に進行中なので、新たに画像選択を開始しない
+ return;
+ }
+
+ setState(() {
+ _isPickingImage = true;
+ });
+
+ try {
+ final XFile? image = await _picker.pickImage(source: ImageSource.gallery);
+
+ if (image != null) {
+ setState(() {
+ _selectedImagePath = image.path;
+ });
+ } else {
+ developer.log('No image selected.');
+ }
+ } catch (e) {
+ developer.log('Error picking image: $e');
+ } finally {
+ setState(() {
+ _isPickingImage = false;
+ });
+ }
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/components/confirm_button.dart b/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/components/confirm_button.dart
new file mode 100644
index 00000000..7042210a
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/components/confirm_button.dart
@@ -0,0 +1,44 @@
+import "package:flutter/material.dart";
+
+class ConfirmButton extends StatelessWidget {
+ final String buttonText;
+ final VoidCallback? onTap;
+ final double fontSize = 20;
+
+ const ConfirmButton({super.key, required this.buttonText, this.onTap});
+
+ @override
+ Widget build(BuildContext context) {
+ return confirmButton(context);
+ }
+
+ Widget confirmButton(BuildContext context) {
+ return Align(
+ alignment: Alignment.bottomCenter,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(vertical: 10),
+ child: SizedBox(
+ width: MediaQuery.of(context).size.width * 0.6,
+ height: fontSize * 2,
+ child: ElevatedButton(
+ onPressed: onTap ?? () {},
+ style: ElevatedButton.styleFrom(
+ backgroundColor: Colors.black,
+ ),
+ child: Text(
+ buttonText,
+ style: buttonTextStyle(),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+
+ TextStyle buttonTextStyle() {
+ return TextStyle(
+ color: Colors.white,
+ fontSize: fontSize,
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/components/guardians_list.dart b/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/components/guardians_list.dart
new file mode 100644
index 00000000..f172d9af
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/components/guardians_list.dart
@@ -0,0 +1,37 @@
+import "package:flutter/material.dart";
+import "package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart";
+
+class GuardiansList extends StatelessWidget {
+ final List guardiansList;
+
+ const GuardiansList({super.key, required this.guardiansList});
+
+ @override
+ Widget build(BuildContext context) {
+ return Expanded(child: guardiansListView(context, guardiansList));
+ }
+
+ Widget guardiansListView(
+ BuildContext context, List guardiansList) {
+ return ListView.builder(
+ itemCount: guardiansList.length,
+ itemBuilder: (context, index) {
+ return Padding(
+ padding: EdgeInsets.fromLTRB(
+ MediaQuery.of(context).size.width * 0.1, 10, 0, 0),
+ child: stationsListElement(guardiansList[index].name),
+ );
+ },
+ );
+ }
+
+ Widget stationsListElement(String guardianName) {
+ return Text(
+ "$guardianNameさん",
+ textAlign: TextAlign.left,
+ style: const TextStyle(
+ fontSize: 18,
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/components/input_element.dart b/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/components/input_element.dart
new file mode 100644
index 00000000..65f02be4
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/components/input_element.dart
@@ -0,0 +1,35 @@
+import "package:flutter/material.dart";
+import "package:where_child_bus/pages/bus_list_page/bus_edit_page/components/input_field.dart";
+import "package:where_child_bus/pages/bus_list_page/bus_edit_page/components/input_field_title.dart";
+
+class InputElement extends StatelessWidget {
+ final String inputFieldTitle;
+ final String labelText;
+ final String hintText;
+ final TextEditingController controller;
+
+ const InputElement(
+ {super.key,
+ required this.inputFieldTitle,
+ required this.labelText,
+ required this.hintText,
+ required this.controller});
+
+ @override
+ Widget build(BuildContext context) {
+ return Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ InputFieldTitle(title: inputFieldTitle),
+ InputField(
+ labelText: labelText,
+ hintText: hintText,
+ controller: controller,
+ ),
+ ],
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/components/input_field.dart b/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/components/input_field.dart
new file mode 100644
index 00000000..1e6f1353
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/components/input_field.dart
@@ -0,0 +1,26 @@
+import "package:flutter/material.dart";
+import "package:where_child_bus/pages/bus_list_page/bus_edit_page/styles/styles.dart";
+
+class InputField extends StatelessWidget {
+ final String labelText;
+ final String hintText;
+ final TextEditingController controller;
+
+ const InputField(
+ {super.key,
+ required this.labelText,
+ required this.hintText,
+ required this.controller});
+
+ @override
+ Widget build(BuildContext context) {
+ return SizedBox(
+ width: MediaQuery.of(context).size.width * 0.8,
+ height: 40,
+ child: TextField(
+ decoration: editPageInputDecoration(labelText, hintText),
+ controller: controller,
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/components/input_field_title.dart b/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/components/input_field_title.dart
new file mode 100644
index 00000000..085fe043
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/components/input_field_title.dart
@@ -0,0 +1,16 @@
+import "package:flutter/material.dart";
+import "package:where_child_bus/pages/bus_list_page/bus_edit_page/styles/styles.dart";
+
+class InputFieldTitle extends StatelessWidget {
+ final String title;
+
+ const InputFieldTitle({super.key, required this.title});
+
+ @override
+ Widget build(BuildContext context) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(vertical: 5),
+ child: Text(title, style: normalText()),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/styles/styles.dart b/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/styles/styles.dart
new file mode 100644
index 00000000..513eaa90
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/bus_edit_page/styles/styles.dart
@@ -0,0 +1,37 @@
+import "package:flutter/material.dart";
+
+ButtonStyle editButtonStyle() {
+ return ButtonStyle(
+ backgroundColor: MaterialStateProperty.all(Colors.grey.shade300),
+ minimumSize: MaterialStateProperty.all(const Size(60, 60)),
+ shape: MaterialStateProperty.all(const CircleBorder(
+ side: BorderSide(
+ color: Colors.white,
+ width: 1,
+ style: BorderStyle.solid,
+ ),
+ )));
+}
+
+InputDecoration editPageInputDecoration(String labelText, String hintText) {
+ return InputDecoration(
+ labelText: labelText,
+ hintText: hintText,
+ border: const OutlineInputBorder(),
+ contentPadding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
+ labelStyle: inputFieldLabelStyle(),
+ );
+}
+
+TextStyle inputFieldLabelStyle() {
+ return const TextStyle(
+ fontSize: 15,
+ );
+}
+
+TextStyle normalText() {
+ return const TextStyle(
+ color: Colors.black,
+ fontSize: 16,
+ );
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/bus_list_page.dart b/frontend/where_child_bus/lib/pages/bus_list_page/bus_list_page.dart
new file mode 100644
index 00000000..5f58182c
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/bus_list_page.dart
@@ -0,0 +1,198 @@
+import "dart:developer" as developer;
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/pages/bus_list_page/widgets/operation_button.dart';
+import 'package:where_child_bus/models/bus_edit_page_type.dart';
+import 'package:where_child_bus/models/nursery_bus_data.dart';
+import 'package:where_child_bus/pages/bus_list_page/bottom_sheet.dart';
+import 'package:where_child_bus/pages/bus_list_page/bus_edit_page/bus_edit_page.dart';
+import 'package:where_child_bus/service/get_bus_list_by_nursery_id.dart';
+import 'package:where_child_bus/models/nursery_data.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/bus.pb.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+import 'widgets/bus_description_text.dart';
+import 'widgets/bus_image.dart';
+import 'widgets/bus_name_text.dart';
+import 'widgets/load_fail_text.dart';
+import 'widgets/no_bus_registered_text.dart';
+
+class BusListPage extends StatefulWidget {
+ const BusListPage({
+ super.key,
+ });
+
+ @override
+ State createState() => _BusListPageState();
+}
+
+class _BusListPageState extends State {
+ List buses = [];
+ bool _isLoading = true;
+ bool _isFailLoading = false;
+
+ @override
+ void initState() {
+ super.initState();
+ _loadBusList();
+ }
+
+ Future _fetchBusList() async {
+ if (mounted) {
+ setState(() {
+ _isLoading = true;
+ });
+ }
+
+ try {
+ GetBusListByNurseryIdResponse busList =
+ await getBusList(NurseryData().getNursery().id);
+ NurseryBusData().setBusListResponse(busList);
+ if (mounted) {
+ setState(() {
+ buses = NurseryBusData().getBusList();
+ _isLoading = false;
+ });
+ }
+ } catch (e) {
+ if (kDebugMode) {
+ developer.log("バスリストのロード中にエラーが発生しました: $e");
+ }
+ setState(() => {_isLoading = false, _isFailLoading = true});
+ }
+ }
+
+ Future _loadBusList() async {
+ if (NurseryBusData().getBusList().isNotEmpty) {
+ if (mounted) {
+ setState(() {
+ buses = NurseryBusData().getBusList();
+ _isLoading = false;
+ });
+ }
+ return;
+ } else {
+ await _fetchBusList();
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ body: _createPageBody(),
+ floatingActionButton: _createAddBusButton(),
+ );
+ }
+
+ Widget _createPageBody() {
+ return _isLoading
+ ? const Center(
+ child: CircularProgressIndicator(),
+ )
+ : Center(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ if (_isFailLoading) const LoadFailText(),
+ if (buses.isEmpty) const NoBusRegisteredText(),
+ Expanded(
+ child: RefreshIndicator(
+ onRefresh: _fetchBusList, child: _listViewBuilder()),
+ )
+ ],
+ ),
+ );
+ }
+
+ Widget _createAddBusButton() {
+ return FloatingActionButton(
+ onPressed: () async {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => const BusEditPage(
+ busEditPageType: BusEditPageType.create,
+ )));
+ await _fetchBusList();
+ },
+ child: const Icon(Icons.add),
+ );
+ }
+
+ Widget _listViewBuilder() {
+ return ListView.builder(
+ itemCount: buses.length,
+ itemBuilder: (BuildContext context, int index) {
+ return _createBusListCard(buses[index]);
+ },
+ );
+ }
+
+ Widget _createBusListCard(Bus bus) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Card(
+ elevation: 8,
+ margin: const EdgeInsets.all(16),
+ clipBehavior: Clip.antiAliasWithSaveLayer,
+ child: Material(
+ color: Colors.white,
+ child: InkWell(
+ onTap: () async {
+ await showModalBottomSheet(
+ context: context,
+ backgroundColor: Colors.transparent,
+ isScrollControlled: false,
+ enableDrag: true,
+ isDismissible: true,
+ barrierColor: Colors.black.withOpacity(0.5),
+ builder: (context) {
+ return BottomSheetWidget(
+ bus: bus,
+ );
+ });
+ },
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ BusImage(busStatus: bus.busStatus),
+ _createBusNameAndDescription(bus.name, bus.busStatus),
+ // const Spacer(),
+ OperationButton(
+ bus: bus,
+ onBusUpdated: (Bus updatedBus) {
+ if (bus.busStatus == BusStatus.BUS_STATUS_MAINTENANCE) {
+ _fetchBusList();
+ } else {
+ int index = buses.indexOf(bus);
+ if (index != -1) {
+ setState(() {
+ buses[index] = updatedBus;
+ });
+ }
+ }
+ },
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+
+ Widget _createBusNameAndDescription(String name, BusStatus busStatus) {
+ return Flexible(
+ child: Padding(
+ padding: const EdgeInsets.all(2),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ BusNameText(name: name),
+ BusDescriptionText(busStatus: busStatus)
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/bus_passenger_page/bus_passenger_page.dart b/frontend/where_child_bus/lib/pages/bus_list_page/bus_passenger_page/bus_passenger_page.dart
new file mode 100644
index 00000000..19eb2a12
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/bus_passenger_page/bus_passenger_page.dart
@@ -0,0 +1,86 @@
+import "dart:developer" as developer;
+import "package:flutter/material.dart";
+import "package:where_child_bus/components/child_list/child_list_with_mark.dart";
+import "package:where_child_bus/service/check_child_in_bus.dart";
+import "package:where_child_bus/service/get_child_list_by_bus_id.dart";
+import "package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart";
+
+class ChildrenAndPhotos {
+ final List children;
+ final List photos;
+ final List isInBus;
+
+ ChildrenAndPhotos(
+ {required this.children, required this.photos, required this.isInBus});
+}
+
+class BusPassengerPage extends StatefulWidget {
+ final Bus bus;
+
+ const BusPassengerPage({super.key, required this.bus});
+
+ @override
+ State createState() => _BusPassengerPage();
+}
+
+class _BusPassengerPage extends State {
+ late Future _childrenFuture;
+
+ Future _loadChildren() async {
+ try {
+ var res = await getChildListByBusIDService(widget.bus.id);
+ List isInBus = [];
+ List photos = [];
+ photos = res.photos;
+
+ for (var child in res.children) {
+ var res = await checkIsChildInBusService(child.id);
+ isInBus.add(res.isInBus);
+ }
+
+ developer.log("園児のロードが完了しました", name: "LoadChildren");
+ return ChildrenAndPhotos(
+ children: res.children, photos: photos, isInBus: isInBus);
+ } catch (e) {
+ developer.log("園児のロード中にエラーが発生しました: $e", name: "LoadChildren");
+ throw Exception('Failed to load children');
+ }
+ }
+
+ @override
+ void initState() {
+ super.initState();
+ _childrenFuture = _loadChildren();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ title: const Text("乗客情報"),
+ ),
+ body: FutureBuilder(
+ future: _childrenFuture,
+ builder: (context, snapshot) {
+ if (snapshot.connectionState == ConnectionState.waiting) {
+ return const Center(child: CircularProgressIndicator());
+ } else if (snapshot.hasError) {
+ return Center(child: Text('エラーが発生しました: ${snapshot.error}'));
+ } else if (snapshot.hasData) {
+ return ChildListWithMark(
+ childNames:
+ snapshot.data!.children.map((child) => child.name).toList(),
+ groupNames: snapshot.data!.children
+ .map((child) => child.age.toString())
+ .toList(),
+ isInBus: snapshot.data!.isInBus,
+ images: snapshot.data!.photos,
+ );
+ } else {
+ return const Text("データがありません");
+ }
+ },
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/create_station_page/create_station_page.dart b/frontend/where_child_bus/lib/pages/bus_list_page/create_station_page/create_station_page.dart
new file mode 100644
index 00000000..bed7b826
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/create_station_page/create_station_page.dart
@@ -0,0 +1,159 @@
+import 'dart:developer' as developer;
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:google_maps_flutter/google_maps_flutter.dart';
+import 'package:where_child_bus/pages/bus_list_page/create_station_page/widget/decide_button.dart';
+import 'package:where_child_bus/pages/bus_list_page/create_station_page/widget/google_map.dart';
+import 'package:where_child_bus/util/api/station.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class CreateStationPage extends StatefulWidget {
+ final Bus bus;
+
+ const CreateStationPage({super.key, required this.bus});
+
+ @override
+ State createState() => _CreateStationPageState();
+}
+
+class _CreateStationPageState extends State {
+ bool _isLoading = false;
+ bool _isFailLoading = false;
+ bool _isLoadingUpdate = false;
+ List guardians = [];
+ List stations = [];
+ Set _markers = {};
+ int _index = 0;
+
+ Future _fetchGuardians() async {
+ _isLoading = true;
+
+ try {
+ var res = await getUnregisteredStations(widget.bus.id);
+ if (mounted) {
+ setState(() {
+ guardians = res.guardians;
+ stations = res.stations;
+ _isLoading = false;
+ });
+ }
+ } catch (e) {
+ if (kDebugMode) {
+ developer.log("保護者リストのロード中にエラーが発生しました: $e");
+ }
+ setState(() => {_isLoading = false, _isFailLoading = true});
+ }
+ }
+
+ void _onMapTapped(Set markers) {
+ developer.log("マップがタップされました ${markers.first.position}");
+ setState(() {
+ _markers = markers;
+ });
+ }
+
+ Future _onButtonPressed() async {
+ setState(() {
+ _isLoadingUpdate = true;
+ });
+
+ if (_markers.isEmpty) {
+ return;
+ }
+
+ try {
+ var res = await updateStation(stations[_index].id, widget.bus.id,
+ _markers.first.position.latitude, _markers.first.position.longitude);
+ developer.log("バス停の更新が完了しました $res", name: "CreateStationPage");
+ setState(() {
+ _markers.clear();
+ if (_index < guardians.length - 1) {
+ _index++;
+ developer.log("index: $_index");
+ } else {
+ Navigator.of(context).pop();
+ }
+ _isLoadingUpdate = false;
+ });
+ } catch (e) {
+ if (kDebugMode) {
+ developer.log("バス停の更新中にエラーが発生しました: $e", name: "CreateStationPageError");
+ }
+ }
+
+ setState(() {
+ _isLoadingUpdate = false;
+ });
+ }
+
+ @override
+ void initState() {
+ super.initState();
+ _fetchGuardians();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ title: const Text('新規バス停作成'),
+ ),
+ body: _createPageBody(),
+ );
+ }
+
+ Widget _createPageBody() {
+ return Column(
+ // SingleChildScrollViewを削除し、Columnを直接使用
+ children: [
+ if (_isLoading)
+ const Expanded(
+ // CircularProgressIndicatorを中央に表示
+ child: Center(child: CircularProgressIndicator()),
+ )
+ else if (_isFailLoading)
+ const Expanded(
+ // エラーメッセージを中央に表示
+ child: Center(child: Text('保護者リストの取得に失敗しました')),
+ )
+ else
+ Expanded(
+ // GoogleMapを表示するためにExpandedを使用
+ flex: 7, // 画面の7割をGoogleMapに割り当てる
+ child: GoogleMapWidget(
+ onTapped: _onMapTapped,
+ ),
+ ),
+ _isLoading
+ ? Container()
+ : SizedBox(
+ width: MediaQuery.of(context).size.width,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.spaceEvenly,
+ children: [
+ Padding(
+ padding: const EdgeInsets.all(10),
+ child: Text(
+ '${guardians[_index].name}さん',
+ style: const TextStyle(fontSize: 20),
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 10.0, vertical: 8.0),
+ child: PositionDecideButton(
+ onPressed:
+ _markers.isNotEmpty ? _onButtonPressed : () {},
+ text: _markers.isNotEmpty
+ ? 'バス停を決定する'
+ : '地図をタップしてバス停を決定してください',
+ isLoading: _isLoadingUpdate,
+ ),
+ ),
+ ],
+ ),
+ )
+ ],
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/create_station_page/locate_user.dart b/frontend/where_child_bus/lib/pages/bus_list_page/create_station_page/locate_user.dart
new file mode 100644
index 00000000..0bca592f
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/create_station_page/locate_user.dart
@@ -0,0 +1,40 @@
+import 'package:flutter/foundation.dart';
+import 'package:google_maps_flutter/google_maps_flutter.dart';
+import 'package:location/location.dart';
+
+Future locateUser(
+ GoogleMapController mapController, VoidCallback? onLocate) async {
+ Location location = Location();
+
+ bool serviceEnabled;
+ PermissionStatus permissionGranted;
+ LocationData locationData;
+
+ serviceEnabled = await location.serviceEnabled();
+ if (!serviceEnabled) {
+ serviceEnabled = await location.requestService();
+ if (!serviceEnabled) {
+ return;
+ }
+ }
+
+ permissionGranted = await location.hasPermission();
+ if (permissionGranted == PermissionStatus.denied) {
+ permissionGranted = await location.requestPermission();
+ if (permissionGranted != PermissionStatus.granted) {
+ return;
+ }
+ }
+
+ locationData = await location.getLocation();
+ mapController.animateCamera(
+ CameraUpdate.newCameraPosition(
+ CameraPosition(
+ target: LatLng(locationData.latitude!, locationData.longitude!),
+ zoom: 15.0,
+ ),
+ ),
+ );
+
+ onLocate?.call();
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/create_station_page/widget/decide_button.dart b/frontend/where_child_bus/lib/pages/bus_list_page/create_station_page/widget/decide_button.dart
new file mode 100644
index 00000000..69f9731b
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/create_station_page/widget/decide_button.dart
@@ -0,0 +1,28 @@
+import 'package:flutter/material.dart';
+
+class PositionDecideButton extends StatelessWidget {
+ final Function() onPressed;
+ final String text;
+ final bool isLoading;
+
+ const PositionDecideButton({
+ Key? key,
+ required this.onPressed,
+ required this.text,
+ required this.isLoading,
+ }) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ return Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: SizedBox(
+ height: 50,
+ child: ElevatedButton(
+ onPressed: onPressed,
+ child: isLoading ? const CircularProgressIndicator() : Text(text),
+ ),
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/create_station_page/widget/google_map.dart b/frontend/where_child_bus/lib/pages/bus_list_page/create_station_page/widget/google_map.dart
new file mode 100644
index 00000000..87851fe5
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/create_station_page/widget/google_map.dart
@@ -0,0 +1,83 @@
+import "dart:developer" as developer;
+import 'package:flutter/material.dart';
+import 'package:google_maps_flutter/google_maps_flutter.dart';
+import 'package:where_child_bus/pages/bus_list_page/create_station_page/locate_user.dart';
+
+class GoogleMapWidget extends StatefulWidget {
+ final Function(Set) onTapped;
+
+ const GoogleMapWidget({super.key, required this.onTapped});
+
+ @override
+ State createState() => _GoogleMapWidgetState();
+}
+
+class _GoogleMapWidgetState extends State {
+ late GoogleMapController mapController;
+ final Set _markers = {};
+
+ final LatLng _center = const LatLng(35.68145403034362, 139.76707116150914);
+
+ bool _isLoading = false;
+
+ void _onLoad() {
+ setState(() {
+ _isLoading = false;
+ });
+ }
+
+ void _onMapCreated(GoogleMapController controller) {
+ developer.log("GoogleMapControllerが作成されました");
+ mapController = controller;
+ locateUser(mapController, _onLoad);
+ }
+
+ void _onMapTapped(LatLng position) {
+ setState(() {
+ // 既存のマーカーをクリア
+ _markers.clear();
+
+ // 新しいマーカーのID
+ const markerId = MarkerId("unique_id");
+
+ // 新しいマーカーの作成
+ final marker = Marker(
+ markerId: markerId,
+ position: position,
+ );
+
+ // 新しいマーカーをセットに追加
+ _markers.add(marker);
+ });
+
+ widget.onTapped.call(_markers);
+ }
+
+ @override
+ void initState() {
+ super.initState();
+ _isLoading = true;
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Stack(
+ children: [
+ GoogleMap(
+ onMapCreated: _onMapCreated,
+ initialCameraPosition: CameraPosition(
+ target: _center,
+ zoom: 11.0,
+ ),
+ onTap: _onMapTapped,
+ markers: _markers,
+ myLocationEnabled: true,
+ ),
+ if (_isLoading) // マップが読み込まれていない間はローディングインジケーターを表示
+ const Center(
+ child: CircularProgressIndicator(),
+ ),
+ ],
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/widgets/bus_description_text.dart b/frontend/where_child_bus/lib/pages/bus_list_page/widgets/bus_description_text.dart
new file mode 100644
index 00000000..e3b73614
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/widgets/bus_description_text.dart
@@ -0,0 +1,32 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class BusDescriptionText extends StatelessWidget {
+ const BusDescriptionText({
+ super.key,
+ required this.busStatus,
+ });
+
+ final BusStatus busStatus;
+
+ @override
+ Widget build(BuildContext context) {
+ late String description;
+ if (busStatus == BusStatus.BUS_STATUS_RUNNING) {
+ description = "運行中";
+ } else if (busStatus == BusStatus.BUS_STATUS_MAINTENANCE) {
+ description = "経路未設定";
+ } else {
+ description = "停止中";
+ }
+ return Text(
+ description,
+ style: const TextStyle(
+ color: Colors.grey,
+ fontSize: 16,
+ ),
+ overflow: TextOverflow.ellipsis,
+ maxLines: 2,
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/widgets/bus_image.dart b/frontend/where_child_bus/lib/pages/bus_list_page/widgets/bus_image.dart
new file mode 100644
index 00000000..96ad9ef9
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/widgets/bus_image.dart
@@ -0,0 +1,34 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class BusImage extends StatelessWidget {
+ const BusImage({
+ super.key,
+ required this.busStatus,
+ });
+
+ final BusStatus busStatus;
+
+ @override
+ Widget build(BuildContext context) {
+ late String imagePath;
+ if (busStatus == BusStatus.BUS_STATUS_RUNNING) {
+ imagePath = "assets/images/bus_operating.png";
+ } else if (busStatus == BusStatus.BUS_STATUS_STOPPED) {
+ imagePath = "assets/images/bus_not_operating.png";
+ } else {
+ imagePath = "assets/images/bus_maintenance.png";
+ }
+
+ return SizedBox(
+ width: 100,
+ height: 100,
+ child: Padding(
+ padding: const EdgeInsets.all(12.0),
+ child: Image.asset(
+ imagePath,
+ fit: BoxFit.cover,
+ ),
+ ));
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/widgets/bus_name_text.dart b/frontend/where_child_bus/lib/pages/bus_list_page/widgets/bus_name_text.dart
new file mode 100644
index 00000000..5ce29a4d
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/widgets/bus_name_text.dart
@@ -0,0 +1,23 @@
+import 'package:flutter/material.dart';
+
+class BusNameText extends StatelessWidget {
+ const BusNameText({
+ super.key,
+ required this.name,
+ });
+
+ final String name;
+
+ @override
+ Widget build(BuildContext context) {
+ return Text(
+ name,
+ overflow: TextOverflow.ellipsis,
+ textAlign: TextAlign.left,
+ style: const TextStyle(
+ fontWeight: FontWeight.w600,
+ fontSize: 22,
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/widgets/load_fail_text.dart b/frontend/where_child_bus/lib/pages/bus_list_page/widgets/load_fail_text.dart
new file mode 100644
index 00000000..55e875b0
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/widgets/load_fail_text.dart
@@ -0,0 +1,15 @@
+import 'package:flutter/material.dart';
+
+class LoadFailText extends StatelessWidget {
+ const LoadFailText({
+ super.key,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ return const Text(
+ "バスのロードに失敗しました",
+ style: TextStyle(color: Colors.red, fontSize: 16),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/widgets/no_bus_registered_text.dart b/frontend/where_child_bus/lib/pages/bus_list_page/widgets/no_bus_registered_text.dart
new file mode 100644
index 00000000..573109e8
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/widgets/no_bus_registered_text.dart
@@ -0,0 +1,15 @@
+import 'package:flutter/material.dart';
+
+class NoBusRegisteredText extends StatelessWidget {
+ const NoBusRegisteredText({
+ super.key,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ return const Padding(
+ padding: EdgeInsets.all(20),
+ child: Text("バスが登録されていません"),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/bus_list_page/widgets/operation_button.dart b/frontend/where_child_bus/lib/pages/bus_list_page/widgets/operation_button.dart
new file mode 100644
index 00000000..328c1b43
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/bus_list_page/widgets/operation_button.dart
@@ -0,0 +1,119 @@
+import 'dart:developer' as developer;
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/pages/bus_list_page/create_station_page/create_station_page.dart';
+import 'package:where_child_bus/util/api/bus.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class OperationButton extends StatefulWidget {
+ final Bus bus;
+ final Function(Bus) onBusUpdated;
+
+ const OperationButton({
+ super.key,
+ required this.bus,
+ required this.onBusUpdated,
+ });
+
+ @override
+ State createState() => _OperationButtonState();
+}
+
+class _OperationButtonState extends State {
+ bool _isLoading = false;
+
+ @override
+ Widget build(BuildContext context) {
+ return _createOperationButton();
+ }
+
+ Future _updateBusStatus() async {
+ BusStatus busStatus;
+
+ if (mounted) {
+ setState(() {
+ _isLoading = true;
+ });
+ }
+
+ if (widget.bus.busStatus == BusStatus.BUS_STATUS_STOPPED) {
+ busStatus = BusStatus.BUS_STATUS_RUNNING;
+ } else {
+ busStatus = BusStatus.BUS_STATUS_STOPPED;
+ }
+
+ try {
+ var res = await updateBusStatus(widget.bus.id, busStatus);
+ if (mounted) {
+ setState(() {
+ widget.onBusUpdated(res.bus);
+ });
+ }
+ } catch (e) {
+ if (kDebugMode) {
+ developer.log("バスの運行状態の更新中にエラーが発生しました: $e");
+ }
+ } finally {
+ if (mounted) {
+ setState(() {
+ _isLoading = false;
+ });
+ }
+ }
+ }
+
+ Widget _createOperationButton() {
+ Color buttonColor;
+ String buttonText;
+ VoidCallback onPressed;
+
+ switch (widget.bus.busStatus) {
+ case BusStatus.BUS_STATUS_STOPPED:
+ buttonColor = Colors.green;
+ buttonText = "運航開始";
+ onPressed = _updateBusStatus;
+ break;
+ case BusStatus.BUS_STATUS_MAINTENANCE:
+ buttonColor = Colors.lime;
+ buttonText = "設定";
+ onPressed = () => {
+ Navigator.push(context, MaterialPageRoute(builder: (context) {
+ return CreateStationPage(bus: widget.bus);
+ })).then((_) => widget.onBusUpdated(widget.bus))
+ };
+ break;
+ default:
+ buttonColor = Colors.red;
+ buttonText = "運航停止";
+ onPressed = _updateBusStatus;
+ }
+
+ return _buildButton(buttonColor, buttonText, onPressed);
+ }
+
+ Widget _buildButton(Color color, String text, VoidCallback onPressed) {
+ return Padding(
+ padding: const EdgeInsets.all(10),
+ child: ElevatedButton(
+ onPressed: onPressed,
+ style: ElevatedButton.styleFrom(
+ backgroundColor: color,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(10),
+ ),
+ ),
+ child: _isLoading
+ ? const CircularProgressIndicator(
+ valueColor: AlwaysStoppedAnimation(Colors.white),
+ )
+ : Text(
+ text,
+ style: const TextStyle(
+ color: Colors.white,
+ fontSize: 16,
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/camera_page/camera_bus_select_page.dart b/frontend/where_child_bus/lib/pages/camera_page/camera_bus_select_page.dart
new file mode 100644
index 00000000..a4663715
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/camera_page/camera_bus_select_page.dart
@@ -0,0 +1,153 @@
+import 'dart:developer' as developer;
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/components/util/input_value_label.dart';
+import 'package:where_child_bus/models/nursery_bus_data.dart';
+import 'package:where_child_bus/models/nursery_data.dart';
+import 'package:where_child_bus/pages/camera_page/camera_page.dart';
+import 'package:where_child_bus/pages/camera_page/widgets/bus_select_box.dart';
+import 'package:where_child_bus/pages/camera_page/widgets/time_select_box.dart';
+import 'package:where_child_bus/service/get_bus_list_by_nursery_id.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/bus.pb.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class BusSelectPage extends StatefulWidget {
+ const BusSelectPage({super.key});
+
+ @override
+ State createState() => _BusSelectPageState();
+}
+
+class _BusSelectPageState extends State {
+ Bus? _selectedBus;
+ BusType _selectedType = BusType.BUS_TYPE_MORNING;
+ List _buses = [];
+ Future>? _busesFuture;
+
+ Future> _loadBuses() async {
+ if (NurseryBusData().getBusList().isNotEmpty) {
+ _selectedBus = NurseryBusData().getBusList().first;
+ return NurseryBusData().getBusList();
+ } else {
+ return _fetchBus();
+ }
+ }
+
+ Future> _fetchBus() async {
+ try {
+ GetBusListByNurseryIdResponse busList =
+ await getBusList(NurseryData().getNursery().id);
+ NurseryBusData().setBusListResponse(busList);
+ _selectedBus = busList.buses[0];
+ return NurseryBusData().getBusList();
+ } catch (error) {
+ if (kDebugMode) {
+ developer.log("バスのロード中にエラーが発生しました", error: error.toString());
+ }
+ throw Exception('バスのロードに失敗しました');
+ }
+ }
+
+ @override
+ void initState() {
+ super.initState();
+ // _loadBuses()の結果をフィールドに保持
+ _busesFuture = _loadBuses();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ body: _createPageBody(),
+ );
+ }
+
+ Widget _createPageBody() {
+ return FutureBuilder>(
+ future: _busesFuture,
+ builder: (context, snapshot) {
+ if (snapshot.connectionState == ConnectionState.waiting) {
+ return const Center(child: CircularProgressIndicator());
+ } else if (snapshot.hasError) {
+ return Center(child: Text('データの取得に失敗しました: ${snapshot.error}'));
+ } else if (snapshot.hasData) {
+ _buses = snapshot.data!;
+ return Center(
+ child: Column(
+ children: [
+ _createBusInputLabelAndSelectBox(context, "バスを選択して下さい",
+ _buses.map((Bus bus) => bus.name).toList()),
+ const SizedBox(height: 20),
+ _createTimeInputLabelAndSelectBox(context, "時間を選択して下さい"),
+ const SizedBox(height: 20),
+ _proceedButton(),
+ ],
+ ),
+ );
+ } else {
+ return const Center(child: Text('利用可能なバスがありません'));
+ }
+ },
+ );
+ }
+
+ Widget _createBusInputLabelAndSelectBox(
+ BuildContext context, String label, List lists) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ InputValueLabel(label: label),
+ BusSelectValueBox(busLists: _buses, onChanged: _onChangedBus),
+ ],
+ );
+ }
+
+ Widget _createTimeInputLabelAndSelectBox(
+ BuildContext context,
+ String label,
+ ) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ InputValueLabel(label: label),
+ TimeSelectValueBox(onChanged: _onChangedTime),
+ ],
+ );
+ }
+
+ void _onChangedTime(BusType type) {
+ if (mounted) {
+ setState(() {
+ _selectedType = type;
+ });
+ }
+ }
+
+ void _onChangedBus(Bus? bus) {
+ if (mounted) {
+ setState(() {
+ _selectedBus = bus;
+ });
+ }
+ }
+
+ Widget _proceedButton() {
+ return ElevatedButton(
+ onPressed: () async {
+ if (_selectedBus != null) {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => CameraPage(
+ bus: _selectedBus!,
+ busType: _selectedType,
+ ),
+ ),
+ );
+ await _fetchBus();
+ }
+ },
+ child: const Text("カメラ起動"),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/camera_page/camera_page.dart b/frontend/where_child_bus/lib/pages/camera_page/camera_page.dart
new file mode 100644
index 00000000..4c62fca5
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/camera_page/camera_page.dart
@@ -0,0 +1,344 @@
+import 'dart:async';
+import 'dart:developer' as developer;
+import 'dart:io';
+import 'package:flutter/material.dart';
+import 'package:camera/camera.dart';
+import 'package:grpc/grpc.dart';
+import 'package:audioplayers/audioplayers.dart';
+import 'package:location/location.dart';
+import 'package:where_child_bus/components/util/audio_manager.dart';
+import 'package:where_child_bus/config/config.dart';
+import 'package:where_child_bus/models/nursery_data.dart';
+import 'package:where_child_bus/pages/camera_page/widgets/riding_toggle.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/bus.pbgrpc.dart';
+import "package:where_child_bus/main.dart" as where_child_bus;
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+import 'widgets/next_station_button.dart';
+
+class CameraPage extends StatefulWidget {
+ Bus bus;
+ final BusType busType;
+
+ CameraPage({Key? key, required this.bus, required this.busType})
+ : super(key: key);
+
+ @override
+ State createState() => _CameraPageState();
+}
+
+class _CameraPageState extends State {
+ final AudioPlayer audioPlayer = AudioPlayer();
+ late CameraController _controller;
+ final StreamController _streamController =
+ StreamController.broadcast();
+ final StreamController _locationStream =
+ StreamController.broadcast();
+ VehicleEvent _vehicleEvent = VehicleEvent.VEHICLE_EVENT_GET_ON;
+ final Location location = Location();
+
+ ClientChannel? _videoChannel;
+ ClientChannel? _locationChannel;
+
+ @override
+ void initState() {
+ super.initState();
+ _initializeCamera();
+ }
+
+ void _initializeCamera() async {
+ var camera = where_child_bus.cameras.first;
+ try {
+ camera = where_child_bus.cameras[1];
+ } catch (e) {
+ developer.log("Failed to get camera: $e");
+ }
+
+ _controller = CameraController(camera, ResolutionPreset.medium);
+
+ try {
+ await _controller.initialize();
+ if (!mounted) return;
+ setState(() {});
+ developer.log("Camera aspect ratio: ${_controller.value.aspectRatio}",
+ name: "CameraPage");
+ _startImageStream();
+ streamBusVideo(_streamController.stream);
+ developer.log("Start streaming coordinate to server", name: "CameraPage");
+ _streamCoordinate(_locationStream.stream);
+ } catch (e) {
+ developer.log('Failed to initialize camera: $e');
+ }
+ }
+
+ Future streamBusVideo(
+ Stream requestStream) async {
+ _videoChannel = ClientChannel(
+ appConfig.grpcEndpoint,
+ port: appConfig.grpcPort,
+ options: const ChannelOptions(),
+ );
+ final grpcClient = BusServiceClient(_videoChannel!);
+ developer.log("ServiceClient created");
+ final res = grpcClient.streamBusVideo(requestStream);
+
+ try {
+ await for (var response in res) {
+ developer.log("Received response: $response", name: "CameraPage");
+ await _playAudio(response);
+ }
+ } catch (error) {
+ developer.log("Caught Error:", error: error, name: "StreamBusVideo");
+ } finally {
+ await _videoChannel!.shutdown();
+ }
+ }
+
+ Future _streamCoordinate(
+ Stream requestStream) async {
+ _locationChannel = ClientChannel(
+ appConfig.grpcEndpoint,
+ port: appConfig.grpcPort,
+ options: const ChannelOptions(),
+ );
+ final grpcClient = BusServiceClient(_locationChannel!);
+ developer.log("ServiceClient created");
+ final res = grpcClient.sendLocationContinuous(requestStream);
+
+ try {
+ await for (var response in res.asStream()) {
+ developer.log("Received response: $response", name: "CameraPage");
+ }
+ } catch (error) {
+ developer.log("Caught Error:", error: error);
+ } finally {
+ await _locationChannel!.shutdown();
+ }
+ }
+
+ Future _getCurrentLocation() async {
+ bool serviceEnabled;
+ PermissionStatus permissionGranted;
+ LocationData locationData;
+
+ // サービスが有効かどうかを確認
+ serviceEnabled = await location.serviceEnabled();
+ if (!serviceEnabled) {
+ // サービスが無効の場合は、ユーザーに有効化を求める
+ serviceEnabled = await location.requestService();
+ if (!serviceEnabled) {
+ throw Exception('Location service is not enabled.');
+ }
+ }
+
+ // 位置情報の権限を確認
+ permissionGranted = await location.hasPermission();
+ if (permissionGranted == PermissionStatus.denied) {
+ // 権限が拒否されている場合は、権限をリクエスト
+ permissionGranted = await location.requestPermission();
+ if (permissionGranted != PermissionStatus.granted) {
+ throw Exception('Location service is not enabled.');
+ }
+ }
+
+ // 現在地の取得
+ locationData = await location.getLocation();
+ developer
+ .log("現在地の緯度: ${locationData.latitude}, 経度: ${locationData.longitude}");
+ return locationData;
+ }
+
+ List _processCameraImage2gray(CameraImage image) {
+ //Note:実験的に縦横を入れ替えてみる
+ final int width = image.width;
+ final int height = image.height;
+ const int bgraPixelStride = 4; // BGRAフォーマットではピクセルあたり4バイト
+ final bgraBytes = image.planes[0].bytes;
+
+ // グレースケール画像データを格納するためのリストを初期化
+ List grayscaleBytes = List.filled(width * height, 0);
+
+ for (int y = 0; y < height; y++) {
+ for (int x = 0; x < width; x++) {
+ final int index = x * bgraPixelStride + y * image.planes[0].bytesPerRow;
+ final int b = bgraBytes[index];
+ final int g = bgraBytes[index + 1];
+ final int r = bgraBytes[index + 2];
+ // 輝度Yを計算
+ final int yValue = (0.299 * r + 0.587 * g + 0.114 * b).round();
+ grayscaleBytes[x + y * width] = yValue;
+ }
+ }
+
+ return grayscaleBytes;
+ }
+
+ List rotateGrayscaleImageLeft90Degrees(
+ List grayscaleBytes, int width, int height) {
+ int rotatedWidth = height;
+ int rotatedHeight = width;
+ List rotatedGrayscaleBytes =
+ List.filled(rotatedWidth * rotatedHeight, 0);
+
+ for (int originalY = 0; originalY < height; originalY++) {
+ for (int originalX = 0; originalX < width; originalX++) {
+ // 元の画像でのピクセルのインデックス
+ int originalIndex = originalY * width + originalX;
+ // 回転後のピクセルの位置
+ int rotatedX = originalY;
+ int rotatedY = width - originalX - 1;
+ // 回転後のピクセルのインデックス
+ int rotatedIndex = rotatedY * rotatedWidth + rotatedX;
+ // 輝度値を新しい位置にコピー
+ rotatedGrayscaleBytes[rotatedIndex] = grayscaleBytes[originalIndex];
+ }
+ }
+
+ return [rotatedGrayscaleBytes, rotatedWidth, rotatedHeight];
+ }
+
+ void _startImageStream() async {
+ List> videoChunks = [];
+ if (!_controller.value.isStreamingImages) {
+ int frameCounter = 0;
+ _controller.startImageStream((CameraImage image) async {
+ frameCounter++;
+ if (frameCounter % 45 == 0) {
+ if (Platform.isAndroid) {
+ videoChunks.add(image.planes[0].bytes.toList());
+ _streamController.add(StreamBusVideoRequest(
+ busId: widget.bus.id,
+ nurseryId: NurseryData().getNursery().id,
+ busType: widget.busType,
+ vehicleEvent: _vehicleEvent,
+ videoChunk: videoChunks,
+ photoHeight: image.height,
+ photoWidth: image.width,
+ ));
+ } else if (Platform.isIOS) {
+ videoChunks.add(rotateGrayscaleImageLeft90Degrees(
+ _processCameraImage2gray(image), image.width, image.height)[0]);
+ _streamController.add(StreamBusVideoRequest(
+ busId: widget.bus.id,
+ nurseryId: NurseryData().getNursery().id,
+ busType: widget.busType,
+ vehicleEvent: _vehicleEvent,
+ videoChunk: videoChunks,
+ photoHeight: image.width,
+ photoWidth: image.height,
+ ));
+ }
+
+ try {
+ // await _getCurrentLocation();
+ await _getCurrentLocation().then((locationData) {
+ _locationStream.add(SendLocationContinuousRequest(
+ busId: widget.bus.id,
+ latitude: locationData.latitude,
+ longitude: locationData.longitude,
+ ));
+ });
+ } catch (e) {
+ developer.log("Failed to get current location: $e");
+ }
+
+ developer.log("width ${image.width}", name: "CameraPage");
+ developer.log("height ${image.height}", name: "CameraPage");
+
+ videoChunks = [];
+ }
+ });
+ }
+ }
+
+ Future _playAudio(StreamBusVideoResponse res) async {
+ List audioFiles = [];
+
+ if (res.children.any((child) => child.hasBag)) {
+ audioFiles.add("sounds/bag.wav");
+ }
+
+ if (res.children.any((child) => child.hasLunchBox)) {
+ audioFiles.add("sounds/lunch_box.wav");
+ }
+
+ if (res.children.any((child) => child.hasWaterBottle)) {
+ audioFiles.add("sounds/water_bottle.wav");
+ }
+
+ if (res.children.any((child) => child.hasUmbrella)) {
+ audioFiles.add("sounds/umbrella.wav");
+ }
+
+ AudioManager(audioFiles: audioFiles).playSequentially();
+ }
+
+ void _onNextButtonPressed(Bus bus) {
+ developer.log("Next button pressed", name: "CameraPage");
+ setState(() {
+ widget.bus = bus;
+ });
+ }
+
+ @override
+ void dispose() {
+ _controller.dispose();
+ _streamController.close();
+ _locationStream.close();
+ _videoChannel?.shutdown();
+ _locationChannel?.shutdown();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ if (!_controller.value.isInitialized) {
+ return const SizedBox.shrink(); // カメラが初期化されていない場合は何も表示しない
+ }
+ return Scaffold(
+ appBar: AppBar(
+ title: const Text("カメラ"),
+ ),
+ body: _createPageBody(),
+ );
+ }
+
+ Widget _createPageBody() {
+ return Stack(
+ children: [
+ Center(
+ child: AspectRatio(
+ aspectRatio: 1 / _controller.value.aspectRatio,
+ child: CameraPreview(_controller)),
+ ),
+ Positioned(
+ right: 15,
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ NextStationButton(
+ bus: widget.bus,
+ busType: widget.busType,
+ onPressed: _onNextButtonPressed),
+ RidingToggle(
+ onToggled: (event) => {
+ setState(() {
+ if (event) {
+ _vehicleEvent = VehicleEvent.VEHICLE_EVENT_GET_ON;
+ } else {
+ _vehicleEvent =
+ VehicleEvent.VEHICLE_EVENT_GET_OFF;
+ }
+ }),
+ }),
+ ],
+ )),
+ //NOTE: テスト用
+ // ElevatedButton(
+ // onPressed: AudioManager(audioFiles: ["sounds/water_bottle.wav"])
+ // .playSequentially,
+ // child: const Text("Play")),
+ ],
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/camera_page/widgets/bus_select_box.dart b/frontend/where_child_bus/lib/pages/camera_page/widgets/bus_select_box.dart
new file mode 100644
index 00000000..f30a8015
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/camera_page/widgets/bus_select_box.dart
@@ -0,0 +1,48 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class BusSelectValueBox extends StatefulWidget {
+ final List busLists;
+ final Function(Bus?) onChanged;
+ final Bus? selectedBus;
+
+ const BusSelectValueBox({
+ required this.busLists,
+ required this.onChanged,
+ this.selectedBus,
+ super.key,
+ });
+
+ @override
+ State createState() => _BusSelectValueBoxState();
+}
+
+class _BusSelectValueBoxState extends State {
+ Bus? _selectedBus;
+
+ @override
+ void initState() {
+ super.initState();
+ _selectedBus = widget.selectedBus ?? widget.busLists.first;
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return SizedBox(
+ width: MediaQuery.of(context).size.width * 0.8,
+ height: 50,
+ child: DropdownButton(
+ value: _selectedBus,
+ items: widget.busLists.map((Bus bus) {
+ return DropdownMenuItem(value: bus, child: Text(bus.name));
+ }).toList(),
+ onChanged: (Bus? value) {
+ setState(() {
+ _selectedBus = value;
+ });
+ widget.onChanged(value);
+ },
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/camera_page/widgets/next_station_button.dart b/frontend/where_child_bus/lib/pages/camera_page/widgets/next_station_button.dart
new file mode 100644
index 00000000..856e92f3
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/camera_page/widgets/next_station_button.dart
@@ -0,0 +1,92 @@
+import "dart:developer" as developer;
+import 'dart:async';
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/util/api/bus.dart';
+import 'package:where_child_bus/util/api/busRoute.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class NextStationButton extends StatefulWidget {
+ final Bus bus;
+ final BusType busType;
+ Function(Bus) onPressed;
+
+ NextStationButton(
+ {Key? key,
+ required this.bus,
+ required this.busType,
+ required this.onPressed})
+ : super(key: key);
+
+ @override
+ State createState() => _NextStationButtonState();
+}
+
+class _NextStationButtonState extends State {
+ BusRoute? _busRoute;
+ bool _isLoading = false;
+
+ Future _fetchMorningBusRoute() async {
+ if (mounted) {
+ setState(() {
+ _isLoading = true;
+ });
+ }
+
+ try {
+ final res = await getBusRouteByBusId(widget.bus.id, widget.busType);
+ if (mounted) {
+ setState(() {
+ _busRoute = res.busRoute;
+ _isLoading = false;
+ });
+ }
+ } catch (error) {
+ developer.log("Caught Error By NextStationButton:",
+ error: error, name: "NextStationButton");
+ }
+ }
+
+ Future _updateNextStation() async {
+ _isLoading = true;
+ var nextStationIndex = _busRoute!.orderedStations
+ .indexWhere((station) => station.id == widget.bus.nextStationId) +
+ 1;
+
+ if (nextStationIndex >= _busRoute!.orderedStations.length) {
+ return;
+ }
+ try {
+ var res = await updateNextStation(
+ widget.bus.id, _busRoute!.orderedStations[nextStationIndex].id);
+ widget.onPressed(res.bus);
+ _isLoading = false;
+ } catch (error) {
+ developer.log("Caught Error By NextStationButton:",
+ error: error, name: "NextStationButton");
+ } finally {
+ if (!mounted) return;
+ setState(() => _isLoading = false);
+ }
+ }
+
+ @override
+ void initState() {
+ super.initState();
+ _fetchMorningBusRoute();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Padding(
+ padding: const EdgeInsets.all(8),
+ child: _isLoading
+ ? const Center(
+ child: SizedBox(
+ width: 20, height: 20, child: CircularProgressIndicator()))
+ : ElevatedButton(
+ onPressed: _updateNextStation,
+ child: const Text("次の停留所へ"),
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/camera_page/widgets/riding_toggle.dart b/frontend/where_child_bus/lib/pages/camera_page/widgets/riding_toggle.dart
new file mode 100644
index 00000000..b8943a98
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/camera_page/widgets/riding_toggle.dart
@@ -0,0 +1,43 @@
+import 'package:flutter/material.dart';
+
+class RidingToggle extends StatefulWidget {
+ final Function(bool) onToggled;
+
+ const RidingToggle({required this.onToggled, super.key});
+
+ @override
+ _RidingToggleState createState() => _RidingToggleState();
+}
+
+class _RidingToggleState extends State {
+ bool _isRide = true;
+
+ @override
+ Widget build(BuildContext context) {
+ return SizedBox(
+ width: 130,
+ child: Card(
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceEvenly,
+ children: [
+ // "乗り"または"降り"のテキストを表示
+ Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: Text(_isRide ? "乗り" : "降り"),
+ ),
+ // スイッチを表示
+ Switch(
+ value: _isRide,
+ onChanged: (bool value) {
+ setState(() {
+ _isRide = value;
+ });
+ widget.onToggled(value);
+ },
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/camera_page/widgets/time_select_box.dart b/frontend/where_child_bus/lib/pages/camera_page/widgets/time_select_box.dart
new file mode 100644
index 00000000..63d27447
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/camera_page/widgets/time_select_box.dart
@@ -0,0 +1,54 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class TimeSelectValueBox extends StatefulWidget {
+ final Function(BusType) onChanged;
+ final BusType initialSelectedType;
+
+ const TimeSelectValueBox(
+ {required this.onChanged,
+ this.initialSelectedType = BusType.BUS_TYPE_MORNING,
+ super.key});
+
+ @override
+ State createState() => _TimeSelectValueBoxState();
+}
+
+class _TimeSelectValueBoxState extends State {
+ late BusType _selectedType;
+
+ @override
+ void initState() {
+ super.initState();
+ _selectedType = widget.initialSelectedType; // 初期状態を設定
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return SizedBox(
+ width: MediaQuery.of(context).size.width * 0.8,
+ height: 50,
+ child: DropdownButton(
+ value: _selectedType, // 選択された状態を使用
+ items: const [
+ DropdownMenuItem(
+ value: BusType.BUS_TYPE_MORNING,
+ child: Text("行き"),
+ ),
+ DropdownMenuItem(
+ value: BusType.BUS_TYPE_EVENING,
+ child: Text("帰り"),
+ ),
+ ],
+ onChanged: (BusType? value) {
+ if (value != null) {
+ setState(() {
+ _selectedType = value; // 選択された値で更新
+ });
+ widget.onChanged(value); // 親ウィジェットに変更を通知
+ }
+ },
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/notification_page/notification_page.dart b/frontend/where_child_bus/lib/pages/notification_page/notification_page.dart
new file mode 100644
index 00000000..3733a369
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/notification_page/notification_page.dart
@@ -0,0 +1,24 @@
+import 'package:flutter/material.dart';
+
+class NotificationPage extends StatefulWidget {
+ const NotificationPage({super.key});
+
+ @override
+ State createState() => _NotificationPageState();
+}
+
+class _NotificationPageState extends State {
+ @override
+ Widget build(BuildContext context) {
+ return const Center(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Text(
+ '連絡情報設定',
+ ),
+ ],
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/register_page/register_page.dart b/frontend/where_child_bus/lib/pages/register_page/register_page.dart
new file mode 100644
index 00000000..367800b0
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/register_page/register_page.dart
@@ -0,0 +1,165 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/app.dart';
+import "dart:developer" as developer;
+import 'package:where_child_bus/util/api/nursery_create.dart';
+import 'package:where_child_bus/models/nursery_data.dart';
+import 'package:where_child_bus/util/validation/create_nursery_validation.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/nursery.pb.dart';
+import '../../models/create_nursery_error.dart';
+
+class RegisterPage extends StatefulWidget {
+ const RegisterPage({super.key});
+
+ @override
+ State createState() => _RegisterPageState();
+}
+
+class _RegisterPageState extends State {
+ final _nameController = TextEditingController();
+ final _emailController = TextEditingController();
+ final _phoneNumberController = TextEditingController();
+ final _addressController = TextEditingController();
+ final _passwordController = TextEditingController();
+ final _confirmPasswordController = TextEditingController();
+
+ CreateNurseryError? _createError;
+
+ @override
+ Widget build(BuildContext context) {
+ return GestureDetector(
+ onTap: () => FocusScope.of(context).unfocus(),
+ child: Scaffold(
+ appBar: AppBar(
+ title: const Text('新規登録'),
+ ),
+ resizeToAvoidBottomInset: true,
+ body: pageBody(),
+ ),
+ );
+ }
+
+ void register() async {
+ // フィールドが全て埋まっているか確認
+ if (!validateFields(
+ _nameController.text,
+ _emailController.text,
+ _phoneNumberController.text,
+ _addressController.text,
+ _passwordController.text,
+ _confirmPasswordController.text)) {
+ setState(() => _createError = CreateNurseryError.fieldsDoNotFilled);
+ return;
+ }
+
+ // メールアドレスが有効な形式かどうか確認
+ if (!validateEmailFormat(_emailController.text)) {
+ setState(() => _createError = CreateNurseryError.invalidEmail);
+ return;
+ }
+
+ // パスワードが一致しているかどうか確認
+ if (!validatePasswordsMatch(
+ _passwordController.text, _confirmPasswordController.text)) {
+ setState(() => _createError = CreateNurseryError.passwordsDoNotMatch);
+ return;
+ }
+
+ try {
+ CreateNurseryResponse res = await createNursery(
+ _emailController.text,
+ _passwordController.text,
+ _phoneNumberController.text,
+ _addressController.text,
+ _nameController.text,
+ );
+
+ NurseryData().setNursery(res.nursery);
+ Navigator.pushReplacement(
+ context,
+ MaterialPageRoute(
+ builder: (BuildContext context) => App(),
+ ),
+ );
+ } catch (err) {
+ developer.log("Caught error", error: err);
+ setState(() {
+ _createError = CreateNurseryError.unknown;
+ });
+ }
+ }
+
+ Widget pageBody() {
+ return SingleChildScrollView(
+ child: Center(
+ child: Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ const SizedBox(height: 32),
+ titleText(),
+ inputField(_nameController, '保育園名'),
+ inputField(_emailController, 'メールアドレス',
+ keyboardType: TextInputType.emailAddress),
+ inputField(_phoneNumberController, '電話番号',
+ keyboardType: TextInputType.phone),
+ inputField(_addressController, '住所'),
+ inputField(_passwordController, 'パスワード', isObscure: true),
+ inputField(_confirmPasswordController, 'パスワードの確認',
+ isObscure: true),
+ const SizedBox(height: 32),
+ if (_createError != null) errorMessage(_createError!),
+ registerButton(),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+
+ Widget titleText() => const Padding(
+ padding: EdgeInsets.only(bottom: 32),
+ child: Text('ほいくるーず',
+ style: TextStyle(fontSize: 32, fontWeight: FontWeight.bold)),
+ );
+
+ Widget inputField(TextEditingController controller, String label,
+ {TextInputType keyboardType = TextInputType.text,
+ bool isObscure = false}) =>
+ Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: TextField(
+ controller: controller,
+ decoration: InputDecoration(
+ border: const OutlineInputBorder(), labelText: label),
+ keyboardType: keyboardType,
+ obscureText: isObscure,
+ ),
+ );
+
+ Widget errorMessage(CreateNurseryError error) => Padding(
+ padding: const EdgeInsets.only(bottom: 16.0),
+ child: Text(
+ createNurseryErrorMessage(error),
+ style: const TextStyle(color: Colors.red),
+ ),
+ );
+
+ Widget registerButton() => SizedBox(
+ width: MediaQuery.of(context).size.width * 0.6,
+ child: ElevatedButton(onPressed: register, child: const Text('登録')),
+ );
+}
+
+String createNurseryErrorMessage(CreateNurseryError error) {
+ switch (error) {
+ case CreateNurseryError.passwordsDoNotMatch:
+ return "パスワードが一致していません";
+ case CreateNurseryError.fieldsDoNotFilled:
+ return "全てのフィールドを入力してください";
+ case CreateNurseryError.invalidEmail:
+ return "メールアドレスが有効な形式ではありません";
+ default:
+ return "不明なエラーです";
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/student_list_page/child_detail_sheet.dart b/frontend/where_child_bus/lib/pages/student_list_page/child_detail_sheet.dart
new file mode 100644
index 00000000..8857a8be
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/student_list_page/child_detail_sheet.dart
@@ -0,0 +1,172 @@
+import "dart:developer" as developer;
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/components/util/image_from_byte.dart';
+import 'package:where_child_bus/pages/student_list_page/child_edit_page.dart';
+import 'package:where_child_bus/service/get_guardians_list_by_child_id.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class StudentDetailSheet extends StatefulWidget {
+ final Child child;
+ final ChildPhoto image;
+
+ const StudentDetailSheet({Key? key, required this.child, required this.image})
+ : super(key: key);
+
+ @override
+ State createState() => _StudentDetailSheetState();
+}
+
+class _StudentDetailSheetState extends State {
+ late GuardianResponse guardian;
+ bool _isLoading = false;
+ bool _isFailLoading = false;
+
+ @override
+ void initState() {
+ super.initState();
+ _loadGuardian();
+ }
+
+ Future _loadGuardian() async {
+ setState(() {
+ _isLoading = true;
+ });
+
+ try {
+ var res = await getGuardianListByChildIdService(widget.child.id);
+
+ if (mounted) {
+ setState(() {
+ guardian = res;
+ _isLoading = false;
+ });
+ }
+ } catch (error) {
+ developer.log("Caught Error",
+ error: error, name: "StudentDetailSheetError");
+ if (mounted) {
+ setState(() {
+ _isLoading = false;
+ _isFailLoading = true;
+ });
+ }
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ padding: const EdgeInsets.all(30.0),
+ height: double.infinity,
+ decoration: const BoxDecoration(
+ color: Colors.white,
+ borderRadius: BorderRadius.only(
+ topLeft: Radius.circular(20.0), topRight: Radius.circular(20.0)),
+ ),
+ child: modalBody(context),
+ );
+ }
+
+ Widget modalBody(BuildContext context) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ modalHeader(context),
+ Container(
+ margin: const EdgeInsets.only(top: 20),
+ child: _isLoading
+ ? const Center(child: CircularProgressIndicator())
+ : _childDetailList())
+ ],
+ );
+ }
+
+ Widget modalHeader(BuildContext context) {
+ return Stack(children: [
+ Positioned(
+ right: -10,
+ top: -10,
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(shape: const CircleBorder()),
+ onPressed: () {
+ Navigator.of(context).push(MaterialPageRoute(
+ builder: (BuildContext context) => StudentEditPage(
+ child: widget.child,
+ isEdit: true,
+ )));
+ },
+ child: const Icon(Icons.edit),
+ ),
+ ),
+ childImageAndChildName(),
+ ]);
+ }
+
+ Widget childImageAndChildName() {
+ return Row(children: [
+ _childFaceImage(),
+ const SizedBox(
+ width: 50,
+ ),
+ Text(widget.child.name,
+ style: const TextStyle(color: Colors.black, fontSize: 24)),
+ ]);
+ }
+
+ Widget _childFaceImage() {
+ return ImageFromBytes(
+ imageData: widget.image.photoData, height: 100, width: 100);
+ }
+
+ Widget _childDetailList() {
+ if (_isLoading) {
+ return const Center(
+ child: CircularProgressIndicator(),
+ );
+ } else if (_isLoading == false && _isFailLoading) {
+ return const Text("ロードに失敗しました");
+ } else {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ _childDetailItem("年齢", "${widget.child.age}歳"),
+ // childDetailItem("クラス", "1組"),
+ _childDetailItem("保護者氏名", guardian.name),
+ _childDetailItem("保護者連絡先", guardian.phoneNumber),
+ _childDetailItem("利用バス", "○○コース"),
+ // childDetailItem("乗降場所", "○○駐車場前"),
+ ],
+ );
+ }
+ }
+
+ Widget _childDetailItem(String title, String element) {
+ return Padding(
+ padding: const EdgeInsets.all(4),
+ child: Row(
+ children: [
+ detailItemTitle(title),
+ const SizedBox(
+ width: 50,
+ ),
+ Text(element,
+ style: const TextStyle(color: Colors.black, fontSize: 18))
+ ],
+ ),
+ );
+ }
+
+ Widget detailItemTitle(String title) {
+ const double fontSize = 18;
+ return SizedBox(
+ width: fontSize * 6 + 6,
+ child: Text(
+ title,
+ style: const TextStyle(color: Colors.black, fontSize: fontSize),
+ textAlign: TextAlign.left,
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/student_list_page/child_edit_page.dart b/frontend/where_child_bus/lib/pages/student_list_page/child_edit_page.dart
new file mode 100644
index 00000000..f30507a2
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/student_list_page/child_edit_page.dart
@@ -0,0 +1,37 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+import 'components/utils/input_form_body.dart';
+
+class StudentEditPage extends StatefulWidget {
+ final Child? child;
+ final bool isEdit;
+
+ const StudentEditPage({super.key, this.child, required this.isEdit});
+
+ @override
+ State createState() => _StudentEditPageState();
+}
+
+class _StudentEditPageState extends State {
+ List guardiansList = [];
+
+ @override
+ void initState() {
+ super.initState();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return GestureDetector(
+ onTap: () => primaryFocus?.unfocus(),
+ child: Scaffold(
+ resizeToAvoidBottomInset: false,
+ appBar: AppBar(),
+ body: InputFormBody(
+ child: widget.child,
+ isEdit: widget.isEdit,
+ ),
+ ),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/student_list_page/child_list_page.dart b/frontend/where_child_bus/lib/pages/student_list_page/child_list_page.dart
new file mode 100644
index 00000000..c51c6ba9
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/student_list_page/child_list_page.dart
@@ -0,0 +1,114 @@
+import "dart:developer" as developer;
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:where_child_bus/components/child_list/child_list.dart';
+import 'package:where_child_bus/models/nursery_child_data.dart';
+import 'package:where_child_bus/pages/student_list_page/child_edit_page.dart';
+import 'package:where_child_bus/service/get_child_list_by_nursery_id.dart';
+import 'package:where_child_bus/models/nursery_data.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/child.pbgrpc.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class ChildListPage extends StatefulWidget {
+ const ChildListPage({
+ super.key,
+ });
+
+ @override
+ State createState() => _ChildListPageState();
+}
+
+class _ChildListPageState extends State {
+ List children = [];
+ List photos = [];
+ bool _isLoading = false;
+ bool _isFailLoading = false;
+
+ @override
+ void initState() {
+ super.initState();
+ _loadChildren();
+ }
+
+ Future _fetchChildren() async {
+ if (mounted) {
+ setState(() {
+ _isLoading = true;
+ });
+ }
+
+ try {
+ GetChildListByNurseryIDResponse res =
+ await getChildListByNurseryIdService(NurseryData().getNursery().id);
+ NurseryChildListData().setChildListResponse(res);
+ if (mounted) {
+ setState(() {
+ children = res.children;
+ photos = res.photos;
+ _isLoading = false;
+ });
+ }
+ } catch (error) {
+ if (kDebugMode) {
+ developer.log("子供のロード中にエラーが発生しました", error: error);
+ }
+
+ if (mounted) {
+ setState(() {
+ _isLoading = false;
+ _isFailLoading = true;
+ });
+ }
+ }
+ }
+
+ Future _loadChildren() async {
+ _isLoading = true;
+
+ // If the child list is already loaded, use it
+ if (NurseryChildListData().getChildList().isNotEmpty) {
+ if (mounted) {
+ setState(() {
+ children = NurseryChildListData().getChildList();
+ photos = NurseryChildListData().getPhotos();
+ _isLoading = false;
+ });
+ }
+ return;
+ } else {
+ await _fetchChildren();
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ body: pageBody(),
+ floatingActionButton: FloatingActionButton(
+ onPressed: () {
+ Navigator.of(context).push(MaterialPageRoute(
+ builder: (BuildContext context) => const StudentEditPage(
+ isEdit: false,
+ )));
+ },
+ child: const Icon(Icons.add),
+ ),
+ );
+ }
+
+ Widget pageBody() {
+ if (_isLoading) {
+ return const Center(
+ child: CircularProgressIndicator(),
+ );
+ } else if (_isFailLoading) {
+ return const Center(
+ child: Text('Failed to load children.'),
+ );
+ } else {
+ return RefreshIndicator(
+ onRefresh: _fetchChildren,
+ child: ChildList(children: children, images: photos));
+ }
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/student_list_page/components/bus_select_value_box.dart b/frontend/where_child_bus/lib/pages/student_list_page/components/bus_select_value_box.dart
new file mode 100644
index 00000000..724e4585
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/student_list_page/components/bus_select_value_box.dart
@@ -0,0 +1,35 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class BusSelectedValueBox extends StatefulWidget {
+ final List lists;
+ Bus? selectedValue;
+ Function(Bus?)? onChanged;
+
+ BusSelectedValueBox(
+ {required this.lists, super.key, this.selectedValue, this.onChanged});
+ @override
+ State createState() => _SelectValueBox();
+}
+
+class _SelectValueBox extends State {
+ @override
+ Widget build(BuildContext context) {
+ return SizedBox(
+ width: MediaQuery.of(context).size.width * 0.8,
+ height: 50,
+ child: DropdownButton(
+ value: widget.selectedValue ?? widget.lists.first,
+ items: widget.lists
+ .map((Bus list) =>
+ DropdownMenuItem(value: list, child: Text(list.name)))
+ .toList(),
+ onChanged: (Bus? value) {
+ setState(() {
+ widget.selectedValue = value;
+ });
+ widget.onChanged?.call(value);
+ }),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/student_list_page/components/guardian_select_value_box.dart b/frontend/where_child_bus/lib/pages/student_list_page/components/guardian_select_value_box.dart
new file mode 100644
index 00000000..18dd73d5
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/student_list_page/components/guardian_select_value_box.dart
@@ -0,0 +1,35 @@
+import 'package:flutter/material.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+class GuardianSelectValueBox extends StatefulWidget {
+ final List lists;
+ GuardianResponse? selectedValue;
+ Function? onChanged;
+
+ GuardianSelectValueBox(
+ {required this.lists, super.key, this.selectedValue, this.onChanged});
+ @override
+ State createState() => _SelectValueBox();
+}
+
+class _SelectValueBox extends State {
+ @override
+ Widget build(BuildContext context) {
+ return SizedBox(
+ width: MediaQuery.of(context).size.width * 0.8,
+ height: 50,
+ child: DropdownButton(
+ value: widget.selectedValue ?? widget.lists.first,
+ items: widget.lists
+ .map((GuardianResponse list) =>
+ DropdownMenuItem(value: list, child: Text(list.name)))
+ .toList(),
+ onChanged: (GuardianResponse? value) {
+ setState(() {
+ widget.selectedValue = value;
+ });
+ widget.onChanged?.call(value);
+ }),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/student_list_page/components/utils/input_form_body.dart b/frontend/where_child_bus/lib/pages/student_list_page/components/utils/input_form_body.dart
new file mode 100644
index 00000000..b02a3f38
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/student_list_page/components/utils/input_form_body.dart
@@ -0,0 +1,333 @@
+import 'dart:developer' as developer;
+import 'dart:io';
+import 'package:flutter/material.dart';
+import 'package:image_picker/image_picker.dart';
+import 'package:where_child_bus/models/nursery_bus_data.dart';
+import 'package:where_child_bus/models/nursery_guardian_data.dart';
+import 'package:where_child_bus/pages/camera_page/widgets/bus_select_box.dart';
+import 'package:where_child_bus/pages/student_list_page/components/guardian_select_value_box.dart';
+import 'package:where_child_bus/service/get_bus_list_by_nursery_id.dart';
+import 'package:where_child_bus/service/get_guardian_list_by_nursery_id.dart';
+import 'package:where_child_bus/models/nursery_data.dart';
+import 'package:where_child_bus/util/api/child.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+import '../../../../components/util/input_value_label.dart';
+import 'text_input_field.dart';
+import '../../../../components/util/select_value_box.dart';
+import 'submit_button.dart';
+
+class InputFormBody extends StatefulWidget {
+ final Child? child;
+ final bool isEdit;
+
+ const InputFormBody({Key? key, this.child, required this.isEdit})
+ : super(key: key);
+
+ @override
+ State createState() => _InputFormBodyState();
+}
+
+class _InputFormBodyState extends State {
+ final TextEditingController _nameController = TextEditingController();
+ final TextEditingController _ageController = TextEditingController();
+ late Future _loadDataFuture; // 非同期処理の結果を保持する変数
+ bool _isCreatingChild = false;
+ List guardians = [];
+ List buses = [];
+ List? images;
+ final picker = ImagePicker();
+
+ Sex? selectedSex;
+ GuardianResponse? selectedGuardian;
+
+ @override
+ void initState() {
+ super.initState();
+ if (widget.child != null) {
+ _nameController.text = widget.child!.name;
+ _ageController.text = widget.child!.age.toString();
+ }
+ _loadDataFuture = _loadBusesAndGuardians();
+ }
+
+ Future _loadBusesAndGuardians() async {
+ try {
+ await _loadGuardians();
+ await _loadBuses();
+ if (widget.isEdit == false) {
+ _onGuardianSelected(guardians[0]);
+ _onSexSelected("男");
+ }
+ } catch (error) {
+ developer.log("Caught Error", error: error.toString());
+ }
+ }
+
+ Future _loadGuardians() async {
+ try {
+ var res = await getGuardianListByNurseryIdService(
+ NurseryData().getNursery().id);
+ NurseryGuardianData().setGuardianListResponse(res);
+ setState(() {
+ guardians = NurseryGuardianData().getGuardianList();
+ });
+ } catch (error) {
+ developer.log("Caught Error", error: error.toString());
+ setState(() {
+ guardians = [];
+ });
+ }
+ }
+
+ Future _loadBuses() async {
+ try {
+ var res = await getBusList(NurseryData().getNursery().id);
+ NurseryBusData().setBusListResponse(res);
+ setState(() {
+ buses = NurseryBusData().getBusList();
+ });
+ } catch (error) {
+ developer.log("Caught Error", error: error.toString());
+ setState(() {
+ buses = [];
+ });
+ }
+ }
+
+ Future _createChild() async {
+ if (selectedGuardian == null || selectedSex == null) {
+ developer.log("保護者、利用バス、性別が選択されていません。");
+ return;
+ }
+ if (_nameController.text.isEmpty || _ageController.text.isEmpty) {
+ developer.log("園児氏名、年齢が入力されていません。");
+ return;
+ }
+ if (images == null || images!.isEmpty) {
+ developer.log("画像が選択されていません。");
+ return;
+ }
+
+ try {
+ if (mounted) {
+ setState(() {
+ _isCreatingChild = true;
+ });
+ }
+ var photos = images!.map((file) => file.readAsBytesSync()).toList();
+ var res = await createChild(
+ NurseryData().getNursery().id,
+ selectedGuardian!.id,
+ _nameController.text,
+ int.parse(_ageController.text),
+ selectedSex!,
+ photos);
+ developer.log("園児情報の登録が完了しました。$res");
+ Navigator.pop(context);
+ } catch (error) {
+ developer.log("Caught Error", error: error.toString());
+ } finally {
+ if (mounted) {
+ setState(() {
+ _isCreatingChild = false;
+ });
+ }
+ }
+ }
+
+ Future _getImageFromGallery() async {
+ final pickedFiles = await picker.pickMultiImage();
+
+ setState(() {
+ if (pickedFiles.isNotEmpty) {
+ images = pickedFiles.map((xFile) => File(xFile.path)).toList();
+ } else {
+ developer.log("画像が選択できませんでした。");
+ }
+ });
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Center(
+ child: ListView(
+ children: [
+ selectChildImage(),
+ FutureBuilder(
+ future: _loadDataFuture, // 修正: 非同期処理の結果を格納した変数を使用
+ builder: (context, snapshot) {
+ if (snapshot.connectionState == ConnectionState.waiting) {
+ return const Padding(
+ padding: EdgeInsets.all(16),
+ child: Center(child: CircularProgressIndicator()),
+ );
+ } else if (snapshot.hasError) {
+ return const Text("保護者情報の読み込みに失敗しました。");
+ } else {
+ // 非同期処理が完了し、データがある場合
+ return editFormBody(context);
+ }
+ },
+ ),
+ ],
+ ),
+ );
+ }
+
+ Widget selectChildImage() {
+ return Column(
+ children: [
+ Wrap(
+ spacing: 8.0,
+ runSpacing: 4.0,
+ children: images == null || images!.isEmpty
+ ? [const Text("画像が選択されていません。")]
+ : images!
+ .map((image) => Image.file(
+ image,
+ width: 100,
+ height: 100,
+ ))
+ .toList(),
+ ),
+ Center(
+ child: ElevatedButton(
+ onPressed: _getImageFromGallery,
+ child: const Text("画像を選択する"),
+ ))
+ ],
+ );
+ }
+
+ void _onSexSelected(String? value) {
+ if (value == "男") {
+ selectedSex = Sex.SEX_MAN;
+ } else if (value == "女") {
+ selectedSex = Sex.SEX_WOMAN;
+ } else {
+ selectedSex = Sex.SEX_OTHER;
+ }
+ }
+
+ void _onGuardianSelected(GuardianResponse? value) {
+ selectedGuardian = value;
+ }
+
+ Widget editFormBody(
+ BuildContext context,
+ ) {
+ return Column(
+ children: [
+ _createInputLabelAndTextField(context, "園児氏名", "園児氏名を入力してください",
+ TextInputType.name, _nameController),
+ _createInputLabelAndTextField(
+ context, "年齢", "年齢を入力してください", TextInputType.number, _ageController),
+ _createSexInputLabelAndSelectBox(
+ context,
+ "性別",
+ ["男", "女", "その他"],
+ _onSexSelected,
+ ),
+ _createGuardianInputLabelAndSelectBox(
+ context,
+ "保護者",
+ guardians,
+ _onGuardianSelected,
+ ),
+ Container(
+ margin: const EdgeInsets.only(top: 20.0),
+ width: MediaQuery.of(context).size.width * 0.6,
+ child: submitButton(),
+ )
+ ],
+ );
+ }
+
+ Widget _createInputLabelAndTextField(BuildContext context, String label,
+ String hintText, TextInputType type, TextEditingController controller) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ InputValueLabel(label: label),
+ TextInputField(
+ hintText: hintText,
+ type: type,
+ controller: controller,
+ )
+ ],
+ );
+ }
+
+ Widget _createSexInputLabelAndSelectBox(BuildContext context, String label,
+ List lists, Function? onChanged) {
+ String selected = "男";
+ if (widget.isEdit) {
+ switch (widget.child!.sex) {
+ case Sex.SEX_MAN:
+ selected = "男";
+ break;
+ case Sex.SEX_WOMAN:
+ selected = "女";
+ break;
+ default:
+ selected = "その他";
+ }
+ }
+
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ InputValueLabel(label: label),
+ SelectValueBox(
+ lists: lists,
+ onChanged: onChanged,
+ selectedValue: selected,
+ ),
+ ],
+ );
+ }
+
+ Widget _createGuardianInputLabelAndSelectBox(BuildContext context,
+ String label, List lists, Function? onChanged) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ InputValueLabel(label: label),
+ GuardianSelectValueBox(
+ lists: lists,
+ onChanged: onChanged,
+ selectedValue: widget.isEdit
+ ? guardians.firstWhere(
+ (guardian) => guardian.id == widget.child!.guardianId)
+ : null,
+ ),
+ ],
+ );
+ }
+
+ Widget _createBusInputLabelAndSelectBox(BuildContext context, String label,
+ List lists, Function(Bus?) onChanged) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ InputValueLabel(label: label),
+ BusSelectValueBox(
+ busLists: lists,
+ onChanged: onChanged,
+ //TODO: 修正: 選択されたバスを初期値として設定
+ ),
+ ],
+ );
+ }
+
+ Widget submitButton() {
+ return _isCreatingChild
+ ? const Center(
+ child: CircularProgressIndicator(),
+ )
+ : SubmitButton(
+ onPressed: widget.isEdit
+ ? () => developer.log("UnImplemented", name: "updateChild")
+ : _createChild);
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/student_list_page/components/utils/submit_button.dart b/frontend/where_child_bus/lib/pages/student_list_page/components/utils/submit_button.dart
new file mode 100644
index 00000000..3040de83
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/student_list_page/components/utils/submit_button.dart
@@ -0,0 +1,16 @@
+import 'package:flutter/material.dart';
+
+class SubmitButton extends StatelessWidget {
+ final VoidCallback onPressed;
+
+ const SubmitButton({required this.onPressed, super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ return ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ backgroundColor: Colors.black, foregroundColor: Colors.white),
+ onPressed: onPressed,
+ child: const Text("保存"));
+ }
+}
diff --git a/frontend/where_child_bus/lib/pages/student_list_page/components/utils/text_input_field.dart b/frontend/where_child_bus/lib/pages/student_list_page/components/utils/text_input_field.dart
new file mode 100644
index 00000000..0bce16f6
--- /dev/null
+++ b/frontend/where_child_bus/lib/pages/student_list_page/components/utils/text_input_field.dart
@@ -0,0 +1,33 @@
+import 'package:flutter/material.dart';
+
+class TextInputField extends StatelessWidget {
+ final String hintText;
+ final TextInputType type;
+ final TextEditingController controller;
+
+ const TextInputField(
+ {required this.hintText,
+ required this.type,
+ required this.controller,
+ super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ return SizedBox(
+ width: MediaQuery.of(context).size.width * 0.8,
+ height: 40,
+ child: TextField(
+ decoration: formInputDecoration(hintText),
+ keyboardType: type,
+ controller: controller,
+ ));
+ }
+
+ InputDecoration formInputDecoration(String hintText) {
+ return InputDecoration(
+ hintText: hintText,
+ hintStyle: const TextStyle(fontSize: 13),
+ border: const OutlineInputBorder(),
+ );
+ }
+}
diff --git a/frontend/where_child_bus/lib/service/check_child_in_bus.dart b/frontend/where_child_bus/lib/service/check_child_in_bus.dart
new file mode 100644
index 00000000..917105fd
--- /dev/null
+++ b/frontend/where_child_bus/lib/service/check_child_in_bus.dart
@@ -0,0 +1,12 @@
+import 'package:where_child_bus/util/api/child.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/child.pb.dart';
+
+Future checkIsChildInBusService(
+ String childId) async {
+ try {
+ var res = await checkIsChildInBus(childId);
+ return res;
+ } catch (error) {
+ return Future.error(error);
+ }
+}
diff --git a/frontend/where_child_bus/lib/service/create_bus.dart b/frontend/where_child_bus/lib/service/create_bus.dart
new file mode 100644
index 00000000..3a27f49e
--- /dev/null
+++ b/frontend/where_child_bus/lib/service/create_bus.dart
@@ -0,0 +1,24 @@
+import 'package:where_child_bus/util/api/bus.dart';
+import 'package:where_child_bus/util/api/busRoute.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/bus.pbgrpc.dart';
+
+Future createBusService(
+ String nurseryId,
+ String name,
+ String plateNumber,
+ Iterable morningGuardianIds,
+ Iterable eveningGuardianIds) async {
+ try {
+ var res = await createBus(nurseryId, name, plateNumber);
+ if (morningGuardianIds.isNotEmpty) {
+ await createMorningBusRoute(
+ res.bus, nurseryId, morningGuardianIds, eveningGuardianIds);
+ } else if (eveningGuardianIds.isNotEmpty) {
+ await createEveningBusRoute(
+ res.bus, nurseryId, morningGuardianIds, eveningGuardianIds);
+ }
+ return res;
+ } catch (error) {
+ return Future.error(error);
+ }
+}
diff --git a/frontend/where_child_bus/lib/service/get_bus_list_by_nursery_id.dart b/frontend/where_child_bus/lib/service/get_bus_list_by_nursery_id.dart
new file mode 100644
index 00000000..bc91c7ef
--- /dev/null
+++ b/frontend/where_child_bus/lib/service/get_bus_list_by_nursery_id.dart
@@ -0,0 +1,12 @@
+import 'package:where_child_bus/util/api/bus.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/bus.pb.dart';
+
+Future getBusList(String nurseryId) async {
+ try {
+ GetBusListByNurseryIdResponse busListResponse =
+ await getBusListByNurseryId(nurseryId);
+ return busListResponse;
+ } catch (error) {
+ return Future.error(error);
+ }
+}
diff --git a/frontend/where_child_bus/lib/service/get_child_list_by_bus_id.dart b/frontend/where_child_bus/lib/service/get_child_list_by_bus_id.dart
new file mode 100644
index 00000000..22c3668a
--- /dev/null
+++ b/frontend/where_child_bus/lib/service/get_child_list_by_bus_id.dart
@@ -0,0 +1,12 @@
+import 'package:where_child_bus/util/api/child.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/child.pbgrpc.dart';
+
+Future getChildListByBusIDService(
+ String busID) async {
+ try {
+ var res = await getChildListByBusId(busID);
+ return res;
+ } catch (error) {
+ return Future.error(error);
+ }
+}
diff --git a/frontend/where_child_bus/lib/service/get_child_list_by_nursery_id.dart b/frontend/where_child_bus/lib/service/get_child_list_by_nursery_id.dart
new file mode 100644
index 00000000..a498ae75
--- /dev/null
+++ b/frontend/where_child_bus/lib/service/get_child_list_by_nursery_id.dart
@@ -0,0 +1,8 @@
+import 'package:where_child_bus/util/api/child.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/child.pbgrpc.dart';
+
+Future getChildListByNurseryIdService(
+ String nurseryId) async {
+ var res = await getChildListByNurseryId(nurseryId);
+ return res;
+}
diff --git a/frontend/where_child_bus/lib/service/get_guardian_list_by_nursery_id.dart b/frontend/where_child_bus/lib/service/get_guardian_list_by_nursery_id.dart
new file mode 100644
index 00000000..7ff1b00c
--- /dev/null
+++ b/frontend/where_child_bus/lib/service/get_guardian_list_by_nursery_id.dart
@@ -0,0 +1,8 @@
+import 'package:where_child_bus/util/api/guardians.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/guardian.pbgrpc.dart';
+
+Future getGuardianListByNurseryIdService(
+ String nurseryId) async {
+ var res = await getGuardiansListByNurseryId(nurseryId);
+ return res;
+}
diff --git a/frontend/where_child_bus/lib/service/get_guardians_list_by_bus_id.dart b/frontend/where_child_bus/lib/service/get_guardians_list_by_bus_id.dart
new file mode 100644
index 00000000..135acb3c
--- /dev/null
+++ b/frontend/where_child_bus/lib/service/get_guardians_list_by_bus_id.dart
@@ -0,0 +1,14 @@
+import "dart:developer" as developer;
+import 'package:where_child_bus/util/api/guardians.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/guardian.pbgrpc.dart';
+
+Future getGuardiansListByBusIdService(
+ String busId) async {
+ try {
+ var res = await getGuardiansListByBusId(busId);
+ return res;
+ } catch (error) {
+ developer.log("Caught Error:", error: error);
+ return Future.error(error);
+ }
+}
diff --git a/frontend/where_child_bus/lib/service/get_guardians_list_by_child_id.dart b/frontend/where_child_bus/lib/service/get_guardians_list_by_child_id.dart
new file mode 100644
index 00000000..798daa20
--- /dev/null
+++ b/frontend/where_child_bus/lib/service/get_guardians_list_by_child_id.dart
@@ -0,0 +1,13 @@
+import "dart:developer" as developer;
+import "package:where_child_bus/util/api/guardians.dart";
+import "package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart";
+
+Future getGuardianListByChildIdService(String childId) async {
+ try {
+ var res = await getGuardiansListByChildId(childId);
+ return res.guardian;
+ } catch (error) {
+ developer.log("Caught Error:", error: error);
+ return Future.error(error);
+ }
+}
diff --git a/frontend/where_child_bus/lib/service/update_bus.dart b/frontend/where_child_bus/lib/service/update_bus.dart
new file mode 100644
index 00000000..1655d223
--- /dev/null
+++ b/frontend/where_child_bus/lib/service/update_bus.dart
@@ -0,0 +1,24 @@
+import 'package:where_child_bus/util/api/bus.dart';
+import 'package:where_child_bus/util/api/busRoute.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/bus.pbgrpc.dart';
+
+Future updateBusService(
+ String nurseryId,
+ String name,
+ String plateNumber,
+ Iterable morningGuardianIds,
+ Iterable eveningGuardianIds) async {
+ try {
+ var res = await updateBus(nurseryId, name, plateNumber);
+ if (morningGuardianIds.isNotEmpty) {
+ await createMorningBusRoute(
+ res.bus, nurseryId, morningGuardianIds, eveningGuardianIds);
+ } else if (eveningGuardianIds.isNotEmpty) {
+ await createEveningBusRoute(
+ res.bus, nurseryId, morningGuardianIds, eveningGuardianIds);
+ }
+ return res;
+ } catch (error) {
+ return Future.error(error);
+ }
+}
diff --git a/frontend/where_child_bus/lib/service/update_bus_status.dart b/frontend/where_child_bus/lib/service/update_bus_status.dart
new file mode 100644
index 00000000..02c6e484
--- /dev/null
+++ b/frontend/where_child_bus/lib/service/update_bus_status.dart
@@ -0,0 +1,16 @@
+import 'dart:async';
+import 'dart:developer' as developer;
+import 'package:where_child_bus/util/api/bus.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/bus.pbgrpc.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+Future updateBusStatusService(
+ String busId, BusStatus busStatus) async {
+ try {
+ var res = updateBusStatus(busId, busStatus);
+ return res;
+ } catch (error) {
+ developer.log("Caught Error:", error: error);
+ return Future.error(error);
+ }
+}
diff --git a/frontend/where_child_bus/lib/util/api/bus.dart b/frontend/where_child_bus/lib/util/api/bus.dart
new file mode 100644
index 00000000..2c4aeace
--- /dev/null
+++ b/frontend/where_child_bus/lib/util/api/bus.dart
@@ -0,0 +1,139 @@
+import "dart:developer" as developer;
+import "package:flutter/foundation.dart";
+import "package:grpc/grpc.dart";
+import "package:where_child_bus/config/config.dart";
+import "package:where_child_bus_api/proto-gen/google/protobuf/field_mask.pb.dart";
+import "package:where_child_bus_api/proto-gen/where_child_bus/v1/bus.pbgrpc.dart";
+import "package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart";
+
+Future performGrpcCall(
+ Future Function(BusServiceClient) grpcCall) async {
+ final channel = ClientChannel(
+ appConfig.grpcEndpoint,
+ port: appConfig.grpcPort,
+ );
+ final grpcClient = BusServiceClient(channel);
+
+ try {
+ final result = await grpcCall(grpcClient);
+ if (kDebugMode) {
+ developer.log("レスポンス: $result");
+ }
+ return result;
+ } catch (error) {
+ developer.log("Caught Error:", error: error);
+ return Future.error(error);
+ } finally {
+ await channel.shutdown();
+ }
+}
+
+Future getBusListByNurseryId(
+ String nurseryId) async {
+ return performGrpcCall((client) async {
+ var req = GetBusListByNurseryIdRequest(nurseryId: nurseryId);
+ return client.getBusListByNurseryId(req);
+ });
+}
+
+Future createBus(
+ String nurseryId,
+ String name,
+ String plateNumber,
+) async {
+ return await performGrpcCall((client) async {
+ var req = CreateBusRequest(
+ nurseryId: nurseryId,
+ name: name,
+ plateNumber: plateNumber,
+ );
+ return client.createBus(req);
+ });
+}
+
+Future updateBus(
+ String busId, String busName, String plateNumber) async {
+ return await performGrpcCall((client) async {
+ var req = UpdateBusRequest(
+ busId: busId,
+ name: busName,
+ plateNumber: plateNumber,
+ updateMask: FieldMask()
+ ..paths.add("name")
+ ..paths.add("plate_number")
+ ..paths.add("bus_id"),
+ );
+ return client.updateBus(req);
+ });
+}
+
+Future updateBusStatus(
+ String busId, BusStatus busStatus) async {
+ DateTime now = DateTime.now();
+ BusType busType;
+ if (now.hour < 12) {
+ busType = BusType.BUS_TYPE_MORNING;
+ } else {
+ busType = BusType.BUS_TYPE_EVENING;
+ }
+ return performGrpcCall((client) async {
+ var req = ChangeBusStatusRequest(
+ busId: busId,
+ busStatus: busStatus,
+ busType: busType,
+ );
+ developer.log("Request: $req");
+ return client.changeBusStatus(req);
+ });
+}
+
+Future updateNextStation(
+ String busId,
+ String nextStationId,
+) async {
+ FieldMask updateMask = FieldMask()..paths.add("next_station_id");
+ final channel = ClientChannel(
+ appConfig.grpcEndpoint,
+ port: appConfig.grpcPort,
+ );
+ final grpcClient = BusServiceClient(channel);
+
+ try {
+ var req = UpdateBusRequest(
+ busId: busId,
+ nextStationId: nextStationId,
+ updateMask: updateMask,
+ );
+ var res = await grpcClient.updateBus(req);
+ developer.log("Request: $req", name: "updateNextStation");
+ developer.log("Response: $res", name: "updateNextStation");
+ return res;
+ } catch (error) {
+ developer.log("Caught Error:", error: error, name: "updateNextStation");
+ return Future.error(error);
+ } finally {
+ await channel.shutdown();
+ }
+}
+
+Future streamBusVideo(Stream requestStream) async {
+ final channel = ClientChannel(
+ appConfig.grpcEndpoint,
+ port: appConfig.grpcPort,
+ options: const ChannelOptions(),
+ );
+ final grpcClient = BusServiceClient(channel);
+ developer.log("ServiceClient created");
+ final res = grpcClient.streamBusVideo(requestStream);
+
+ try {
+ developer.log("Streamed video to server");
+ await for (var response in res) {
+ developer.log("Received response: $response");
+ }
+ } catch (error) {
+ developer.log("Caught Error:", error: error.toString());
+ } finally {
+ await channel.shutdown();
+ }
+}
diff --git a/frontend/where_child_bus/lib/util/api/busRoute.dart b/frontend/where_child_bus/lib/util/api/busRoute.dart
new file mode 100644
index 00000000..5ed3f61e
--- /dev/null
+++ b/frontend/where_child_bus/lib/util/api/busRoute.dart
@@ -0,0 +1,76 @@
+import 'package:grpc/grpc.dart';
+import 'package:where_child_bus/config/config.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/bus_route.pbgrpc.dart';
+import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';
+
+Future createMorningBusRoute(
+ Bus bus,
+ String nurseryId,
+ Iterable morningGuardianIds,
+ Iterable eveningGuardianIds) async {
+ try {
+ final channel = ClientChannel(
+ appConfig.grpcEndpoint,
+ port: appConfig.grpcPort,
+ );
+
+ final grpcClient = BusRouteServiceClient(channel);
+
+ var req = CreateBusRouteRequest(
+ busId: bus.id,
+ busType: BusType.BUS_TYPE_MORNING,
+ nurseryId: nurseryId,
+ guardianIds: morningGuardianIds,
+ );
+
+ var res = await grpcClient.createBusRoute(req);
+ return res;
+ } catch (error) {
+ return Future.error(error);
+ }
+}
+
+Future createEveningBusRoute(
+ Bus bus,
+ String nurseryId,
+ Iterable morningGuardianIds,
+ Iterable eveningGuardianIds) async {
+ try {
+ final channel = ClientChannel(
+ appConfig.grpcEndpoint,
+ port: appConfig.grpcPort,
+ );
+
+ final grpcClient = BusRouteServiceClient(channel);
+
+ var req = CreateBusRouteRequest(
+ busId: bus.id,
+ busType: BusType.BUS_TYPE_EVENING,
+ nurseryId: nurseryId,
+ guardianIds: morningGuardianIds,
+ );
+
+ var res = await grpcClient.createBusRoute(req);
+ return res;
+ } catch (error) {
+ return Future.error(error);
+ }
+}
+
+Future getBusRouteByBusId(
+ String busId, BusType busType) async {
+ final channel = ClientChannel(
+ appConfig.grpcEndpoint,
+ port: appConfig.grpcPort,
+ );
+
+ final grpcClient = BusRouteServiceClient(channel);
+
+ var req = GetBusRouteByBusIDRequest(
+ busId: busId,
+ busType: busType,
+ );
+
+ var res = await grpcClient.getBusRouteByBusID(req);
+ return res;
+}
diff --git a/frontend/where_child_bus/lib/util/api/child.dart b/frontend/where_child_bus/lib/util/api/child.dart
new file mode 100644
index 00000000..c2b37a16
--- /dev/null
+++ b/frontend/where_child_bus/lib/util/api/child.dart
@@ -0,0 +1,90 @@
+import "dart:developer" as developer;
+
+import "package:flutter/foundation.dart";
+import "package:grpc/grpc.dart";
+import "package:where_child_bus/config/config.dart";
+import "package:where_child_bus_api/proto-gen/google/protobuf/field_mask.pb.dart";
+import "package:where_child_bus_api/proto-gen/where_child_bus/v1/child.pbgrpc.dart";
+import "package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart";
+
+Future performGrpcCall(
+ Future Function(ChildServiceClient) grpcCall) async {
+ final channel = ClientChannel(
+ appConfig.grpcEndpoint,
+ port: appConfig.grpcPort,
+ );
+ final grpcClient = ChildServiceClient(channel);
+ final Stopwatch stopwatch = Stopwatch()..start();
+
+ try {
+ final result = await grpcCall(grpcClient);
+ stopwatch.stop();
+
+ if (kDebugMode) {
+ developer.log("レスポンスが返ってきました: ${stopwatch.elapsedMilliseconds}ms");
+ }
+ return result;
+ } catch (error) {
+ developer.log("Caught Error:", error: error);
+ return Future.error(error);
+ } finally {
+ await channel.shutdown();
+ }
+}
+
+Future getChildListByNurseryId(
+ String nurseryId) async {
+ return performGrpcCall((client) async {
+ var req = GetChildListByNurseryIDRequest(nurseryId: nurseryId);
+ return client.getChildListByNurseryID(req);
+ });
+}
+
+Future createChild(String nurseryId, String guardianId,
+ String name, int age, Sex sex, Iterable> photos) async {
+ return performGrpcCall((client) async {
+ var req = CreateChildRequest(
+ nurseryId: nurseryId,
+ guardianId: guardianId,
+ name: name,
+ age: age,
+ sex: sex,
+ photos: photos);
+ return client.createChild(req);
+ });
+}
+
+Future