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 updateChild( + String id, + String nurseryId, + String guardianId, + String name, + int age, + Sex sex, + FieldMask updateMask, +) async { + return performGrpcCall((client) async { + var req = UpdateChildRequest( + childId: id, + name: name, + age: age, + sex: sex, + updateMask: updateMask, + ); + return client.updateChild(req); + }); +} + +Future getChildListByBusId(String busId) async { + return performGrpcCall((client) async { + var req = GetChildListByBusIDRequest(busId: busId); + return client.getChildListByBusID(req); + }); +} + +Future checkIsChildInBus(String childId) async { + return performGrpcCall((client) async { + var req = CheckIsChildInBusRequest(childId: childId); + return client.checkIsChildInBus(req); + }); +} diff --git a/frontend/where_child_bus/lib/util/api/guardians.dart b/frontend/where_child_bus/lib/util/api/guardians.dart new file mode 100644 index 00000000..65d303c4 --- /dev/null +++ b/frontend/where_child_bus/lib/util/api/guardians.dart @@ -0,0 +1,51 @@ +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/where_child_bus/v1/guardian.pbgrpc.dart"; + +Future performGrpcCall( + Future Function(GuardianServiceClient) grpcCall) async { + final channel = ClientChannel( + appConfig.grpcEndpoint, + port: appConfig.grpcPort, + ); + final grpcClient = GuardianServiceClient(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 getGuardiansListByBusId( + String busId) async { + return performGrpcCall((client) async { + var req = GetGuardianListByBusIdRequest(busId: busId); + return client.getGuardianListByBusId(req); + }); +} + +Future getGuardiansListByChildId( + String childId) async { + return performGrpcCall((client) async { + var req = GetGuardianByChildIdRequest(childId: childId); + return client.getGuardianByChildId(req); + }); +} + +Future getGuardiansListByNurseryId( + String nurseryId) async { + return performGrpcCall((client) async { + var req = GetGuardianListByNurseryIdRequest(nurseryId: nurseryId); + return client.getGuardianListByNurseryId(req); + }); +} diff --git a/frontend/where_child_bus/lib/util/api/health_check.dart b/frontend/where_child_bus/lib/util/api/health_check.dart new file mode 100644 index 00000000..1a4ed81b --- /dev/null +++ b/frontend/where_child_bus/lib/util/api/health_check.dart @@ -0,0 +1,28 @@ +import 'dart:async'; +import 'dart:developer' as developer; // エラーログに使用 +import 'package:grpc/grpc.dart'; +import "package:where_child_bus_api/proto-gen/where_child_bus/v1/health_check.pbgrpc.dart"; +import 'package:where_child_bus/config/config.dart'; + +Future serviceHealthCheck() async { + final channel = ClientChannel( + appConfig.grpcEndpoint, + port: appConfig.grpcPort, + ); + + final grpcClient = HealthcheckServiceClient(channel, + options: CallOptions(timeout: const Duration(seconds: 60))); + + try { + var rqst = PingRequest(); + rqst.name = "ping"; + PingResponse res = await grpcClient.ping(rqst); + developer.log(res.message); + await channel.shutdown(); + return res; + } catch (error) { + developer.log('Caught error: $error'); + await channel.shutdown(); + return Future.error(error); + } +} diff --git a/frontend/where_child_bus/lib/util/api/nursery_create.dart b/frontend/where_child_bus/lib/util/api/nursery_create.dart new file mode 100644 index 00000000..13de605f --- /dev/null +++ b/frontend/where_child_bus/lib/util/api/nursery_create.dart @@ -0,0 +1,56 @@ +import "dart:async"; +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/where_child_bus/v1/nursery.pbgrpc.dart"; + +Future createNursery(String email, String password, + String phoneNumber, String address, String name) async { + final channel = ClientChannel( + appConfig.grpcEndpoint, + port: appConfig.grpcPort, + options: const ChannelOptions(), + ); + + final grpcClient = NurseryServiceClient(channel); + + try { + var req = CreateNurseryRequest( + email: email, + password: password, + phoneNumber: phoneNumber, + address: address, + name: name, + ); + + if (kDebugMode) { + developer.log("リクエスト: $req"); + } + + var res = await grpcClient.createNursery(req); + if (kDebugMode) { + developer.log("レスポンス: $res"); + } + return res; + } catch (e) { + if (e is GrpcError) { + // 特定のGrpcErrorに対してカスタマイズされた処理を行う + developer.log("gRPCエラー: ${e.message}", error: e); + switch (e.code) { + case StatusCode.unavailable: + return Future.error('サーバーが利用不可です。'); + case StatusCode.alreadyExists: + return Future.error('メールアドレスは既に登録されています。'); + default: + return Future.error('登録中にエラーが発生しました。'); + } + } else { + // 予期せぬエラー + developer.log("予期せぬエラー", error: e); + return Future.error('不明なエラーが発生しました。'); + } + } finally { + await channel.shutdown(); + } +} diff --git a/frontend/where_child_bus/lib/util/api/nursery_login.dart b/frontend/where_child_bus/lib/util/api/nursery_login.dart new file mode 100644 index 00000000..eb1e6c77 --- /dev/null +++ b/frontend/where_child_bus/lib/util/api/nursery_login.dart @@ -0,0 +1,33 @@ +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/where_child_bus/v1/nursery.pbgrpc.dart"; + +Future nurseryLogin(String email, String password) async { + var channel = ClientChannel( + appConfig.grpcEndpoint, + port: appConfig.grpcPort, + ); + var client = NurseryServiceClient(channel); + try { + var req = NurseryLoginRequest(email: email, password: password); + + if (kDebugMode) { + print("リクエスト: $req"); + } + + var res = await client.nurseryLogin(req); + if (kDebugMode) { + debugPrint(res.toString()); + } + return res; + } catch (err) { + developer.log("Caught error", error: err); + await channel.shutdown(); + return Future.error(err); + } finally { + await channel.shutdown(); + } +} diff --git a/frontend/where_child_bus/lib/util/api/station.dart b/frontend/where_child_bus/lib/util/api/station.dart new file mode 100644 index 00000000..e74dabb2 --- /dev/null +++ b/frontend/where_child_bus/lib/util/api/station.dart @@ -0,0 +1,96 @@ +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/station.pbgrpc.dart"; + +Future getStationListByBusId( + String busId) async { + final channel = ClientChannel( + appConfig.grpcEndpoint, + port: appConfig.grpcPort, + ); + + final grpcClient = StationServiceClient(channel); + + try { + var req = GetStationListByBusIdRequest(busId: busId); + + if (kDebugMode) { + developer.log("リクエスト: $req"); + } + + var res = await grpcClient.getStationListByBusId(req); + if (kDebugMode) { + developer.log("レスポンス: $res"); + } + + await channel.shutdown(); + return res; + } catch (error) { + await channel.shutdown(); + developer.log("Caught Error:", error: error); + return Future.error(error); + } +} + +Future getUnregisteredStations( + String busId) async { + final channel = ClientChannel( + appConfig.grpcEndpoint, + port: appConfig.grpcPort, + ); + + final grpcClient = StationServiceClient(channel); + + try { + var req = GetUnregisteredStationListRequest(busId: busId); + var res = await grpcClient.getUnregisteredStationList(req); + if (kDebugMode) { + developer.log("リクエスト: $req"); + developer.log("レスポンス: ${res.stations}"); + } + return res; + } catch (error) { + developer.log("Caught Error:", error: error); + return Future.error(error); + } finally { + await channel.shutdown(); + } +} + +Future updateStation( + String stationId, + String busId, + double latitude, + double longitude, +) async { + final channel = ClientChannel( + appConfig.grpcEndpoint, + port: appConfig.grpcPort, + ); + + final grpcClient = StationServiceClient(channel); + + try { + var req = UpdateStationRequest( + id: stationId, + busId: busId, + latitude: latitude, + longitude: longitude, + updateMask: FieldMask(paths: ["latitude", "longitude"])); + var res = await grpcClient.updateStation(req); + if (kDebugMode) { + developer.log("リクエスト: $req"); + developer.log("レスポンス: $res"); + } + return res; + } catch (error) { + developer.log("Caught Error:", error: error); + return Future.error(error); + } finally { + await channel.shutdown(); + } +} diff --git a/frontend/where_child_bus/lib/util/validation/create_bus_validation.dart b/frontend/where_child_bus/lib/util/validation/create_bus_validation.dart new file mode 100644 index 00000000..ae7048fd --- /dev/null +++ b/frontend/where_child_bus/lib/util/validation/create_bus_validation.dart @@ -0,0 +1,14 @@ +class CreateBusValidator { + static bool validateFields(String name, String plateNumber) { + return name.isEmpty && plateNumber.isEmpty; + } + + static bool validateGuardians( + List morningGuardians, List eveningGuardians) { + return morningGuardians.isEmpty && eveningGuardians.isEmpty; + } + + static bool validateNameLength(String name) { + return name.length <= 20; + } +} diff --git a/frontend/where_child_bus/lib/util/validation/create_nursery_validation.dart b/frontend/where_child_bus/lib/util/validation/create_nursery_validation.dart new file mode 100644 index 00000000..d960c799 --- /dev/null +++ b/frontend/where_child_bus/lib/util/validation/create_nursery_validation.dart @@ -0,0 +1,18 @@ +bool validateFields(String name, String email, String phoneNumber, + String address, String password, String confirmPassword) { + return email.isNotEmpty && + phoneNumber.isNotEmpty && + address.isNotEmpty && + password.isNotEmpty && + confirmPassword.isNotEmpty && + name.isNotEmpty; +} + +bool validateEmailFormat(String email) { + RegExp emailValidator = RegExp(r'^[a-zA-Z0-9.]+@[a-zA-Z0-9]+\.[a-zA-Z]+'); + return emailValidator.hasMatch(email); +} + +bool validatePasswordsMatch(String password, String confirmPassword) { + return password == confirmPassword; +} diff --git a/frontend/where_child_bus/linux/.gitignore b/frontend/where_child_bus/linux/.gitignore new file mode 100644 index 00000000..d3896c98 --- /dev/null +++ b/frontend/where_child_bus/linux/.gitignore @@ -0,0 +1 @@ +flutter/ephemeral diff --git a/frontend/where_child_bus/linux/CMakeLists.txt b/frontend/where_child_bus/linux/CMakeLists.txt new file mode 100644 index 00000000..ecc656d1 --- /dev/null +++ b/frontend/where_child_bus/linux/CMakeLists.txt @@ -0,0 +1,145 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.10) +project(runner LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "where_child_bus") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID +set(APPLICATION_ID "com.example.where_child_bus") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(SET CMP0063 NEW) + +# Load bundled libraries from the lib/ directory relative to the binary. +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") + +# Root filesystem for cross-building. +if(FLUTTER_TARGET_PLATFORM_SYSROOT) + set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endif() + +# Define build configuration options. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") +endif() + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_14) + target_compile_options(${TARGET} PRIVATE -Wall -Werror) + target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") + target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) + +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Define the application target. To change its name, change BINARY_NAME above, +# not the value here, or `flutter run` will no longer work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} + "main.cc" + "my_application.cc" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add dependency libraries. Add any application-specific dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) + +# Only the install-generated bundle's copy of the executable will launch +# correctly, since the resources must in the right relative locations. To avoid +# people trying to run the unbundled copy, put it in a subdirectory instead of +# the default top-level location. +set_target_properties(${BINARY_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" +) + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# By default, "installing" just makes a relocatable bundle in the build +# directory. +set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +# Start with a clean build bundle directory every time. +install(CODE " + file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") + " COMPONENT Runtime) + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) + install(FILES "${bundled_library}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endforeach(bundled_library) + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") + install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() diff --git a/frontend/where_child_bus/linux/flutter/CMakeLists.txt b/frontend/where_child_bus/linux/flutter/CMakeLists.txt new file mode 100644 index 00000000..d5bd0164 --- /dev/null +++ b/frontend/where_child_bus/linux/flutter/CMakeLists.txt @@ -0,0 +1,88 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.10) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. + +# Serves the same purpose as list(TRANSFORM ... PREPEND ...), +# which isn't available in 3.10. +function(list_prepend LIST_NAME PREFIX) + set(NEW_LIST "") + foreach(element ${${LIST_NAME}}) + list(APPEND NEW_LIST "${PREFIX}${element}") + endforeach(element) + set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) +endfunction() + +# === Flutter Library === +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) +pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) +pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) + +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "fl_basic_message_channel.h" + "fl_binary_codec.h" + "fl_binary_messenger.h" + "fl_dart_project.h" + "fl_engine.h" + "fl_json_message_codec.h" + "fl_json_method_codec.h" + "fl_message_codec.h" + "fl_method_call.h" + "fl_method_channel.h" + "fl_method_codec.h" + "fl_method_response.h" + "fl_plugin_registrar.h" + "fl_plugin_registry.h" + "fl_standard_message_codec.h" + "fl_standard_method_codec.h" + "fl_string_codec.h" + "fl_value.h" + "fl_view.h" + "flutter_linux.h" +) +list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") +target_link_libraries(flutter INTERFACE + PkgConfig::GTK + PkgConfig::GLIB + PkgConfig::GIO +) +add_dependencies(flutter flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CMAKE_CURRENT_BINARY_DIR}/_phony_ + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" + ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} +) diff --git a/frontend/where_child_bus/linux/flutter/generated_plugin_registrant.cc b/frontend/where_child_bus/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 00000000..e71a16d2 --- /dev/null +++ b/frontend/where_child_bus/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void fl_register_plugins(FlPluginRegistry* registry) { +} diff --git a/frontend/where_child_bus/linux/flutter/generated_plugin_registrant.h b/frontend/where_child_bus/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 00000000..e0f0a47b --- /dev/null +++ b/frontend/where_child_bus/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/frontend/where_child_bus/linux/flutter/generated_plugins.cmake b/frontend/where_child_bus/linux/flutter/generated_plugins.cmake new file mode 100644 index 00000000..2e1de87a --- /dev/null +++ b/frontend/where_child_bus/linux/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/frontend/where_child_bus/linux/main.cc b/frontend/where_child_bus/linux/main.cc new file mode 100644 index 00000000..e7c5c543 --- /dev/null +++ b/frontend/where_child_bus/linux/main.cc @@ -0,0 +1,6 @@ +#include "my_application.h" + +int main(int argc, char** argv) { + g_autoptr(MyApplication) app = my_application_new(); + return g_application_run(G_APPLICATION(app), argc, argv); +} diff --git a/frontend/where_child_bus/linux/my_application.cc b/frontend/where_child_bus/linux/my_application.cc new file mode 100644 index 00000000..bcb2ebfc --- /dev/null +++ b/frontend/where_child_bus/linux/my_application.cc @@ -0,0 +1,104 @@ +#include "my_application.h" + +#include +#ifdef GDK_WINDOWING_X11 +#include +#endif + +#include "flutter/generated_plugin_registrant.h" + +struct _MyApplication { + GtkApplication parent_instance; + char** dart_entrypoint_arguments; +}; + +G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) + +// Implements GApplication::activate. +static void my_application_activate(GApplication* application) { + MyApplication* self = MY_APPLICATION(application); + GtkWindow* window = + GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); + + // Use a header bar when running in GNOME as this is the common style used + // by applications and is the setup most users will be using (e.g. Ubuntu + // desktop). + // If running on X and not using GNOME then just use a traditional title bar + // in case the window manager does more exotic layout, e.g. tiling. + // If running on Wayland assume the header bar will work (may need changing + // if future cases occur). + gboolean use_header_bar = TRUE; +#ifdef GDK_WINDOWING_X11 + GdkScreen* screen = gtk_window_get_screen(window); + if (GDK_IS_X11_SCREEN(screen)) { + const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); + if (g_strcmp0(wm_name, "GNOME Shell") != 0) { + use_header_bar = FALSE; + } + } +#endif + if (use_header_bar) { + GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); + gtk_widget_show(GTK_WIDGET(header_bar)); + gtk_header_bar_set_title(header_bar, "where_child_bus"); + gtk_header_bar_set_show_close_button(header_bar, TRUE); + gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); + } else { + gtk_window_set_title(window, "where_child_bus"); + } + + gtk_window_set_default_size(window, 1280, 720); + gtk_widget_show(GTK_WIDGET(window)); + + g_autoptr(FlDartProject) project = fl_dart_project_new(); + fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); + + FlView* view = fl_view_new(project); + gtk_widget_show(GTK_WIDGET(view)); + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); + + fl_register_plugins(FL_PLUGIN_REGISTRY(view)); + + gtk_widget_grab_focus(GTK_WIDGET(view)); +} + +// Implements GApplication::local_command_line. +static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { + MyApplication* self = MY_APPLICATION(application); + // Strip out the first argument as it is the binary name. + self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); + + g_autoptr(GError) error = nullptr; + if (!g_application_register(application, nullptr, &error)) { + g_warning("Failed to register: %s", error->message); + *exit_status = 1; + return TRUE; + } + + g_application_activate(application); + *exit_status = 0; + + return TRUE; +} + +// Implements GObject::dispose. +static void my_application_dispose(GObject* object) { + MyApplication* self = MY_APPLICATION(object); + g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); + G_OBJECT_CLASS(my_application_parent_class)->dispose(object); +} + +static void my_application_class_init(MyApplicationClass* klass) { + G_APPLICATION_CLASS(klass)->activate = my_application_activate; + G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; + G_OBJECT_CLASS(klass)->dispose = my_application_dispose; +} + +static void my_application_init(MyApplication* self) {} + +MyApplication* my_application_new() { + return MY_APPLICATION(g_object_new(my_application_get_type(), + "application-id", APPLICATION_ID, + "flags", G_APPLICATION_NON_UNIQUE, + nullptr)); +} diff --git a/frontend/where_child_bus/linux/my_application.h b/frontend/where_child_bus/linux/my_application.h new file mode 100644 index 00000000..72271d5e --- /dev/null +++ b/frontend/where_child_bus/linux/my_application.h @@ -0,0 +1,18 @@ +#ifndef FLUTTER_MY_APPLICATION_H_ +#define FLUTTER_MY_APPLICATION_H_ + +#include + +G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, + GtkApplication) + +/** + * my_application_new: + * + * Creates a new Flutter-based application. + * + * Returns: a new #MyApplication. + */ +MyApplication* my_application_new(); + +#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/frontend/where_child_bus/macos/.gitignore b/frontend/where_child_bus/macos/.gitignore new file mode 100644 index 00000000..746adbb6 --- /dev/null +++ b/frontend/where_child_bus/macos/.gitignore @@ -0,0 +1,7 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ diff --git a/frontend/where_child_bus/macos/Flutter/Flutter-Debug.xcconfig b/frontend/where_child_bus/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 00000000..c2efd0b6 --- /dev/null +++ b/frontend/where_child_bus/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/frontend/where_child_bus/macos/Flutter/Flutter-Release.xcconfig b/frontend/where_child_bus/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 00000000..c2efd0b6 --- /dev/null +++ b/frontend/where_child_bus/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/frontend/where_child_bus/macos/Flutter/GeneratedPluginRegistrant.swift b/frontend/where_child_bus/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 00000000..cccf817a --- /dev/null +++ b/frontend/where_child_bus/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,10 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { +} diff --git a/frontend/where_child_bus/macos/Runner.xcodeproj/project.pbxproj b/frontend/where_child_bus/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 00000000..32cd41bf --- /dev/null +++ b/frontend/where_child_bus/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,695 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC10EC2044A3C60003C045; + remoteInfo = Runner; + }; + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* where_child_bus.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "where_child_bus.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 331C80D2294CF70F00263BE5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C80D6294CF71000263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C80D7294CF71000263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 331C80D6294CF71000263BE5 /* RunnerTests */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* where_child_bus.app */, + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C80D1294CF70F00263BE5 /* Sources */, + 331C80D2294CF70F00263BE5 /* Frameworks */, + 331C80D3294CF70F00263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C80DA294CF71000263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* where_child_bus.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1430; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C80D4294CF70F00263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 33CC10EC2044A3C60003C045; + }; + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 331C80D4294CF70F00263BE5 /* RunnerTests */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C80D3294CF70F00263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C80D1294CF70F00263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC10EC2044A3C60003C045 /* Runner */; + targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; + }; + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 331C80DB294CF71000263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + 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)/where_child_bus.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/where_child_bus"; + }; + name = Debug; + }; + 331C80DC294CF71000263BE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + 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)/where_child_bus.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/where_child_bus"; + }; + name = Release; + }; + 331C80DD294CF71000263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + 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)/where_child_bus.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/where_child_bus"; + }; + name = Profile; + }; + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + 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_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + 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_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + 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_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + 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_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + 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_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + 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_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C80DB294CF71000263BE5 /* Debug */, + 331C80DC294CF71000263BE5 /* Release */, + 331C80DD294CF71000263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/frontend/where_child_bus/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/frontend/where_child_bus/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/frontend/where_child_bus/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/frontend/where_child_bus/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/frontend/where_child_bus/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 00000000..425fbb80 --- /dev/null +++ b/frontend/where_child_bus/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/where_child_bus/macos/Runner.xcworkspace/contents.xcworkspacedata b/frontend/where_child_bus/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..1d526a16 --- /dev/null +++ b/frontend/where_child_bus/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/frontend/where_child_bus/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/frontend/where_child_bus/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/frontend/where_child_bus/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/frontend/where_child_bus/macos/Runner/AppDelegate.swift b/frontend/where_child_bus/macos/Runner/AppDelegate.swift new file mode 100644 index 00000000..d53ef643 --- /dev/null +++ b/frontend/where_child_bus/macos/Runner/AppDelegate.swift @@ -0,0 +1,9 @@ +import Cocoa +import FlutterMacOS + +@NSApplicationMain +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } +} diff --git a/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..a2ec33f1 --- /dev/null +++ b/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 00000000..82b6f9d9 Binary files /dev/null and b/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 00000000..13b35eba Binary files /dev/null and b/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 00000000..0a3f5fa4 Binary files /dev/null and b/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 00000000..bdb57226 Binary files /dev/null and b/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 00000000..f083318e Binary files /dev/null and b/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 00000000..326c0e72 Binary files /dev/null and b/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 00000000..2f1632cf Binary files /dev/null and b/frontend/where_child_bus/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/frontend/where_child_bus/macos/Runner/Base.lproj/MainMenu.xib b/frontend/where_child_bus/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 00000000..80e867a4 --- /dev/null +++ b/frontend/where_child_bus/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/where_child_bus/macos/Runner/Configs/AppInfo.xcconfig b/frontend/where_child_bus/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 00000000..1b24d2e5 --- /dev/null +++ b/frontend/where_child_bus/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = where_child_bus + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.whereChildBus + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. diff --git a/frontend/where_child_bus/macos/Runner/Configs/Debug.xcconfig b/frontend/where_child_bus/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 00000000..36b0fd94 --- /dev/null +++ b/frontend/where_child_bus/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/frontend/where_child_bus/macos/Runner/Configs/Release.xcconfig b/frontend/where_child_bus/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 00000000..dff4f495 --- /dev/null +++ b/frontend/where_child_bus/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/frontend/where_child_bus/macos/Runner/Configs/Warnings.xcconfig b/frontend/where_child_bus/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 00000000..42bcbf47 --- /dev/null +++ b/frontend/where_child_bus/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/frontend/where_child_bus/macos/Runner/DebugProfile.entitlements b/frontend/where_child_bus/macos/Runner/DebugProfile.entitlements new file mode 100644 index 00000000..dddb8a30 --- /dev/null +++ b/frontend/where_child_bus/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.cs.allow-jit + + com.apple.security.network.server + + + diff --git a/frontend/where_child_bus/macos/Runner/Info.plist b/frontend/where_child_bus/macos/Runner/Info.plist new file mode 100644 index 00000000..4789daa6 --- /dev/null +++ b/frontend/where_child_bus/macos/Runner/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/frontend/where_child_bus/macos/Runner/MainFlutterWindow.swift b/frontend/where_child_bus/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 00000000..3cc05eb2 --- /dev/null +++ b/frontend/where_child_bus/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,15 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/frontend/where_child_bus/macos/Runner/Release.entitlements b/frontend/where_child_bus/macos/Runner/Release.entitlements new file mode 100644 index 00000000..852fa1a4 --- /dev/null +++ b/frontend/where_child_bus/macos/Runner/Release.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/frontend/where_child_bus/macos/RunnerTests/RunnerTests.swift b/frontend/where_child_bus/macos/RunnerTests/RunnerTests.swift new file mode 100644 index 00000000..5418c9f5 --- /dev/null +++ b/frontend/where_child_bus/macos/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import FlutterMacOS +import Cocoa +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/pubspec.lock b/frontend/where_child_bus/pubspec.lock new file mode 100644 index 00000000..dcc58ec1 --- /dev/null +++ b/frontend/where_child_bus/pubspec.lock @@ -0,0 +1,833 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + archive: + dependency: transitive + description: + name: archive + sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" + url: "https://pub.dev" + source: hosted + version: "3.4.10" + args: + dependency: transitive + description: + name: args + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + audioplayers: + dependency: "direct main" + description: + name: audioplayers + sha256: c05c6147124cd63e725e861335a8b4d57300b80e6e92cea7c145c739223bbaef + url: "https://pub.dev" + source: hosted + version: "5.2.1" + audioplayers_android: + dependency: transitive + description: + name: audioplayers_android + sha256: b00e1a0e11365d88576320ec2d8c192bc21f1afb6c0e5995d1c57ae63156acb5 + url: "https://pub.dev" + source: hosted + version: "4.0.3" + audioplayers_darwin: + dependency: transitive + description: + name: audioplayers_darwin + sha256: "3034e99a6df8d101da0f5082dcca0a2a99db62ab1d4ddb3277bed3f6f81afe08" + url: "https://pub.dev" + source: hosted + version: "5.0.2" + audioplayers_linux: + dependency: transitive + description: + name: audioplayers_linux + sha256: "60787e73fefc4d2e0b9c02c69885402177e818e4e27ef087074cf27c02246c9e" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + audioplayers_platform_interface: + dependency: transitive + description: + name: audioplayers_platform_interface + sha256: "365c547f1bb9e77d94dd1687903a668d8f7ac3409e48e6e6a3668a1ac2982adb" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + audioplayers_web: + dependency: transitive + description: + name: audioplayers_web + sha256: "22cd0173e54d92bd9b2c80b1204eb1eb159ece87475ab58c9788a70ec43c2a62" + url: "https://pub.dev" + source: hosted + version: "4.1.0" + audioplayers_windows: + dependency: transitive + description: + name: audioplayers_windows + sha256: "9536812c9103563644ada2ef45ae523806b0745f7a78e89d1b5fb1951de90e1a" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + camera: + dependency: "direct main" + description: + name: camera + sha256: "9499cbc2e51d8eb0beadc158b288380037618ce4e30c9acbc4fae1ac3ecb5797" + url: "https://pub.dev" + source: hosted + version: "0.10.5+9" + camera_android: + dependency: transitive + description: + name: camera_android + sha256: "351429510121d179b9aac5a2e8cb525c3cd6c39f4d709c5f72dfb21726e52371" + url: "https://pub.dev" + source: hosted + version: "0.10.8+16" + camera_avfoundation: + dependency: transitive + description: + name: camera_avfoundation + sha256: "7d0763dfcbf060f56aa254a68c103210280bee9e97bbe4fdef23e257a4f70ab9" + url: "https://pub.dev" + source: hosted + version: "0.9.14" + camera_platform_interface: + dependency: transitive + description: + name: camera_platform_interface + sha256: fceb2c36038b6392317b1d5790c6ba9e6ca9f1da3031181b8bea03882bf9387a + url: "https://pub.dev" + source: hosted + version: "2.7.3" + camera_web: + dependency: transitive + description: + name: camera_web + sha256: f18ccfb33b2a7c49a52ad5aa3f07330b7422faaecbdfd9b9fe8e51182f6ad67d + url: "https://pub.dev" + source: hosted + version: "0.3.2+4" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + collection: + dependency: "direct main" + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: fedaadfa3a6996f75211d835aaeb8fede285dae94262485698afd832371b9a5e + url: "https://pub.dev" + source: hosted + version: "0.3.3+8" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + csslib: + dependency: transitive + description: + name: csslib + sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d + url: "https://pub.dev" + source: hosted + version: "1.0.6" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + file: + dependency: transitive + description: + name: file + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + file_selector_linux: + dependency: transitive + description: + name: file_selector_linux + sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492" + url: "https://pub.dev" + source: hosted + version: "0.9.2+1" + file_selector_macos: + dependency: transitive + description: + name: file_selector_macos + sha256: b15c3da8bd4908b9918111fa486903f5808e388b8d1c559949f584725a6594d6 + url: "https://pub.dev" + source: hosted + version: "0.9.3+3" + file_selector_platform_interface: + dependency: transitive + description: + name: file_selector_platform_interface + sha256: a3994c26f10378a039faa11de174d7b78eb8f79e4dd0af2a451410c1a5c3f66b + url: "https://pub.dev" + source: hosted + version: "2.6.2" + file_selector_windows: + dependency: transitive + description: + name: file_selector_windows + sha256: d3547240c20cabf205c7c7f01a50ecdbc413755814d6677f3cb366f04abcead0 + url: "https://pub.dev" + source: hosted + version: "0.9.3+1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_cache_manager: + dependency: "direct main" + description: + name: flutter_cache_manager + sha256: "8207f27539deb83732fdda03e259349046a39a4c767269285f449ade355d54ba" + url: "https://pub.dev" + source: hosted + version: "3.3.1" + flutter_config: + dependency: "direct main" + description: + name: flutter_config + sha256: a07e6156bb6e776e29c6357be433155acda87d1dab1a3f787a72091a1b71ffbf + url: "https://pub.dev" + source: hosted + version: "2.0.2" + flutter_dotenv: + dependency: "direct main" + description: + name: flutter_dotenv + sha256: "9357883bdd153ab78cbf9ffa07656e336b8bbb2b5a3ca596b0b27e119f7c7d77" + url: "https://pub.dev" + source: hosted + version: "5.1.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 + url: "https://pub.dev" + source: hosted + version: "2.0.3" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: b068ffc46f82a55844acfa4fdbb61fad72fa2aef0905548419d97f0f95c456da + url: "https://pub.dev" + source: hosted + version: "2.0.17" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + google_maps: + dependency: transitive + description: + name: google_maps + sha256: "555d5d736339b0478e821167ac521c810d7b51c3b2734e6802a9f046b64ea37a" + url: "https://pub.dev" + source: hosted + version: "6.3.0" + google_maps_flutter: + dependency: "direct main" + description: + name: google_maps_flutter + sha256: ae66fef3e71261d7df2eff29b2a119e190b2884325ecaa55321b1e17b5504066 + url: "https://pub.dev" + source: hosted + version: "2.5.3" + google_maps_flutter_android: + dependency: transitive + description: + name: google_maps_flutter_android + sha256: "714530f865f13bb3b9505c58821c3baed5d247a871724acf5d2ea5808fbed02c" + url: "https://pub.dev" + source: hosted + version: "2.6.2" + google_maps_flutter_ios: + dependency: transitive + description: + name: google_maps_flutter_ios + sha256: "29503b5159da2308a66212c3827963998bfb943ba073e2114fb2d486b47fd2c8" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + google_maps_flutter_platform_interface: + dependency: transitive + description: + name: google_maps_flutter_platform_interface + sha256: "6060779f020638a8eedeb0fb14234818e5fa32ec45a4653d6428ab436e2bbc64" + url: "https://pub.dev" + source: hosted + version: "2.4.3" + google_maps_flutter_web: + dependency: transitive + description: + name: google_maps_flutter_web + sha256: "6245721c160d6f531c1ef568cf9bef8d660cd585a982aa75121269030163785a" + url: "https://pub.dev" + source: hosted + version: "0.5.4+3" + googleapis_auth: + dependency: transitive + description: + name: googleapis_auth + sha256: af7c3a3edf9d0de2e1e0a77e994fae0a581c525fa7012af4fa0d4a52ed9484da + url: "https://pub.dev" + source: hosted + version: "1.4.1" + grpc: + dependency: "direct main" + description: + name: grpc + sha256: e93ee3bce45c134bf44e9728119102358c7cd69de7832d9a874e2e74eb8cab40 + url: "https://pub.dev" + source: hosted + version: "3.2.4" + html: + dependency: transitive + description: + name: html + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + url: "https://pub.dev" + source: hosted + version: "0.15.4" + http: + dependency: transitive + description: + name: http + sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba + url: "https://pub.dev" + source: hosted + version: "1.2.0" + http2: + dependency: transitive + description: + name: http2 + sha256: "9ced024a160b77aba8fb8674e38f70875e321d319e6f303ec18e87bd5a4b0c1d" + url: "https://pub.dev" + source: hosted + version: "2.3.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + image: + dependency: "direct main" + description: + name: image + sha256: "4c68bfd5ae83e700b5204c1e74451e7bf3cf750e6843c6e158289cf56bda018e" + url: "https://pub.dev" + source: hosted + version: "4.1.7" + image_picker: + dependency: "direct main" + description: + name: image_picker + sha256: "26222b01a0c9a2c8fe02fc90b8208bd3325da5ed1f4a2acabf75939031ac0bdd" + url: "https://pub.dev" + source: hosted + version: "1.0.7" + image_picker_android: + dependency: transitive + description: + name: image_picker_android + sha256: "39f2bfe497e495450c81abcd44b62f56c2a36a37a175da7d137b4454977b51b1" + url: "https://pub.dev" + source: hosted + version: "0.8.9+3" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + sha256: e2423c53a68b579a7c37a1eda967b8ae536c3d98518e5db95ca1fe5719a730a3 + url: "https://pub.dev" + source: hosted + version: "3.0.2" + image_picker_ios: + dependency: transitive + description: + name: image_picker_ios + sha256: fadafce49e8569257a0cad56d24438a6fa1f0cbd7ee0af9b631f7492818a4ca3 + url: "https://pub.dev" + source: hosted + version: "0.8.9+1" + image_picker_linux: + dependency: transitive + description: + name: image_picker_linux + sha256: "4ed1d9bb36f7cd60aa6e6cd479779cc56a4cb4e4de8f49d487b1aaad831300fa" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_macos: + dependency: transitive + description: + name: image_picker_macos + sha256: "3f5ad1e8112a9a6111c46d0b57a7be2286a9a07fc6e1976fdf5be2bd31d4ff62" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + sha256: fa4e815e6fcada50e35718727d83ba1c92f1edf95c0b4436554cec301b56233b + url: "https://pub.dev" + source: hosted + version: "2.9.3" + image_picker_windows: + dependency: transitive + description: + name: image_picker_windows + sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + js_wrapping: + dependency: transitive + description: + name: js_wrapping + sha256: e385980f7c76a8c1c9a560dfb623b890975841542471eade630b2871d243851c + url: "https://pub.dev" + source: hosted + version: "0.7.4" + lints: + dependency: transitive + description: + name: lints + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + location: + dependency: "direct main" + description: + name: location + sha256: "06be54f682c9073cbfec3899eb9bc8ed90faa0e17735c9d9fa7fe426f5be1dd1" + url: "https://pub.dev" + source: hosted + version: "5.0.3" + location_platform_interface: + dependency: transitive + description: + name: location_platform_interface + sha256: "8aa1d34eeecc979d7c9fe372931d84f6d2ebbd52226a54fe1620de6fdc0753b1" + url: "https://pub.dev" + source: hosted + version: "3.1.2" + location_web: + dependency: transitive + description: + name: location_web + sha256: ec484c66e8a4ff1ee5d044c203f4b6b71e3a0556a97b739a5bc9616de672412b + url: "https://pub.dev" + source: hosted + version: "4.2.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" + source: hosted + version: "0.12.16" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" + source: hosted + version: "0.5.0" + meta: + dependency: transitive + description: + name: meta + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + url: "https://pub.dev" + source: hosted + version: "1.10.0" + mime: + dependency: transitive + description: + name: mime + sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" + url: "https://pub.dev" + source: hosted + version: "1.0.5" + path: + dependency: transitive + description: + name: path + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" + source: hosted + version: "1.8.3" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + url: "https://pub.dev" + source: hosted + version: "6.0.2" + platform: + dependency: transitive + description: + name: platform + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + url: "https://pub.dev" + source: hosted + version: "3.1.4" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pointycastle: + dependency: transitive + description: + name: pointycastle + sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29" + url: "https://pub.dev" + source: hosted + version: "3.7.4" + protobuf: + dependency: "direct main" + description: + name: protobuf + sha256: "68645b24e0716782e58948f8467fd42a880f255096a821f9e7d0ec625b00c84d" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + rxdart: + dependency: transitive + description: + name: rxdart + sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" + url: "https://pub.dev" + source: hosted + version: "0.27.7" + sanitize_html: + dependency: transitive + description: + name: sanitize_html + sha256: "12669c4a913688a26555323fb9cec373d8f9fbe091f2d01c40c723b33caa8989" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + sqflite: + dependency: transitive + description: + name: sqflite + sha256: a9016f495c927cb90557c909ff26a6d92d9bd54fc42ba92e19d4e79d61e798c6 + url: "https://pub.dev" + source: hosted + version: "2.3.2" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + sha256: "28d8c66baee4968519fb8bd6cdbedad982d6e53359091f0b74544a9f32ec72d5" + url: "https://pub.dev" + source: hosted + version: "2.5.3" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558" + url: "https://pub.dev" + source: hosted + version: "3.1.0+1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" + source: hosted + version: "0.6.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + uuid: + dependency: transitive + description: + name: uuid + sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8 + url: "https://pub.dev" + source: hosted + version: "4.3.3" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + web: + dependency: transitive + description: + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" + source: hosted + version: "0.3.0" + where_child_bus_api: + dependency: "direct main" + description: + path: "../where_child_bus_api" + relative: true + source: path + version: "0.0.1" + win32: + dependency: transitive + description: + name: win32 + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" + url: "https://pub.dev" + source: hosted + version: "5.2.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + url: "https://pub.dev" + source: hosted + version: "1.0.4" + xml: + dependency: transitive + description: + name: xml + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.dev" + source: hosted + version: "6.5.0" +sdks: + dart: ">=3.2.6 <4.0.0" + flutter: ">=3.16.6" diff --git a/frontend/where_child_bus/pubspec.yaml b/frontend/where_child_bus/pubspec.yaml new file mode 100644 index 00000000..956e3119 --- /dev/null +++ b/frontend/where_child_bus/pubspec.yaml @@ -0,0 +1,42 @@ +name: where_child_bus +description: "WhereChildBus" +publish_to: "none" + +version: 1.0.0+1 + +environment: + sdk: ">=3.2.6 <4.0.0" + +dependencies: + flutter: + sdk: flutter + grpc: ^3.2.4 + protobuf: ^3.1.0 + flutter_dotenv: ^5.1.0 + image_picker: ^1.0.7 + flutter_cache_manager: ^3.3.1 + camera: ^0.10.5+9 + image: ^4.1.7 + google_maps_flutter: ^2.5.3 + collection: ^1.18.0 + location: ^5.0.3 + audioplayers: ^5.2.1 + flutter_config: ^2.0.2 + where_child_bus_api: + path: ../where_child_bus_api + + cupertino_icons: ^1.0.2 + +dev_dependencies: + flutter_test: + sdk: flutter + + flutter_lints: ^2.0.0 + +flutter: + uses-material-design: true + assets: + - assets/images/ + - assets/sounds/ + - .env + diff --git a/frontend/where_child_bus/test/widget_test.dart b/frontend/where_child_bus/test/widget_test.dart new file mode 100644 index 00000000..ab73b3a2 --- /dev/null +++ b/frontend/where_child_bus/test/widget_test.dart @@ -0,0 +1 @@ +void main() {} diff --git a/frontend/where_child_bus/web/favicon.png b/frontend/where_child_bus/web/favicon.png new file mode 100644 index 00000000..8aaa46ac Binary files /dev/null and b/frontend/where_child_bus/web/favicon.png differ diff --git a/frontend/where_child_bus/web/icons/Icon-192.png b/frontend/where_child_bus/web/icons/Icon-192.png new file mode 100644 index 00000000..b749bfef Binary files /dev/null and b/frontend/where_child_bus/web/icons/Icon-192.png differ diff --git a/frontend/where_child_bus/web/icons/Icon-512.png b/frontend/where_child_bus/web/icons/Icon-512.png new file mode 100644 index 00000000..88cfd48d Binary files /dev/null and b/frontend/where_child_bus/web/icons/Icon-512.png differ diff --git a/frontend/where_child_bus/web/icons/Icon-maskable-192.png b/frontend/where_child_bus/web/icons/Icon-maskable-192.png new file mode 100644 index 00000000..eb9b4d76 Binary files /dev/null and b/frontend/where_child_bus/web/icons/Icon-maskable-192.png differ diff --git a/frontend/where_child_bus/web/icons/Icon-maskable-512.png b/frontend/where_child_bus/web/icons/Icon-maskable-512.png new file mode 100644 index 00000000..d69c5669 Binary files /dev/null and b/frontend/where_child_bus/web/icons/Icon-maskable-512.png differ diff --git a/frontend/where_child_bus/web/index.html b/frontend/where_child_bus/web/index.html new file mode 100644 index 00000000..f7158f69 --- /dev/null +++ b/frontend/where_child_bus/web/index.html @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + where_child_bus + + + + + + + + + + diff --git a/frontend/where_child_bus/web/manifest.json b/frontend/where_child_bus/web/manifest.json new file mode 100644 index 00000000..b64db05d --- /dev/null +++ b/frontend/where_child_bus/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "where_child_bus", + "short_name": "where_child_bus", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "icons/Icon-maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/Icon-maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/frontend/where_child_bus/where_child_bus.iml b/frontend/where_child_bus/where_child_bus.iml new file mode 100644 index 00000000..f66303d5 --- /dev/null +++ b/frontend/where_child_bus/where_child_bus.iml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/frontend/where_child_bus/windows/.gitignore b/frontend/where_child_bus/windows/.gitignore new file mode 100644 index 00000000..d492d0d9 --- /dev/null +++ b/frontend/where_child_bus/windows/.gitignore @@ -0,0 +1,17 @@ +flutter/ephemeral/ + +# Visual Studio user-specific files. +*.suo +*.user +*.userosscache +*.sln.docstates + +# Visual Studio build-related files. +x64/ +x86/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ diff --git a/frontend/where_child_bus/windows/CMakeLists.txt b/frontend/where_child_bus/windows/CMakeLists.txt new file mode 100644 index 00000000..d7c98651 --- /dev/null +++ b/frontend/where_child_bus/windows/CMakeLists.txt @@ -0,0 +1,108 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.14) +project(where_child_bus LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "where_child_bus") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(VERSION 3.14...3.25) + +# Define build configuration option. +get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(IS_MULTICONFIG) + set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" + CACHE STRING "" FORCE) +else() + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") + endif() +endif() +# Define settings for the Profile build mode. +set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") +set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") +set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") +set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") + +# Use Unicode for all projects. +add_definitions(-DUNICODE -D_UNICODE) + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_17) + target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") + target_compile_options(${TARGET} PRIVATE /EHsc) + target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") + target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# Support files are copied into place next to the executable, so that it can +# run in place. This is done instead of making a separate bundle (as on Linux) +# so that building and running from within Visual Studio will work. +set(BUILD_BUNDLE_DIR "$") +# Make the "install" step default, as it's required to run. +set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +if(PLUGIN_BUNDLED_LIBRARIES) + install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + CONFIGURATIONS Profile;Release + COMPONENT Runtime) diff --git a/frontend/where_child_bus/windows/flutter/CMakeLists.txt b/frontend/where_child_bus/windows/flutter/CMakeLists.txt new file mode 100644 index 00000000..903f4899 --- /dev/null +++ b/frontend/where_child_bus/windows/flutter/CMakeLists.txt @@ -0,0 +1,109 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.14) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. +set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") + +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + +# === Flutter Library === +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "flutter_export.h" + "flutter_windows.h" + "flutter_messenger.h" + "flutter_plugin_registrar.h" + "flutter_texture_registrar.h" +) +list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") +add_dependencies(flutter flutter_assemble) + +# === Wrapper === +list(APPEND CPP_WRAPPER_SOURCES_CORE + "core_implementations.cc" + "standard_codec.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_PLUGIN + "plugin_registrar.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_APP + "flutter_engine.cc" + "flutter_view_controller.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") + +# Wrapper sources needed for a plugin. +add_library(flutter_wrapper_plugin STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} +) +apply_standard_settings(flutter_wrapper_plugin) +set_target_properties(flutter_wrapper_plugin PROPERTIES + POSITION_INDEPENDENT_CODE ON) +set_target_properties(flutter_wrapper_plugin PROPERTIES + CXX_VISIBILITY_PRESET hidden) +target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) +target_include_directories(flutter_wrapper_plugin PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_plugin flutter_assemble) + +# Wrapper sources needed for the runner. +add_library(flutter_wrapper_app STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_APP} +) +apply_standard_settings(flutter_wrapper_app) +target_link_libraries(flutter_wrapper_app PUBLIC flutter) +target_include_directories(flutter_wrapper_app PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_app flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") +set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} + ${PHONY_OUTPUT} + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" + ${FLUTTER_TARGET_PLATFORM} $ + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} +) diff --git a/frontend/where_child_bus/windows/flutter/generated_plugin_registrant.cc b/frontend/where_child_bus/windows/flutter/generated_plugin_registrant.cc new file mode 100644 index 00000000..8b6d4680 --- /dev/null +++ b/frontend/where_child_bus/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void RegisterPlugins(flutter::PluginRegistry* registry) { +} diff --git a/frontend/where_child_bus/windows/flutter/generated_plugin_registrant.h b/frontend/where_child_bus/windows/flutter/generated_plugin_registrant.h new file mode 100644 index 00000000..dc139d85 --- /dev/null +++ b/frontend/where_child_bus/windows/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void RegisterPlugins(flutter::PluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/frontend/where_child_bus/windows/flutter/generated_plugins.cmake b/frontend/where_child_bus/windows/flutter/generated_plugins.cmake new file mode 100644 index 00000000..b93c4c30 --- /dev/null +++ b/frontend/where_child_bus/windows/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/frontend/where_child_bus/windows/runner/CMakeLists.txt b/frontend/where_child_bus/windows/runner/CMakeLists.txt new file mode 100644 index 00000000..394917c0 --- /dev/null +++ b/frontend/where_child_bus/windows/runner/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.14) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} WIN32 + "flutter_window.cpp" + "main.cpp" + "utils.cpp" + "win32_window.cpp" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" + "Runner.rc" + "runner.exe.manifest" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the build version. +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") + +# Disable Windows macros that collide with C++ standard library functions. +target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") + +# Add dependency libraries and include directories. Add any application-specific +# dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) +target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/frontend/where_child_bus/windows/runner/Runner.rc b/frontend/where_child_bus/windows/runner/Runner.rc new file mode 100644 index 00000000..16ef5a32 --- /dev/null +++ b/frontend/where_child_bus/windows/runner/Runner.rc @@ -0,0 +1,121 @@ +// Microsoft Visual C++ generated resource script. +// +#pragma code_page(65001) +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_APP_ICON ICON "resources\\app_icon.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) +#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD +#else +#define VERSION_AS_NUMBER 1,0,0,0 +#endif + +#if defined(FLUTTER_VERSION) +#define VERSION_AS_STRING FLUTTER_VERSION +#else +#define VERSION_AS_STRING "1.0.0" +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_AS_NUMBER + PRODUCTVERSION VERSION_AS_NUMBER + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "com.example" "\0" + VALUE "FileDescription", "where_child_bus" "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "where_child_bus" "\0" + VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" + VALUE "OriginalFilename", "where_child_bus.exe" "\0" + VALUE "ProductName", "where_child_bus" "\0" + VALUE "ProductVersion", VERSION_AS_STRING "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/frontend/where_child_bus/windows/runner/flutter_window.cpp b/frontend/where_child_bus/windows/runner/flutter_window.cpp new file mode 100644 index 00000000..955ee303 --- /dev/null +++ b/frontend/where_child_bus/windows/runner/flutter_window.cpp @@ -0,0 +1,71 @@ +#include "flutter_window.h" + +#include + +#include "flutter/generated_plugin_registrant.h" + +FlutterWindow::FlutterWindow(const flutter::DartProject& project) + : project_(project) {} + +FlutterWindow::~FlutterWindow() {} + +bool FlutterWindow::OnCreate() { + if (!Win32Window::OnCreate()) { + return false; + } + + RECT frame = GetClientArea(); + + // The size here must match the window dimensions to avoid unnecessary surface + // creation / destruction in the startup path. + flutter_controller_ = std::make_unique( + frame.right - frame.left, frame.bottom - frame.top, project_); + // Ensure that basic setup of the controller was successful. + if (!flutter_controller_->engine() || !flutter_controller_->view()) { + return false; + } + RegisterPlugins(flutter_controller_->engine()); + SetChildContent(flutter_controller_->view()->GetNativeWindow()); + + flutter_controller_->engine()->SetNextFrameCallback([&]() { + this->Show(); + }); + + // Flutter can complete the first frame before the "show window" callback is + // registered. The following call ensures a frame is pending to ensure the + // window is shown. It is a no-op if the first frame hasn't completed yet. + flutter_controller_->ForceRedraw(); + + return true; +} + +void FlutterWindow::OnDestroy() { + if (flutter_controller_) { + flutter_controller_ = nullptr; + } + + Win32Window::OnDestroy(); +} + +LRESULT +FlutterWindow::MessageHandler(HWND hwnd, UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + // Give Flutter, including plugins, an opportunity to handle window messages. + if (flutter_controller_) { + std::optional result = + flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, + lparam); + if (result) { + return *result; + } + } + + switch (message) { + case WM_FONTCHANGE: + flutter_controller_->engine()->ReloadSystemFonts(); + break; + } + + return Win32Window::MessageHandler(hwnd, message, wparam, lparam); +} diff --git a/frontend/where_child_bus/windows/runner/flutter_window.h b/frontend/where_child_bus/windows/runner/flutter_window.h new file mode 100644 index 00000000..6da0652f --- /dev/null +++ b/frontend/where_child_bus/windows/runner/flutter_window.h @@ -0,0 +1,33 @@ +#ifndef RUNNER_FLUTTER_WINDOW_H_ +#define RUNNER_FLUTTER_WINDOW_H_ + +#include +#include + +#include + +#include "win32_window.h" + +// A window that does nothing but host a Flutter view. +class FlutterWindow : public Win32Window { + public: + // Creates a new FlutterWindow hosting a Flutter view running |project|. + explicit FlutterWindow(const flutter::DartProject& project); + virtual ~FlutterWindow(); + + protected: + // Win32Window: + bool OnCreate() override; + void OnDestroy() override; + LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, + LPARAM const lparam) noexcept override; + + private: + // The project to run. + flutter::DartProject project_; + + // The Flutter instance hosted by this window. + std::unique_ptr flutter_controller_; +}; + +#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/frontend/where_child_bus/windows/runner/main.cpp b/frontend/where_child_bus/windows/runner/main.cpp new file mode 100644 index 00000000..8a3637cb --- /dev/null +++ b/frontend/where_child_bus/windows/runner/main.cpp @@ -0,0 +1,43 @@ +#include +#include +#include + +#include "flutter_window.h" +#include "utils.h" + +int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, + _In_ wchar_t *command_line, _In_ int show_command) { + // Attach to console when present (e.g., 'flutter run') or create a + // new console when running with a debugger. + if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { + CreateAndAttachConsole(); + } + + // Initialize COM, so that it is available for use in the library and/or + // plugins. + ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + + flutter::DartProject project(L"data"); + + std::vector command_line_arguments = + GetCommandLineArguments(); + + project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); + + FlutterWindow window(project); + Win32Window::Point origin(10, 10); + Win32Window::Size size(1280, 720); + if (!window.Create(L"where_child_bus", origin, size)) { + return EXIT_FAILURE; + } + window.SetQuitOnClose(true); + + ::MSG msg; + while (::GetMessage(&msg, nullptr, 0, 0)) { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + + ::CoUninitialize(); + return EXIT_SUCCESS; +} diff --git a/frontend/where_child_bus/windows/runner/resource.h b/frontend/where_child_bus/windows/runner/resource.h new file mode 100644 index 00000000..66a65d1e --- /dev/null +++ b/frontend/where_child_bus/windows/runner/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Runner.rc +// +#define IDI_APP_ICON 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/frontend/where_child_bus/windows/runner/resources/app_icon.ico b/frontend/where_child_bus/windows/runner/resources/app_icon.ico new file mode 100644 index 00000000..c04e20ca Binary files /dev/null and b/frontend/where_child_bus/windows/runner/resources/app_icon.ico differ diff --git a/frontend/where_child_bus/windows/runner/runner.exe.manifest b/frontend/where_child_bus/windows/runner/runner.exe.manifest new file mode 100644 index 00000000..a42ea768 --- /dev/null +++ b/frontend/where_child_bus/windows/runner/runner.exe.manifest @@ -0,0 +1,20 @@ + + + + + PerMonitorV2 + + + + + + + + + + + + + + + diff --git a/frontend/where_child_bus/windows/runner/utils.cpp b/frontend/where_child_bus/windows/runner/utils.cpp new file mode 100644 index 00000000..b2b08734 --- /dev/null +++ b/frontend/where_child_bus/windows/runner/utils.cpp @@ -0,0 +1,65 @@ +#include "utils.h" + +#include +#include +#include +#include + +#include + +void CreateAndAttachConsole() { + if (::AllocConsole()) { + FILE *unused; + if (freopen_s(&unused, "CONOUT$", "w", stdout)) { + _dup2(_fileno(stdout), 1); + } + if (freopen_s(&unused, "CONOUT$", "w", stderr)) { + _dup2(_fileno(stdout), 2); + } + std::ios::sync_with_stdio(); + FlutterDesktopResyncOutputStreams(); + } +} + +std::vector GetCommandLineArguments() { + // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. + int argc; + wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); + if (argv == nullptr) { + return std::vector(); + } + + std::vector command_line_arguments; + + // Skip the first argument as it's the binary name. + for (int i = 1; i < argc; i++) { + command_line_arguments.push_back(Utf8FromUtf16(argv[i])); + } + + ::LocalFree(argv); + + return command_line_arguments; +} + +std::string Utf8FromUtf16(const wchar_t* utf16_string) { + if (utf16_string == nullptr) { + return std::string(); + } + int target_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + -1, nullptr, 0, nullptr, nullptr) + -1; // remove the trailing null character + int input_length = (int)wcslen(utf16_string); + std::string utf8_string; + if (target_length <= 0 || target_length > utf8_string.max_size()) { + return utf8_string; + } + utf8_string.resize(target_length); + int converted_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + input_length, utf8_string.data(), target_length, nullptr, nullptr); + if (converted_length == 0) { + return std::string(); + } + return utf8_string; +} diff --git a/frontend/where_child_bus/windows/runner/utils.h b/frontend/where_child_bus/windows/runner/utils.h new file mode 100644 index 00000000..3879d547 --- /dev/null +++ b/frontend/where_child_bus/windows/runner/utils.h @@ -0,0 +1,19 @@ +#ifndef RUNNER_UTILS_H_ +#define RUNNER_UTILS_H_ + +#include +#include + +// Creates a console for the process, and redirects stdout and stderr to +// it for both the runner and the Flutter library. +void CreateAndAttachConsole(); + +// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string +// encoded in UTF-8. Returns an empty std::string on failure. +std::string Utf8FromUtf16(const wchar_t* utf16_string); + +// Gets the command line arguments passed in as a std::vector, +// encoded in UTF-8. Returns an empty std::vector on failure. +std::vector GetCommandLineArguments(); + +#endif // RUNNER_UTILS_H_ diff --git a/frontend/where_child_bus/windows/runner/win32_window.cpp b/frontend/where_child_bus/windows/runner/win32_window.cpp new file mode 100644 index 00000000..60608d0f --- /dev/null +++ b/frontend/where_child_bus/windows/runner/win32_window.cpp @@ -0,0 +1,288 @@ +#include "win32_window.h" + +#include +#include + +#include "resource.h" + +namespace { + +/// Window attribute that enables dark mode window decorations. +/// +/// Redefined in case the developer's machine has a Windows SDK older than +/// version 10.0.22000.0. +/// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute +#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE +#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 +#endif + +constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; + +/// Registry key for app theme preference. +/// +/// A value of 0 indicates apps should use dark mode. A non-zero or missing +/// value indicates apps should use light mode. +constexpr const wchar_t kGetPreferredBrightnessRegKey[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; +constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; + +// The number of Win32Window objects that currently exist. +static int g_active_window_count = 0; + +using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); + +// Scale helper to convert logical scaler values to physical using passed in +// scale factor +int Scale(int source, double scale_factor) { + return static_cast(source * scale_factor); +} + +// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. +// This API is only needed for PerMonitor V1 awareness mode. +void EnableFullDpiSupportIfAvailable(HWND hwnd) { + HMODULE user32_module = LoadLibraryA("User32.dll"); + if (!user32_module) { + return; + } + auto enable_non_client_dpi_scaling = + reinterpret_cast( + GetProcAddress(user32_module, "EnableNonClientDpiScaling")); + if (enable_non_client_dpi_scaling != nullptr) { + enable_non_client_dpi_scaling(hwnd); + } + FreeLibrary(user32_module); +} + +} // namespace + +// Manages the Win32Window's window class registration. +class WindowClassRegistrar { + public: + ~WindowClassRegistrar() = default; + + // Returns the singleton registrar instance. + static WindowClassRegistrar* GetInstance() { + if (!instance_) { + instance_ = new WindowClassRegistrar(); + } + return instance_; + } + + // Returns the name of the window class, registering the class if it hasn't + // previously been registered. + const wchar_t* GetWindowClass(); + + // Unregisters the window class. Should only be called if there are no + // instances of the window. + void UnregisterWindowClass(); + + private: + WindowClassRegistrar() = default; + + static WindowClassRegistrar* instance_; + + bool class_registered_ = false; +}; + +WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; + +const wchar_t* WindowClassRegistrar::GetWindowClass() { + if (!class_registered_) { + WNDCLASS window_class{}; + window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); + window_class.lpszClassName = kWindowClassName; + window_class.style = CS_HREDRAW | CS_VREDRAW; + window_class.cbClsExtra = 0; + window_class.cbWndExtra = 0; + window_class.hInstance = GetModuleHandle(nullptr); + window_class.hIcon = + LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); + window_class.hbrBackground = 0; + window_class.lpszMenuName = nullptr; + window_class.lpfnWndProc = Win32Window::WndProc; + RegisterClass(&window_class); + class_registered_ = true; + } + return kWindowClassName; +} + +void WindowClassRegistrar::UnregisterWindowClass() { + UnregisterClass(kWindowClassName, nullptr); + class_registered_ = false; +} + +Win32Window::Win32Window() { + ++g_active_window_count; +} + +Win32Window::~Win32Window() { + --g_active_window_count; + Destroy(); +} + +bool Win32Window::Create(const std::wstring& title, + const Point& origin, + const Size& size) { + Destroy(); + + const wchar_t* window_class = + WindowClassRegistrar::GetInstance()->GetWindowClass(); + + const POINT target_point = {static_cast(origin.x), + static_cast(origin.y)}; + HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); + UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); + double scale_factor = dpi / 96.0; + + HWND window = CreateWindow( + window_class, title.c_str(), WS_OVERLAPPEDWINDOW, + Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), + Scale(size.width, scale_factor), Scale(size.height, scale_factor), + nullptr, nullptr, GetModuleHandle(nullptr), this); + + if (!window) { + return false; + } + + UpdateTheme(window); + + return OnCreate(); +} + +bool Win32Window::Show() { + return ShowWindow(window_handle_, SW_SHOWNORMAL); +} + +// static +LRESULT CALLBACK Win32Window::WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + if (message == WM_NCCREATE) { + auto window_struct = reinterpret_cast(lparam); + SetWindowLongPtr(window, GWLP_USERDATA, + reinterpret_cast(window_struct->lpCreateParams)); + + auto that = static_cast(window_struct->lpCreateParams); + EnableFullDpiSupportIfAvailable(window); + that->window_handle_ = window; + } else if (Win32Window* that = GetThisFromHandle(window)) { + return that->MessageHandler(window, message, wparam, lparam); + } + + return DefWindowProc(window, message, wparam, lparam); +} + +LRESULT +Win32Window::MessageHandler(HWND hwnd, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + switch (message) { + case WM_DESTROY: + window_handle_ = nullptr; + Destroy(); + if (quit_on_close_) { + PostQuitMessage(0); + } + return 0; + + case WM_DPICHANGED: { + auto newRectSize = reinterpret_cast(lparam); + LONG newWidth = newRectSize->right - newRectSize->left; + LONG newHeight = newRectSize->bottom - newRectSize->top; + + SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, + newHeight, SWP_NOZORDER | SWP_NOACTIVATE); + + return 0; + } + case WM_SIZE: { + RECT rect = GetClientArea(); + if (child_content_ != nullptr) { + // Size and position the child window. + MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, TRUE); + } + return 0; + } + + case WM_ACTIVATE: + if (child_content_ != nullptr) { + SetFocus(child_content_); + } + return 0; + + case WM_DWMCOLORIZATIONCOLORCHANGED: + UpdateTheme(hwnd); + return 0; + } + + return DefWindowProc(window_handle_, message, wparam, lparam); +} + +void Win32Window::Destroy() { + OnDestroy(); + + if (window_handle_) { + DestroyWindow(window_handle_); + window_handle_ = nullptr; + } + if (g_active_window_count == 0) { + WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); + } +} + +Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { + return reinterpret_cast( + GetWindowLongPtr(window, GWLP_USERDATA)); +} + +void Win32Window::SetChildContent(HWND content) { + child_content_ = content; + SetParent(content, window_handle_); + RECT frame = GetClientArea(); + + MoveWindow(content, frame.left, frame.top, frame.right - frame.left, + frame.bottom - frame.top, true); + + SetFocus(child_content_); +} + +RECT Win32Window::GetClientArea() { + RECT frame; + GetClientRect(window_handle_, &frame); + return frame; +} + +HWND Win32Window::GetHandle() { + return window_handle_; +} + +void Win32Window::SetQuitOnClose(bool quit_on_close) { + quit_on_close_ = quit_on_close; +} + +bool Win32Window::OnCreate() { + // No-op; provided for subclasses. + return true; +} + +void Win32Window::OnDestroy() { + // No-op; provided for subclasses. +} + +void Win32Window::UpdateTheme(HWND const window) { + DWORD light_mode; + DWORD light_mode_size = sizeof(light_mode); + LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, + kGetPreferredBrightnessRegValue, + RRF_RT_REG_DWORD, nullptr, &light_mode, + &light_mode_size); + + if (result == ERROR_SUCCESS) { + BOOL enable_dark_mode = light_mode == 0; + DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, + &enable_dark_mode, sizeof(enable_dark_mode)); + } +} diff --git a/frontend/where_child_bus/windows/runner/win32_window.h b/frontend/where_child_bus/windows/runner/win32_window.h new file mode 100644 index 00000000..e901dde6 --- /dev/null +++ b/frontend/where_child_bus/windows/runner/win32_window.h @@ -0,0 +1,102 @@ +#ifndef RUNNER_WIN32_WINDOW_H_ +#define RUNNER_WIN32_WINDOW_H_ + +#include + +#include +#include +#include + +// A class abstraction for a high DPI-aware Win32 Window. Intended to be +// inherited from by classes that wish to specialize with custom +// rendering and input handling +class Win32Window { + public: + struct Point { + unsigned int x; + unsigned int y; + Point(unsigned int x, unsigned int y) : x(x), y(y) {} + }; + + struct Size { + unsigned int width; + unsigned int height; + Size(unsigned int width, unsigned int height) + : width(width), height(height) {} + }; + + Win32Window(); + virtual ~Win32Window(); + + // Creates a win32 window with |title| that is positioned and sized using + // |origin| and |size|. New windows are created on the default monitor. Window + // sizes are specified to the OS in physical pixels, hence to ensure a + // consistent size this function will scale the inputted width and height as + // as appropriate for the default monitor. The window is invisible until + // |Show| is called. Returns true if the window was created successfully. + bool Create(const std::wstring& title, const Point& origin, const Size& size); + + // Show the current window. Returns true if the window was successfully shown. + bool Show(); + + // Release OS resources associated with window. + void Destroy(); + + // Inserts |content| into the window tree. + void SetChildContent(HWND content); + + // Returns the backing Window handle to enable clients to set icon and other + // window properties. Returns nullptr if the window has been destroyed. + HWND GetHandle(); + + // If true, closing this window will quit the application. + void SetQuitOnClose(bool quit_on_close); + + // Return a RECT representing the bounds of the current client area. + RECT GetClientArea(); + + protected: + // Processes and route salient window messages for mouse handling, + // size change and DPI. Delegates handling of these to member overloads that + // inheriting classes can handle. + virtual LRESULT MessageHandler(HWND window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Called when CreateAndShow is called, allowing subclass window-related + // setup. Subclasses should return false if setup fails. + virtual bool OnCreate(); + + // Called when Destroy is called. + virtual void OnDestroy(); + + private: + friend class WindowClassRegistrar; + + // OS callback called by message pump. Handles the WM_NCCREATE message which + // is passed when the non-client area is being created and enables automatic + // non-client DPI scaling so that the non-client area automatically + // responds to changes in DPI. All other messages are handled by + // MessageHandler. + static LRESULT CALLBACK WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Retrieves a class instance pointer for |window| + static Win32Window* GetThisFromHandle(HWND const window) noexcept; + + // Update the window frame's theme to match the system theme. + static void UpdateTheme(HWND const window); + + bool quit_on_close_ = false; + + // window handle for top level window. + HWND window_handle_ = nullptr; + + // window handle for hosted content. + HWND child_content_ = nullptr; +}; + +#endif // RUNNER_WIN32_WINDOW_H_ diff --git a/frontend/where_child_bus_api/.gitignore b/frontend/where_child_bus_api/.gitignore new file mode 100644 index 00000000..8919a098 --- /dev/null +++ b/frontend/where_child_bus_api/.gitignore @@ -0,0 +1,147 @@ +# 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 + +# 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_api/.idea/libraries/Dart_SDK.xml b/frontend/where_child_bus_api/.idea/libraries/Dart_SDK.xml new file mode 100644 index 00000000..4914c6f6 --- /dev/null +++ b/frontend/where_child_bus_api/.idea/libraries/Dart_SDK.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frontend/where_child_bus_api/.idea/modules.xml b/frontend/where_child_bus_api/.idea/modules.xml new file mode 100644 index 00000000..0b0b7c28 --- /dev/null +++ b/frontend/where_child_bus_api/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/frontend/where_child_bus_api/.idea/workspace.xml b/frontend/where_child_bus_api/.idea/workspace.xml new file mode 100644 index 00000000..5b3388cc --- /dev/null +++ b/frontend/where_child_bus_api/.idea/workspace.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/where_child_bus_api/.metadata b/frontend/where_child_bus_api/.metadata new file mode 100644 index 00000000..5c46f074 --- /dev/null +++ b/frontend/where_child_bus_api/.metadata @@ -0,0 +1,10 @@ +# 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: package diff --git a/frontend/where_child_bus_api/CHANGELOG.md b/frontend/where_child_bus_api/CHANGELOG.md new file mode 100644 index 00000000..41cc7d81 --- /dev/null +++ b/frontend/where_child_bus_api/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.0.1 + +* TODO: Describe initial release. diff --git a/frontend/where_child_bus_api/LICENSE b/frontend/where_child_bus_api/LICENSE new file mode 100644 index 00000000..ba75c69f --- /dev/null +++ b/frontend/where_child_bus_api/LICENSE @@ -0,0 +1 @@ +TODO: Add your license here. diff --git a/frontend/where_child_bus_api/README.md b/frontend/where_child_bus_api/README.md new file mode 100644 index 00000000..02fe8eca --- /dev/null +++ b/frontend/where_child_bus_api/README.md @@ -0,0 +1,39 @@ + + +TODO: Put a short description of the package here that helps potential users +know whether this package might be useful for them. + +## Features + +TODO: List what your package can do. Maybe include images, gifs, or videos. + +## Getting started + +TODO: List prerequisites and provide or point to information on how to +start using the package. + +## Usage + +TODO: Include short and useful examples for package users. Add longer examples +to `/example` folder. + +```dart +const like = 'sample'; +``` + +## Additional information + +TODO: Tell users more about the package: where to find more information, how to +contribute to the package, how to file issues, what response they can expect +from the package authors, and more. diff --git a/frontend/where_child_bus_api/analysis_options.yaml b/frontend/where_child_bus_api/analysis_options.yaml new file mode 100644 index 00000000..a5744c1c --- /dev/null +++ b/frontend/where_child_bus_api/analysis_options.yaml @@ -0,0 +1,4 @@ +include: package:flutter_lints/flutter.yaml + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/field_mask.pb.dart b/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/field_mask.pb.dart new file mode 100644 index 00000000..12037c68 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/field_mask.pb.dart @@ -0,0 +1,263 @@ +// +// Generated code. Do not modify. +// source: google/protobuf/field_mask.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; +import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin; + +/// `FieldMask` represents a set of symbolic field paths, for example: +/// +/// paths: "f.a" +/// paths: "f.b.d" +/// +/// Here `f` represents a field in some root message, `a` and `b` +/// fields in the message found in `f`, and `d` a field found in the +/// message in `f.b`. +/// +/// Field masks are used to specify a subset of fields that should be +/// returned by a get operation or modified by an update operation. +/// Field masks also have a custom JSON encoding (see below). +/// +/// # Field Masks in Projections +/// +/// When used in the context of a projection, a response message or +/// sub-message is filtered by the API to only contain those fields as +/// specified in the mask. For example, if the mask in the previous +/// example is applied to a response message as follows: +/// +/// f { +/// a : 22 +/// b { +/// d : 1 +/// x : 2 +/// } +/// y : 13 +/// } +/// z: 8 +/// +/// The result will not contain specific values for fields x,y and z +/// (their value will be set to the default, and omitted in proto text +/// output): +/// +/// +/// f { +/// a : 22 +/// b { +/// d : 1 +/// } +/// } +/// +/// A repeated field is not allowed except at the last position of a +/// paths string. +/// +/// If a FieldMask object is not present in a get operation, the +/// operation applies to all fields (as if a FieldMask of all fields +/// had been specified). +/// +/// Note that a field mask does not necessarily apply to the +/// top-level response message. In case of a REST get operation, the +/// field mask applies directly to the response, but in case of a REST +/// list operation, the mask instead applies to each individual message +/// in the returned resource list. In case of a REST custom method, +/// other definitions may be used. Where the mask applies will be +/// clearly documented together with its declaration in the API. In +/// any case, the effect on the returned resource/resources is required +/// behavior for APIs. +/// +/// # Field Masks in Update Operations +/// +/// A field mask in update operations specifies which fields of the +/// targeted resource are going to be updated. The API is required +/// to only change the values of the fields as specified in the mask +/// and leave the others untouched. If a resource is passed in to +/// describe the updated values, the API ignores the values of all +/// fields not covered by the mask. +/// +/// If a repeated field is specified for an update operation, new values will +/// be appended to the existing repeated field in the target resource. Note that +/// a repeated field is only allowed in the last position of a `paths` string. +/// +/// If a sub-message is specified in the last position of the field mask for an +/// update operation, then new value will be merged into the existing sub-message +/// in the target resource. +/// +/// For example, given the target message: +/// +/// f { +/// b { +/// d: 1 +/// x: 2 +/// } +/// c: [1] +/// } +/// +/// And an update message: +/// +/// f { +/// b { +/// d: 10 +/// } +/// c: [2] +/// } +/// +/// then if the field mask is: +/// +/// paths: ["f.b", "f.c"] +/// +/// then the result will be: +/// +/// f { +/// b { +/// d: 10 +/// x: 2 +/// } +/// c: [1, 2] +/// } +/// +/// An implementation may provide options to override this default behavior for +/// repeated and message fields. +/// +/// In order to reset a field's value to the default, the field must +/// be in the mask and set to the default value in the provided resource. +/// Hence, in order to reset all fields of a resource, provide a default +/// instance of the resource and set all fields in the mask, or do +/// not provide a mask as described below. +/// +/// If a field mask is not present on update, the operation applies to +/// all fields (as if a field mask of all fields has been specified). +/// Note that in the presence of schema evolution, this may mean that +/// fields the client does not know and has therefore not filled into +/// the request will be reset to their default. If this is unwanted +/// behavior, a specific service may require a client to always specify +/// a field mask, producing an error if not. +/// +/// As with get operations, the location of the resource which +/// describes the updated values in the request message depends on the +/// operation kind. In any case, the effect of the field mask is +/// required to be honored by the API. +/// +/// ## Considerations for HTTP REST +/// +/// The HTTP kind of an update operation which uses a field mask must +/// be set to PATCH instead of PUT in order to satisfy HTTP semantics +/// (PUT must only be used for full updates). +/// +/// # JSON Encoding of Field Masks +/// +/// In JSON, a field mask is encoded as a single string where paths are +/// separated by a comma. Fields name in each path are converted +/// to/from lower-camel naming conventions. +/// +/// As an example, consider the following message declarations: +/// +/// message Profile { +/// User user = 1; +/// Photo photo = 2; +/// } +/// message User { +/// string display_name = 1; +/// string address = 2; +/// } +/// +/// In proto a field mask for `Profile` may look as such: +/// +/// mask { +/// paths: "user.display_name" +/// paths: "photo" +/// } +/// +/// In JSON, the same mask is represented as below: +/// +/// { +/// mask: "user.displayName,photo" +/// } +/// +/// # Field Masks and Oneof Fields +/// +/// Field masks treat fields in oneofs just as regular fields. Consider the +/// following message: +/// +/// message SampleMessage { +/// oneof test_oneof { +/// string name = 4; +/// SubMessage sub_message = 9; +/// } +/// } +/// +/// The field mask can be: +/// +/// mask { +/// paths: "name" +/// } +/// +/// Or: +/// +/// mask { +/// paths: "sub_message" +/// } +/// +/// Note that oneof type names ("test_oneof" in this case) cannot be used in +/// paths. +/// +/// ## Field Mask Verification +/// +/// The implementation of any API method which has a FieldMask type field in the +/// request should verify the included field paths, and return an +/// `INVALID_ARGUMENT` error if any path is unmappable. +class FieldMask extends $pb.GeneratedMessage with $mixin.FieldMaskMixin { + factory FieldMask({ + $core.Iterable<$core.String>? paths, + }) { + final $result = create(); + if (paths != null) { + $result.paths.addAll(paths); + } + return $result; + } + FieldMask._() : super(); + factory FieldMask.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory FieldMask.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'FieldMask', package: const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), createEmptyInstance: create, toProto3Json: $mixin.FieldMaskMixin.toProto3JsonHelper, fromProto3Json: $mixin.FieldMaskMixin.fromProto3JsonHelper) + ..pPS(1, _omitFieldNames ? '' : 'paths') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + FieldMask clone() => FieldMask()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + FieldMask copyWith(void Function(FieldMask) updates) => super.copyWith((message) => updates(message as FieldMask)) as FieldMask; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static FieldMask create() => FieldMask._(); + FieldMask createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static FieldMask getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static FieldMask? _defaultInstance; + + /// The set of field mask paths. + @$pb.TagNumber(1) + $core.List<$core.String> get paths => $_getList(0); +} + + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/field_mask.pbenum.dart b/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/field_mask.pbenum.dart new file mode 100644 index 00000000..97d02b53 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/field_mask.pbenum.dart @@ -0,0 +1,11 @@ +// +// Generated code. Do not modify. +// source: google/protobuf/field_mask.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + diff --git a/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/field_mask.pbjson.dart b/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/field_mask.pbjson.dart new file mode 100644 index 00000000..cc50b089 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/field_mask.pbjson.dart @@ -0,0 +1,27 @@ +// +// Generated code. Do not modify. +// source: google/protobuf/field_mask.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use fieldMaskDescriptor instead') +const FieldMask$json = { + '1': 'FieldMask', + '2': [ + {'1': 'paths', '3': 1, '4': 3, '5': 9, '10': 'paths'}, + ], +}; + +/// Descriptor for `FieldMask`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List fieldMaskDescriptor = $convert.base64Decode( + 'CglGaWVsZE1hc2sSFAoFcGF0aHMYASADKAlSBXBhdGhz'); + diff --git a/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/field_mask.pbserver.dart b/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/field_mask.pbserver.dart new file mode 100644 index 00000000..877c5017 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/field_mask.pbserver.dart @@ -0,0 +1,14 @@ +// +// Generated code. Do not modify. +// source: google/protobuf/field_mask.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +export 'field_mask.pb.dart'; + diff --git a/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/timestamp.pb.dart b/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/timestamp.pb.dart new file mode 100644 index 00000000..ea44b44e --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/timestamp.pb.dart @@ -0,0 +1,188 @@ +// +// Generated code. Do not modify. +// source: google/protobuf/timestamp.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:fixnum/fixnum.dart' as $fixnum; +import 'package:protobuf/protobuf.dart' as $pb; +import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin; + +/// A Timestamp represents a point in time independent of any time zone or local +/// calendar, encoded as a count of seconds and fractions of seconds at +/// nanosecond resolution. The count is relative to an epoch at UTC midnight on +/// January 1, 1970, in the proleptic Gregorian calendar which extends the +/// Gregorian calendar backwards to year one. +/// +/// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap +/// second table is needed for interpretation, using a [24-hour linear +/// smear](https://developers.google.com/time/smear). +/// +/// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By +/// restricting to that range, we ensure that we can convert to and from [RFC +/// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. +/// +/// # Examples +/// +/// Example 1: Compute Timestamp from POSIX `time()`. +/// +/// Timestamp timestamp; +/// timestamp.set_seconds(time(NULL)); +/// timestamp.set_nanos(0); +/// +/// Example 2: Compute Timestamp from POSIX `gettimeofday()`. +/// +/// struct timeval tv; +/// gettimeofday(&tv, NULL); +/// +/// Timestamp timestamp; +/// timestamp.set_seconds(tv.tv_sec); +/// timestamp.set_nanos(tv.tv_usec * 1000); +/// +/// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. +/// +/// FILETIME ft; +/// GetSystemTimeAsFileTime(&ft); +/// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; +/// +/// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z +/// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. +/// Timestamp timestamp; +/// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); +/// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); +/// +/// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. +/// +/// long millis = System.currentTimeMillis(); +/// +/// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) +/// .setNanos((int) ((millis % 1000) * 1000000)).build(); +/// +/// Example 5: Compute Timestamp from Java `Instant.now()`. +/// +/// Instant now = Instant.now(); +/// +/// Timestamp timestamp = +/// Timestamp.newBuilder().setSeconds(now.getEpochSecond()) +/// .setNanos(now.getNano()).build(); +/// +/// Example 6: Compute Timestamp from current time in Python. +/// +/// timestamp = Timestamp() +/// timestamp.GetCurrentTime() +/// +/// # JSON Mapping +/// +/// In JSON format, the Timestamp type is encoded as a string in the +/// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the +/// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" +/// where {year} is always expressed using four digits while {month}, {day}, +/// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional +/// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), +/// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone +/// is required. A proto3 JSON serializer should always use UTC (as indicated by +/// "Z") when printing the Timestamp type and a proto3 JSON parser should be +/// able to accept both UTC and other timezones (as indicated by an offset). +/// +/// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past +/// 01:30 UTC on January 15, 2017. +/// +/// In JavaScript, one can convert a Date object to this format using the +/// standard +/// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) +/// method. In Python, a standard `datetime.datetime` object can be converted +/// to this format using +/// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with +/// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use +/// the Joda Time's [`ISODateTimeFormat.dateTime()`]( +/// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() +/// ) to obtain a formatter capable of generating timestamps in this format. +class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin { + factory Timestamp({ + $fixnum.Int64? seconds, + $core.int? nanos, + }) { + final $result = create(); + if (seconds != null) { + $result.seconds = seconds; + } + if (nanos != null) { + $result.nanos = nanos; + } + return $result; + } + Timestamp._() : super(); + factory Timestamp.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Timestamp.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Timestamp', package: const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), createEmptyInstance: create, toProto3Json: $mixin.TimestampMixin.toProto3JsonHelper, fromProto3Json: $mixin.TimestampMixin.fromProto3JsonHelper) + ..aInt64(1, _omitFieldNames ? '' : 'seconds') + ..a<$core.int>(2, _omitFieldNames ? '' : 'nanos', $pb.PbFieldType.O3) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Timestamp clone() => Timestamp()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Timestamp copyWith(void Function(Timestamp) updates) => super.copyWith((message) => updates(message as Timestamp)) as Timestamp; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Timestamp create() => Timestamp._(); + Timestamp createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Timestamp getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Timestamp? _defaultInstance; + + /// Represents seconds of UTC time since Unix epoch + /// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + /// 9999-12-31T23:59:59Z inclusive. + @$pb.TagNumber(1) + $fixnum.Int64 get seconds => $_getI64(0); + @$pb.TagNumber(1) + set seconds($fixnum.Int64 v) { $_setInt64(0, v); } + @$pb.TagNumber(1) + $core.bool hasSeconds() => $_has(0); + @$pb.TagNumber(1) + void clearSeconds() => clearField(1); + + /// Non-negative fractions of a second at nanosecond resolution. Negative + /// second values with fractions must still have non-negative nanos values + /// that count forward in time. Must be from 0 to 999,999,999 + /// inclusive. + @$pb.TagNumber(2) + $core.int get nanos => $_getIZ(1); + @$pb.TagNumber(2) + set nanos($core.int v) { $_setSignedInt32(1, v); } + @$pb.TagNumber(2) + $core.bool hasNanos() => $_has(1); + @$pb.TagNumber(2) + void clearNanos() => clearField(2); + /// Creates a new instance from [dateTime]. + /// + /// Time zone information will not be preserved. + static Timestamp fromDateTime($core.DateTime dateTime) { + final result = create(); + $mixin.TimestampMixin.setFromDateTime(result, dateTime); + return result; + } +} + + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/timestamp.pbenum.dart b/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/timestamp.pbenum.dart new file mode 100644 index 00000000..30275f6a --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/timestamp.pbenum.dart @@ -0,0 +1,11 @@ +// +// Generated code. Do not modify. +// source: google/protobuf/timestamp.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + diff --git a/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/timestamp.pbjson.dart b/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/timestamp.pbjson.dart new file mode 100644 index 00000000..3dfd63b5 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/timestamp.pbjson.dart @@ -0,0 +1,29 @@ +// +// Generated code. Do not modify. +// source: google/protobuf/timestamp.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use timestampDescriptor instead') +const Timestamp$json = { + '1': 'Timestamp', + '2': [ + {'1': 'seconds', '3': 1, '4': 1, '5': 3, '10': 'seconds'}, + {'1': 'nanos', '3': 2, '4': 1, '5': 5, '10': 'nanos'}, + ], +}; + +/// Descriptor for `Timestamp`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List timestampDescriptor = $convert.base64Decode( + 'CglUaW1lc3RhbXASGAoHc2Vjb25kcxgBIAEoA1IHc2Vjb25kcxIUCgVuYW5vcxgCIAEoBVIFbm' + 'Fub3M='); + diff --git a/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/timestamp.pbserver.dart b/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/timestamp.pbserver.dart new file mode 100644 index 00000000..6580f167 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/google/protobuf/timestamp.pbserver.dart @@ -0,0 +1,14 @@ +// +// Generated code. Do not modify. +// source: google/protobuf/timestamp.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +export 'timestamp.pb.dart'; + diff --git a/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/health_check.pb.dart b/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/health_check.pb.dart new file mode 100644 index 00000000..a00a2fc7 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/health_check.pb.dart @@ -0,0 +1,118 @@ +// +// Generated code. Do not modify. +// source: machine_learning/v1/health_check.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +class PingRequest extends $pb.GeneratedMessage { + factory PingRequest({ + $core.String? name, + }) { + final $result = create(); + if (name != null) { + $result.name = name; + } + return $result; + } + PingRequest._() : super(); + factory PingRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory PingRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'PingRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'machine_learning.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'name') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + PingRequest clone() => PingRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + PingRequest copyWith(void Function(PingRequest) updates) => super.copyWith((message) => updates(message as PingRequest)) as PingRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static PingRequest create() => PingRequest._(); + PingRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static PingRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static PingRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get name => $_getSZ(0); + @$pb.TagNumber(1) + set name($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasName() => $_has(0); + @$pb.TagNumber(1) + void clearName() => clearField(1); +} + +class PingResponse extends $pb.GeneratedMessage { + factory PingResponse({ + $core.String? message, + }) { + final $result = create(); + if (message != null) { + $result.message = message; + } + return $result; + } + PingResponse._() : super(); + factory PingResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory PingResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'PingResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'machine_learning.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'message') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + PingResponse clone() => PingResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + PingResponse copyWith(void Function(PingResponse) updates) => super.copyWith((message) => updates(message as PingResponse)) as PingResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static PingResponse create() => PingResponse._(); + PingResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static PingResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static PingResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get message => $_getSZ(0); + @$pb.TagNumber(1) + set message($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasMessage() => $_has(0); + @$pb.TagNumber(1) + void clearMessage() => clearField(1); +} + + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/health_check.pbenum.dart b/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/health_check.pbenum.dart new file mode 100644 index 00000000..e066cff3 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/health_check.pbenum.dart @@ -0,0 +1,11 @@ +// +// Generated code. Do not modify. +// source: machine_learning/v1/health_check.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + diff --git a/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/health_check.pbgrpc.dart b/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/health_check.pbgrpc.dart new file mode 100644 index 00000000..ca5c3ca6 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/health_check.pbgrpc.dart @@ -0,0 +1,59 @@ +// +// Generated code. Do not modify. +// source: machine_learning/v1/health_check.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:async' as $async; +import 'dart:core' as $core; + +import 'package:grpc/service_api.dart' as $grpc; +import 'package:protobuf/protobuf.dart' as $pb; + +import 'health_check.pb.dart' as $0; + +export 'health_check.pb.dart'; + +@$pb.GrpcServiceName('machine_learning.v1.HealthcheckService') +class HealthcheckServiceClient extends $grpc.Client { + static final _$ping = $grpc.ClientMethod<$0.PingRequest, $0.PingResponse>( + '/machine_learning.v1.HealthcheckService/Ping', + ($0.PingRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $0.PingResponse.fromBuffer(value)); + + HealthcheckServiceClient($grpc.ClientChannel channel, + {$grpc.CallOptions? options, + $core.Iterable<$grpc.ClientInterceptor>? interceptors}) + : super(channel, options: options, + interceptors: interceptors); + + $grpc.ResponseFuture<$0.PingResponse> ping($0.PingRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$ping, request, options: options); + } +} + +@$pb.GrpcServiceName('machine_learning.v1.HealthcheckService') +abstract class HealthcheckServiceBase extends $grpc.Service { + $core.String get $name => 'machine_learning.v1.HealthcheckService'; + + HealthcheckServiceBase() { + $addMethod($grpc.ServiceMethod<$0.PingRequest, $0.PingResponse>( + 'Ping', + ping_Pre, + false, + false, + ($core.List<$core.int> value) => $0.PingRequest.fromBuffer(value), + ($0.PingResponse value) => value.writeToBuffer())); + } + + $async.Future<$0.PingResponse> ping_Pre($grpc.ServiceCall call, $async.Future<$0.PingRequest> request) async { + return ping(call, await request); + } + + $async.Future<$0.PingResponse> ping($grpc.ServiceCall call, $0.PingRequest request); +} diff --git a/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/health_check.pbjson.dart b/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/health_check.pbjson.dart new file mode 100644 index 00000000..8be154bc --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/health_check.pbjson.dart @@ -0,0 +1,39 @@ +// +// Generated code. Do not modify. +// source: machine_learning/v1/health_check.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use pingRequestDescriptor instead') +const PingRequest$json = { + '1': 'PingRequest', + '2': [ + {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'}, + ], +}; + +/// Descriptor for `PingRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List pingRequestDescriptor = $convert.base64Decode( + 'CgtQaW5nUmVxdWVzdBISCgRuYW1lGAEgASgJUgRuYW1l'); + +@$core.Deprecated('Use pingResponseDescriptor instead') +const PingResponse$json = { + '1': 'PingResponse', + '2': [ + {'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'}, + ], +}; + +/// Descriptor for `PingResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List pingResponseDescriptor = $convert.base64Decode( + 'CgxQaW5nUmVzcG9uc2USGAoHbWVzc2FnZRgBIAEoCVIHbWVzc2FnZQ=='); + diff --git a/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/machine_learning.pb.dart b/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/machine_learning.pb.dart new file mode 100644 index 00000000..b91db661 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/machine_learning.pb.dart @@ -0,0 +1,331 @@ +// +// Generated code. Do not modify. +// source: machine_learning/v1/machine_learning.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +import '../../where_child_bus/v1/resources.pbenum.dart' as $3; +import 'machine_learning.pbenum.dart'; + +export 'machine_learning.pbenum.dart'; + +class TrainRequest extends $pb.GeneratedMessage { + factory TrainRequest({ + $core.String? nurseryId, + $core.String? busId, + $core.Iterable<$core.String>? childIds, + $3.BusType? busType, + }) { + final $result = create(); + if (nurseryId != null) { + $result.nurseryId = nurseryId; + } + if (busId != null) { + $result.busId = busId; + } + if (childIds != null) { + $result.childIds.addAll(childIds); + } + if (busType != null) { + $result.busType = busType; + } + return $result; + } + TrainRequest._() : super(); + factory TrainRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory TrainRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'TrainRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'machine_learning.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'nurseryId') + ..aOS(2, _omitFieldNames ? '' : 'busId') + ..pPS(3, _omitFieldNames ? '' : 'childIds') + ..e<$3.BusType>(4, _omitFieldNames ? '' : 'busType', $pb.PbFieldType.OE, defaultOrMaker: $3.BusType.BUS_TYPE_UNSPECIFIED, valueOf: $3.BusType.valueOf, enumValues: $3.BusType.values) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + TrainRequest clone() => TrainRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + TrainRequest copyWith(void Function(TrainRequest) updates) => super.copyWith((message) => updates(message as TrainRequest)) as TrainRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static TrainRequest create() => TrainRequest._(); + TrainRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static TrainRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static TrainRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get nurseryId => $_getSZ(0); + @$pb.TagNumber(1) + set nurseryId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasNurseryId() => $_has(0); + @$pb.TagNumber(1) + void clearNurseryId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get busId => $_getSZ(1); + @$pb.TagNumber(2) + set busId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasBusId() => $_has(1); + @$pb.TagNumber(2) + void clearBusId() => clearField(2); + + @$pb.TagNumber(3) + $core.List<$core.String> get childIds => $_getList(2); + + @$pb.TagNumber(4) + $3.BusType get busType => $_getN(3); + @$pb.TagNumber(4) + set busType($3.BusType v) { setField(4, v); } + @$pb.TagNumber(4) + $core.bool hasBusType() => $_has(3); + @$pb.TagNumber(4) + void clearBusType() => clearField(4); +} + +class TrainResponse extends $pb.GeneratedMessage { + factory TrainResponse({ + Status? status, + }) { + final $result = create(); + if (status != null) { + $result.status = status; + } + return $result; + } + TrainResponse._() : super(); + factory TrainResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory TrainResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'TrainResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'machine_learning.v1'), createEmptyInstance: create) + ..e(1, _omitFieldNames ? '' : 'status', $pb.PbFieldType.OE, defaultOrMaker: Status.STATUS_UNSPECIFIED, valueOf: Status.valueOf, enumValues: Status.values) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + TrainResponse clone() => TrainResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + TrainResponse copyWith(void Function(TrainResponse) updates) => super.copyWith((message) => updates(message as TrainResponse)) as TrainResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static TrainResponse create() => TrainResponse._(); + TrainResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static TrainResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static TrainResponse? _defaultInstance; + + @$pb.TagNumber(1) + Status get status => $_getN(0); + @$pb.TagNumber(1) + set status(Status v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasStatus() => $_has(0); + @$pb.TagNumber(1) + void clearStatus() => clearField(1); +} + +class PredResponse extends $pb.GeneratedMessage { + factory PredResponse({ + $core.bool? isDetected, + $core.Iterable<$core.String>? childIds, + }) { + final $result = create(); + if (isDetected != null) { + $result.isDetected = isDetected; + } + if (childIds != null) { + $result.childIds.addAll(childIds); + } + return $result; + } + PredResponse._() : super(); + factory PredResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory PredResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'PredResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'machine_learning.v1'), createEmptyInstance: create) + ..aOB(1, _omitFieldNames ? '' : 'isDetected') + ..pPS(2, _omitFieldNames ? '' : 'childIds') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + PredResponse clone() => PredResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + PredResponse copyWith(void Function(PredResponse) updates) => super.copyWith((message) => updates(message as PredResponse)) as PredResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static PredResponse create() => PredResponse._(); + PredResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static PredResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static PredResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.bool get isDetected => $_getBF(0); + @$pb.TagNumber(1) + set isDetected($core.bool v) { $_setBool(0, v); } + @$pb.TagNumber(1) + $core.bool hasIsDetected() => $_has(0); + @$pb.TagNumber(1) + void clearIsDetected() => clearField(1); + + @$pb.TagNumber(2) + $core.List<$core.String> get childIds => $_getList(1); +} + +class FaceDetectAndClipRequest extends $pb.GeneratedMessage { + factory FaceDetectAndClipRequest({ + $core.String? nurseryId, + $core.String? childId, + }) { + final $result = create(); + if (nurseryId != null) { + $result.nurseryId = nurseryId; + } + if (childId != null) { + $result.childId = childId; + } + return $result; + } + FaceDetectAndClipRequest._() : super(); + factory FaceDetectAndClipRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory FaceDetectAndClipRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'FaceDetectAndClipRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'machine_learning.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'nurseryId') + ..aOS(2, _omitFieldNames ? '' : 'childId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + FaceDetectAndClipRequest clone() => FaceDetectAndClipRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + FaceDetectAndClipRequest copyWith(void Function(FaceDetectAndClipRequest) updates) => super.copyWith((message) => updates(message as FaceDetectAndClipRequest)) as FaceDetectAndClipRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static FaceDetectAndClipRequest create() => FaceDetectAndClipRequest._(); + FaceDetectAndClipRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static FaceDetectAndClipRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static FaceDetectAndClipRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get nurseryId => $_getSZ(0); + @$pb.TagNumber(1) + set nurseryId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasNurseryId() => $_has(0); + @$pb.TagNumber(1) + void clearNurseryId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get childId => $_getSZ(1); + @$pb.TagNumber(2) + set childId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasChildId() => $_has(1); + @$pb.TagNumber(2) + void clearChildId() => clearField(2); +} + +class FaceDetectAndClipResponse extends $pb.GeneratedMessage { + factory FaceDetectAndClipResponse({ + $core.bool? isStarted, + }) { + final $result = create(); + if (isStarted != null) { + $result.isStarted = isStarted; + } + return $result; + } + FaceDetectAndClipResponse._() : super(); + factory FaceDetectAndClipResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory FaceDetectAndClipResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'FaceDetectAndClipResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'machine_learning.v1'), createEmptyInstance: create) + ..aOB(1, _omitFieldNames ? '' : 'isStarted') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + FaceDetectAndClipResponse clone() => FaceDetectAndClipResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + FaceDetectAndClipResponse copyWith(void Function(FaceDetectAndClipResponse) updates) => super.copyWith((message) => updates(message as FaceDetectAndClipResponse)) as FaceDetectAndClipResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static FaceDetectAndClipResponse create() => FaceDetectAndClipResponse._(); + FaceDetectAndClipResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static FaceDetectAndClipResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static FaceDetectAndClipResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.bool get isStarted => $_getBF(0); + @$pb.TagNumber(1) + set isStarted($core.bool v) { $_setBool(0, v); } + @$pb.TagNumber(1) + $core.bool hasIsStarted() => $_has(0); + @$pb.TagNumber(1) + void clearIsStarted() => clearField(1); +} + + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/machine_learning.pbenum.dart b/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/machine_learning.pbenum.dart new file mode 100644 index 00000000..0ce7dbd8 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/machine_learning.pbenum.dart @@ -0,0 +1,38 @@ +// +// Generated code. Do not modify. +// source: machine_learning/v1/machine_learning.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +class Status extends $pb.ProtobufEnum { + static const Status STATUS_UNSPECIFIED = Status._(0, _omitEnumNames ? '' : 'STATUS_UNSPECIFIED'); + static const Status STATUS_SUCCESS = Status._(1, _omitEnumNames ? '' : 'STATUS_SUCCESS'); + static const Status STATUS_PROCESSING = Status._(2, _omitEnumNames ? '' : 'STATUS_PROCESSING'); + static const Status STATUS_FAILED = Status._(3, _omitEnumNames ? '' : 'STATUS_FAILED'); + static const Status STATUS_WAITING = Status._(4, _omitEnumNames ? '' : 'STATUS_WAITING'); + + static const $core.List values = [ + STATUS_UNSPECIFIED, + STATUS_SUCCESS, + STATUS_PROCESSING, + STATUS_FAILED, + STATUS_WAITING, + ]; + + static final $core.Map<$core.int, Status> _byValue = $pb.ProtobufEnum.initByValue(values); + static Status? valueOf($core.int value) => _byValue[value]; + + const Status._($core.int v, $core.String n) : super(v, n); +} + + +const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names'); diff --git a/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/machine_learning.pbgrpc.dart b/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/machine_learning.pbgrpc.dart new file mode 100644 index 00000000..28e01ab5 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/machine_learning.pbgrpc.dart @@ -0,0 +1,96 @@ +// +// Generated code. Do not modify. +// source: machine_learning/v1/machine_learning.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:async' as $async; +import 'dart:core' as $core; + +import 'package:grpc/service_api.dart' as $grpc; +import 'package:protobuf/protobuf.dart' as $pb; + +import '../../where_child_bus/v1/bus.pb.dart' as $1; +import 'machine_learning.pb.dart' as $2; + +export 'machine_learning.pb.dart'; + +@$pb.GrpcServiceName('machine_learning.v1.MachineLearningService') +class MachineLearningServiceClient extends $grpc.Client { + static final _$train = $grpc.ClientMethod<$2.TrainRequest, $2.TrainResponse>( + '/machine_learning.v1.MachineLearningService/Train', + ($2.TrainRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $2.TrainResponse.fromBuffer(value)); + static final _$pred = $grpc.ClientMethod<$1.StreamBusVideoRequest, $2.PredResponse>( + '/machine_learning.v1.MachineLearningService/Pred', + ($1.StreamBusVideoRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $2.PredResponse.fromBuffer(value)); + static final _$faceDetectAndClip = $grpc.ClientMethod<$2.FaceDetectAndClipRequest, $2.FaceDetectAndClipResponse>( + '/machine_learning.v1.MachineLearningService/FaceDetectAndClip', + ($2.FaceDetectAndClipRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $2.FaceDetectAndClipResponse.fromBuffer(value)); + + MachineLearningServiceClient($grpc.ClientChannel channel, + {$grpc.CallOptions? options, + $core.Iterable<$grpc.ClientInterceptor>? interceptors}) + : super(channel, options: options, + interceptors: interceptors); + + $grpc.ResponseStream<$2.TrainResponse> train($2.TrainRequest request, {$grpc.CallOptions? options}) { + return $createStreamingCall(_$train, $async.Stream.fromIterable([request]), options: options); + } + + $grpc.ResponseStream<$2.PredResponse> pred($async.Stream<$1.StreamBusVideoRequest> request, {$grpc.CallOptions? options}) { + return $createStreamingCall(_$pred, request, options: options); + } + + $grpc.ResponseFuture<$2.FaceDetectAndClipResponse> faceDetectAndClip($2.FaceDetectAndClipRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$faceDetectAndClip, request, options: options); + } +} + +@$pb.GrpcServiceName('machine_learning.v1.MachineLearningService') +abstract class MachineLearningServiceBase extends $grpc.Service { + $core.String get $name => 'machine_learning.v1.MachineLearningService'; + + MachineLearningServiceBase() { + $addMethod($grpc.ServiceMethod<$2.TrainRequest, $2.TrainResponse>( + 'Train', + train_Pre, + false, + true, + ($core.List<$core.int> value) => $2.TrainRequest.fromBuffer(value), + ($2.TrainResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$1.StreamBusVideoRequest, $2.PredResponse>( + 'Pred', + pred, + true, + true, + ($core.List<$core.int> value) => $1.StreamBusVideoRequest.fromBuffer(value), + ($2.PredResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$2.FaceDetectAndClipRequest, $2.FaceDetectAndClipResponse>( + 'FaceDetectAndClip', + faceDetectAndClip_Pre, + false, + false, + ($core.List<$core.int> value) => $2.FaceDetectAndClipRequest.fromBuffer(value), + ($2.FaceDetectAndClipResponse value) => value.writeToBuffer())); + } + + $async.Stream<$2.TrainResponse> train_Pre($grpc.ServiceCall call, $async.Future<$2.TrainRequest> request) async* { + yield* train(call, await request); + } + + $async.Future<$2.FaceDetectAndClipResponse> faceDetectAndClip_Pre($grpc.ServiceCall call, $async.Future<$2.FaceDetectAndClipRequest> request) async { + return faceDetectAndClip(call, await request); + } + + $async.Stream<$2.TrainResponse> train($grpc.ServiceCall call, $2.TrainRequest request); + $async.Stream<$2.PredResponse> pred($grpc.ServiceCall call, $async.Stream<$1.StreamBusVideoRequest> request); + $async.Future<$2.FaceDetectAndClipResponse> faceDetectAndClip($grpc.ServiceCall call, $2.FaceDetectAndClipRequest request); +} diff --git a/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/machine_learning.pbjson.dart b/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/machine_learning.pbjson.dart new file mode 100644 index 00000000..602b85d5 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/machine_learning/v1/machine_learning.pbjson.dart @@ -0,0 +1,104 @@ +// +// Generated code. Do not modify. +// source: machine_learning/v1/machine_learning.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use statusDescriptor instead') +const Status$json = { + '1': 'Status', + '2': [ + {'1': 'STATUS_UNSPECIFIED', '2': 0}, + {'1': 'STATUS_SUCCESS', '2': 1}, + {'1': 'STATUS_PROCESSING', '2': 2}, + {'1': 'STATUS_FAILED', '2': 3}, + {'1': 'STATUS_WAITING', '2': 4}, + ], +}; + +/// Descriptor for `Status`. Decode as a `google.protobuf.EnumDescriptorProto`. +final $typed_data.Uint8List statusDescriptor = $convert.base64Decode( + 'CgZTdGF0dXMSFgoSU1RBVFVTX1VOU1BFQ0lGSUVEEAASEgoOU1RBVFVTX1NVQ0NFU1MQARIVCh' + 'FTVEFUVVNfUFJPQ0VTU0lORxACEhEKDVNUQVRVU19GQUlMRUQQAxISCg5TVEFUVVNfV0FJVElO' + 'RxAE'); + +@$core.Deprecated('Use trainRequestDescriptor instead') +const TrainRequest$json = { + '1': 'TrainRequest', + '2': [ + {'1': 'nursery_id', '3': 1, '4': 1, '5': 9, '10': 'nurseryId'}, + {'1': 'bus_id', '3': 2, '4': 1, '5': 9, '10': 'busId'}, + {'1': 'child_ids', '3': 3, '4': 3, '5': 9, '10': 'childIds'}, + {'1': 'bus_type', '3': 4, '4': 1, '5': 14, '6': '.where_child_bus.v1.BusType', '10': 'busType'}, + ], +}; + +/// Descriptor for `TrainRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List trainRequestDescriptor = $convert.base64Decode( + 'CgxUcmFpblJlcXVlc3QSHQoKbnVyc2VyeV9pZBgBIAEoCVIJbnVyc2VyeUlkEhUKBmJ1c19pZB' + 'gCIAEoCVIFYnVzSWQSGwoJY2hpbGRfaWRzGAMgAygJUghjaGlsZElkcxI2CghidXNfdHlwZRgE' + 'IAEoDjIbLndoZXJlX2NoaWxkX2J1cy52MS5CdXNUeXBlUgdidXNUeXBl'); + +@$core.Deprecated('Use trainResponseDescriptor instead') +const TrainResponse$json = { + '1': 'TrainResponse', + '2': [ + {'1': 'status', '3': 1, '4': 1, '5': 14, '6': '.machine_learning.v1.Status', '10': 'status'}, + ], +}; + +/// Descriptor for `TrainResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List trainResponseDescriptor = $convert.base64Decode( + 'Cg1UcmFpblJlc3BvbnNlEjMKBnN0YXR1cxgBIAEoDjIbLm1hY2hpbmVfbGVhcm5pbmcudjEuU3' + 'RhdHVzUgZzdGF0dXM='); + +@$core.Deprecated('Use predResponseDescriptor instead') +const PredResponse$json = { + '1': 'PredResponse', + '2': [ + {'1': 'is_detected', '3': 1, '4': 1, '5': 8, '10': 'isDetected'}, + {'1': 'child_ids', '3': 2, '4': 3, '5': 9, '10': 'childIds'}, + ], +}; + +/// Descriptor for `PredResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List predResponseDescriptor = $convert.base64Decode( + 'CgxQcmVkUmVzcG9uc2USHwoLaXNfZGV0ZWN0ZWQYASABKAhSCmlzRGV0ZWN0ZWQSGwoJY2hpbG' + 'RfaWRzGAIgAygJUghjaGlsZElkcw=='); + +@$core.Deprecated('Use faceDetectAndClipRequestDescriptor instead') +const FaceDetectAndClipRequest$json = { + '1': 'FaceDetectAndClipRequest', + '2': [ + {'1': 'nursery_id', '3': 1, '4': 1, '5': 9, '10': 'nurseryId'}, + {'1': 'child_id', '3': 2, '4': 1, '5': 9, '10': 'childId'}, + ], +}; + +/// Descriptor for `FaceDetectAndClipRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List faceDetectAndClipRequestDescriptor = $convert.base64Decode( + 'ChhGYWNlRGV0ZWN0QW5kQ2xpcFJlcXVlc3QSHQoKbnVyc2VyeV9pZBgBIAEoCVIJbnVyc2VyeU' + 'lkEhkKCGNoaWxkX2lkGAIgASgJUgdjaGlsZElk'); + +@$core.Deprecated('Use faceDetectAndClipResponseDescriptor instead') +const FaceDetectAndClipResponse$json = { + '1': 'FaceDetectAndClipResponse', + '2': [ + {'1': 'is_started', '3': 1, '4': 1, '5': 8, '10': 'isStarted'}, + ], +}; + +/// Descriptor for `FaceDetectAndClipResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List faceDetectAndClipResponseDescriptor = $convert.base64Decode( + 'ChlGYWNlRGV0ZWN0QW5kQ2xpcFJlc3BvbnNlEh0KCmlzX3N0YXJ0ZWQYASABKAhSCWlzU3Rhcn' + 'RlZA=='); + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus.pb.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus.pb.dart new file mode 100644 index 00000000..d359765b --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus.pb.dart @@ -0,0 +1,1119 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/bus.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +import '../../google/protobuf/field_mask.pb.dart' as $10; +import 'resources.pb.dart' as $9; +import 'resources.pbenum.dart' as $9; + +class CreateBusRequest extends $pb.GeneratedMessage { + factory CreateBusRequest({ + $core.String? nurseryId, + $core.String? name, + $core.String? plateNumber, + }) { + final $result = create(); + if (nurseryId != null) { + $result.nurseryId = nurseryId; + } + if (name != null) { + $result.name = name; + } + if (plateNumber != null) { + $result.plateNumber = plateNumber; + } + return $result; + } + CreateBusRequest._() : super(); + factory CreateBusRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory CreateBusRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'CreateBusRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'nurseryId') + ..aOS(2, _omitFieldNames ? '' : 'name') + ..aOS(3, _omitFieldNames ? '' : 'plateNumber') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + CreateBusRequest clone() => CreateBusRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + CreateBusRequest copyWith(void Function(CreateBusRequest) updates) => super.copyWith((message) => updates(message as CreateBusRequest)) as CreateBusRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static CreateBusRequest create() => CreateBusRequest._(); + CreateBusRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static CreateBusRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CreateBusRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get nurseryId => $_getSZ(0); + @$pb.TagNumber(1) + set nurseryId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasNurseryId() => $_has(0); + @$pb.TagNumber(1) + void clearNurseryId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get name => $_getSZ(1); + @$pb.TagNumber(2) + set name($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasName() => $_has(1); + @$pb.TagNumber(2) + void clearName() => clearField(2); + + @$pb.TagNumber(3) + $core.String get plateNumber => $_getSZ(2); + @$pb.TagNumber(3) + set plateNumber($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasPlateNumber() => $_has(2); + @$pb.TagNumber(3) + void clearPlateNumber() => clearField(3); +} + +class CreateBusResponse extends $pb.GeneratedMessage { + factory CreateBusResponse({ + $9.Bus? bus, + }) { + final $result = create(); + if (bus != null) { + $result.bus = bus; + } + return $result; + } + CreateBusResponse._() : super(); + factory CreateBusResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory CreateBusResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'CreateBusResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.Bus>(1, _omitFieldNames ? '' : 'bus', subBuilder: $9.Bus.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + CreateBusResponse clone() => CreateBusResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + CreateBusResponse copyWith(void Function(CreateBusResponse) updates) => super.copyWith((message) => updates(message as CreateBusResponse)) as CreateBusResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static CreateBusResponse create() => CreateBusResponse._(); + CreateBusResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static CreateBusResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CreateBusResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.Bus get bus => $_getN(0); + @$pb.TagNumber(1) + set bus($9.Bus v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasBus() => $_has(0); + @$pb.TagNumber(1) + void clearBus() => clearField(1); + @$pb.TagNumber(1) + $9.Bus ensureBus() => $_ensure(0); +} + +class GetBusListByNurseryIdRequest extends $pb.GeneratedMessage { + factory GetBusListByNurseryIdRequest({ + $core.String? nurseryId, + }) { + final $result = create(); + if (nurseryId != null) { + $result.nurseryId = nurseryId; + } + return $result; + } + GetBusListByNurseryIdRequest._() : super(); + factory GetBusListByNurseryIdRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetBusListByNurseryIdRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetBusListByNurseryIdRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'nurseryId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetBusListByNurseryIdRequest clone() => GetBusListByNurseryIdRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetBusListByNurseryIdRequest copyWith(void Function(GetBusListByNurseryIdRequest) updates) => super.copyWith((message) => updates(message as GetBusListByNurseryIdRequest)) as GetBusListByNurseryIdRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetBusListByNurseryIdRequest create() => GetBusListByNurseryIdRequest._(); + GetBusListByNurseryIdRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetBusListByNurseryIdRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetBusListByNurseryIdRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get nurseryId => $_getSZ(0); + @$pb.TagNumber(1) + set nurseryId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasNurseryId() => $_has(0); + @$pb.TagNumber(1) + void clearNurseryId() => clearField(1); +} + +class GetBusListByNurseryIdResponse extends $pb.GeneratedMessage { + factory GetBusListByNurseryIdResponse({ + $core.Iterable<$9.Bus>? buses, + }) { + final $result = create(); + if (buses != null) { + $result.buses.addAll(buses); + } + return $result; + } + GetBusListByNurseryIdResponse._() : super(); + factory GetBusListByNurseryIdResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetBusListByNurseryIdResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetBusListByNurseryIdResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..pc<$9.Bus>(1, _omitFieldNames ? '' : 'buses', $pb.PbFieldType.PM, subBuilder: $9.Bus.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetBusListByNurseryIdResponse clone() => GetBusListByNurseryIdResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetBusListByNurseryIdResponse copyWith(void Function(GetBusListByNurseryIdResponse) updates) => super.copyWith((message) => updates(message as GetBusListByNurseryIdResponse)) as GetBusListByNurseryIdResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetBusListByNurseryIdResponse create() => GetBusListByNurseryIdResponse._(); + GetBusListByNurseryIdResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetBusListByNurseryIdResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetBusListByNurseryIdResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.List<$9.Bus> get buses => $_getList(0); +} + +class GetRunningBusByGuardianIdRequest extends $pb.GeneratedMessage { + factory GetRunningBusByGuardianIdRequest({ + $core.String? guardianId, + }) { + final $result = create(); + if (guardianId != null) { + $result.guardianId = guardianId; + } + return $result; + } + GetRunningBusByGuardianIdRequest._() : super(); + factory GetRunningBusByGuardianIdRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetRunningBusByGuardianIdRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetRunningBusByGuardianIdRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'guardianId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetRunningBusByGuardianIdRequest clone() => GetRunningBusByGuardianIdRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetRunningBusByGuardianIdRequest copyWith(void Function(GetRunningBusByGuardianIdRequest) updates) => super.copyWith((message) => updates(message as GetRunningBusByGuardianIdRequest)) as GetRunningBusByGuardianIdRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetRunningBusByGuardianIdRequest create() => GetRunningBusByGuardianIdRequest._(); + GetRunningBusByGuardianIdRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetRunningBusByGuardianIdRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetRunningBusByGuardianIdRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get guardianId => $_getSZ(0); + @$pb.TagNumber(1) + set guardianId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGuardianId() => $_has(0); + @$pb.TagNumber(1) + void clearGuardianId() => clearField(1); +} + +class GetRunningBusByGuardianIdResponse extends $pb.GeneratedMessage { + factory GetRunningBusByGuardianIdResponse({ + $9.Bus? bus, + }) { + final $result = create(); + if (bus != null) { + $result.bus = bus; + } + return $result; + } + GetRunningBusByGuardianIdResponse._() : super(); + factory GetRunningBusByGuardianIdResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetRunningBusByGuardianIdResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetRunningBusByGuardianIdResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.Bus>(1, _omitFieldNames ? '' : 'bus', subBuilder: $9.Bus.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetRunningBusByGuardianIdResponse clone() => GetRunningBusByGuardianIdResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetRunningBusByGuardianIdResponse copyWith(void Function(GetRunningBusByGuardianIdResponse) updates) => super.copyWith((message) => updates(message as GetRunningBusByGuardianIdResponse)) as GetRunningBusByGuardianIdResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetRunningBusByGuardianIdResponse create() => GetRunningBusByGuardianIdResponse._(); + GetRunningBusByGuardianIdResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetRunningBusByGuardianIdResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetRunningBusByGuardianIdResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.Bus get bus => $_getN(0); + @$pb.TagNumber(1) + set bus($9.Bus v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasBus() => $_has(0); + @$pb.TagNumber(1) + void clearBus() => clearField(1); + @$pb.TagNumber(1) + $9.Bus ensureBus() => $_ensure(0); +} + +class ChangeBusStatusRequest extends $pb.GeneratedMessage { + factory ChangeBusStatusRequest({ + $core.String? busId, + $9.BusStatus? busStatus, + $9.BusType? busType, + }) { + final $result = create(); + if (busId != null) { + $result.busId = busId; + } + if (busStatus != null) { + $result.busStatus = busStatus; + } + if (busType != null) { + $result.busType = busType; + } + return $result; + } + ChangeBusStatusRequest._() : super(); + factory ChangeBusStatusRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ChangeBusStatusRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ChangeBusStatusRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'busId') + ..e<$9.BusStatus>(2, _omitFieldNames ? '' : 'busStatus', $pb.PbFieldType.OE, defaultOrMaker: $9.BusStatus.BUS_STATUS_UNSPECIFIED, valueOf: $9.BusStatus.valueOf, enumValues: $9.BusStatus.values) + ..e<$9.BusType>(3, _omitFieldNames ? '' : 'busType', $pb.PbFieldType.OE, defaultOrMaker: $9.BusType.BUS_TYPE_UNSPECIFIED, valueOf: $9.BusType.valueOf, enumValues: $9.BusType.values) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ChangeBusStatusRequest clone() => ChangeBusStatusRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ChangeBusStatusRequest copyWith(void Function(ChangeBusStatusRequest) updates) => super.copyWith((message) => updates(message as ChangeBusStatusRequest)) as ChangeBusStatusRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static ChangeBusStatusRequest create() => ChangeBusStatusRequest._(); + ChangeBusStatusRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ChangeBusStatusRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ChangeBusStatusRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get busId => $_getSZ(0); + @$pb.TagNumber(1) + set busId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasBusId() => $_has(0); + @$pb.TagNumber(1) + void clearBusId() => clearField(1); + + @$pb.TagNumber(2) + $9.BusStatus get busStatus => $_getN(1); + @$pb.TagNumber(2) + set busStatus($9.BusStatus v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasBusStatus() => $_has(1); + @$pb.TagNumber(2) + void clearBusStatus() => clearField(2); + + @$pb.TagNumber(3) + $9.BusType get busType => $_getN(2); + @$pb.TagNumber(3) + set busType($9.BusType v) { setField(3, v); } + @$pb.TagNumber(3) + $core.bool hasBusType() => $_has(2); + @$pb.TagNumber(3) + void clearBusType() => clearField(3); +} + +class ChangeBusStatusResponse extends $pb.GeneratedMessage { + factory ChangeBusStatusResponse({ + $9.Bus? bus, + }) { + final $result = create(); + if (bus != null) { + $result.bus = bus; + } + return $result; + } + ChangeBusStatusResponse._() : super(); + factory ChangeBusStatusResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ChangeBusStatusResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ChangeBusStatusResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.Bus>(1, _omitFieldNames ? '' : 'bus', subBuilder: $9.Bus.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ChangeBusStatusResponse clone() => ChangeBusStatusResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ChangeBusStatusResponse copyWith(void Function(ChangeBusStatusResponse) updates) => super.copyWith((message) => updates(message as ChangeBusStatusResponse)) as ChangeBusStatusResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static ChangeBusStatusResponse create() => ChangeBusStatusResponse._(); + ChangeBusStatusResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ChangeBusStatusResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ChangeBusStatusResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.Bus get bus => $_getN(0); + @$pb.TagNumber(1) + set bus($9.Bus v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasBus() => $_has(0); + @$pb.TagNumber(1) + void clearBus() => clearField(1); + @$pb.TagNumber(1) + $9.Bus ensureBus() => $_ensure(0); +} + +/// Updated and newly defined messages for the adjusted RPCs +class SendLocationContinuousRequest extends $pb.GeneratedMessage { + factory SendLocationContinuousRequest({ + $core.String? busId, + $core.double? latitude, + $core.double? longitude, + }) { + final $result = create(); + if (busId != null) { + $result.busId = busId; + } + if (latitude != null) { + $result.latitude = latitude; + } + if (longitude != null) { + $result.longitude = longitude; + } + return $result; + } + SendLocationContinuousRequest._() : super(); + factory SendLocationContinuousRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory SendLocationContinuousRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'SendLocationContinuousRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'busId') + ..a<$core.double>(2, _omitFieldNames ? '' : 'latitude', $pb.PbFieldType.OD) + ..a<$core.double>(3, _omitFieldNames ? '' : 'longitude', $pb.PbFieldType.OD) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + SendLocationContinuousRequest clone() => SendLocationContinuousRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + SendLocationContinuousRequest copyWith(void Function(SendLocationContinuousRequest) updates) => super.copyWith((message) => updates(message as SendLocationContinuousRequest)) as SendLocationContinuousRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static SendLocationContinuousRequest create() => SendLocationContinuousRequest._(); + SendLocationContinuousRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static SendLocationContinuousRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static SendLocationContinuousRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get busId => $_getSZ(0); + @$pb.TagNumber(1) + set busId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasBusId() => $_has(0); + @$pb.TagNumber(1) + void clearBusId() => clearField(1); + + @$pb.TagNumber(2) + $core.double get latitude => $_getN(1); + @$pb.TagNumber(2) + set latitude($core.double v) { $_setDouble(1, v); } + @$pb.TagNumber(2) + $core.bool hasLatitude() => $_has(1); + @$pb.TagNumber(2) + void clearLatitude() => clearField(2); + + @$pb.TagNumber(3) + $core.double get longitude => $_getN(2); + @$pb.TagNumber(3) + set longitude($core.double v) { $_setDouble(2, v); } + @$pb.TagNumber(3) + $core.bool hasLongitude() => $_has(2); + @$pb.TagNumber(3) + void clearLongitude() => clearField(3); +} + +class SendLocationContinuousResponse extends $pb.GeneratedMessage { + factory SendLocationContinuousResponse() => create(); + SendLocationContinuousResponse._() : super(); + factory SendLocationContinuousResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory SendLocationContinuousResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'SendLocationContinuousResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + SendLocationContinuousResponse clone() => SendLocationContinuousResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + SendLocationContinuousResponse copyWith(void Function(SendLocationContinuousResponse) updates) => super.copyWith((message) => updates(message as SendLocationContinuousResponse)) as SendLocationContinuousResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static SendLocationContinuousResponse create() => SendLocationContinuousResponse._(); + SendLocationContinuousResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static SendLocationContinuousResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static SendLocationContinuousResponse? _defaultInstance; +} + +class TrackBusContinuousRequest extends $pb.GeneratedMessage { + factory TrackBusContinuousRequest({ + $core.String? busId, + }) { + final $result = create(); + if (busId != null) { + $result.busId = busId; + } + return $result; + } + TrackBusContinuousRequest._() : super(); + factory TrackBusContinuousRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory TrackBusContinuousRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'TrackBusContinuousRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'busId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + TrackBusContinuousRequest clone() => TrackBusContinuousRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + TrackBusContinuousRequest copyWith(void Function(TrackBusContinuousRequest) updates) => super.copyWith((message) => updates(message as TrackBusContinuousRequest)) as TrackBusContinuousRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static TrackBusContinuousRequest create() => TrackBusContinuousRequest._(); + TrackBusContinuousRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static TrackBusContinuousRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static TrackBusContinuousRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get busId => $_getSZ(0); + @$pb.TagNumber(1) + set busId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasBusId() => $_has(0); + @$pb.TagNumber(1) + void clearBusId() => clearField(1); +} + +class TrackBusContinuousResponse extends $pb.GeneratedMessage { + factory TrackBusContinuousResponse({ + $core.String? busId, + $core.double? latitude, + $core.double? longitude, + $core.String? nextStationId, + }) { + final $result = create(); + if (busId != null) { + $result.busId = busId; + } + if (latitude != null) { + $result.latitude = latitude; + } + if (longitude != null) { + $result.longitude = longitude; + } + if (nextStationId != null) { + $result.nextStationId = nextStationId; + } + return $result; + } + TrackBusContinuousResponse._() : super(); + factory TrackBusContinuousResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory TrackBusContinuousResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'TrackBusContinuousResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'busId') + ..a<$core.double>(2, _omitFieldNames ? '' : 'latitude', $pb.PbFieldType.OD) + ..a<$core.double>(3, _omitFieldNames ? '' : 'longitude', $pb.PbFieldType.OD) + ..aOS(4, _omitFieldNames ? '' : 'nextStationId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + TrackBusContinuousResponse clone() => TrackBusContinuousResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + TrackBusContinuousResponse copyWith(void Function(TrackBusContinuousResponse) updates) => super.copyWith((message) => updates(message as TrackBusContinuousResponse)) as TrackBusContinuousResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static TrackBusContinuousResponse create() => TrackBusContinuousResponse._(); + TrackBusContinuousResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static TrackBusContinuousResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static TrackBusContinuousResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get busId => $_getSZ(0); + @$pb.TagNumber(1) + set busId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasBusId() => $_has(0); + @$pb.TagNumber(1) + void clearBusId() => clearField(1); + + @$pb.TagNumber(2) + $core.double get latitude => $_getN(1); + @$pb.TagNumber(2) + set latitude($core.double v) { $_setDouble(1, v); } + @$pb.TagNumber(2) + $core.bool hasLatitude() => $_has(1); + @$pb.TagNumber(2) + void clearLatitude() => clearField(2); + + @$pb.TagNumber(3) + $core.double get longitude => $_getN(2); + @$pb.TagNumber(3) + set longitude($core.double v) { $_setDouble(2, v); } + @$pb.TagNumber(3) + $core.bool hasLongitude() => $_has(2); + @$pb.TagNumber(3) + void clearLongitude() => clearField(3); + + @$pb.TagNumber(4) + $core.String get nextStationId => $_getSZ(3); + @$pb.TagNumber(4) + set nextStationId($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasNextStationId() => $_has(3); + @$pb.TagNumber(4) + void clearNextStationId() => clearField(4); +} + +class StreamBusVideoRequest extends $pb.GeneratedMessage { + factory StreamBusVideoRequest({ + $core.String? busId, + $core.String? nurseryId, + $9.BusType? busType, + $9.VehicleEvent? vehicleEvent, + $core.Iterable<$core.List<$core.int>>? videoChunk, + $core.int? photoHeight, + $core.int? photoWidth, + }) { + final $result = create(); + if (busId != null) { + $result.busId = busId; + } + if (nurseryId != null) { + $result.nurseryId = nurseryId; + } + if (busType != null) { + $result.busType = busType; + } + if (vehicleEvent != null) { + $result.vehicleEvent = vehicleEvent; + } + if (videoChunk != null) { + $result.videoChunk.addAll(videoChunk); + } + if (photoHeight != null) { + $result.photoHeight = photoHeight; + } + if (photoWidth != null) { + $result.photoWidth = photoWidth; + } + return $result; + } + StreamBusVideoRequest._() : super(); + factory StreamBusVideoRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory StreamBusVideoRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'StreamBusVideoRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'busId') + ..aOS(2, _omitFieldNames ? '' : 'nurseryId') + ..e<$9.BusType>(3, _omitFieldNames ? '' : 'busType', $pb.PbFieldType.OE, defaultOrMaker: $9.BusType.BUS_TYPE_UNSPECIFIED, valueOf: $9.BusType.valueOf, enumValues: $9.BusType.values) + ..e<$9.VehicleEvent>(4, _omitFieldNames ? '' : 'vehicleEvent', $pb.PbFieldType.OE, defaultOrMaker: $9.VehicleEvent.VEHICLE_EVENT_UNSPECIFIED, valueOf: $9.VehicleEvent.valueOf, enumValues: $9.VehicleEvent.values) + ..p<$core.List<$core.int>>(5, _omitFieldNames ? '' : 'videoChunk', $pb.PbFieldType.PY) + ..a<$core.int>(6, _omitFieldNames ? '' : 'photoHeight', $pb.PbFieldType.O3) + ..a<$core.int>(7, _omitFieldNames ? '' : 'photoWidth', $pb.PbFieldType.O3) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + StreamBusVideoRequest clone() => StreamBusVideoRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + StreamBusVideoRequest copyWith(void Function(StreamBusVideoRequest) updates) => super.copyWith((message) => updates(message as StreamBusVideoRequest)) as StreamBusVideoRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static StreamBusVideoRequest create() => StreamBusVideoRequest._(); + StreamBusVideoRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static StreamBusVideoRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static StreamBusVideoRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get busId => $_getSZ(0); + @$pb.TagNumber(1) + set busId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasBusId() => $_has(0); + @$pb.TagNumber(1) + void clearBusId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get nurseryId => $_getSZ(1); + @$pb.TagNumber(2) + set nurseryId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasNurseryId() => $_has(1); + @$pb.TagNumber(2) + void clearNurseryId() => clearField(2); + + @$pb.TagNumber(3) + $9.BusType get busType => $_getN(2); + @$pb.TagNumber(3) + set busType($9.BusType v) { setField(3, v); } + @$pb.TagNumber(3) + $core.bool hasBusType() => $_has(2); + @$pb.TagNumber(3) + void clearBusType() => clearField(3); + + @$pb.TagNumber(4) + $9.VehicleEvent get vehicleEvent => $_getN(3); + @$pb.TagNumber(4) + set vehicleEvent($9.VehicleEvent v) { setField(4, v); } + @$pb.TagNumber(4) + $core.bool hasVehicleEvent() => $_has(3); + @$pb.TagNumber(4) + void clearVehicleEvent() => clearField(4); + + @$pb.TagNumber(5) + $core.List<$core.List<$core.int>> get videoChunk => $_getList(4); + + @$pb.TagNumber(6) + $core.int get photoHeight => $_getIZ(5); + @$pb.TagNumber(6) + set photoHeight($core.int v) { $_setSignedInt32(5, v); } + @$pb.TagNumber(6) + $core.bool hasPhotoHeight() => $_has(5); + @$pb.TagNumber(6) + void clearPhotoHeight() => clearField(6); + + @$pb.TagNumber(7) + $core.int get photoWidth => $_getIZ(6); + @$pb.TagNumber(7) + set photoWidth($core.int v) { $_setSignedInt32(6, v); } + @$pb.TagNumber(7) + $core.bool hasPhotoWidth() => $_has(6); + @$pb.TagNumber(7) + void clearPhotoWidth() => clearField(7); +} + +class StreamBusVideoResponse extends $pb.GeneratedMessage { + factory StreamBusVideoResponse({ + $core.bool? isDetected, + $core.Iterable<$9.Child>? children, + }) { + final $result = create(); + if (isDetected != null) { + $result.isDetected = isDetected; + } + if (children != null) { + $result.children.addAll(children); + } + return $result; + } + StreamBusVideoResponse._() : super(); + factory StreamBusVideoResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory StreamBusVideoResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'StreamBusVideoResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOB(1, _omitFieldNames ? '' : 'isDetected') + ..pc<$9.Child>(2, _omitFieldNames ? '' : 'children', $pb.PbFieldType.PM, subBuilder: $9.Child.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + StreamBusVideoResponse clone() => StreamBusVideoResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + StreamBusVideoResponse copyWith(void Function(StreamBusVideoResponse) updates) => super.copyWith((message) => updates(message as StreamBusVideoResponse)) as StreamBusVideoResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static StreamBusVideoResponse create() => StreamBusVideoResponse._(); + StreamBusVideoResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static StreamBusVideoResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static StreamBusVideoResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.bool get isDetected => $_getBF(0); + @$pb.TagNumber(1) + set isDetected($core.bool v) { $_setBool(0, v); } + @$pb.TagNumber(1) + $core.bool hasIsDetected() => $_has(0); + @$pb.TagNumber(1) + void clearIsDetected() => clearField(1); + + @$pb.TagNumber(2) + $core.List<$9.Child> get children => $_getList(1); +} + +class UpdateBusRequest extends $pb.GeneratedMessage { + factory UpdateBusRequest({ + $core.String? busId, + $core.String? name, + $core.String? plateNumber, + $core.double? latitude, + $core.double? longitude, + $core.bool? enableFaceRecognition, + $core.String? nextStationId, + $10.FieldMask? updateMask, + }) { + final $result = create(); + if (busId != null) { + $result.busId = busId; + } + if (name != null) { + $result.name = name; + } + if (plateNumber != null) { + $result.plateNumber = plateNumber; + } + if (latitude != null) { + $result.latitude = latitude; + } + if (longitude != null) { + $result.longitude = longitude; + } + if (enableFaceRecognition != null) { + $result.enableFaceRecognition = enableFaceRecognition; + } + if (nextStationId != null) { + $result.nextStationId = nextStationId; + } + if (updateMask != null) { + $result.updateMask = updateMask; + } + return $result; + } + UpdateBusRequest._() : super(); + factory UpdateBusRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory UpdateBusRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'UpdateBusRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'busId') + ..aOS(2, _omitFieldNames ? '' : 'name') + ..aOS(3, _omitFieldNames ? '' : 'plateNumber') + ..a<$core.double>(4, _omitFieldNames ? '' : 'latitude', $pb.PbFieldType.OD) + ..a<$core.double>(5, _omitFieldNames ? '' : 'longitude', $pb.PbFieldType.OD) + ..aOB(6, _omitFieldNames ? '' : 'enableFaceRecognition') + ..aOS(9, _omitFieldNames ? '' : 'nextStationId') + ..aOM<$10.FieldMask>(10, _omitFieldNames ? '' : 'updateMask', subBuilder: $10.FieldMask.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + UpdateBusRequest clone() => UpdateBusRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + UpdateBusRequest copyWith(void Function(UpdateBusRequest) updates) => super.copyWith((message) => updates(message as UpdateBusRequest)) as UpdateBusRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static UpdateBusRequest create() => UpdateBusRequest._(); + UpdateBusRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static UpdateBusRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static UpdateBusRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get busId => $_getSZ(0); + @$pb.TagNumber(1) + set busId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasBusId() => $_has(0); + @$pb.TagNumber(1) + void clearBusId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get name => $_getSZ(1); + @$pb.TagNumber(2) + set name($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasName() => $_has(1); + @$pb.TagNumber(2) + void clearName() => clearField(2); + + @$pb.TagNumber(3) + $core.String get plateNumber => $_getSZ(2); + @$pb.TagNumber(3) + set plateNumber($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasPlateNumber() => $_has(2); + @$pb.TagNumber(3) + void clearPlateNumber() => clearField(3); + + @$pb.TagNumber(4) + $core.double get latitude => $_getN(3); + @$pb.TagNumber(4) + set latitude($core.double v) { $_setDouble(3, v); } + @$pb.TagNumber(4) + $core.bool hasLatitude() => $_has(3); + @$pb.TagNumber(4) + void clearLatitude() => clearField(4); + + @$pb.TagNumber(5) + $core.double get longitude => $_getN(4); + @$pb.TagNumber(5) + set longitude($core.double v) { $_setDouble(4, v); } + @$pb.TagNumber(5) + $core.bool hasLongitude() => $_has(4); + @$pb.TagNumber(5) + void clearLongitude() => clearField(5); + + @$pb.TagNumber(6) + $core.bool get enableFaceRecognition => $_getBF(5); + @$pb.TagNumber(6) + set enableFaceRecognition($core.bool v) { $_setBool(5, v); } + @$pb.TagNumber(6) + $core.bool hasEnableFaceRecognition() => $_has(5); + @$pb.TagNumber(6) + void clearEnableFaceRecognition() => clearField(6); + + @$pb.TagNumber(9) + $core.String get nextStationId => $_getSZ(6); + @$pb.TagNumber(9) + set nextStationId($core.String v) { $_setString(6, v); } + @$pb.TagNumber(9) + $core.bool hasNextStationId() => $_has(6); + @$pb.TagNumber(9) + void clearNextStationId() => clearField(9); + + @$pb.TagNumber(10) + $10.FieldMask get updateMask => $_getN(7); + @$pb.TagNumber(10) + set updateMask($10.FieldMask v) { setField(10, v); } + @$pb.TagNumber(10) + $core.bool hasUpdateMask() => $_has(7); + @$pb.TagNumber(10) + void clearUpdateMask() => clearField(10); + @$pb.TagNumber(10) + $10.FieldMask ensureUpdateMask() => $_ensure(7); +} + +class UpdateBusResponse extends $pb.GeneratedMessage { + factory UpdateBusResponse({ + $9.Bus? bus, + }) { + final $result = create(); + if (bus != null) { + $result.bus = bus; + } + return $result; + } + UpdateBusResponse._() : super(); + factory UpdateBusResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory UpdateBusResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'UpdateBusResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.Bus>(1, _omitFieldNames ? '' : 'bus', subBuilder: $9.Bus.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + UpdateBusResponse clone() => UpdateBusResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + UpdateBusResponse copyWith(void Function(UpdateBusResponse) updates) => super.copyWith((message) => updates(message as UpdateBusResponse)) as UpdateBusResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static UpdateBusResponse create() => UpdateBusResponse._(); + UpdateBusResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static UpdateBusResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static UpdateBusResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.Bus get bus => $_getN(0); + @$pb.TagNumber(1) + set bus($9.Bus v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasBus() => $_has(0); + @$pb.TagNumber(1) + void clearBus() => clearField(1); + @$pb.TagNumber(1) + $9.Bus ensureBus() => $_ensure(0); +} + + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus.pbenum.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus.pbenum.dart new file mode 100644 index 00000000..e8661467 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus.pbenum.dart @@ -0,0 +1,11 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/bus.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus.pbgrpc.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus.pbgrpc.dart new file mode 100644 index 00000000..88c505fc --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus.pbgrpc.dart @@ -0,0 +1,191 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/bus.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:async' as $async; +import 'dart:core' as $core; + +import 'package:grpc/service_api.dart' as $grpc; +import 'package:protobuf/protobuf.dart' as $pb; + +import 'bus.pb.dart' as $0; + +export 'bus.pb.dart'; + +@$pb.GrpcServiceName('where_child_bus.v1.BusService') +class BusServiceClient extends $grpc.Client { + static final _$createBus = $grpc.ClientMethod<$0.CreateBusRequest, $0.CreateBusResponse>( + '/where_child_bus.v1.BusService/CreateBus', + ($0.CreateBusRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $0.CreateBusResponse.fromBuffer(value)); + static final _$getBusListByNurseryId = $grpc.ClientMethod<$0.GetBusListByNurseryIdRequest, $0.GetBusListByNurseryIdResponse>( + '/where_child_bus.v1.BusService/GetBusListByNurseryId', + ($0.GetBusListByNurseryIdRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $0.GetBusListByNurseryIdResponse.fromBuffer(value)); + static final _$getRunningBusByGuardianId = $grpc.ClientMethod<$0.GetRunningBusByGuardianIdRequest, $0.GetRunningBusByGuardianIdResponse>( + '/where_child_bus.v1.BusService/GetRunningBusByGuardianId', + ($0.GetRunningBusByGuardianIdRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $0.GetRunningBusByGuardianIdResponse.fromBuffer(value)); + static final _$updateBus = $grpc.ClientMethod<$0.UpdateBusRequest, $0.UpdateBusResponse>( + '/where_child_bus.v1.BusService/UpdateBus', + ($0.UpdateBusRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $0.UpdateBusResponse.fromBuffer(value)); + static final _$changeBusStatus = $grpc.ClientMethod<$0.ChangeBusStatusRequest, $0.ChangeBusStatusResponse>( + '/where_child_bus.v1.BusService/ChangeBusStatus', + ($0.ChangeBusStatusRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $0.ChangeBusStatusResponse.fromBuffer(value)); + static final _$sendLocationContinuous = $grpc.ClientMethod<$0.SendLocationContinuousRequest, $0.SendLocationContinuousResponse>( + '/where_child_bus.v1.BusService/SendLocationContinuous', + ($0.SendLocationContinuousRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $0.SendLocationContinuousResponse.fromBuffer(value)); + static final _$trackBusContinuous = $grpc.ClientMethod<$0.TrackBusContinuousRequest, $0.TrackBusContinuousResponse>( + '/where_child_bus.v1.BusService/TrackBusContinuous', + ($0.TrackBusContinuousRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $0.TrackBusContinuousResponse.fromBuffer(value)); + static final _$streamBusVideo = $grpc.ClientMethod<$0.StreamBusVideoRequest, $0.StreamBusVideoResponse>( + '/where_child_bus.v1.BusService/StreamBusVideo', + ($0.StreamBusVideoRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $0.StreamBusVideoResponse.fromBuffer(value)); + + BusServiceClient($grpc.ClientChannel channel, + {$grpc.CallOptions? options, + $core.Iterable<$grpc.ClientInterceptor>? interceptors}) + : super(channel, options: options, + interceptors: interceptors); + + $grpc.ResponseFuture<$0.CreateBusResponse> createBus($0.CreateBusRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$createBus, request, options: options); + } + + $grpc.ResponseFuture<$0.GetBusListByNurseryIdResponse> getBusListByNurseryId($0.GetBusListByNurseryIdRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getBusListByNurseryId, request, options: options); + } + + $grpc.ResponseFuture<$0.GetRunningBusByGuardianIdResponse> getRunningBusByGuardianId($0.GetRunningBusByGuardianIdRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getRunningBusByGuardianId, request, options: options); + } + + $grpc.ResponseFuture<$0.UpdateBusResponse> updateBus($0.UpdateBusRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$updateBus, request, options: options); + } + + $grpc.ResponseFuture<$0.ChangeBusStatusResponse> changeBusStatus($0.ChangeBusStatusRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$changeBusStatus, request, options: options); + } + + $grpc.ResponseFuture<$0.SendLocationContinuousResponse> sendLocationContinuous($async.Stream<$0.SendLocationContinuousRequest> request, {$grpc.CallOptions? options}) { + return $createStreamingCall(_$sendLocationContinuous, request, options: options).single; + } + + $grpc.ResponseStream<$0.TrackBusContinuousResponse> trackBusContinuous($0.TrackBusContinuousRequest request, {$grpc.CallOptions? options}) { + return $createStreamingCall(_$trackBusContinuous, $async.Stream.fromIterable([request]), options: options); + } + + $grpc.ResponseStream<$0.StreamBusVideoResponse> streamBusVideo($async.Stream<$0.StreamBusVideoRequest> request, {$grpc.CallOptions? options}) { + return $createStreamingCall(_$streamBusVideo, request, options: options); + } +} + +@$pb.GrpcServiceName('where_child_bus.v1.BusService') +abstract class BusServiceBase extends $grpc.Service { + $core.String get $name => 'where_child_bus.v1.BusService'; + + BusServiceBase() { + $addMethod($grpc.ServiceMethod<$0.CreateBusRequest, $0.CreateBusResponse>( + 'CreateBus', + createBus_Pre, + false, + false, + ($core.List<$core.int> value) => $0.CreateBusRequest.fromBuffer(value), + ($0.CreateBusResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$0.GetBusListByNurseryIdRequest, $0.GetBusListByNurseryIdResponse>( + 'GetBusListByNurseryId', + getBusListByNurseryId_Pre, + false, + false, + ($core.List<$core.int> value) => $0.GetBusListByNurseryIdRequest.fromBuffer(value), + ($0.GetBusListByNurseryIdResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$0.GetRunningBusByGuardianIdRequest, $0.GetRunningBusByGuardianIdResponse>( + 'GetRunningBusByGuardianId', + getRunningBusByGuardianId_Pre, + false, + false, + ($core.List<$core.int> value) => $0.GetRunningBusByGuardianIdRequest.fromBuffer(value), + ($0.GetRunningBusByGuardianIdResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$0.UpdateBusRequest, $0.UpdateBusResponse>( + 'UpdateBus', + updateBus_Pre, + false, + false, + ($core.List<$core.int> value) => $0.UpdateBusRequest.fromBuffer(value), + ($0.UpdateBusResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$0.ChangeBusStatusRequest, $0.ChangeBusStatusResponse>( + 'ChangeBusStatus', + changeBusStatus_Pre, + false, + false, + ($core.List<$core.int> value) => $0.ChangeBusStatusRequest.fromBuffer(value), + ($0.ChangeBusStatusResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$0.SendLocationContinuousRequest, $0.SendLocationContinuousResponse>( + 'SendLocationContinuous', + sendLocationContinuous, + true, + false, + ($core.List<$core.int> value) => $0.SendLocationContinuousRequest.fromBuffer(value), + ($0.SendLocationContinuousResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$0.TrackBusContinuousRequest, $0.TrackBusContinuousResponse>( + 'TrackBusContinuous', + trackBusContinuous_Pre, + false, + true, + ($core.List<$core.int> value) => $0.TrackBusContinuousRequest.fromBuffer(value), + ($0.TrackBusContinuousResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$0.StreamBusVideoRequest, $0.StreamBusVideoResponse>( + 'StreamBusVideo', + streamBusVideo, + true, + true, + ($core.List<$core.int> value) => $0.StreamBusVideoRequest.fromBuffer(value), + ($0.StreamBusVideoResponse value) => value.writeToBuffer())); + } + + $async.Future<$0.CreateBusResponse> createBus_Pre($grpc.ServiceCall call, $async.Future<$0.CreateBusRequest> request) async { + return createBus(call, await request); + } + + $async.Future<$0.GetBusListByNurseryIdResponse> getBusListByNurseryId_Pre($grpc.ServiceCall call, $async.Future<$0.GetBusListByNurseryIdRequest> request) async { + return getBusListByNurseryId(call, await request); + } + + $async.Future<$0.GetRunningBusByGuardianIdResponse> getRunningBusByGuardianId_Pre($grpc.ServiceCall call, $async.Future<$0.GetRunningBusByGuardianIdRequest> request) async { + return getRunningBusByGuardianId(call, await request); + } + + $async.Future<$0.UpdateBusResponse> updateBus_Pre($grpc.ServiceCall call, $async.Future<$0.UpdateBusRequest> request) async { + return updateBus(call, await request); + } + + $async.Future<$0.ChangeBusStatusResponse> changeBusStatus_Pre($grpc.ServiceCall call, $async.Future<$0.ChangeBusStatusRequest> request) async { + return changeBusStatus(call, await request); + } + + $async.Stream<$0.TrackBusContinuousResponse> trackBusContinuous_Pre($grpc.ServiceCall call, $async.Future<$0.TrackBusContinuousRequest> request) async* { + yield* trackBusContinuous(call, await request); + } + + $async.Future<$0.CreateBusResponse> createBus($grpc.ServiceCall call, $0.CreateBusRequest request); + $async.Future<$0.GetBusListByNurseryIdResponse> getBusListByNurseryId($grpc.ServiceCall call, $0.GetBusListByNurseryIdRequest request); + $async.Future<$0.GetRunningBusByGuardianIdResponse> getRunningBusByGuardianId($grpc.ServiceCall call, $0.GetRunningBusByGuardianIdRequest request); + $async.Future<$0.UpdateBusResponse> updateBus($grpc.ServiceCall call, $0.UpdateBusRequest request); + $async.Future<$0.ChangeBusStatusResponse> changeBusStatus($grpc.ServiceCall call, $0.ChangeBusStatusRequest request); + $async.Future<$0.SendLocationContinuousResponse> sendLocationContinuous($grpc.ServiceCall call, $async.Stream<$0.SendLocationContinuousRequest> request); + $async.Stream<$0.TrackBusContinuousResponse> trackBusContinuous($grpc.ServiceCall call, $0.TrackBusContinuousRequest request); + $async.Stream<$0.StreamBusVideoResponse> streamBusVideo($grpc.ServiceCall call, $async.Stream<$0.StreamBusVideoRequest> request); +} diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus.pbjson.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus.pbjson.dart new file mode 100644 index 00000000..dde508c2 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus.pbjson.dart @@ -0,0 +1,253 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/bus.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use createBusRequestDescriptor instead') +const CreateBusRequest$json = { + '1': 'CreateBusRequest', + '2': [ + {'1': 'nursery_id', '3': 1, '4': 1, '5': 9, '10': 'nurseryId'}, + {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'}, + {'1': 'plate_number', '3': 3, '4': 1, '5': 9, '10': 'plateNumber'}, + ], +}; + +/// Descriptor for `CreateBusRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List createBusRequestDescriptor = $convert.base64Decode( + 'ChBDcmVhdGVCdXNSZXF1ZXN0Eh0KCm51cnNlcnlfaWQYASABKAlSCW51cnNlcnlJZBISCgRuYW' + '1lGAIgASgJUgRuYW1lEiEKDHBsYXRlX251bWJlchgDIAEoCVILcGxhdGVOdW1iZXI='); + +@$core.Deprecated('Use createBusResponseDescriptor instead') +const CreateBusResponse$json = { + '1': 'CreateBusResponse', + '2': [ + {'1': 'bus', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.Bus', '10': 'bus'}, + ], +}; + +/// Descriptor for `CreateBusResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List createBusResponseDescriptor = $convert.base64Decode( + 'ChFDcmVhdGVCdXNSZXNwb25zZRIpCgNidXMYASABKAsyFy53aGVyZV9jaGlsZF9idXMudjEuQn' + 'VzUgNidXM='); + +@$core.Deprecated('Use getBusListByNurseryIdRequestDescriptor instead') +const GetBusListByNurseryIdRequest$json = { + '1': 'GetBusListByNurseryIdRequest', + '2': [ + {'1': 'nursery_id', '3': 1, '4': 1, '5': 9, '10': 'nurseryId'}, + ], +}; + +/// Descriptor for `GetBusListByNurseryIdRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getBusListByNurseryIdRequestDescriptor = $convert.base64Decode( + 'ChxHZXRCdXNMaXN0QnlOdXJzZXJ5SWRSZXF1ZXN0Eh0KCm51cnNlcnlfaWQYASABKAlSCW51cn' + 'NlcnlJZA=='); + +@$core.Deprecated('Use getBusListByNurseryIdResponseDescriptor instead') +const GetBusListByNurseryIdResponse$json = { + '1': 'GetBusListByNurseryIdResponse', + '2': [ + {'1': 'buses', '3': 1, '4': 3, '5': 11, '6': '.where_child_bus.v1.Bus', '10': 'buses'}, + ], +}; + +/// Descriptor for `GetBusListByNurseryIdResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getBusListByNurseryIdResponseDescriptor = $convert.base64Decode( + 'Ch1HZXRCdXNMaXN0QnlOdXJzZXJ5SWRSZXNwb25zZRItCgVidXNlcxgBIAMoCzIXLndoZXJlX2' + 'NoaWxkX2J1cy52MS5CdXNSBWJ1c2Vz'); + +@$core.Deprecated('Use getRunningBusByGuardianIdRequestDescriptor instead') +const GetRunningBusByGuardianIdRequest$json = { + '1': 'GetRunningBusByGuardianIdRequest', + '2': [ + {'1': 'guardian_id', '3': 1, '4': 1, '5': 9, '10': 'guardianId'}, + ], +}; + +/// Descriptor for `GetRunningBusByGuardianIdRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getRunningBusByGuardianIdRequestDescriptor = $convert.base64Decode( + 'CiBHZXRSdW5uaW5nQnVzQnlHdWFyZGlhbklkUmVxdWVzdBIfCgtndWFyZGlhbl9pZBgBIAEoCV' + 'IKZ3VhcmRpYW5JZA=='); + +@$core.Deprecated('Use getRunningBusByGuardianIdResponseDescriptor instead') +const GetRunningBusByGuardianIdResponse$json = { + '1': 'GetRunningBusByGuardianIdResponse', + '2': [ + {'1': 'bus', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.Bus', '10': 'bus'}, + ], +}; + +/// Descriptor for `GetRunningBusByGuardianIdResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getRunningBusByGuardianIdResponseDescriptor = $convert.base64Decode( + 'CiFHZXRSdW5uaW5nQnVzQnlHdWFyZGlhbklkUmVzcG9uc2USKQoDYnVzGAEgASgLMhcud2hlcm' + 'VfY2hpbGRfYnVzLnYxLkJ1c1IDYnVz'); + +@$core.Deprecated('Use changeBusStatusRequestDescriptor instead') +const ChangeBusStatusRequest$json = { + '1': 'ChangeBusStatusRequest', + '2': [ + {'1': 'bus_id', '3': 1, '4': 1, '5': 9, '10': 'busId'}, + {'1': 'bus_status', '3': 2, '4': 1, '5': 14, '6': '.where_child_bus.v1.BusStatus', '10': 'busStatus'}, + {'1': 'bus_type', '3': 3, '4': 1, '5': 14, '6': '.where_child_bus.v1.BusType', '10': 'busType'}, + ], +}; + +/// Descriptor for `ChangeBusStatusRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List changeBusStatusRequestDescriptor = $convert.base64Decode( + 'ChZDaGFuZ2VCdXNTdGF0dXNSZXF1ZXN0EhUKBmJ1c19pZBgBIAEoCVIFYnVzSWQSPAoKYnVzX3' + 'N0YXR1cxgCIAEoDjIdLndoZXJlX2NoaWxkX2J1cy52MS5CdXNTdGF0dXNSCWJ1c1N0YXR1cxI2' + 'CghidXNfdHlwZRgDIAEoDjIbLndoZXJlX2NoaWxkX2J1cy52MS5CdXNUeXBlUgdidXNUeXBl'); + +@$core.Deprecated('Use changeBusStatusResponseDescriptor instead') +const ChangeBusStatusResponse$json = { + '1': 'ChangeBusStatusResponse', + '2': [ + {'1': 'bus', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.Bus', '10': 'bus'}, + ], +}; + +/// Descriptor for `ChangeBusStatusResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List changeBusStatusResponseDescriptor = $convert.base64Decode( + 'ChdDaGFuZ2VCdXNTdGF0dXNSZXNwb25zZRIpCgNidXMYASABKAsyFy53aGVyZV9jaGlsZF9idX' + 'MudjEuQnVzUgNidXM='); + +@$core.Deprecated('Use sendLocationContinuousRequestDescriptor instead') +const SendLocationContinuousRequest$json = { + '1': 'SendLocationContinuousRequest', + '2': [ + {'1': 'bus_id', '3': 1, '4': 1, '5': 9, '10': 'busId'}, + {'1': 'latitude', '3': 2, '4': 1, '5': 1, '10': 'latitude'}, + {'1': 'longitude', '3': 3, '4': 1, '5': 1, '10': 'longitude'}, + ], +}; + +/// Descriptor for `SendLocationContinuousRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List sendLocationContinuousRequestDescriptor = $convert.base64Decode( + 'Ch1TZW5kTG9jYXRpb25Db250aW51b3VzUmVxdWVzdBIVCgZidXNfaWQYASABKAlSBWJ1c0lkEh' + 'oKCGxhdGl0dWRlGAIgASgBUghsYXRpdHVkZRIcCglsb25naXR1ZGUYAyABKAFSCWxvbmdpdHVk' + 'ZQ=='); + +@$core.Deprecated('Use sendLocationContinuousResponseDescriptor instead') +const SendLocationContinuousResponse$json = { + '1': 'SendLocationContinuousResponse', +}; + +/// Descriptor for `SendLocationContinuousResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List sendLocationContinuousResponseDescriptor = $convert.base64Decode( + 'Ch5TZW5kTG9jYXRpb25Db250aW51b3VzUmVzcG9uc2U='); + +@$core.Deprecated('Use trackBusContinuousRequestDescriptor instead') +const TrackBusContinuousRequest$json = { + '1': 'TrackBusContinuousRequest', + '2': [ + {'1': 'bus_id', '3': 1, '4': 1, '5': 9, '10': 'busId'}, + ], +}; + +/// Descriptor for `TrackBusContinuousRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List trackBusContinuousRequestDescriptor = $convert.base64Decode( + 'ChlUcmFja0J1c0NvbnRpbnVvdXNSZXF1ZXN0EhUKBmJ1c19pZBgBIAEoCVIFYnVzSWQ='); + +@$core.Deprecated('Use trackBusContinuousResponseDescriptor instead') +const TrackBusContinuousResponse$json = { + '1': 'TrackBusContinuousResponse', + '2': [ + {'1': 'bus_id', '3': 1, '4': 1, '5': 9, '10': 'busId'}, + {'1': 'latitude', '3': 2, '4': 1, '5': 1, '10': 'latitude'}, + {'1': 'longitude', '3': 3, '4': 1, '5': 1, '10': 'longitude'}, + {'1': 'next_station_id', '3': 4, '4': 1, '5': 9, '10': 'nextStationId'}, + ], +}; + +/// Descriptor for `TrackBusContinuousResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List trackBusContinuousResponseDescriptor = $convert.base64Decode( + 'ChpUcmFja0J1c0NvbnRpbnVvdXNSZXNwb25zZRIVCgZidXNfaWQYASABKAlSBWJ1c0lkEhoKCG' + 'xhdGl0dWRlGAIgASgBUghsYXRpdHVkZRIcCglsb25naXR1ZGUYAyABKAFSCWxvbmdpdHVkZRIm' + 'Cg9uZXh0X3N0YXRpb25faWQYBCABKAlSDW5leHRTdGF0aW9uSWQ='); + +@$core.Deprecated('Use streamBusVideoRequestDescriptor instead') +const StreamBusVideoRequest$json = { + '1': 'StreamBusVideoRequest', + '2': [ + {'1': 'bus_id', '3': 1, '4': 1, '5': 9, '10': 'busId'}, + {'1': 'nursery_id', '3': 2, '4': 1, '5': 9, '10': 'nurseryId'}, + {'1': 'bus_type', '3': 3, '4': 1, '5': 14, '6': '.where_child_bus.v1.BusType', '10': 'busType'}, + {'1': 'vehicle_event', '3': 4, '4': 1, '5': 14, '6': '.where_child_bus.v1.VehicleEvent', '10': 'vehicleEvent'}, + {'1': 'video_chunk', '3': 5, '4': 3, '5': 12, '10': 'videoChunk'}, + {'1': 'photo_height', '3': 6, '4': 1, '5': 5, '10': 'photoHeight'}, + {'1': 'photo_width', '3': 7, '4': 1, '5': 5, '10': 'photoWidth'}, + ], +}; + +/// Descriptor for `StreamBusVideoRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List streamBusVideoRequestDescriptor = $convert.base64Decode( + 'ChVTdHJlYW1CdXNWaWRlb1JlcXVlc3QSFQoGYnVzX2lkGAEgASgJUgVidXNJZBIdCgpudXJzZX' + 'J5X2lkGAIgASgJUgludXJzZXJ5SWQSNgoIYnVzX3R5cGUYAyABKA4yGy53aGVyZV9jaGlsZF9i' + 'dXMudjEuQnVzVHlwZVIHYnVzVHlwZRJFCg12ZWhpY2xlX2V2ZW50GAQgASgOMiAud2hlcmVfY2' + 'hpbGRfYnVzLnYxLlZlaGljbGVFdmVudFIMdmVoaWNsZUV2ZW50Eh8KC3ZpZGVvX2NodW5rGAUg' + 'AygMUgp2aWRlb0NodW5rEiEKDHBob3RvX2hlaWdodBgGIAEoBVILcGhvdG9IZWlnaHQSHwoLcG' + 'hvdG9fd2lkdGgYByABKAVSCnBob3RvV2lkdGg='); + +@$core.Deprecated('Use streamBusVideoResponseDescriptor instead') +const StreamBusVideoResponse$json = { + '1': 'StreamBusVideoResponse', + '2': [ + {'1': 'is_detected', '3': 1, '4': 1, '5': 8, '10': 'isDetected'}, + {'1': 'children', '3': 2, '4': 3, '5': 11, '6': '.where_child_bus.v1.Child', '10': 'children'}, + ], +}; + +/// Descriptor for `StreamBusVideoResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List streamBusVideoResponseDescriptor = $convert.base64Decode( + 'ChZTdHJlYW1CdXNWaWRlb1Jlc3BvbnNlEh8KC2lzX2RldGVjdGVkGAEgASgIUgppc0RldGVjdG' + 'VkEjUKCGNoaWxkcmVuGAIgAygLMhkud2hlcmVfY2hpbGRfYnVzLnYxLkNoaWxkUghjaGlsZHJl' + 'bg=='); + +@$core.Deprecated('Use updateBusRequestDescriptor instead') +const UpdateBusRequest$json = { + '1': 'UpdateBusRequest', + '2': [ + {'1': 'bus_id', '3': 1, '4': 1, '5': 9, '10': 'busId'}, + {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'}, + {'1': 'plate_number', '3': 3, '4': 1, '5': 9, '10': 'plateNumber'}, + {'1': 'latitude', '3': 4, '4': 1, '5': 1, '10': 'latitude'}, + {'1': 'longitude', '3': 5, '4': 1, '5': 1, '10': 'longitude'}, + {'1': 'enable_face_recognition', '3': 6, '4': 1, '5': 8, '10': 'enableFaceRecognition'}, + {'1': 'next_station_id', '3': 9, '4': 1, '5': 9, '10': 'nextStationId'}, + {'1': 'update_mask', '3': 10, '4': 1, '5': 11, '6': '.google.protobuf.FieldMask', '10': 'updateMask'}, + ], +}; + +/// Descriptor for `UpdateBusRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List updateBusRequestDescriptor = $convert.base64Decode( + 'ChBVcGRhdGVCdXNSZXF1ZXN0EhUKBmJ1c19pZBgBIAEoCVIFYnVzSWQSEgoEbmFtZRgCIAEoCV' + 'IEbmFtZRIhCgxwbGF0ZV9udW1iZXIYAyABKAlSC3BsYXRlTnVtYmVyEhoKCGxhdGl0dWRlGAQg' + 'ASgBUghsYXRpdHVkZRIcCglsb25naXR1ZGUYBSABKAFSCWxvbmdpdHVkZRI2ChdlbmFibGVfZm' + 'FjZV9yZWNvZ25pdGlvbhgGIAEoCFIVZW5hYmxlRmFjZVJlY29nbml0aW9uEiYKD25leHRfc3Rh' + 'dGlvbl9pZBgJIAEoCVINbmV4dFN0YXRpb25JZBI7Cgt1cGRhdGVfbWFzaxgKIAEoCzIaLmdvb2' + 'dsZS5wcm90b2J1Zi5GaWVsZE1hc2tSCnVwZGF0ZU1hc2s='); + +@$core.Deprecated('Use updateBusResponseDescriptor instead') +const UpdateBusResponse$json = { + '1': 'UpdateBusResponse', + '2': [ + {'1': 'bus', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.Bus', '10': 'bus'}, + ], +}; + +/// Descriptor for `UpdateBusResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List updateBusResponseDescriptor = $convert.base64Decode( + 'ChFVcGRhdGVCdXNSZXNwb25zZRIpCgNidXMYASABKAsyFy53aGVyZV9jaGlsZF9idXMudjEuQn' + 'VzUgNidXM='); + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus_route.pb.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus_route.pb.dart new file mode 100644 index 00000000..30cfc608 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus_route.pb.dart @@ -0,0 +1,275 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/bus_route.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +import 'resources.pb.dart' as $9; +import 'resources.pbenum.dart' as $9; + +class CreateBusRouteRequest extends $pb.GeneratedMessage { + factory CreateBusRouteRequest({ + $core.String? busId, + $9.BusType? busType, + $core.String? nurseryId, + $core.Iterable<$core.String>? guardianIds, + }) { + final $result = create(); + if (busId != null) { + $result.busId = busId; + } + if (busType != null) { + $result.busType = busType; + } + if (nurseryId != null) { + $result.nurseryId = nurseryId; + } + if (guardianIds != null) { + $result.guardianIds.addAll(guardianIds); + } + return $result; + } + CreateBusRouteRequest._() : super(); + factory CreateBusRouteRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory CreateBusRouteRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'CreateBusRouteRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'busId') + ..e<$9.BusType>(2, _omitFieldNames ? '' : 'busType', $pb.PbFieldType.OE, defaultOrMaker: $9.BusType.BUS_TYPE_UNSPECIFIED, valueOf: $9.BusType.valueOf, enumValues: $9.BusType.values) + ..aOS(3, _omitFieldNames ? '' : 'nurseryId') + ..pPS(4, _omitFieldNames ? '' : 'guardianIds') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + CreateBusRouteRequest clone() => CreateBusRouteRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + CreateBusRouteRequest copyWith(void Function(CreateBusRouteRequest) updates) => super.copyWith((message) => updates(message as CreateBusRouteRequest)) as CreateBusRouteRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static CreateBusRouteRequest create() => CreateBusRouteRequest._(); + CreateBusRouteRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static CreateBusRouteRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CreateBusRouteRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get busId => $_getSZ(0); + @$pb.TagNumber(1) + set busId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasBusId() => $_has(0); + @$pb.TagNumber(1) + void clearBusId() => clearField(1); + + @$pb.TagNumber(2) + $9.BusType get busType => $_getN(1); + @$pb.TagNumber(2) + set busType($9.BusType v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasBusType() => $_has(1); + @$pb.TagNumber(2) + void clearBusType() => clearField(2); + + @$pb.TagNumber(3) + $core.String get nurseryId => $_getSZ(2); + @$pb.TagNumber(3) + set nurseryId($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasNurseryId() => $_has(2); + @$pb.TagNumber(3) + void clearNurseryId() => clearField(3); + + @$pb.TagNumber(4) + $core.List<$core.String> get guardianIds => $_getList(3); +} + +class CreateBusRouteResponse extends $pb.GeneratedMessage { + factory CreateBusRouteResponse({ + $9.BusRoute? busRoute, + }) { + final $result = create(); + if (busRoute != null) { + $result.busRoute = busRoute; + } + return $result; + } + CreateBusRouteResponse._() : super(); + factory CreateBusRouteResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory CreateBusRouteResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'CreateBusRouteResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.BusRoute>(1, _omitFieldNames ? '' : 'busRoute', subBuilder: $9.BusRoute.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + CreateBusRouteResponse clone() => CreateBusRouteResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + CreateBusRouteResponse copyWith(void Function(CreateBusRouteResponse) updates) => super.copyWith((message) => updates(message as CreateBusRouteResponse)) as CreateBusRouteResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static CreateBusRouteResponse create() => CreateBusRouteResponse._(); + CreateBusRouteResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static CreateBusRouteResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CreateBusRouteResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.BusRoute get busRoute => $_getN(0); + @$pb.TagNumber(1) + set busRoute($9.BusRoute v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasBusRoute() => $_has(0); + @$pb.TagNumber(1) + void clearBusRoute() => clearField(1); + @$pb.TagNumber(1) + $9.BusRoute ensureBusRoute() => $_ensure(0); +} + +class GetBusRouteByBusIDRequest extends $pb.GeneratedMessage { + factory GetBusRouteByBusIDRequest({ + $core.String? busId, + $9.BusType? busType, + }) { + final $result = create(); + if (busId != null) { + $result.busId = busId; + } + if (busType != null) { + $result.busType = busType; + } + return $result; + } + GetBusRouteByBusIDRequest._() : super(); + factory GetBusRouteByBusIDRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetBusRouteByBusIDRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetBusRouteByBusIDRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'busId') + ..e<$9.BusType>(2, _omitFieldNames ? '' : 'busType', $pb.PbFieldType.OE, defaultOrMaker: $9.BusType.BUS_TYPE_UNSPECIFIED, valueOf: $9.BusType.valueOf, enumValues: $9.BusType.values) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetBusRouteByBusIDRequest clone() => GetBusRouteByBusIDRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetBusRouteByBusIDRequest copyWith(void Function(GetBusRouteByBusIDRequest) updates) => super.copyWith((message) => updates(message as GetBusRouteByBusIDRequest)) as GetBusRouteByBusIDRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetBusRouteByBusIDRequest create() => GetBusRouteByBusIDRequest._(); + GetBusRouteByBusIDRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetBusRouteByBusIDRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetBusRouteByBusIDRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get busId => $_getSZ(0); + @$pb.TagNumber(1) + set busId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasBusId() => $_has(0); + @$pb.TagNumber(1) + void clearBusId() => clearField(1); + + @$pb.TagNumber(2) + $9.BusType get busType => $_getN(1); + @$pb.TagNumber(2) + set busType($9.BusType v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasBusType() => $_has(1); + @$pb.TagNumber(2) + void clearBusType() => clearField(2); +} + +class GetBusRouteByBusIDResponse extends $pb.GeneratedMessage { + factory GetBusRouteByBusIDResponse({ + $9.BusRoute? busRoute, + }) { + final $result = create(); + if (busRoute != null) { + $result.busRoute = busRoute; + } + return $result; + } + GetBusRouteByBusIDResponse._() : super(); + factory GetBusRouteByBusIDResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetBusRouteByBusIDResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetBusRouteByBusIDResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.BusRoute>(1, _omitFieldNames ? '' : 'busRoute', subBuilder: $9.BusRoute.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetBusRouteByBusIDResponse clone() => GetBusRouteByBusIDResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetBusRouteByBusIDResponse copyWith(void Function(GetBusRouteByBusIDResponse) updates) => super.copyWith((message) => updates(message as GetBusRouteByBusIDResponse)) as GetBusRouteByBusIDResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetBusRouteByBusIDResponse create() => GetBusRouteByBusIDResponse._(); + GetBusRouteByBusIDResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetBusRouteByBusIDResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetBusRouteByBusIDResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.BusRoute get busRoute => $_getN(0); + @$pb.TagNumber(1) + set busRoute($9.BusRoute v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasBusRoute() => $_has(0); + @$pb.TagNumber(1) + void clearBusRoute() => clearField(1); + @$pb.TagNumber(1) + $9.BusRoute ensureBusRoute() => $_ensure(0); +} + + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus_route.pbenum.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus_route.pbenum.dart new file mode 100644 index 00000000..a819b9d2 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus_route.pbenum.dart @@ -0,0 +1,11 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/bus_route.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus_route.pbgrpc.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus_route.pbgrpc.dart new file mode 100644 index 00000000..4b014de1 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus_route.pbgrpc.dart @@ -0,0 +1,79 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/bus_route.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:async' as $async; +import 'dart:core' as $core; + +import 'package:grpc/service_api.dart' as $grpc; +import 'package:protobuf/protobuf.dart' as $pb; + +import 'bus_route.pb.dart' as $1; + +export 'bus_route.pb.dart'; + +@$pb.GrpcServiceName('where_child_bus.v1.BusRouteService') +class BusRouteServiceClient extends $grpc.Client { + static final _$createBusRoute = $grpc.ClientMethod<$1.CreateBusRouteRequest, $1.CreateBusRouteResponse>( + '/where_child_bus.v1.BusRouteService/CreateBusRoute', + ($1.CreateBusRouteRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $1.CreateBusRouteResponse.fromBuffer(value)); + static final _$getBusRouteByBusID = $grpc.ClientMethod<$1.GetBusRouteByBusIDRequest, $1.GetBusRouteByBusIDResponse>( + '/where_child_bus.v1.BusRouteService/GetBusRouteByBusID', + ($1.GetBusRouteByBusIDRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $1.GetBusRouteByBusIDResponse.fromBuffer(value)); + + BusRouteServiceClient($grpc.ClientChannel channel, + {$grpc.CallOptions? options, + $core.Iterable<$grpc.ClientInterceptor>? interceptors}) + : super(channel, options: options, + interceptors: interceptors); + + $grpc.ResponseFuture<$1.CreateBusRouteResponse> createBusRoute($1.CreateBusRouteRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$createBusRoute, request, options: options); + } + + $grpc.ResponseFuture<$1.GetBusRouteByBusIDResponse> getBusRouteByBusID($1.GetBusRouteByBusIDRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getBusRouteByBusID, request, options: options); + } +} + +@$pb.GrpcServiceName('where_child_bus.v1.BusRouteService') +abstract class BusRouteServiceBase extends $grpc.Service { + $core.String get $name => 'where_child_bus.v1.BusRouteService'; + + BusRouteServiceBase() { + $addMethod($grpc.ServiceMethod<$1.CreateBusRouteRequest, $1.CreateBusRouteResponse>( + 'CreateBusRoute', + createBusRoute_Pre, + false, + false, + ($core.List<$core.int> value) => $1.CreateBusRouteRequest.fromBuffer(value), + ($1.CreateBusRouteResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$1.GetBusRouteByBusIDRequest, $1.GetBusRouteByBusIDResponse>( + 'GetBusRouteByBusID', + getBusRouteByBusID_Pre, + false, + false, + ($core.List<$core.int> value) => $1.GetBusRouteByBusIDRequest.fromBuffer(value), + ($1.GetBusRouteByBusIDResponse value) => value.writeToBuffer())); + } + + $async.Future<$1.CreateBusRouteResponse> createBusRoute_Pre($grpc.ServiceCall call, $async.Future<$1.CreateBusRouteRequest> request) async { + return createBusRoute(call, await request); + } + + $async.Future<$1.GetBusRouteByBusIDResponse> getBusRouteByBusID_Pre($grpc.ServiceCall call, $async.Future<$1.GetBusRouteByBusIDRequest> request) async { + return getBusRouteByBusID(call, await request); + } + + $async.Future<$1.CreateBusRouteResponse> createBusRoute($grpc.ServiceCall call, $1.CreateBusRouteRequest request); + $async.Future<$1.GetBusRouteByBusIDResponse> getBusRouteByBusID($grpc.ServiceCall call, $1.GetBusRouteByBusIDRequest request); +} diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus_route.pbjson.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus_route.pbjson.dart new file mode 100644 index 00000000..717f347a --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/bus_route.pbjson.dart @@ -0,0 +1,73 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/bus_route.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use createBusRouteRequestDescriptor instead') +const CreateBusRouteRequest$json = { + '1': 'CreateBusRouteRequest', + '2': [ + {'1': 'bus_id', '3': 1, '4': 1, '5': 9, '10': 'busId'}, + {'1': 'bus_type', '3': 2, '4': 1, '5': 14, '6': '.where_child_bus.v1.BusType', '10': 'busType'}, + {'1': 'nursery_id', '3': 3, '4': 1, '5': 9, '10': 'nurseryId'}, + {'1': 'guardian_ids', '3': 4, '4': 3, '5': 9, '10': 'guardianIds'}, + ], +}; + +/// Descriptor for `CreateBusRouteRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List createBusRouteRequestDescriptor = $convert.base64Decode( + 'ChVDcmVhdGVCdXNSb3V0ZVJlcXVlc3QSFQoGYnVzX2lkGAEgASgJUgVidXNJZBI2CghidXNfdH' + 'lwZRgCIAEoDjIbLndoZXJlX2NoaWxkX2J1cy52MS5CdXNUeXBlUgdidXNUeXBlEh0KCm51cnNl' + 'cnlfaWQYAyABKAlSCW51cnNlcnlJZBIhCgxndWFyZGlhbl9pZHMYBCADKAlSC2d1YXJkaWFuSW' + 'Rz'); + +@$core.Deprecated('Use createBusRouteResponseDescriptor instead') +const CreateBusRouteResponse$json = { + '1': 'CreateBusRouteResponse', + '2': [ + {'1': 'bus_route', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.BusRoute', '10': 'busRoute'}, + ], +}; + +/// Descriptor for `CreateBusRouteResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List createBusRouteResponseDescriptor = $convert.base64Decode( + 'ChZDcmVhdGVCdXNSb3V0ZVJlc3BvbnNlEjkKCWJ1c19yb3V0ZRgBIAEoCzIcLndoZXJlX2NoaW' + 'xkX2J1cy52MS5CdXNSb3V0ZVIIYnVzUm91dGU='); + +@$core.Deprecated('Use getBusRouteByBusIDRequestDescriptor instead') +const GetBusRouteByBusIDRequest$json = { + '1': 'GetBusRouteByBusIDRequest', + '2': [ + {'1': 'bus_id', '3': 1, '4': 1, '5': 9, '10': 'busId'}, + {'1': 'bus_type', '3': 2, '4': 1, '5': 14, '6': '.where_child_bus.v1.BusType', '10': 'busType'}, + ], +}; + +/// Descriptor for `GetBusRouteByBusIDRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getBusRouteByBusIDRequestDescriptor = $convert.base64Decode( + 'ChlHZXRCdXNSb3V0ZUJ5QnVzSURSZXF1ZXN0EhUKBmJ1c19pZBgBIAEoCVIFYnVzSWQSNgoIYn' + 'VzX3R5cGUYAiABKA4yGy53aGVyZV9jaGlsZF9idXMudjEuQnVzVHlwZVIHYnVzVHlwZQ=='); + +@$core.Deprecated('Use getBusRouteByBusIDResponseDescriptor instead') +const GetBusRouteByBusIDResponse$json = { + '1': 'GetBusRouteByBusIDResponse', + '2': [ + {'1': 'bus_route', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.BusRoute', '10': 'busRoute'}, + ], +}; + +/// Descriptor for `GetBusRouteByBusIDResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getBusRouteByBusIDResponseDescriptor = $convert.base64Decode( + 'ChpHZXRCdXNSb3V0ZUJ5QnVzSURSZXNwb25zZRI5CglidXNfcm91dGUYASABKAsyHC53aGVyZV' + '9jaGlsZF9idXMudjEuQnVzUm91dGVSCGJ1c1JvdXRl'); + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child.pb.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child.pb.dart new file mode 100644 index 00000000..776e4e55 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child.pb.dart @@ -0,0 +1,838 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/child.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +import '../../google/protobuf/field_mask.pb.dart' as $10; +import 'resources.pb.dart' as $9; +import 'resources.pbenum.dart' as $9; + +class CreateChildRequest extends $pb.GeneratedMessage { + factory CreateChildRequest({ + $core.String? nurseryId, + $core.String? guardianId, + $core.String? name, + $core.int? age, + $9.Sex? sex, + $core.Iterable<$core.List<$core.int>>? photos, + }) { + final $result = create(); + if (nurseryId != null) { + $result.nurseryId = nurseryId; + } + if (guardianId != null) { + $result.guardianId = guardianId; + } + if (name != null) { + $result.name = name; + } + if (age != null) { + $result.age = age; + } + if (sex != null) { + $result.sex = sex; + } + if (photos != null) { + $result.photos.addAll(photos); + } + return $result; + } + CreateChildRequest._() : super(); + factory CreateChildRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory CreateChildRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'CreateChildRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'nurseryId') + ..aOS(2, _omitFieldNames ? '' : 'guardianId') + ..aOS(3, _omitFieldNames ? '' : 'name') + ..a<$core.int>(4, _omitFieldNames ? '' : 'age', $pb.PbFieldType.O3) + ..e<$9.Sex>(5, _omitFieldNames ? '' : 'sex', $pb.PbFieldType.OE, defaultOrMaker: $9.Sex.SEX_UNSPECIFIED, valueOf: $9.Sex.valueOf, enumValues: $9.Sex.values) + ..p<$core.List<$core.int>>(6, _omitFieldNames ? '' : 'photos', $pb.PbFieldType.PY) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + CreateChildRequest clone() => CreateChildRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + CreateChildRequest copyWith(void Function(CreateChildRequest) updates) => super.copyWith((message) => updates(message as CreateChildRequest)) as CreateChildRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static CreateChildRequest create() => CreateChildRequest._(); + CreateChildRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static CreateChildRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CreateChildRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get nurseryId => $_getSZ(0); + @$pb.TagNumber(1) + set nurseryId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasNurseryId() => $_has(0); + @$pb.TagNumber(1) + void clearNurseryId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get guardianId => $_getSZ(1); + @$pb.TagNumber(2) + set guardianId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasGuardianId() => $_has(1); + @$pb.TagNumber(2) + void clearGuardianId() => clearField(2); + + @$pb.TagNumber(3) + $core.String get name => $_getSZ(2); + @$pb.TagNumber(3) + set name($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasName() => $_has(2); + @$pb.TagNumber(3) + void clearName() => clearField(3); + + @$pb.TagNumber(4) + $core.int get age => $_getIZ(3); + @$pb.TagNumber(4) + set age($core.int v) { $_setSignedInt32(3, v); } + @$pb.TagNumber(4) + $core.bool hasAge() => $_has(3); + @$pb.TagNumber(4) + void clearAge() => clearField(4); + + @$pb.TagNumber(5) + $9.Sex get sex => $_getN(4); + @$pb.TagNumber(5) + set sex($9.Sex v) { setField(5, v); } + @$pb.TagNumber(5) + $core.bool hasSex() => $_has(4); + @$pb.TagNumber(5) + void clearSex() => clearField(5); + + @$pb.TagNumber(6) + $core.List<$core.List<$core.int>> get photos => $_getList(5); +} + +class CreateChildResponse extends $pb.GeneratedMessage { + factory CreateChildResponse({ + $9.Child? child, + }) { + final $result = create(); + if (child != null) { + $result.child = child; + } + return $result; + } + CreateChildResponse._() : super(); + factory CreateChildResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory CreateChildResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'CreateChildResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.Child>(1, _omitFieldNames ? '' : 'child', subBuilder: $9.Child.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + CreateChildResponse clone() => CreateChildResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + CreateChildResponse copyWith(void Function(CreateChildResponse) updates) => super.copyWith((message) => updates(message as CreateChildResponse)) as CreateChildResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static CreateChildResponse create() => CreateChildResponse._(); + CreateChildResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static CreateChildResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CreateChildResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.Child get child => $_getN(0); + @$pb.TagNumber(1) + set child($9.Child v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasChild() => $_has(0); + @$pb.TagNumber(1) + void clearChild() => clearField(1); + @$pb.TagNumber(1) + $9.Child ensureChild() => $_ensure(0); +} + +class GetChildListByNurseryIDRequest extends $pb.GeneratedMessage { + factory GetChildListByNurseryIDRequest({ + $core.String? nurseryId, + }) { + final $result = create(); + if (nurseryId != null) { + $result.nurseryId = nurseryId; + } + return $result; + } + GetChildListByNurseryIDRequest._() : super(); + factory GetChildListByNurseryIDRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetChildListByNurseryIDRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetChildListByNurseryIDRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'nurseryId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetChildListByNurseryIDRequest clone() => GetChildListByNurseryIDRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetChildListByNurseryIDRequest copyWith(void Function(GetChildListByNurseryIDRequest) updates) => super.copyWith((message) => updates(message as GetChildListByNurseryIDRequest)) as GetChildListByNurseryIDRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetChildListByNurseryIDRequest create() => GetChildListByNurseryIDRequest._(); + GetChildListByNurseryIDRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetChildListByNurseryIDRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetChildListByNurseryIDRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get nurseryId => $_getSZ(0); + @$pb.TagNumber(1) + set nurseryId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasNurseryId() => $_has(0); + @$pb.TagNumber(1) + void clearNurseryId() => clearField(1); +} + +class GetChildListByNurseryIDResponse extends $pb.GeneratedMessage { + factory GetChildListByNurseryIDResponse({ + $core.Iterable<$9.Child>? children, + $core.Iterable<$9.ChildPhoto>? photos, + }) { + final $result = create(); + if (children != null) { + $result.children.addAll(children); + } + if (photos != null) { + $result.photos.addAll(photos); + } + return $result; + } + GetChildListByNurseryIDResponse._() : super(); + factory GetChildListByNurseryIDResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetChildListByNurseryIDResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetChildListByNurseryIDResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..pc<$9.Child>(1, _omitFieldNames ? '' : 'children', $pb.PbFieldType.PM, subBuilder: $9.Child.create) + ..pc<$9.ChildPhoto>(2, _omitFieldNames ? '' : 'photos', $pb.PbFieldType.PM, subBuilder: $9.ChildPhoto.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetChildListByNurseryIDResponse clone() => GetChildListByNurseryIDResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetChildListByNurseryIDResponse copyWith(void Function(GetChildListByNurseryIDResponse) updates) => super.copyWith((message) => updates(message as GetChildListByNurseryIDResponse)) as GetChildListByNurseryIDResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetChildListByNurseryIDResponse create() => GetChildListByNurseryIDResponse._(); + GetChildListByNurseryIDResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetChildListByNurseryIDResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetChildListByNurseryIDResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.List<$9.Child> get children => $_getList(0); + + @$pb.TagNumber(2) + $core.List<$9.ChildPhoto> get photos => $_getList(1); +} + +class GetChildListByGuardianIDRequest extends $pb.GeneratedMessage { + factory GetChildListByGuardianIDRequest({ + $core.String? guardianId, + }) { + final $result = create(); + if (guardianId != null) { + $result.guardianId = guardianId; + } + return $result; + } + GetChildListByGuardianIDRequest._() : super(); + factory GetChildListByGuardianIDRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetChildListByGuardianIDRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetChildListByGuardianIDRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'guardianId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetChildListByGuardianIDRequest clone() => GetChildListByGuardianIDRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetChildListByGuardianIDRequest copyWith(void Function(GetChildListByGuardianIDRequest) updates) => super.copyWith((message) => updates(message as GetChildListByGuardianIDRequest)) as GetChildListByGuardianIDRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetChildListByGuardianIDRequest create() => GetChildListByGuardianIDRequest._(); + GetChildListByGuardianIDRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetChildListByGuardianIDRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetChildListByGuardianIDRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get guardianId => $_getSZ(0); + @$pb.TagNumber(1) + set guardianId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGuardianId() => $_has(0); + @$pb.TagNumber(1) + void clearGuardianId() => clearField(1); +} + +class GetChildListByGuardianIDResponse extends $pb.GeneratedMessage { + factory GetChildListByGuardianIDResponse({ + $core.Iterable<$9.Child>? children, + $core.Iterable<$9.ChildPhoto>? photos, + }) { + final $result = create(); + if (children != null) { + $result.children.addAll(children); + } + if (photos != null) { + $result.photos.addAll(photos); + } + return $result; + } + GetChildListByGuardianIDResponse._() : super(); + factory GetChildListByGuardianIDResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetChildListByGuardianIDResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetChildListByGuardianIDResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..pc<$9.Child>(1, _omitFieldNames ? '' : 'children', $pb.PbFieldType.PM, subBuilder: $9.Child.create) + ..pc<$9.ChildPhoto>(2, _omitFieldNames ? '' : 'photos', $pb.PbFieldType.PM, subBuilder: $9.ChildPhoto.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetChildListByGuardianIDResponse clone() => GetChildListByGuardianIDResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetChildListByGuardianIDResponse copyWith(void Function(GetChildListByGuardianIDResponse) updates) => super.copyWith((message) => updates(message as GetChildListByGuardianIDResponse)) as GetChildListByGuardianIDResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetChildListByGuardianIDResponse create() => GetChildListByGuardianIDResponse._(); + GetChildListByGuardianIDResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetChildListByGuardianIDResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetChildListByGuardianIDResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.List<$9.Child> get children => $_getList(0); + + @$pb.TagNumber(2) + $core.List<$9.ChildPhoto> get photos => $_getList(1); +} + +class GetChildListByBusIDRequest extends $pb.GeneratedMessage { + factory GetChildListByBusIDRequest({ + $core.String? busId, + }) { + final $result = create(); + if (busId != null) { + $result.busId = busId; + } + return $result; + } + GetChildListByBusIDRequest._() : super(); + factory GetChildListByBusIDRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetChildListByBusIDRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetChildListByBusIDRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'busId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetChildListByBusIDRequest clone() => GetChildListByBusIDRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetChildListByBusIDRequest copyWith(void Function(GetChildListByBusIDRequest) updates) => super.copyWith((message) => updates(message as GetChildListByBusIDRequest)) as GetChildListByBusIDRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetChildListByBusIDRequest create() => GetChildListByBusIDRequest._(); + GetChildListByBusIDRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetChildListByBusIDRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetChildListByBusIDRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get busId => $_getSZ(0); + @$pb.TagNumber(1) + set busId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasBusId() => $_has(0); + @$pb.TagNumber(1) + void clearBusId() => clearField(1); +} + +class GetChildListByBusIDResponse extends $pb.GeneratedMessage { + factory GetChildListByBusIDResponse({ + $core.Iterable<$9.Child>? children, + $core.Iterable<$9.ChildPhoto>? photos, + }) { + final $result = create(); + if (children != null) { + $result.children.addAll(children); + } + if (photos != null) { + $result.photos.addAll(photos); + } + return $result; + } + GetChildListByBusIDResponse._() : super(); + factory GetChildListByBusIDResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetChildListByBusIDResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetChildListByBusIDResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..pc<$9.Child>(1, _omitFieldNames ? '' : 'children', $pb.PbFieldType.PM, subBuilder: $9.Child.create) + ..pc<$9.ChildPhoto>(2, _omitFieldNames ? '' : 'photos', $pb.PbFieldType.PM, subBuilder: $9.ChildPhoto.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetChildListByBusIDResponse clone() => GetChildListByBusIDResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetChildListByBusIDResponse copyWith(void Function(GetChildListByBusIDResponse) updates) => super.copyWith((message) => updates(message as GetChildListByBusIDResponse)) as GetChildListByBusIDResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetChildListByBusIDResponse create() => GetChildListByBusIDResponse._(); + GetChildListByBusIDResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetChildListByBusIDResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetChildListByBusIDResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.List<$9.Child> get children => $_getList(0); + + @$pb.TagNumber(2) + $core.List<$9.ChildPhoto> get photos => $_getList(1); +} + +class CheckIsChildInBusRequest extends $pb.GeneratedMessage { + factory CheckIsChildInBusRequest({ + $core.String? childId, + }) { + final $result = create(); + if (childId != null) { + $result.childId = childId; + } + return $result; + } + CheckIsChildInBusRequest._() : super(); + factory CheckIsChildInBusRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory CheckIsChildInBusRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'CheckIsChildInBusRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'childId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + CheckIsChildInBusRequest clone() => CheckIsChildInBusRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + CheckIsChildInBusRequest copyWith(void Function(CheckIsChildInBusRequest) updates) => super.copyWith((message) => updates(message as CheckIsChildInBusRequest)) as CheckIsChildInBusRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static CheckIsChildInBusRequest create() => CheckIsChildInBusRequest._(); + CheckIsChildInBusRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static CheckIsChildInBusRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CheckIsChildInBusRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get childId => $_getSZ(0); + @$pb.TagNumber(1) + set childId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasChildId() => $_has(0); + @$pb.TagNumber(1) + void clearChildId() => clearField(1); +} + +class CheckIsChildInBusResponse extends $pb.GeneratedMessage { + factory CheckIsChildInBusResponse({ + $core.bool? isInBus, + }) { + final $result = create(); + if (isInBus != null) { + $result.isInBus = isInBus; + } + return $result; + } + CheckIsChildInBusResponse._() : super(); + factory CheckIsChildInBusResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory CheckIsChildInBusResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'CheckIsChildInBusResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOB(1, _omitFieldNames ? '' : 'isInBus') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + CheckIsChildInBusResponse clone() => CheckIsChildInBusResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + CheckIsChildInBusResponse copyWith(void Function(CheckIsChildInBusResponse) updates) => super.copyWith((message) => updates(message as CheckIsChildInBusResponse)) as CheckIsChildInBusResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static CheckIsChildInBusResponse create() => CheckIsChildInBusResponse._(); + CheckIsChildInBusResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static CheckIsChildInBusResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CheckIsChildInBusResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.bool get isInBus => $_getBF(0); + @$pb.TagNumber(1) + set isInBus($core.bool v) { $_setBool(0, v); } + @$pb.TagNumber(1) + $core.bool hasIsInBus() => $_has(0); + @$pb.TagNumber(1) + void clearIsInBus() => clearField(1); +} + +class UpdateChildRequest extends $pb.GeneratedMessage { + factory UpdateChildRequest({ + $core.String? childId, + $core.String? name, + $core.int? age, + $9.Sex? sex, + $core.bool? checkForMissingItems, + $core.bool? hasBag, + $core.bool? hasLunchBox, + $core.bool? hasWaterBottle, + $core.bool? hasUmbrella, + $core.bool? hasOther, + $10.FieldMask? updateMask, + }) { + final $result = create(); + if (childId != null) { + $result.childId = childId; + } + if (name != null) { + $result.name = name; + } + if (age != null) { + $result.age = age; + } + if (sex != null) { + $result.sex = sex; + } + if (checkForMissingItems != null) { + $result.checkForMissingItems = checkForMissingItems; + } + if (hasBag != null) { + $result.hasBag = hasBag; + } + if (hasLunchBox != null) { + $result.hasLunchBox = hasLunchBox; + } + if (hasWaterBottle != null) { + $result.hasWaterBottle = hasWaterBottle; + } + if (hasUmbrella != null) { + $result.hasUmbrella = hasUmbrella; + } + if (hasOther != null) { + $result.hasOther = hasOther; + } + if (updateMask != null) { + $result.updateMask = updateMask; + } + return $result; + } + UpdateChildRequest._() : super(); + factory UpdateChildRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory UpdateChildRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'UpdateChildRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'childId') + ..aOS(2, _omitFieldNames ? '' : 'name') + ..a<$core.int>(3, _omitFieldNames ? '' : 'age', $pb.PbFieldType.O3) + ..e<$9.Sex>(4, _omitFieldNames ? '' : 'sex', $pb.PbFieldType.OE, defaultOrMaker: $9.Sex.SEX_UNSPECIFIED, valueOf: $9.Sex.valueOf, enumValues: $9.Sex.values) + ..aOB(5, _omitFieldNames ? '' : 'checkForMissingItems') + ..aOB(6, _omitFieldNames ? '' : 'hasBag') + ..aOB(7, _omitFieldNames ? '' : 'hasLunchBox') + ..aOB(8, _omitFieldNames ? '' : 'hasWaterBottle') + ..aOB(9, _omitFieldNames ? '' : 'hasUmbrella') + ..aOB(10, _omitFieldNames ? '' : 'hasOther') + ..aOM<$10.FieldMask>(11, _omitFieldNames ? '' : 'updateMask', subBuilder: $10.FieldMask.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + UpdateChildRequest clone() => UpdateChildRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + UpdateChildRequest copyWith(void Function(UpdateChildRequest) updates) => super.copyWith((message) => updates(message as UpdateChildRequest)) as UpdateChildRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static UpdateChildRequest create() => UpdateChildRequest._(); + UpdateChildRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static UpdateChildRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static UpdateChildRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get childId => $_getSZ(0); + @$pb.TagNumber(1) + set childId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasChildId() => $_has(0); + @$pb.TagNumber(1) + void clearChildId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get name => $_getSZ(1); + @$pb.TagNumber(2) + set name($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasName() => $_has(1); + @$pb.TagNumber(2) + void clearName() => clearField(2); + + @$pb.TagNumber(3) + $core.int get age => $_getIZ(2); + @$pb.TagNumber(3) + set age($core.int v) { $_setSignedInt32(2, v); } + @$pb.TagNumber(3) + $core.bool hasAge() => $_has(2); + @$pb.TagNumber(3) + void clearAge() => clearField(3); + + @$pb.TagNumber(4) + $9.Sex get sex => $_getN(3); + @$pb.TagNumber(4) + set sex($9.Sex v) { setField(4, v); } + @$pb.TagNumber(4) + $core.bool hasSex() => $_has(3); + @$pb.TagNumber(4) + void clearSex() => clearField(4); + + @$pb.TagNumber(5) + $core.bool get checkForMissingItems => $_getBF(4); + @$pb.TagNumber(5) + set checkForMissingItems($core.bool v) { $_setBool(4, v); } + @$pb.TagNumber(5) + $core.bool hasCheckForMissingItems() => $_has(4); + @$pb.TagNumber(5) + void clearCheckForMissingItems() => clearField(5); + + @$pb.TagNumber(6) + $core.bool get hasBag => $_getBF(5); + @$pb.TagNumber(6) + set hasBag($core.bool v) { $_setBool(5, v); } + @$pb.TagNumber(6) + $core.bool hasHasBag() => $_has(5); + @$pb.TagNumber(6) + void clearHasBag() => clearField(6); + + @$pb.TagNumber(7) + $core.bool get hasLunchBox => $_getBF(6); + @$pb.TagNumber(7) + set hasLunchBox($core.bool v) { $_setBool(6, v); } + @$pb.TagNumber(7) + $core.bool hasHasLunchBox() => $_has(6); + @$pb.TagNumber(7) + void clearHasLunchBox() => clearField(7); + + @$pb.TagNumber(8) + $core.bool get hasWaterBottle => $_getBF(7); + @$pb.TagNumber(8) + set hasWaterBottle($core.bool v) { $_setBool(7, v); } + @$pb.TagNumber(8) + $core.bool hasHasWaterBottle() => $_has(7); + @$pb.TagNumber(8) + void clearHasWaterBottle() => clearField(8); + + @$pb.TagNumber(9) + $core.bool get hasUmbrella => $_getBF(8); + @$pb.TagNumber(9) + set hasUmbrella($core.bool v) { $_setBool(8, v); } + @$pb.TagNumber(9) + $core.bool hasHasUmbrella() => $_has(8); + @$pb.TagNumber(9) + void clearHasUmbrella() => clearField(9); + + @$pb.TagNumber(10) + $core.bool get hasOther => $_getBF(9); + @$pb.TagNumber(10) + set hasOther($core.bool v) { $_setBool(9, v); } + @$pb.TagNumber(10) + $core.bool hasHasOther() => $_has(9); + @$pb.TagNumber(10) + void clearHasOther() => clearField(10); + + @$pb.TagNumber(11) + $10.FieldMask get updateMask => $_getN(10); + @$pb.TagNumber(11) + set updateMask($10.FieldMask v) { setField(11, v); } + @$pb.TagNumber(11) + $core.bool hasUpdateMask() => $_has(10); + @$pb.TagNumber(11) + void clearUpdateMask() => clearField(11); + @$pb.TagNumber(11) + $10.FieldMask ensureUpdateMask() => $_ensure(10); +} + +class UpdateChildResponse extends $pb.GeneratedMessage { + factory UpdateChildResponse({ + $9.Child? child, + }) { + final $result = create(); + if (child != null) { + $result.child = child; + } + return $result; + } + UpdateChildResponse._() : super(); + factory UpdateChildResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory UpdateChildResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'UpdateChildResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.Child>(1, _omitFieldNames ? '' : 'child', subBuilder: $9.Child.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + UpdateChildResponse clone() => UpdateChildResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + UpdateChildResponse copyWith(void Function(UpdateChildResponse) updates) => super.copyWith((message) => updates(message as UpdateChildResponse)) as UpdateChildResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static UpdateChildResponse create() => UpdateChildResponse._(); + UpdateChildResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static UpdateChildResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static UpdateChildResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.Child get child => $_getN(0); + @$pb.TagNumber(1) + set child($9.Child v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasChild() => $_has(0); + @$pb.TagNumber(1) + void clearChild() => clearField(1); + @$pb.TagNumber(1) + $9.Child ensureChild() => $_ensure(0); +} + + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child.pbenum.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child.pbenum.dart new file mode 100644 index 00000000..f0c731f1 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child.pbenum.dart @@ -0,0 +1,11 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/child.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child.pbgrpc.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child.pbgrpc.dart new file mode 100644 index 00000000..9b2f5e62 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child.pbgrpc.dart @@ -0,0 +1,159 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/child.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:async' as $async; +import 'dart:core' as $core; + +import 'package:grpc/service_api.dart' as $grpc; +import 'package:protobuf/protobuf.dart' as $pb; + +import 'child.pb.dart' as $2; + +export 'child.pb.dart'; + +@$pb.GrpcServiceName('where_child_bus.v1.ChildService') +class ChildServiceClient extends $grpc.Client { + static final _$createChild = $grpc.ClientMethod<$2.CreateChildRequest, $2.CreateChildResponse>( + '/where_child_bus.v1.ChildService/CreateChild', + ($2.CreateChildRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $2.CreateChildResponse.fromBuffer(value)); + static final _$getChildListByNurseryID = $grpc.ClientMethod<$2.GetChildListByNurseryIDRequest, $2.GetChildListByNurseryIDResponse>( + '/where_child_bus.v1.ChildService/GetChildListByNurseryID', + ($2.GetChildListByNurseryIDRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $2.GetChildListByNurseryIDResponse.fromBuffer(value)); + static final _$getChildListByGuardianID = $grpc.ClientMethod<$2.GetChildListByGuardianIDRequest, $2.GetChildListByGuardianIDResponse>( + '/where_child_bus.v1.ChildService/GetChildListByGuardianID', + ($2.GetChildListByGuardianIDRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $2.GetChildListByGuardianIDResponse.fromBuffer(value)); + static final _$getChildListByBusID = $grpc.ClientMethod<$2.GetChildListByBusIDRequest, $2.GetChildListByBusIDResponse>( + '/where_child_bus.v1.ChildService/GetChildListByBusID', + ($2.GetChildListByBusIDRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $2.GetChildListByBusIDResponse.fromBuffer(value)); + static final _$checkIsChildInBus = $grpc.ClientMethod<$2.CheckIsChildInBusRequest, $2.CheckIsChildInBusResponse>( + '/where_child_bus.v1.ChildService/CheckIsChildInBus', + ($2.CheckIsChildInBusRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $2.CheckIsChildInBusResponse.fromBuffer(value)); + static final _$updateChild = $grpc.ClientMethod<$2.UpdateChildRequest, $2.UpdateChildResponse>( + '/where_child_bus.v1.ChildService/UpdateChild', + ($2.UpdateChildRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $2.UpdateChildResponse.fromBuffer(value)); + + ChildServiceClient($grpc.ClientChannel channel, + {$grpc.CallOptions? options, + $core.Iterable<$grpc.ClientInterceptor>? interceptors}) + : super(channel, options: options, + interceptors: interceptors); + + $grpc.ResponseFuture<$2.CreateChildResponse> createChild($2.CreateChildRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$createChild, request, options: options); + } + + $grpc.ResponseFuture<$2.GetChildListByNurseryIDResponse> getChildListByNurseryID($2.GetChildListByNurseryIDRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getChildListByNurseryID, request, options: options); + } + + $grpc.ResponseFuture<$2.GetChildListByGuardianIDResponse> getChildListByGuardianID($2.GetChildListByGuardianIDRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getChildListByGuardianID, request, options: options); + } + + $grpc.ResponseFuture<$2.GetChildListByBusIDResponse> getChildListByBusID($2.GetChildListByBusIDRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getChildListByBusID, request, options: options); + } + + $grpc.ResponseFuture<$2.CheckIsChildInBusResponse> checkIsChildInBus($2.CheckIsChildInBusRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$checkIsChildInBus, request, options: options); + } + + $grpc.ResponseFuture<$2.UpdateChildResponse> updateChild($2.UpdateChildRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$updateChild, request, options: options); + } +} + +@$pb.GrpcServiceName('where_child_bus.v1.ChildService') +abstract class ChildServiceBase extends $grpc.Service { + $core.String get $name => 'where_child_bus.v1.ChildService'; + + ChildServiceBase() { + $addMethod($grpc.ServiceMethod<$2.CreateChildRequest, $2.CreateChildResponse>( + 'CreateChild', + createChild_Pre, + false, + false, + ($core.List<$core.int> value) => $2.CreateChildRequest.fromBuffer(value), + ($2.CreateChildResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$2.GetChildListByNurseryIDRequest, $2.GetChildListByNurseryIDResponse>( + 'GetChildListByNurseryID', + getChildListByNurseryID_Pre, + false, + false, + ($core.List<$core.int> value) => $2.GetChildListByNurseryIDRequest.fromBuffer(value), + ($2.GetChildListByNurseryIDResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$2.GetChildListByGuardianIDRequest, $2.GetChildListByGuardianIDResponse>( + 'GetChildListByGuardianID', + getChildListByGuardianID_Pre, + false, + false, + ($core.List<$core.int> value) => $2.GetChildListByGuardianIDRequest.fromBuffer(value), + ($2.GetChildListByGuardianIDResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$2.GetChildListByBusIDRequest, $2.GetChildListByBusIDResponse>( + 'GetChildListByBusID', + getChildListByBusID_Pre, + false, + false, + ($core.List<$core.int> value) => $2.GetChildListByBusIDRequest.fromBuffer(value), + ($2.GetChildListByBusIDResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$2.CheckIsChildInBusRequest, $2.CheckIsChildInBusResponse>( + 'CheckIsChildInBus', + checkIsChildInBus_Pre, + false, + false, + ($core.List<$core.int> value) => $2.CheckIsChildInBusRequest.fromBuffer(value), + ($2.CheckIsChildInBusResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$2.UpdateChildRequest, $2.UpdateChildResponse>( + 'UpdateChild', + updateChild_Pre, + false, + false, + ($core.List<$core.int> value) => $2.UpdateChildRequest.fromBuffer(value), + ($2.UpdateChildResponse value) => value.writeToBuffer())); + } + + $async.Future<$2.CreateChildResponse> createChild_Pre($grpc.ServiceCall call, $async.Future<$2.CreateChildRequest> request) async { + return createChild(call, await request); + } + + $async.Future<$2.GetChildListByNurseryIDResponse> getChildListByNurseryID_Pre($grpc.ServiceCall call, $async.Future<$2.GetChildListByNurseryIDRequest> request) async { + return getChildListByNurseryID(call, await request); + } + + $async.Future<$2.GetChildListByGuardianIDResponse> getChildListByGuardianID_Pre($grpc.ServiceCall call, $async.Future<$2.GetChildListByGuardianIDRequest> request) async { + return getChildListByGuardianID(call, await request); + } + + $async.Future<$2.GetChildListByBusIDResponse> getChildListByBusID_Pre($grpc.ServiceCall call, $async.Future<$2.GetChildListByBusIDRequest> request) async { + return getChildListByBusID(call, await request); + } + + $async.Future<$2.CheckIsChildInBusResponse> checkIsChildInBus_Pre($grpc.ServiceCall call, $async.Future<$2.CheckIsChildInBusRequest> request) async { + return checkIsChildInBus(call, await request); + } + + $async.Future<$2.UpdateChildResponse> updateChild_Pre($grpc.ServiceCall call, $async.Future<$2.UpdateChildRequest> request) async { + return updateChild(call, await request); + } + + $async.Future<$2.CreateChildResponse> createChild($grpc.ServiceCall call, $2.CreateChildRequest request); + $async.Future<$2.GetChildListByNurseryIDResponse> getChildListByNurseryID($grpc.ServiceCall call, $2.GetChildListByNurseryIDRequest request); + $async.Future<$2.GetChildListByGuardianIDResponse> getChildListByGuardianID($grpc.ServiceCall call, $2.GetChildListByGuardianIDRequest request); + $async.Future<$2.GetChildListByBusIDResponse> getChildListByBusID($grpc.ServiceCall call, $2.GetChildListByBusIDRequest request); + $async.Future<$2.CheckIsChildInBusResponse> checkIsChildInBus($grpc.ServiceCall call, $2.CheckIsChildInBusRequest request); + $async.Future<$2.UpdateChildResponse> updateChild($grpc.ServiceCall call, $2.UpdateChildRequest request); +} diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child.pbjson.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child.pbjson.dart new file mode 100644 index 00000000..54ce6a39 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child.pbjson.dart @@ -0,0 +1,198 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/child.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use createChildRequestDescriptor instead') +const CreateChildRequest$json = { + '1': 'CreateChildRequest', + '2': [ + {'1': 'nursery_id', '3': 1, '4': 1, '5': 9, '10': 'nurseryId'}, + {'1': 'guardian_id', '3': 2, '4': 1, '5': 9, '10': 'guardianId'}, + {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, + {'1': 'age', '3': 4, '4': 1, '5': 5, '10': 'age'}, + {'1': 'sex', '3': 5, '4': 1, '5': 14, '6': '.where_child_bus.v1.Sex', '10': 'sex'}, + {'1': 'photos', '3': 6, '4': 3, '5': 12, '10': 'photos'}, + ], +}; + +/// Descriptor for `CreateChildRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List createChildRequestDescriptor = $convert.base64Decode( + 'ChJDcmVhdGVDaGlsZFJlcXVlc3QSHQoKbnVyc2VyeV9pZBgBIAEoCVIJbnVyc2VyeUlkEh8KC2' + 'd1YXJkaWFuX2lkGAIgASgJUgpndWFyZGlhbklkEhIKBG5hbWUYAyABKAlSBG5hbWUSEAoDYWdl' + 'GAQgASgFUgNhZ2USKQoDc2V4GAUgASgOMhcud2hlcmVfY2hpbGRfYnVzLnYxLlNleFIDc2V4Eh' + 'YKBnBob3RvcxgGIAMoDFIGcGhvdG9z'); + +@$core.Deprecated('Use createChildResponseDescriptor instead') +const CreateChildResponse$json = { + '1': 'CreateChildResponse', + '2': [ + {'1': 'child', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.Child', '10': 'child'}, + ], +}; + +/// Descriptor for `CreateChildResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List createChildResponseDescriptor = $convert.base64Decode( + 'ChNDcmVhdGVDaGlsZFJlc3BvbnNlEi8KBWNoaWxkGAEgASgLMhkud2hlcmVfY2hpbGRfYnVzLn' + 'YxLkNoaWxkUgVjaGlsZA=='); + +@$core.Deprecated('Use getChildListByNurseryIDRequestDescriptor instead') +const GetChildListByNurseryIDRequest$json = { + '1': 'GetChildListByNurseryIDRequest', + '2': [ + {'1': 'nursery_id', '3': 1, '4': 1, '5': 9, '10': 'nurseryId'}, + ], +}; + +/// Descriptor for `GetChildListByNurseryIDRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getChildListByNurseryIDRequestDescriptor = $convert.base64Decode( + 'Ch5HZXRDaGlsZExpc3RCeU51cnNlcnlJRFJlcXVlc3QSHQoKbnVyc2VyeV9pZBgBIAEoCVIJbn' + 'Vyc2VyeUlk'); + +@$core.Deprecated('Use getChildListByNurseryIDResponseDescriptor instead') +const GetChildListByNurseryIDResponse$json = { + '1': 'GetChildListByNurseryIDResponse', + '2': [ + {'1': 'children', '3': 1, '4': 3, '5': 11, '6': '.where_child_bus.v1.Child', '10': 'children'}, + {'1': 'photos', '3': 2, '4': 3, '5': 11, '6': '.where_child_bus.v1.ChildPhoto', '10': 'photos'}, + ], +}; + +/// Descriptor for `GetChildListByNurseryIDResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getChildListByNurseryIDResponseDescriptor = $convert.base64Decode( + 'Ch9HZXRDaGlsZExpc3RCeU51cnNlcnlJRFJlc3BvbnNlEjUKCGNoaWxkcmVuGAEgAygLMhkud2' + 'hlcmVfY2hpbGRfYnVzLnYxLkNoaWxkUghjaGlsZHJlbhI2CgZwaG90b3MYAiADKAsyHi53aGVy' + 'ZV9jaGlsZF9idXMudjEuQ2hpbGRQaG90b1IGcGhvdG9z'); + +@$core.Deprecated('Use getChildListByGuardianIDRequestDescriptor instead') +const GetChildListByGuardianIDRequest$json = { + '1': 'GetChildListByGuardianIDRequest', + '2': [ + {'1': 'guardian_id', '3': 1, '4': 1, '5': 9, '10': 'guardianId'}, + ], +}; + +/// Descriptor for `GetChildListByGuardianIDRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getChildListByGuardianIDRequestDescriptor = $convert.base64Decode( + 'Ch9HZXRDaGlsZExpc3RCeUd1YXJkaWFuSURSZXF1ZXN0Eh8KC2d1YXJkaWFuX2lkGAEgASgJUg' + 'pndWFyZGlhbklk'); + +@$core.Deprecated('Use getChildListByGuardianIDResponseDescriptor instead') +const GetChildListByGuardianIDResponse$json = { + '1': 'GetChildListByGuardianIDResponse', + '2': [ + {'1': 'children', '3': 1, '4': 3, '5': 11, '6': '.where_child_bus.v1.Child', '10': 'children'}, + {'1': 'photos', '3': 2, '4': 3, '5': 11, '6': '.where_child_bus.v1.ChildPhoto', '10': 'photos'}, + ], +}; + +/// Descriptor for `GetChildListByGuardianIDResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getChildListByGuardianIDResponseDescriptor = $convert.base64Decode( + 'CiBHZXRDaGlsZExpc3RCeUd1YXJkaWFuSURSZXNwb25zZRI1CghjaGlsZHJlbhgBIAMoCzIZLn' + 'doZXJlX2NoaWxkX2J1cy52MS5DaGlsZFIIY2hpbGRyZW4SNgoGcGhvdG9zGAIgAygLMh4ud2hl' + 'cmVfY2hpbGRfYnVzLnYxLkNoaWxkUGhvdG9SBnBob3Rvcw=='); + +@$core.Deprecated('Use getChildListByBusIDRequestDescriptor instead') +const GetChildListByBusIDRequest$json = { + '1': 'GetChildListByBusIDRequest', + '2': [ + {'1': 'bus_id', '3': 1, '4': 1, '5': 9, '10': 'busId'}, + ], +}; + +/// Descriptor for `GetChildListByBusIDRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getChildListByBusIDRequestDescriptor = $convert.base64Decode( + 'ChpHZXRDaGlsZExpc3RCeUJ1c0lEUmVxdWVzdBIVCgZidXNfaWQYASABKAlSBWJ1c0lk'); + +@$core.Deprecated('Use getChildListByBusIDResponseDescriptor instead') +const GetChildListByBusIDResponse$json = { + '1': 'GetChildListByBusIDResponse', + '2': [ + {'1': 'children', '3': 1, '4': 3, '5': 11, '6': '.where_child_bus.v1.Child', '10': 'children'}, + {'1': 'photos', '3': 2, '4': 3, '5': 11, '6': '.where_child_bus.v1.ChildPhoto', '10': 'photos'}, + ], +}; + +/// Descriptor for `GetChildListByBusIDResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getChildListByBusIDResponseDescriptor = $convert.base64Decode( + 'ChtHZXRDaGlsZExpc3RCeUJ1c0lEUmVzcG9uc2USNQoIY2hpbGRyZW4YASADKAsyGS53aGVyZV' + '9jaGlsZF9idXMudjEuQ2hpbGRSCGNoaWxkcmVuEjYKBnBob3RvcxgCIAMoCzIeLndoZXJlX2No' + 'aWxkX2J1cy52MS5DaGlsZFBob3RvUgZwaG90b3M='); + +@$core.Deprecated('Use checkIsChildInBusRequestDescriptor instead') +const CheckIsChildInBusRequest$json = { + '1': 'CheckIsChildInBusRequest', + '2': [ + {'1': 'child_id', '3': 1, '4': 1, '5': 9, '10': 'childId'}, + ], +}; + +/// Descriptor for `CheckIsChildInBusRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List checkIsChildInBusRequestDescriptor = $convert.base64Decode( + 'ChhDaGVja0lzQ2hpbGRJbkJ1c1JlcXVlc3QSGQoIY2hpbGRfaWQYASABKAlSB2NoaWxkSWQ='); + +@$core.Deprecated('Use checkIsChildInBusResponseDescriptor instead') +const CheckIsChildInBusResponse$json = { + '1': 'CheckIsChildInBusResponse', + '2': [ + {'1': 'is_in_bus', '3': 1, '4': 1, '5': 8, '10': 'isInBus'}, + ], +}; + +/// Descriptor for `CheckIsChildInBusResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List checkIsChildInBusResponseDescriptor = $convert.base64Decode( + 'ChlDaGVja0lzQ2hpbGRJbkJ1c1Jlc3BvbnNlEhoKCWlzX2luX2J1cxgBIAEoCFIHaXNJbkJ1cw' + '=='); + +@$core.Deprecated('Use updateChildRequestDescriptor instead') +const UpdateChildRequest$json = { + '1': 'UpdateChildRequest', + '2': [ + {'1': 'child_id', '3': 1, '4': 1, '5': 9, '10': 'childId'}, + {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'}, + {'1': 'age', '3': 3, '4': 1, '5': 5, '10': 'age'}, + {'1': 'sex', '3': 4, '4': 1, '5': 14, '6': '.where_child_bus.v1.Sex', '10': 'sex'}, + {'1': 'check_for_missing_items', '3': 5, '4': 1, '5': 8, '10': 'checkForMissingItems'}, + {'1': 'has_bag', '3': 6, '4': 1, '5': 8, '10': 'hasBag'}, + {'1': 'has_lunch_box', '3': 7, '4': 1, '5': 8, '10': 'hasLunchBox'}, + {'1': 'has_water_bottle', '3': 8, '4': 1, '5': 8, '10': 'hasWaterBottle'}, + {'1': 'has_umbrella', '3': 9, '4': 1, '5': 8, '10': 'hasUmbrella'}, + {'1': 'has_other', '3': 10, '4': 1, '5': 8, '10': 'hasOther'}, + {'1': 'update_mask', '3': 11, '4': 1, '5': 11, '6': '.google.protobuf.FieldMask', '10': 'updateMask'}, + ], +}; + +/// Descriptor for `UpdateChildRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List updateChildRequestDescriptor = $convert.base64Decode( + 'ChJVcGRhdGVDaGlsZFJlcXVlc3QSGQoIY2hpbGRfaWQYASABKAlSB2NoaWxkSWQSEgoEbmFtZR' + 'gCIAEoCVIEbmFtZRIQCgNhZ2UYAyABKAVSA2FnZRIpCgNzZXgYBCABKA4yFy53aGVyZV9jaGls' + 'ZF9idXMudjEuU2V4UgNzZXgSNQoXY2hlY2tfZm9yX21pc3NpbmdfaXRlbXMYBSABKAhSFGNoZW' + 'NrRm9yTWlzc2luZ0l0ZW1zEhcKB2hhc19iYWcYBiABKAhSBmhhc0JhZxIiCg1oYXNfbHVuY2hf' + 'Ym94GAcgASgIUgtoYXNMdW5jaEJveBIoChBoYXNfd2F0ZXJfYm90dGxlGAggASgIUg5oYXNXYX' + 'RlckJvdHRsZRIhCgxoYXNfdW1icmVsbGEYCSABKAhSC2hhc1VtYnJlbGxhEhsKCWhhc19vdGhl' + 'chgKIAEoCFIIaGFzT3RoZXISOwoLdXBkYXRlX21hc2sYCyABKAsyGi5nb29nbGUucHJvdG9idW' + 'YuRmllbGRNYXNrUgp1cGRhdGVNYXNr'); + +@$core.Deprecated('Use updateChildResponseDescriptor instead') +const UpdateChildResponse$json = { + '1': 'UpdateChildResponse', + '2': [ + {'1': 'child', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.Child', '10': 'child'}, + ], +}; + +/// Descriptor for `UpdateChildResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List updateChildResponseDescriptor = $convert.base64Decode( + 'ChNVcGRhdGVDaGlsZFJlc3BvbnNlEi8KBWNoaWxkGAEgASgLMhkud2hlcmVfY2hpbGRfYnVzLn' + 'YxLkNoaWxkUgVjaGlsZA=='); + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child_photo.pb.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child_photo.pb.dart new file mode 100644 index 00000000..ae735096 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child_photo.pb.dart @@ -0,0 +1,382 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/child_photo.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +class DuplicationCheckRequest extends $pb.GeneratedMessage { + factory DuplicationCheckRequest({ + $core.Iterable<$core.String>? childIds, + }) { + final $result = create(); + if (childIds != null) { + $result.childIds.addAll(childIds); + } + return $result; + } + DuplicationCheckRequest._() : super(); + factory DuplicationCheckRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory DuplicationCheckRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'DuplicationCheckRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..pPS(1, _omitFieldNames ? '' : 'childIds') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + DuplicationCheckRequest clone() => DuplicationCheckRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + DuplicationCheckRequest copyWith(void Function(DuplicationCheckRequest) updates) => super.copyWith((message) => updates(message as DuplicationCheckRequest)) as DuplicationCheckRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static DuplicationCheckRequest create() => DuplicationCheckRequest._(); + DuplicationCheckRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static DuplicationCheckRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static DuplicationCheckRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.List<$core.String> get childIds => $_getList(0); +} + +class DuplicationCheckResponse extends $pb.GeneratedMessage { + factory DuplicationCheckResponse({ + $core.bool? isDuplicated, + $core.Iterable<$core.String>? photoIds, + $core.Iterable<$core.List<$core.int>>? duplicatedPhotos, + }) { + final $result = create(); + if (isDuplicated != null) { + $result.isDuplicated = isDuplicated; + } + if (photoIds != null) { + $result.photoIds.addAll(photoIds); + } + if (duplicatedPhotos != null) { + $result.duplicatedPhotos.addAll(duplicatedPhotos); + } + return $result; + } + DuplicationCheckResponse._() : super(); + factory DuplicationCheckResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory DuplicationCheckResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'DuplicationCheckResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOB(1, _omitFieldNames ? '' : 'isDuplicated') + ..pPS(2, _omitFieldNames ? '' : 'photoIds') + ..p<$core.List<$core.int>>(3, _omitFieldNames ? '' : 'duplicatedPhotos', $pb.PbFieldType.PY) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + DuplicationCheckResponse clone() => DuplicationCheckResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + DuplicationCheckResponse copyWith(void Function(DuplicationCheckResponse) updates) => super.copyWith((message) => updates(message as DuplicationCheckResponse)) as DuplicationCheckResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static DuplicationCheckResponse create() => DuplicationCheckResponse._(); + DuplicationCheckResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static DuplicationCheckResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static DuplicationCheckResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.bool get isDuplicated => $_getBF(0); + @$pb.TagNumber(1) + set isDuplicated($core.bool v) { $_setBool(0, v); } + @$pb.TagNumber(1) + $core.bool hasIsDuplicated() => $_has(0); + @$pb.TagNumber(1) + void clearIsDuplicated() => clearField(1); + + @$pb.TagNumber(2) + $core.List<$core.String> get photoIds => $_getList(1); + + @$pb.TagNumber(3) + $core.List<$core.List<$core.int>> get duplicatedPhotos => $_getList(2); +} + +class DeleteChildPhotoRequest extends $pb.GeneratedMessage { + factory DeleteChildPhotoRequest({ + $core.Iterable<$core.String>? ids, + }) { + final $result = create(); + if (ids != null) { + $result.ids.addAll(ids); + } + return $result; + } + DeleteChildPhotoRequest._() : super(); + factory DeleteChildPhotoRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory DeleteChildPhotoRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'DeleteChildPhotoRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..pPS(1, _omitFieldNames ? '' : 'ids') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + DeleteChildPhotoRequest clone() => DeleteChildPhotoRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + DeleteChildPhotoRequest copyWith(void Function(DeleteChildPhotoRequest) updates) => super.copyWith((message) => updates(message as DeleteChildPhotoRequest)) as DeleteChildPhotoRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static DeleteChildPhotoRequest create() => DeleteChildPhotoRequest._(); + DeleteChildPhotoRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static DeleteChildPhotoRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static DeleteChildPhotoRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.List<$core.String> get ids => $_getList(0); +} + +class DeleteChildPhotoResponse extends $pb.GeneratedMessage { + factory DeleteChildPhotoResponse({ + $core.Iterable<$core.bool>? isSuccessList, + $core.Iterable<$core.String>? ids, + }) { + final $result = create(); + if (isSuccessList != null) { + $result.isSuccessList.addAll(isSuccessList); + } + if (ids != null) { + $result.ids.addAll(ids); + } + return $result; + } + DeleteChildPhotoResponse._() : super(); + factory DeleteChildPhotoResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory DeleteChildPhotoResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'DeleteChildPhotoResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..p<$core.bool>(1, _omitFieldNames ? '' : 'isSuccessList', $pb.PbFieldType.KB) + ..pPS(2, _omitFieldNames ? '' : 'ids') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + DeleteChildPhotoResponse clone() => DeleteChildPhotoResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + DeleteChildPhotoResponse copyWith(void Function(DeleteChildPhotoResponse) updates) => super.copyWith((message) => updates(message as DeleteChildPhotoResponse)) as DeleteChildPhotoResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static DeleteChildPhotoResponse create() => DeleteChildPhotoResponse._(); + DeleteChildPhotoResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static DeleteChildPhotoResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static DeleteChildPhotoResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.List<$core.bool> get isSuccessList => $_getList(0); + + @$pb.TagNumber(2) + $core.List<$core.String> get ids => $_getList(1); +} + +class GetChildPhotoRequest extends $pb.GeneratedMessage { + factory GetChildPhotoRequest({ + $core.String? childId, + }) { + final $result = create(); + if (childId != null) { + $result.childId = childId; + } + return $result; + } + GetChildPhotoRequest._() : super(); + factory GetChildPhotoRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetChildPhotoRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetChildPhotoRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'childId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetChildPhotoRequest clone() => GetChildPhotoRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetChildPhotoRequest copyWith(void Function(GetChildPhotoRequest) updates) => super.copyWith((message) => updates(message as GetChildPhotoRequest)) as GetChildPhotoRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetChildPhotoRequest create() => GetChildPhotoRequest._(); + GetChildPhotoRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetChildPhotoRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetChildPhotoRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get childId => $_getSZ(0); + @$pb.TagNumber(1) + set childId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasChildId() => $_has(0); + @$pb.TagNumber(1) + void clearChildId() => clearField(1); +} + +class ChildPhotoResponse extends $pb.GeneratedMessage { + factory ChildPhotoResponse({ + $core.String? childPhotoId, + $core.List<$core.int>? photo, + }) { + final $result = create(); + if (childPhotoId != null) { + $result.childPhotoId = childPhotoId; + } + if (photo != null) { + $result.photo = photo; + } + return $result; + } + ChildPhotoResponse._() : super(); + factory ChildPhotoResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ChildPhotoResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ChildPhotoResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'childPhotoId') + ..a<$core.List<$core.int>>(2, _omitFieldNames ? '' : 'photo', $pb.PbFieldType.OY) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ChildPhotoResponse clone() => ChildPhotoResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ChildPhotoResponse copyWith(void Function(ChildPhotoResponse) updates) => super.copyWith((message) => updates(message as ChildPhotoResponse)) as ChildPhotoResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static ChildPhotoResponse create() => ChildPhotoResponse._(); + ChildPhotoResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ChildPhotoResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ChildPhotoResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get childPhotoId => $_getSZ(0); + @$pb.TagNumber(1) + set childPhotoId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasChildPhotoId() => $_has(0); + @$pb.TagNumber(1) + void clearChildPhotoId() => clearField(1); + + @$pb.TagNumber(2) + $core.List<$core.int> get photo => $_getN(1); + @$pb.TagNumber(2) + set photo($core.List<$core.int> v) { $_setBytes(1, v); } + @$pb.TagNumber(2) + $core.bool hasPhoto() => $_has(1); + @$pb.TagNumber(2) + void clearPhoto() => clearField(2); +} + +class GetChildPhotoResponse extends $pb.GeneratedMessage { + factory GetChildPhotoResponse({ + $core.Iterable? childPhotos, + }) { + final $result = create(); + if (childPhotos != null) { + $result.childPhotos.addAll(childPhotos); + } + return $result; + } + GetChildPhotoResponse._() : super(); + factory GetChildPhotoResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetChildPhotoResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetChildPhotoResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..pc(1, _omitFieldNames ? '' : 'childPhotos', $pb.PbFieldType.PM, subBuilder: ChildPhotoResponse.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetChildPhotoResponse clone() => GetChildPhotoResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetChildPhotoResponse copyWith(void Function(GetChildPhotoResponse) updates) => super.copyWith((message) => updates(message as GetChildPhotoResponse)) as GetChildPhotoResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetChildPhotoResponse create() => GetChildPhotoResponse._(); + GetChildPhotoResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetChildPhotoResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetChildPhotoResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.List get childPhotos => $_getList(0); +} + + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child_photo.pbenum.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child_photo.pbenum.dart new file mode 100644 index 00000000..0adb482e --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child_photo.pbenum.dart @@ -0,0 +1,11 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/child_photo.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child_photo.pbgrpc.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child_photo.pbgrpc.dart new file mode 100644 index 00000000..ea53ed3e --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child_photo.pbgrpc.dart @@ -0,0 +1,99 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/child_photo.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:async' as $async; +import 'dart:core' as $core; + +import 'package:grpc/service_api.dart' as $grpc; +import 'package:protobuf/protobuf.dart' as $pb; + +import 'child_photo.pb.dart' as $3; + +export 'child_photo.pb.dart'; + +@$pb.GrpcServiceName('where_child_bus.v1.ChildPhotoService') +class ChildPhotoServiceClient extends $grpc.Client { + static final _$duplicationCheck = $grpc.ClientMethod<$3.DuplicationCheckRequest, $3.DuplicationCheckResponse>( + '/where_child_bus.v1.ChildPhotoService/DuplicationCheck', + ($3.DuplicationCheckRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $3.DuplicationCheckResponse.fromBuffer(value)); + static final _$deleteChildPhoto = $grpc.ClientMethod<$3.DeleteChildPhotoRequest, $3.DeleteChildPhotoResponse>( + '/where_child_bus.v1.ChildPhotoService/DeleteChildPhoto', + ($3.DeleteChildPhotoRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $3.DeleteChildPhotoResponse.fromBuffer(value)); + static final _$getChildPhoto = $grpc.ClientMethod<$3.GetChildPhotoRequest, $3.GetChildPhotoResponse>( + '/where_child_bus.v1.ChildPhotoService/GetChildPhoto', + ($3.GetChildPhotoRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $3.GetChildPhotoResponse.fromBuffer(value)); + + ChildPhotoServiceClient($grpc.ClientChannel channel, + {$grpc.CallOptions? options, + $core.Iterable<$grpc.ClientInterceptor>? interceptors}) + : super(channel, options: options, + interceptors: interceptors); + + $grpc.ResponseFuture<$3.DuplicationCheckResponse> duplicationCheck($3.DuplicationCheckRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$duplicationCheck, request, options: options); + } + + $grpc.ResponseFuture<$3.DeleteChildPhotoResponse> deleteChildPhoto($3.DeleteChildPhotoRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$deleteChildPhoto, request, options: options); + } + + $grpc.ResponseFuture<$3.GetChildPhotoResponse> getChildPhoto($3.GetChildPhotoRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getChildPhoto, request, options: options); + } +} + +@$pb.GrpcServiceName('where_child_bus.v1.ChildPhotoService') +abstract class ChildPhotoServiceBase extends $grpc.Service { + $core.String get $name => 'where_child_bus.v1.ChildPhotoService'; + + ChildPhotoServiceBase() { + $addMethod($grpc.ServiceMethod<$3.DuplicationCheckRequest, $3.DuplicationCheckResponse>( + 'DuplicationCheck', + duplicationCheck_Pre, + false, + false, + ($core.List<$core.int> value) => $3.DuplicationCheckRequest.fromBuffer(value), + ($3.DuplicationCheckResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$3.DeleteChildPhotoRequest, $3.DeleteChildPhotoResponse>( + 'DeleteChildPhoto', + deleteChildPhoto_Pre, + false, + false, + ($core.List<$core.int> value) => $3.DeleteChildPhotoRequest.fromBuffer(value), + ($3.DeleteChildPhotoResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$3.GetChildPhotoRequest, $3.GetChildPhotoResponse>( + 'GetChildPhoto', + getChildPhoto_Pre, + false, + false, + ($core.List<$core.int> value) => $3.GetChildPhotoRequest.fromBuffer(value), + ($3.GetChildPhotoResponse value) => value.writeToBuffer())); + } + + $async.Future<$3.DuplicationCheckResponse> duplicationCheck_Pre($grpc.ServiceCall call, $async.Future<$3.DuplicationCheckRequest> request) async { + return duplicationCheck(call, await request); + } + + $async.Future<$3.DeleteChildPhotoResponse> deleteChildPhoto_Pre($grpc.ServiceCall call, $async.Future<$3.DeleteChildPhotoRequest> request) async { + return deleteChildPhoto(call, await request); + } + + $async.Future<$3.GetChildPhotoResponse> getChildPhoto_Pre($grpc.ServiceCall call, $async.Future<$3.GetChildPhotoRequest> request) async { + return getChildPhoto(call, await request); + } + + $async.Future<$3.DuplicationCheckResponse> duplicationCheck($grpc.ServiceCall call, $3.DuplicationCheckRequest request); + $async.Future<$3.DeleteChildPhotoResponse> deleteChildPhoto($grpc.ServiceCall call, $3.DeleteChildPhotoRequest request); + $async.Future<$3.GetChildPhotoResponse> getChildPhoto($grpc.ServiceCall call, $3.GetChildPhotoRequest request); +} diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child_photo.pbjson.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child_photo.pbjson.dart new file mode 100644 index 00000000..9cad8f79 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/child_photo.pbjson.dart @@ -0,0 +1,108 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/child_photo.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use duplicationCheckRequestDescriptor instead') +const DuplicationCheckRequest$json = { + '1': 'DuplicationCheckRequest', + '2': [ + {'1': 'child_ids', '3': 1, '4': 3, '5': 9, '10': 'childIds'}, + ], +}; + +/// Descriptor for `DuplicationCheckRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List duplicationCheckRequestDescriptor = $convert.base64Decode( + 'ChdEdXBsaWNhdGlvbkNoZWNrUmVxdWVzdBIbCgljaGlsZF9pZHMYASADKAlSCGNoaWxkSWRz'); + +@$core.Deprecated('Use duplicationCheckResponseDescriptor instead') +const DuplicationCheckResponse$json = { + '1': 'DuplicationCheckResponse', + '2': [ + {'1': 'is_duplicated', '3': 1, '4': 1, '5': 8, '10': 'isDuplicated'}, + {'1': 'photo_ids', '3': 2, '4': 3, '5': 9, '10': 'photoIds'}, + {'1': 'duplicated_photos', '3': 3, '4': 3, '5': 12, '10': 'duplicatedPhotos'}, + ], +}; + +/// Descriptor for `DuplicationCheckResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List duplicationCheckResponseDescriptor = $convert.base64Decode( + 'ChhEdXBsaWNhdGlvbkNoZWNrUmVzcG9uc2USIwoNaXNfZHVwbGljYXRlZBgBIAEoCFIMaXNEdX' + 'BsaWNhdGVkEhsKCXBob3RvX2lkcxgCIAMoCVIIcGhvdG9JZHMSKwoRZHVwbGljYXRlZF9waG90' + 'b3MYAyADKAxSEGR1cGxpY2F0ZWRQaG90b3M='); + +@$core.Deprecated('Use deleteChildPhotoRequestDescriptor instead') +const DeleteChildPhotoRequest$json = { + '1': 'DeleteChildPhotoRequest', + '2': [ + {'1': 'ids', '3': 1, '4': 3, '5': 9, '10': 'ids'}, + ], +}; + +/// Descriptor for `DeleteChildPhotoRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List deleteChildPhotoRequestDescriptor = $convert.base64Decode( + 'ChdEZWxldGVDaGlsZFBob3RvUmVxdWVzdBIQCgNpZHMYASADKAlSA2lkcw=='); + +@$core.Deprecated('Use deleteChildPhotoResponseDescriptor instead') +const DeleteChildPhotoResponse$json = { + '1': 'DeleteChildPhotoResponse', + '2': [ + {'1': 'is_success_list', '3': 1, '4': 3, '5': 8, '10': 'isSuccessList'}, + {'1': 'ids', '3': 2, '4': 3, '5': 9, '10': 'ids'}, + ], +}; + +/// Descriptor for `DeleteChildPhotoResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List deleteChildPhotoResponseDescriptor = $convert.base64Decode( + 'ChhEZWxldGVDaGlsZFBob3RvUmVzcG9uc2USJgoPaXNfc3VjY2Vzc19saXN0GAEgAygIUg1pc1' + 'N1Y2Nlc3NMaXN0EhAKA2lkcxgCIAMoCVIDaWRz'); + +@$core.Deprecated('Use getChildPhotoRequestDescriptor instead') +const GetChildPhotoRequest$json = { + '1': 'GetChildPhotoRequest', + '2': [ + {'1': 'child_id', '3': 1, '4': 1, '5': 9, '10': 'childId'}, + ], +}; + +/// Descriptor for `GetChildPhotoRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getChildPhotoRequestDescriptor = $convert.base64Decode( + 'ChRHZXRDaGlsZFBob3RvUmVxdWVzdBIZCghjaGlsZF9pZBgBIAEoCVIHY2hpbGRJZA=='); + +@$core.Deprecated('Use childPhotoResponseDescriptor instead') +const ChildPhotoResponse$json = { + '1': 'ChildPhotoResponse', + '2': [ + {'1': 'child_photo_id', '3': 1, '4': 1, '5': 9, '10': 'childPhotoId'}, + {'1': 'photo', '3': 2, '4': 1, '5': 12, '10': 'photo'}, + ], +}; + +/// Descriptor for `ChildPhotoResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List childPhotoResponseDescriptor = $convert.base64Decode( + 'ChJDaGlsZFBob3RvUmVzcG9uc2USJAoOY2hpbGRfcGhvdG9faWQYASABKAlSDGNoaWxkUGhvdG' + '9JZBIUCgVwaG90bxgCIAEoDFIFcGhvdG8='); + +@$core.Deprecated('Use getChildPhotoResponseDescriptor instead') +const GetChildPhotoResponse$json = { + '1': 'GetChildPhotoResponse', + '2': [ + {'1': 'child_photos', '3': 1, '4': 3, '5': 11, '6': '.where_child_bus.v1.ChildPhotoResponse', '10': 'childPhotos'}, + ], +}; + +/// Descriptor for `GetChildPhotoResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getChildPhotoResponseDescriptor = $convert.base64Decode( + 'ChVHZXRDaGlsZFBob3RvUmVzcG9uc2USSQoMY2hpbGRfcGhvdG9zGAEgAygLMiYud2hlcmVfY2' + 'hpbGRfYnVzLnYxLkNoaWxkUGhvdG9SZXNwb25zZVILY2hpbGRQaG90b3M='); + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/guardian.pb.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/guardian.pb.dart new file mode 100644 index 00000000..a3ceb10d --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/guardian.pb.dart @@ -0,0 +1,803 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/guardian.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +import '../../google/protobuf/field_mask.pb.dart' as $10; +import 'resources.pb.dart' as $9; + +class CreateGuardianRequest extends $pb.GeneratedMessage { + factory CreateGuardianRequest({ + $core.String? nurseryCode, + $core.String? email, + $core.String? password, + $core.String? name, + $core.String? phoneNumber, + }) { + final $result = create(); + if (nurseryCode != null) { + $result.nurseryCode = nurseryCode; + } + if (email != null) { + $result.email = email; + } + if (password != null) { + $result.password = password; + } + if (name != null) { + $result.name = name; + } + if (phoneNumber != null) { + $result.phoneNumber = phoneNumber; + } + return $result; + } + CreateGuardianRequest._() : super(); + factory CreateGuardianRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory CreateGuardianRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'CreateGuardianRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'nurseryCode') + ..aOS(2, _omitFieldNames ? '' : 'email') + ..aOS(3, _omitFieldNames ? '' : 'password') + ..aOS(4, _omitFieldNames ? '' : 'name') + ..aOS(5, _omitFieldNames ? '' : 'phoneNumber') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + CreateGuardianRequest clone() => CreateGuardianRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + CreateGuardianRequest copyWith(void Function(CreateGuardianRequest) updates) => super.copyWith((message) => updates(message as CreateGuardianRequest)) as CreateGuardianRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static CreateGuardianRequest create() => CreateGuardianRequest._(); + CreateGuardianRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static CreateGuardianRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CreateGuardianRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get nurseryCode => $_getSZ(0); + @$pb.TagNumber(1) + set nurseryCode($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasNurseryCode() => $_has(0); + @$pb.TagNumber(1) + void clearNurseryCode() => clearField(1); + + @$pb.TagNumber(2) + $core.String get email => $_getSZ(1); + @$pb.TagNumber(2) + set email($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasEmail() => $_has(1); + @$pb.TagNumber(2) + void clearEmail() => clearField(2); + + @$pb.TagNumber(3) + $core.String get password => $_getSZ(2); + @$pb.TagNumber(3) + set password($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasPassword() => $_has(2); + @$pb.TagNumber(3) + void clearPassword() => clearField(3); + + @$pb.TagNumber(4) + $core.String get name => $_getSZ(3); + @$pb.TagNumber(4) + set name($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasName() => $_has(3); + @$pb.TagNumber(4) + void clearName() => clearField(4); + + @$pb.TagNumber(5) + $core.String get phoneNumber => $_getSZ(4); + @$pb.TagNumber(5) + set phoneNumber($core.String v) { $_setString(4, v); } + @$pb.TagNumber(5) + $core.bool hasPhoneNumber() => $_has(4); + @$pb.TagNumber(5) + void clearPhoneNumber() => clearField(5); +} + +class CreateGuardianResponse extends $pb.GeneratedMessage { + factory CreateGuardianResponse({ + $9.GuardianResponse? guardian, + }) { + final $result = create(); + if (guardian != null) { + $result.guardian = guardian; + } + return $result; + } + CreateGuardianResponse._() : super(); + factory CreateGuardianResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory CreateGuardianResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'CreateGuardianResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.GuardianResponse>(1, _omitFieldNames ? '' : 'guardian', subBuilder: $9.GuardianResponse.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + CreateGuardianResponse clone() => CreateGuardianResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + CreateGuardianResponse copyWith(void Function(CreateGuardianResponse) updates) => super.copyWith((message) => updates(message as CreateGuardianResponse)) as CreateGuardianResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static CreateGuardianResponse create() => CreateGuardianResponse._(); + CreateGuardianResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static CreateGuardianResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CreateGuardianResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.GuardianResponse get guardian => $_getN(0); + @$pb.TagNumber(1) + set guardian($9.GuardianResponse v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasGuardian() => $_has(0); + @$pb.TagNumber(1) + void clearGuardian() => clearField(1); + @$pb.TagNumber(1) + $9.GuardianResponse ensureGuardian() => $_ensure(0); +} + +class GuardianLoginRequest extends $pb.GeneratedMessage { + factory GuardianLoginRequest({ + $core.String? email, + $core.String? password, + }) { + final $result = create(); + if (email != null) { + $result.email = email; + } + if (password != null) { + $result.password = password; + } + return $result; + } + GuardianLoginRequest._() : super(); + factory GuardianLoginRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GuardianLoginRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GuardianLoginRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'email') + ..aOS(2, _omitFieldNames ? '' : 'password') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GuardianLoginRequest clone() => GuardianLoginRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GuardianLoginRequest copyWith(void Function(GuardianLoginRequest) updates) => super.copyWith((message) => updates(message as GuardianLoginRequest)) as GuardianLoginRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GuardianLoginRequest create() => GuardianLoginRequest._(); + GuardianLoginRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GuardianLoginRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GuardianLoginRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get email => $_getSZ(0); + @$pb.TagNumber(1) + set email($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasEmail() => $_has(0); + @$pb.TagNumber(1) + void clearEmail() => clearField(1); + + @$pb.TagNumber(2) + $core.String get password => $_getSZ(1); + @$pb.TagNumber(2) + set password($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasPassword() => $_has(1); + @$pb.TagNumber(2) + void clearPassword() => clearField(2); +} + +class GuardianLoginResponse extends $pb.GeneratedMessage { + factory GuardianLoginResponse({ + $core.bool? success, + $9.GuardianResponse? guardian, + $9.NurseryResponse? nursery, + }) { + final $result = create(); + if (success != null) { + $result.success = success; + } + if (guardian != null) { + $result.guardian = guardian; + } + if (nursery != null) { + $result.nursery = nursery; + } + return $result; + } + GuardianLoginResponse._() : super(); + factory GuardianLoginResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GuardianLoginResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GuardianLoginResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOB(1, _omitFieldNames ? '' : 'success') + ..aOM<$9.GuardianResponse>(2, _omitFieldNames ? '' : 'guardian', subBuilder: $9.GuardianResponse.create) + ..aOM<$9.NurseryResponse>(3, _omitFieldNames ? '' : 'nursery', subBuilder: $9.NurseryResponse.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GuardianLoginResponse clone() => GuardianLoginResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GuardianLoginResponse copyWith(void Function(GuardianLoginResponse) updates) => super.copyWith((message) => updates(message as GuardianLoginResponse)) as GuardianLoginResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GuardianLoginResponse create() => GuardianLoginResponse._(); + GuardianLoginResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GuardianLoginResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GuardianLoginResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.bool get success => $_getBF(0); + @$pb.TagNumber(1) + set success($core.bool v) { $_setBool(0, v); } + @$pb.TagNumber(1) + $core.bool hasSuccess() => $_has(0); + @$pb.TagNumber(1) + void clearSuccess() => clearField(1); + + @$pb.TagNumber(2) + $9.GuardianResponse get guardian => $_getN(1); + @$pb.TagNumber(2) + set guardian($9.GuardianResponse v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasGuardian() => $_has(1); + @$pb.TagNumber(2) + void clearGuardian() => clearField(2); + @$pb.TagNumber(2) + $9.GuardianResponse ensureGuardian() => $_ensure(1); + + @$pb.TagNumber(3) + $9.NurseryResponse get nursery => $_getN(2); + @$pb.TagNumber(3) + set nursery($9.NurseryResponse v) { setField(3, v); } + @$pb.TagNumber(3) + $core.bool hasNursery() => $_has(2); + @$pb.TagNumber(3) + void clearNursery() => clearField(3); + @$pb.TagNumber(3) + $9.NurseryResponse ensureNursery() => $_ensure(2); +} + +class GetGuardianListByBusIdRequest extends $pb.GeneratedMessage { + factory GetGuardianListByBusIdRequest({ + $core.String? busId, + }) { + final $result = create(); + if (busId != null) { + $result.busId = busId; + } + return $result; + } + GetGuardianListByBusIdRequest._() : super(); + factory GetGuardianListByBusIdRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetGuardianListByBusIdRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetGuardianListByBusIdRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'busId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetGuardianListByBusIdRequest clone() => GetGuardianListByBusIdRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetGuardianListByBusIdRequest copyWith(void Function(GetGuardianListByBusIdRequest) updates) => super.copyWith((message) => updates(message as GetGuardianListByBusIdRequest)) as GetGuardianListByBusIdRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetGuardianListByBusIdRequest create() => GetGuardianListByBusIdRequest._(); + GetGuardianListByBusIdRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetGuardianListByBusIdRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetGuardianListByBusIdRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get busId => $_getSZ(0); + @$pb.TagNumber(1) + set busId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasBusId() => $_has(0); + @$pb.TagNumber(1) + void clearBusId() => clearField(1); +} + +class GetGuardianListByBusIdResponse extends $pb.GeneratedMessage { + factory GetGuardianListByBusIdResponse({ + $core.Iterable<$9.GuardianResponse>? guardians, + }) { + final $result = create(); + if (guardians != null) { + $result.guardians.addAll(guardians); + } + return $result; + } + GetGuardianListByBusIdResponse._() : super(); + factory GetGuardianListByBusIdResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetGuardianListByBusIdResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetGuardianListByBusIdResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..pc<$9.GuardianResponse>(1, _omitFieldNames ? '' : 'guardians', $pb.PbFieldType.PM, subBuilder: $9.GuardianResponse.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetGuardianListByBusIdResponse clone() => GetGuardianListByBusIdResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetGuardianListByBusIdResponse copyWith(void Function(GetGuardianListByBusIdResponse) updates) => super.copyWith((message) => updates(message as GetGuardianListByBusIdResponse)) as GetGuardianListByBusIdResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetGuardianListByBusIdResponse create() => GetGuardianListByBusIdResponse._(); + GetGuardianListByBusIdResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetGuardianListByBusIdResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetGuardianListByBusIdResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.List<$9.GuardianResponse> get guardians => $_getList(0); +} + +class GetGuardianByChildIdRequest extends $pb.GeneratedMessage { + factory GetGuardianByChildIdRequest({ + $core.String? childId, + }) { + final $result = create(); + if (childId != null) { + $result.childId = childId; + } + return $result; + } + GetGuardianByChildIdRequest._() : super(); + factory GetGuardianByChildIdRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetGuardianByChildIdRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetGuardianByChildIdRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'childId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetGuardianByChildIdRequest clone() => GetGuardianByChildIdRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetGuardianByChildIdRequest copyWith(void Function(GetGuardianByChildIdRequest) updates) => super.copyWith((message) => updates(message as GetGuardianByChildIdRequest)) as GetGuardianByChildIdRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetGuardianByChildIdRequest create() => GetGuardianByChildIdRequest._(); + GetGuardianByChildIdRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetGuardianByChildIdRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetGuardianByChildIdRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get childId => $_getSZ(0); + @$pb.TagNumber(1) + set childId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasChildId() => $_has(0); + @$pb.TagNumber(1) + void clearChildId() => clearField(1); +} + +class GetGuardianByChildIdResponse extends $pb.GeneratedMessage { + factory GetGuardianByChildIdResponse({ + $9.GuardianResponse? guardian, + }) { + final $result = create(); + if (guardian != null) { + $result.guardian = guardian; + } + return $result; + } + GetGuardianByChildIdResponse._() : super(); + factory GetGuardianByChildIdResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetGuardianByChildIdResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetGuardianByChildIdResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.GuardianResponse>(1, _omitFieldNames ? '' : 'guardian', subBuilder: $9.GuardianResponse.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetGuardianByChildIdResponse clone() => GetGuardianByChildIdResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetGuardianByChildIdResponse copyWith(void Function(GetGuardianByChildIdResponse) updates) => super.copyWith((message) => updates(message as GetGuardianByChildIdResponse)) as GetGuardianByChildIdResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetGuardianByChildIdResponse create() => GetGuardianByChildIdResponse._(); + GetGuardianByChildIdResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetGuardianByChildIdResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetGuardianByChildIdResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.GuardianResponse get guardian => $_getN(0); + @$pb.TagNumber(1) + set guardian($9.GuardianResponse v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasGuardian() => $_has(0); + @$pb.TagNumber(1) + void clearGuardian() => clearField(1); + @$pb.TagNumber(1) + $9.GuardianResponse ensureGuardian() => $_ensure(0); +} + +class GetGuardianListByNurseryIdRequest extends $pb.GeneratedMessage { + factory GetGuardianListByNurseryIdRequest({ + $core.String? nurseryId, + }) { + final $result = create(); + if (nurseryId != null) { + $result.nurseryId = nurseryId; + } + return $result; + } + GetGuardianListByNurseryIdRequest._() : super(); + factory GetGuardianListByNurseryIdRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetGuardianListByNurseryIdRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetGuardianListByNurseryIdRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'nurseryId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetGuardianListByNurseryIdRequest clone() => GetGuardianListByNurseryIdRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetGuardianListByNurseryIdRequest copyWith(void Function(GetGuardianListByNurseryIdRequest) updates) => super.copyWith((message) => updates(message as GetGuardianListByNurseryIdRequest)) as GetGuardianListByNurseryIdRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetGuardianListByNurseryIdRequest create() => GetGuardianListByNurseryIdRequest._(); + GetGuardianListByNurseryIdRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetGuardianListByNurseryIdRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetGuardianListByNurseryIdRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get nurseryId => $_getSZ(0); + @$pb.TagNumber(1) + set nurseryId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasNurseryId() => $_has(0); + @$pb.TagNumber(1) + void clearNurseryId() => clearField(1); +} + +class GetGuardianListByNurseryIdResponse extends $pb.GeneratedMessage { + factory GetGuardianListByNurseryIdResponse({ + $core.Iterable<$9.GuardianResponse>? guardians, + }) { + final $result = create(); + if (guardians != null) { + $result.guardians.addAll(guardians); + } + return $result; + } + GetGuardianListByNurseryIdResponse._() : super(); + factory GetGuardianListByNurseryIdResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetGuardianListByNurseryIdResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetGuardianListByNurseryIdResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..pc<$9.GuardianResponse>(1, _omitFieldNames ? '' : 'guardians', $pb.PbFieldType.PM, subBuilder: $9.GuardianResponse.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetGuardianListByNurseryIdResponse clone() => GetGuardianListByNurseryIdResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetGuardianListByNurseryIdResponse copyWith(void Function(GetGuardianListByNurseryIdResponse) updates) => super.copyWith((message) => updates(message as GetGuardianListByNurseryIdResponse)) as GetGuardianListByNurseryIdResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetGuardianListByNurseryIdResponse create() => GetGuardianListByNurseryIdResponse._(); + GetGuardianListByNurseryIdResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetGuardianListByNurseryIdResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetGuardianListByNurseryIdResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.List<$9.GuardianResponse> get guardians => $_getList(0); +} + +class UpdateGuardianRequest extends $pb.GeneratedMessage { + factory UpdateGuardianRequest({ + $core.String? guardianId, + $core.String? name, + $core.String? email, + $core.String? phoneNumber, + $core.bool? isUseMorningBus, + $core.bool? isUseEveningBus, + $10.FieldMask? updateMask, + }) { + final $result = create(); + if (guardianId != null) { + $result.guardianId = guardianId; + } + if (name != null) { + $result.name = name; + } + if (email != null) { + $result.email = email; + } + if (phoneNumber != null) { + $result.phoneNumber = phoneNumber; + } + if (isUseMorningBus != null) { + $result.isUseMorningBus = isUseMorningBus; + } + if (isUseEveningBus != null) { + $result.isUseEveningBus = isUseEveningBus; + } + if (updateMask != null) { + $result.updateMask = updateMask; + } + return $result; + } + UpdateGuardianRequest._() : super(); + factory UpdateGuardianRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory UpdateGuardianRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'UpdateGuardianRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'guardianId') + ..aOS(2, _omitFieldNames ? '' : 'name') + ..aOS(3, _omitFieldNames ? '' : 'email') + ..aOS(4, _omitFieldNames ? '' : 'phoneNumber') + ..aOB(5, _omitFieldNames ? '' : 'isUseMorningBus') + ..aOB(6, _omitFieldNames ? '' : 'isUseEveningBus') + ..aOM<$10.FieldMask>(11, _omitFieldNames ? '' : 'updateMask', subBuilder: $10.FieldMask.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + UpdateGuardianRequest clone() => UpdateGuardianRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + UpdateGuardianRequest copyWith(void Function(UpdateGuardianRequest) updates) => super.copyWith((message) => updates(message as UpdateGuardianRequest)) as UpdateGuardianRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static UpdateGuardianRequest create() => UpdateGuardianRequest._(); + UpdateGuardianRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static UpdateGuardianRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static UpdateGuardianRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get guardianId => $_getSZ(0); + @$pb.TagNumber(1) + set guardianId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGuardianId() => $_has(0); + @$pb.TagNumber(1) + void clearGuardianId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get name => $_getSZ(1); + @$pb.TagNumber(2) + set name($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasName() => $_has(1); + @$pb.TagNumber(2) + void clearName() => clearField(2); + + @$pb.TagNumber(3) + $core.String get email => $_getSZ(2); + @$pb.TagNumber(3) + set email($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasEmail() => $_has(2); + @$pb.TagNumber(3) + void clearEmail() => clearField(3); + + @$pb.TagNumber(4) + $core.String get phoneNumber => $_getSZ(3); + @$pb.TagNumber(4) + set phoneNumber($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasPhoneNumber() => $_has(3); + @$pb.TagNumber(4) + void clearPhoneNumber() => clearField(4); + + @$pb.TagNumber(5) + $core.bool get isUseMorningBus => $_getBF(4); + @$pb.TagNumber(5) + set isUseMorningBus($core.bool v) { $_setBool(4, v); } + @$pb.TagNumber(5) + $core.bool hasIsUseMorningBus() => $_has(4); + @$pb.TagNumber(5) + void clearIsUseMorningBus() => clearField(5); + + @$pb.TagNumber(6) + $core.bool get isUseEveningBus => $_getBF(5); + @$pb.TagNumber(6) + set isUseEveningBus($core.bool v) { $_setBool(5, v); } + @$pb.TagNumber(6) + $core.bool hasIsUseEveningBus() => $_has(5); + @$pb.TagNumber(6) + void clearIsUseEveningBus() => clearField(6); + + @$pb.TagNumber(11) + $10.FieldMask get updateMask => $_getN(6); + @$pb.TagNumber(11) + set updateMask($10.FieldMask v) { setField(11, v); } + @$pb.TagNumber(11) + $core.bool hasUpdateMask() => $_has(6); + @$pb.TagNumber(11) + void clearUpdateMask() => clearField(11); + @$pb.TagNumber(11) + $10.FieldMask ensureUpdateMask() => $_ensure(6); +} + +class UpdateGuardianResponse extends $pb.GeneratedMessage { + factory UpdateGuardianResponse({ + $9.GuardianResponse? guardian, + }) { + final $result = create(); + if (guardian != null) { + $result.guardian = guardian; + } + return $result; + } + UpdateGuardianResponse._() : super(); + factory UpdateGuardianResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory UpdateGuardianResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'UpdateGuardianResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.GuardianResponse>(1, _omitFieldNames ? '' : 'guardian', subBuilder: $9.GuardianResponse.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + UpdateGuardianResponse clone() => UpdateGuardianResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + UpdateGuardianResponse copyWith(void Function(UpdateGuardianResponse) updates) => super.copyWith((message) => updates(message as UpdateGuardianResponse)) as UpdateGuardianResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static UpdateGuardianResponse create() => UpdateGuardianResponse._(); + UpdateGuardianResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static UpdateGuardianResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static UpdateGuardianResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.GuardianResponse get guardian => $_getN(0); + @$pb.TagNumber(1) + set guardian($9.GuardianResponse v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasGuardian() => $_has(0); + @$pb.TagNumber(1) + void clearGuardian() => clearField(1); + @$pb.TagNumber(1) + $9.GuardianResponse ensureGuardian() => $_ensure(0); +} + + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/guardian.pbenum.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/guardian.pbenum.dart new file mode 100644 index 00000000..6f3a02a7 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/guardian.pbenum.dart @@ -0,0 +1,11 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/guardian.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/guardian.pbgrpc.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/guardian.pbgrpc.dart new file mode 100644 index 00000000..cb8f41b3 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/guardian.pbgrpc.dart @@ -0,0 +1,159 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/guardian.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:async' as $async; +import 'dart:core' as $core; + +import 'package:grpc/service_api.dart' as $grpc; +import 'package:protobuf/protobuf.dart' as $pb; + +import 'guardian.pb.dart' as $4; + +export 'guardian.pb.dart'; + +@$pb.GrpcServiceName('where_child_bus.v1.GuardianService') +class GuardianServiceClient extends $grpc.Client { + static final _$createGuardian = $grpc.ClientMethod<$4.CreateGuardianRequest, $4.CreateGuardianResponse>( + '/where_child_bus.v1.GuardianService/CreateGuardian', + ($4.CreateGuardianRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $4.CreateGuardianResponse.fromBuffer(value)); + static final _$guardianLogin = $grpc.ClientMethod<$4.GuardianLoginRequest, $4.GuardianLoginResponse>( + '/where_child_bus.v1.GuardianService/GuardianLogin', + ($4.GuardianLoginRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $4.GuardianLoginResponse.fromBuffer(value)); + static final _$getGuardianListByBusId = $grpc.ClientMethod<$4.GetGuardianListByBusIdRequest, $4.GetGuardianListByBusIdResponse>( + '/where_child_bus.v1.GuardianService/GetGuardianListByBusId', + ($4.GetGuardianListByBusIdRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $4.GetGuardianListByBusIdResponse.fromBuffer(value)); + static final _$getGuardianByChildId = $grpc.ClientMethod<$4.GetGuardianByChildIdRequest, $4.GetGuardianByChildIdResponse>( + '/where_child_bus.v1.GuardianService/GetGuardianByChildId', + ($4.GetGuardianByChildIdRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $4.GetGuardianByChildIdResponse.fromBuffer(value)); + static final _$getGuardianListByNurseryId = $grpc.ClientMethod<$4.GetGuardianListByNurseryIdRequest, $4.GetGuardianListByNurseryIdResponse>( + '/where_child_bus.v1.GuardianService/GetGuardianListByNurseryId', + ($4.GetGuardianListByNurseryIdRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $4.GetGuardianListByNurseryIdResponse.fromBuffer(value)); + static final _$updateGuardian = $grpc.ClientMethod<$4.UpdateGuardianRequest, $4.UpdateGuardianResponse>( + '/where_child_bus.v1.GuardianService/UpdateGuardian', + ($4.UpdateGuardianRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $4.UpdateGuardianResponse.fromBuffer(value)); + + GuardianServiceClient($grpc.ClientChannel channel, + {$grpc.CallOptions? options, + $core.Iterable<$grpc.ClientInterceptor>? interceptors}) + : super(channel, options: options, + interceptors: interceptors); + + $grpc.ResponseFuture<$4.CreateGuardianResponse> createGuardian($4.CreateGuardianRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$createGuardian, request, options: options); + } + + $grpc.ResponseFuture<$4.GuardianLoginResponse> guardianLogin($4.GuardianLoginRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$guardianLogin, request, options: options); + } + + $grpc.ResponseFuture<$4.GetGuardianListByBusIdResponse> getGuardianListByBusId($4.GetGuardianListByBusIdRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getGuardianListByBusId, request, options: options); + } + + $grpc.ResponseFuture<$4.GetGuardianByChildIdResponse> getGuardianByChildId($4.GetGuardianByChildIdRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getGuardianByChildId, request, options: options); + } + + $grpc.ResponseFuture<$4.GetGuardianListByNurseryIdResponse> getGuardianListByNurseryId($4.GetGuardianListByNurseryIdRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getGuardianListByNurseryId, request, options: options); + } + + $grpc.ResponseFuture<$4.UpdateGuardianResponse> updateGuardian($4.UpdateGuardianRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$updateGuardian, request, options: options); + } +} + +@$pb.GrpcServiceName('where_child_bus.v1.GuardianService') +abstract class GuardianServiceBase extends $grpc.Service { + $core.String get $name => 'where_child_bus.v1.GuardianService'; + + GuardianServiceBase() { + $addMethod($grpc.ServiceMethod<$4.CreateGuardianRequest, $4.CreateGuardianResponse>( + 'CreateGuardian', + createGuardian_Pre, + false, + false, + ($core.List<$core.int> value) => $4.CreateGuardianRequest.fromBuffer(value), + ($4.CreateGuardianResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$4.GuardianLoginRequest, $4.GuardianLoginResponse>( + 'GuardianLogin', + guardianLogin_Pre, + false, + false, + ($core.List<$core.int> value) => $4.GuardianLoginRequest.fromBuffer(value), + ($4.GuardianLoginResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$4.GetGuardianListByBusIdRequest, $4.GetGuardianListByBusIdResponse>( + 'GetGuardianListByBusId', + getGuardianListByBusId_Pre, + false, + false, + ($core.List<$core.int> value) => $4.GetGuardianListByBusIdRequest.fromBuffer(value), + ($4.GetGuardianListByBusIdResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$4.GetGuardianByChildIdRequest, $4.GetGuardianByChildIdResponse>( + 'GetGuardianByChildId', + getGuardianByChildId_Pre, + false, + false, + ($core.List<$core.int> value) => $4.GetGuardianByChildIdRequest.fromBuffer(value), + ($4.GetGuardianByChildIdResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$4.GetGuardianListByNurseryIdRequest, $4.GetGuardianListByNurseryIdResponse>( + 'GetGuardianListByNurseryId', + getGuardianListByNurseryId_Pre, + false, + false, + ($core.List<$core.int> value) => $4.GetGuardianListByNurseryIdRequest.fromBuffer(value), + ($4.GetGuardianListByNurseryIdResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$4.UpdateGuardianRequest, $4.UpdateGuardianResponse>( + 'UpdateGuardian', + updateGuardian_Pre, + false, + false, + ($core.List<$core.int> value) => $4.UpdateGuardianRequest.fromBuffer(value), + ($4.UpdateGuardianResponse value) => value.writeToBuffer())); + } + + $async.Future<$4.CreateGuardianResponse> createGuardian_Pre($grpc.ServiceCall call, $async.Future<$4.CreateGuardianRequest> request) async { + return createGuardian(call, await request); + } + + $async.Future<$4.GuardianLoginResponse> guardianLogin_Pre($grpc.ServiceCall call, $async.Future<$4.GuardianLoginRequest> request) async { + return guardianLogin(call, await request); + } + + $async.Future<$4.GetGuardianListByBusIdResponse> getGuardianListByBusId_Pre($grpc.ServiceCall call, $async.Future<$4.GetGuardianListByBusIdRequest> request) async { + return getGuardianListByBusId(call, await request); + } + + $async.Future<$4.GetGuardianByChildIdResponse> getGuardianByChildId_Pre($grpc.ServiceCall call, $async.Future<$4.GetGuardianByChildIdRequest> request) async { + return getGuardianByChildId(call, await request); + } + + $async.Future<$4.GetGuardianListByNurseryIdResponse> getGuardianListByNurseryId_Pre($grpc.ServiceCall call, $async.Future<$4.GetGuardianListByNurseryIdRequest> request) async { + return getGuardianListByNurseryId(call, await request); + } + + $async.Future<$4.UpdateGuardianResponse> updateGuardian_Pre($grpc.ServiceCall call, $async.Future<$4.UpdateGuardianRequest> request) async { + return updateGuardian(call, await request); + } + + $async.Future<$4.CreateGuardianResponse> createGuardian($grpc.ServiceCall call, $4.CreateGuardianRequest request); + $async.Future<$4.GuardianLoginResponse> guardianLogin($grpc.ServiceCall call, $4.GuardianLoginRequest request); + $async.Future<$4.GetGuardianListByBusIdResponse> getGuardianListByBusId($grpc.ServiceCall call, $4.GetGuardianListByBusIdRequest request); + $async.Future<$4.GetGuardianByChildIdResponse> getGuardianByChildId($grpc.ServiceCall call, $4.GetGuardianByChildIdRequest request); + $async.Future<$4.GetGuardianListByNurseryIdResponse> getGuardianListByNurseryId($grpc.ServiceCall call, $4.GetGuardianListByNurseryIdRequest request); + $async.Future<$4.UpdateGuardianResponse> updateGuardian($grpc.ServiceCall call, $4.UpdateGuardianRequest request); +} diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/guardian.pbjson.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/guardian.pbjson.dart new file mode 100644 index 00000000..7a56eb62 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/guardian.pbjson.dart @@ -0,0 +1,190 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/guardian.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use createGuardianRequestDescriptor instead') +const CreateGuardianRequest$json = { + '1': 'CreateGuardianRequest', + '2': [ + {'1': 'nursery_code', '3': 1, '4': 1, '5': 9, '10': 'nurseryCode'}, + {'1': 'email', '3': 2, '4': 1, '5': 9, '10': 'email'}, + {'1': 'password', '3': 3, '4': 1, '5': 9, '10': 'password'}, + {'1': 'name', '3': 4, '4': 1, '5': 9, '10': 'name'}, + {'1': 'phone_number', '3': 5, '4': 1, '5': 9, '10': 'phoneNumber'}, + ], +}; + +/// Descriptor for `CreateGuardianRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List createGuardianRequestDescriptor = $convert.base64Decode( + 'ChVDcmVhdGVHdWFyZGlhblJlcXVlc3QSIQoMbnVyc2VyeV9jb2RlGAEgASgJUgtudXJzZXJ5Q2' + '9kZRIUCgVlbWFpbBgCIAEoCVIFZW1haWwSGgoIcGFzc3dvcmQYAyABKAlSCHBhc3N3b3JkEhIK' + 'BG5hbWUYBCABKAlSBG5hbWUSIQoMcGhvbmVfbnVtYmVyGAUgASgJUgtwaG9uZU51bWJlcg=='); + +@$core.Deprecated('Use createGuardianResponseDescriptor instead') +const CreateGuardianResponse$json = { + '1': 'CreateGuardianResponse', + '2': [ + {'1': 'guardian', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.GuardianResponse', '10': 'guardian'}, + ], +}; + +/// Descriptor for `CreateGuardianResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List createGuardianResponseDescriptor = $convert.base64Decode( + 'ChZDcmVhdGVHdWFyZGlhblJlc3BvbnNlEkAKCGd1YXJkaWFuGAEgASgLMiQud2hlcmVfY2hpbG' + 'RfYnVzLnYxLkd1YXJkaWFuUmVzcG9uc2VSCGd1YXJkaWFu'); + +@$core.Deprecated('Use guardianLoginRequestDescriptor instead') +const GuardianLoginRequest$json = { + '1': 'GuardianLoginRequest', + '2': [ + {'1': 'email', '3': 1, '4': 1, '5': 9, '10': 'email'}, + {'1': 'password', '3': 2, '4': 1, '5': 9, '10': 'password'}, + ], +}; + +/// Descriptor for `GuardianLoginRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List guardianLoginRequestDescriptor = $convert.base64Decode( + 'ChRHdWFyZGlhbkxvZ2luUmVxdWVzdBIUCgVlbWFpbBgBIAEoCVIFZW1haWwSGgoIcGFzc3dvcm' + 'QYAiABKAlSCHBhc3N3b3Jk'); + +@$core.Deprecated('Use guardianLoginResponseDescriptor instead') +const GuardianLoginResponse$json = { + '1': 'GuardianLoginResponse', + '2': [ + {'1': 'success', '3': 1, '4': 1, '5': 8, '10': 'success'}, + {'1': 'guardian', '3': 2, '4': 1, '5': 11, '6': '.where_child_bus.v1.GuardianResponse', '10': 'guardian'}, + {'1': 'nursery', '3': 3, '4': 1, '5': 11, '6': '.where_child_bus.v1.NurseryResponse', '10': 'nursery'}, + ], +}; + +/// Descriptor for `GuardianLoginResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List guardianLoginResponseDescriptor = $convert.base64Decode( + 'ChVHdWFyZGlhbkxvZ2luUmVzcG9uc2USGAoHc3VjY2VzcxgBIAEoCFIHc3VjY2VzcxJACghndW' + 'FyZGlhbhgCIAEoCzIkLndoZXJlX2NoaWxkX2J1cy52MS5HdWFyZGlhblJlc3BvbnNlUghndWFy' + 'ZGlhbhI9CgdudXJzZXJ5GAMgASgLMiMud2hlcmVfY2hpbGRfYnVzLnYxLk51cnNlcnlSZXNwb2' + '5zZVIHbnVyc2VyeQ=='); + +@$core.Deprecated('Use getGuardianListByBusIdRequestDescriptor instead') +const GetGuardianListByBusIdRequest$json = { + '1': 'GetGuardianListByBusIdRequest', + '2': [ + {'1': 'bus_id', '3': 1, '4': 1, '5': 9, '10': 'busId'}, + ], +}; + +/// Descriptor for `GetGuardianListByBusIdRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getGuardianListByBusIdRequestDescriptor = $convert.base64Decode( + 'Ch1HZXRHdWFyZGlhbkxpc3RCeUJ1c0lkUmVxdWVzdBIVCgZidXNfaWQYASABKAlSBWJ1c0lk'); + +@$core.Deprecated('Use getGuardianListByBusIdResponseDescriptor instead') +const GetGuardianListByBusIdResponse$json = { + '1': 'GetGuardianListByBusIdResponse', + '2': [ + {'1': 'guardians', '3': 1, '4': 3, '5': 11, '6': '.where_child_bus.v1.GuardianResponse', '10': 'guardians'}, + ], +}; + +/// Descriptor for `GetGuardianListByBusIdResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getGuardianListByBusIdResponseDescriptor = $convert.base64Decode( + 'Ch5HZXRHdWFyZGlhbkxpc3RCeUJ1c0lkUmVzcG9uc2USQgoJZ3VhcmRpYW5zGAEgAygLMiQud2' + 'hlcmVfY2hpbGRfYnVzLnYxLkd1YXJkaWFuUmVzcG9uc2VSCWd1YXJkaWFucw=='); + +@$core.Deprecated('Use getGuardianByChildIdRequestDescriptor instead') +const GetGuardianByChildIdRequest$json = { + '1': 'GetGuardianByChildIdRequest', + '2': [ + {'1': 'child_id', '3': 1, '4': 1, '5': 9, '10': 'childId'}, + ], +}; + +/// Descriptor for `GetGuardianByChildIdRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getGuardianByChildIdRequestDescriptor = $convert.base64Decode( + 'ChtHZXRHdWFyZGlhbkJ5Q2hpbGRJZFJlcXVlc3QSGQoIY2hpbGRfaWQYASABKAlSB2NoaWxkSW' + 'Q='); + +@$core.Deprecated('Use getGuardianByChildIdResponseDescriptor instead') +const GetGuardianByChildIdResponse$json = { + '1': 'GetGuardianByChildIdResponse', + '2': [ + {'1': 'guardian', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.GuardianResponse', '10': 'guardian'}, + ], +}; + +/// Descriptor for `GetGuardianByChildIdResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getGuardianByChildIdResponseDescriptor = $convert.base64Decode( + 'ChxHZXRHdWFyZGlhbkJ5Q2hpbGRJZFJlc3BvbnNlEkAKCGd1YXJkaWFuGAEgASgLMiQud2hlcm' + 'VfY2hpbGRfYnVzLnYxLkd1YXJkaWFuUmVzcG9uc2VSCGd1YXJkaWFu'); + +@$core.Deprecated('Use getGuardianListByNurseryIdRequestDescriptor instead') +const GetGuardianListByNurseryIdRequest$json = { + '1': 'GetGuardianListByNurseryIdRequest', + '2': [ + {'1': 'nursery_id', '3': 1, '4': 1, '5': 9, '10': 'nurseryId'}, + ], +}; + +/// Descriptor for `GetGuardianListByNurseryIdRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getGuardianListByNurseryIdRequestDescriptor = $convert.base64Decode( + 'CiFHZXRHdWFyZGlhbkxpc3RCeU51cnNlcnlJZFJlcXVlc3QSHQoKbnVyc2VyeV9pZBgBIAEoCV' + 'IJbnVyc2VyeUlk'); + +@$core.Deprecated('Use getGuardianListByNurseryIdResponseDescriptor instead') +const GetGuardianListByNurseryIdResponse$json = { + '1': 'GetGuardianListByNurseryIdResponse', + '2': [ + {'1': 'guardians', '3': 1, '4': 3, '5': 11, '6': '.where_child_bus.v1.GuardianResponse', '10': 'guardians'}, + ], +}; + +/// Descriptor for `GetGuardianListByNurseryIdResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getGuardianListByNurseryIdResponseDescriptor = $convert.base64Decode( + 'CiJHZXRHdWFyZGlhbkxpc3RCeU51cnNlcnlJZFJlc3BvbnNlEkIKCWd1YXJkaWFucxgBIAMoCz' + 'IkLndoZXJlX2NoaWxkX2J1cy52MS5HdWFyZGlhblJlc3BvbnNlUglndWFyZGlhbnM='); + +@$core.Deprecated('Use updateGuardianRequestDescriptor instead') +const UpdateGuardianRequest$json = { + '1': 'UpdateGuardianRequest', + '2': [ + {'1': 'guardian_id', '3': 1, '4': 1, '5': 9, '10': 'guardianId'}, + {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'}, + {'1': 'email', '3': 3, '4': 1, '5': 9, '10': 'email'}, + {'1': 'phone_number', '3': 4, '4': 1, '5': 9, '10': 'phoneNumber'}, + {'1': 'is_use_morning_bus', '3': 5, '4': 1, '5': 8, '10': 'isUseMorningBus'}, + {'1': 'is_use_evening_bus', '3': 6, '4': 1, '5': 8, '10': 'isUseEveningBus'}, + {'1': 'update_mask', '3': 11, '4': 1, '5': 11, '6': '.google.protobuf.FieldMask', '10': 'updateMask'}, + ], +}; + +/// Descriptor for `UpdateGuardianRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List updateGuardianRequestDescriptor = $convert.base64Decode( + 'ChVVcGRhdGVHdWFyZGlhblJlcXVlc3QSHwoLZ3VhcmRpYW5faWQYASABKAlSCmd1YXJkaWFuSW' + 'QSEgoEbmFtZRgCIAEoCVIEbmFtZRIUCgVlbWFpbBgDIAEoCVIFZW1haWwSIQoMcGhvbmVfbnVt' + 'YmVyGAQgASgJUgtwaG9uZU51bWJlchIrChJpc191c2VfbW9ybmluZ19idXMYBSABKAhSD2lzVX' + 'NlTW9ybmluZ0J1cxIrChJpc191c2VfZXZlbmluZ19idXMYBiABKAhSD2lzVXNlRXZlbmluZ0J1' + 'cxI7Cgt1cGRhdGVfbWFzaxgLIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2tSCnVwZG' + 'F0ZU1hc2s='); + +@$core.Deprecated('Use updateGuardianResponseDescriptor instead') +const UpdateGuardianResponse$json = { + '1': 'UpdateGuardianResponse', + '2': [ + {'1': 'guardian', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.GuardianResponse', '10': 'guardian'}, + ], +}; + +/// Descriptor for `UpdateGuardianResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List updateGuardianResponseDescriptor = $convert.base64Decode( + 'ChZVcGRhdGVHdWFyZGlhblJlc3BvbnNlEkAKCGd1YXJkaWFuGAEgASgLMiQud2hlcmVfY2hpbG' + 'RfYnVzLnYxLkd1YXJkaWFuUmVzcG9uc2VSCGd1YXJkaWFu'); + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/health_check.pb.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/health_check.pb.dart new file mode 100644 index 00000000..dcbde2f5 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/health_check.pb.dart @@ -0,0 +1,118 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/health_check.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +class PingRequest extends $pb.GeneratedMessage { + factory PingRequest({ + $core.String? name, + }) { + final $result = create(); + if (name != null) { + $result.name = name; + } + return $result; + } + PingRequest._() : super(); + factory PingRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory PingRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'PingRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'name') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + PingRequest clone() => PingRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + PingRequest copyWith(void Function(PingRequest) updates) => super.copyWith((message) => updates(message as PingRequest)) as PingRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static PingRequest create() => PingRequest._(); + PingRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static PingRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static PingRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get name => $_getSZ(0); + @$pb.TagNumber(1) + set name($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasName() => $_has(0); + @$pb.TagNumber(1) + void clearName() => clearField(1); +} + +class PingResponse extends $pb.GeneratedMessage { + factory PingResponse({ + $core.String? message, + }) { + final $result = create(); + if (message != null) { + $result.message = message; + } + return $result; + } + PingResponse._() : super(); + factory PingResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory PingResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'PingResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'message') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + PingResponse clone() => PingResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + PingResponse copyWith(void Function(PingResponse) updates) => super.copyWith((message) => updates(message as PingResponse)) as PingResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static PingResponse create() => PingResponse._(); + PingResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static PingResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static PingResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get message => $_getSZ(0); + @$pb.TagNumber(1) + set message($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasMessage() => $_has(0); + @$pb.TagNumber(1) + void clearMessage() => clearField(1); +} + + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/health_check.pbenum.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/health_check.pbenum.dart new file mode 100644 index 00000000..c9450c86 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/health_check.pbenum.dart @@ -0,0 +1,11 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/health_check.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/health_check.pbgrpc.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/health_check.pbgrpc.dart new file mode 100644 index 00000000..88562fd4 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/health_check.pbgrpc.dart @@ -0,0 +1,59 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/health_check.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:async' as $async; +import 'dart:core' as $core; + +import 'package:grpc/service_api.dart' as $grpc; +import 'package:protobuf/protobuf.dart' as $pb; + +import 'health_check.pb.dart' as $5; + +export 'health_check.pb.dart'; + +@$pb.GrpcServiceName('where_child_bus.v1.HealthcheckService') +class HealthcheckServiceClient extends $grpc.Client { + static final _$ping = $grpc.ClientMethod<$5.PingRequest, $5.PingResponse>( + '/where_child_bus.v1.HealthcheckService/Ping', + ($5.PingRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $5.PingResponse.fromBuffer(value)); + + HealthcheckServiceClient($grpc.ClientChannel channel, + {$grpc.CallOptions? options, + $core.Iterable<$grpc.ClientInterceptor>? interceptors}) + : super(channel, options: options, + interceptors: interceptors); + + $grpc.ResponseFuture<$5.PingResponse> ping($5.PingRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$ping, request, options: options); + } +} + +@$pb.GrpcServiceName('where_child_bus.v1.HealthcheckService') +abstract class HealthcheckServiceBase extends $grpc.Service { + $core.String get $name => 'where_child_bus.v1.HealthcheckService'; + + HealthcheckServiceBase() { + $addMethod($grpc.ServiceMethod<$5.PingRequest, $5.PingResponse>( + 'Ping', + ping_Pre, + false, + false, + ($core.List<$core.int> value) => $5.PingRequest.fromBuffer(value), + ($5.PingResponse value) => value.writeToBuffer())); + } + + $async.Future<$5.PingResponse> ping_Pre($grpc.ServiceCall call, $async.Future<$5.PingRequest> request) async { + return ping(call, await request); + } + + $async.Future<$5.PingResponse> ping($grpc.ServiceCall call, $5.PingRequest request); +} diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/health_check.pbjson.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/health_check.pbjson.dart new file mode 100644 index 00000000..201d4755 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/health_check.pbjson.dart @@ -0,0 +1,39 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/health_check.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use pingRequestDescriptor instead') +const PingRequest$json = { + '1': 'PingRequest', + '2': [ + {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'}, + ], +}; + +/// Descriptor for `PingRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List pingRequestDescriptor = $convert.base64Decode( + 'CgtQaW5nUmVxdWVzdBISCgRuYW1lGAEgASgJUgRuYW1l'); + +@$core.Deprecated('Use pingResponseDescriptor instead') +const PingResponse$json = { + '1': 'PingResponse', + '2': [ + {'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'}, + ], +}; + +/// Descriptor for `PingResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List pingResponseDescriptor = $convert.base64Decode( + 'CgxQaW5nUmVzcG9uc2USGAoHbWVzc2FnZRgBIAEoCVIHbWVzc2FnZQ=='); + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/nursery.pb.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/nursery.pb.dart new file mode 100644 index 00000000..36ceaba8 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/nursery.pb.dart @@ -0,0 +1,599 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/nursery.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +import '../../google/protobuf/field_mask.pb.dart' as $10; +import 'resources.pb.dart' as $9; + +class GetNurseryByGuardianIdRequest extends $pb.GeneratedMessage { + factory GetNurseryByGuardianIdRequest({ + $core.String? guardianId, + }) { + final $result = create(); + if (guardianId != null) { + $result.guardianId = guardianId; + } + return $result; + } + GetNurseryByGuardianIdRequest._() : super(); + factory GetNurseryByGuardianIdRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetNurseryByGuardianIdRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetNurseryByGuardianIdRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'guardianId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetNurseryByGuardianIdRequest clone() => GetNurseryByGuardianIdRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetNurseryByGuardianIdRequest copyWith(void Function(GetNurseryByGuardianIdRequest) updates) => super.copyWith((message) => updates(message as GetNurseryByGuardianIdRequest)) as GetNurseryByGuardianIdRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetNurseryByGuardianIdRequest create() => GetNurseryByGuardianIdRequest._(); + GetNurseryByGuardianIdRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetNurseryByGuardianIdRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetNurseryByGuardianIdRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get guardianId => $_getSZ(0); + @$pb.TagNumber(1) + set guardianId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGuardianId() => $_has(0); + @$pb.TagNumber(1) + void clearGuardianId() => clearField(1); +} + +class GetNurseryByGuardianIdResponse extends $pb.GeneratedMessage { + factory GetNurseryByGuardianIdResponse({ + $9.NurseryResponse? nurseries, + }) { + final $result = create(); + if (nurseries != null) { + $result.nurseries = nurseries; + } + return $result; + } + GetNurseryByGuardianIdResponse._() : super(); + factory GetNurseryByGuardianIdResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetNurseryByGuardianIdResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetNurseryByGuardianIdResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.NurseryResponse>(1, _omitFieldNames ? '' : 'nurseries', subBuilder: $9.NurseryResponse.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetNurseryByGuardianIdResponse clone() => GetNurseryByGuardianIdResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetNurseryByGuardianIdResponse copyWith(void Function(GetNurseryByGuardianIdResponse) updates) => super.copyWith((message) => updates(message as GetNurseryByGuardianIdResponse)) as GetNurseryByGuardianIdResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetNurseryByGuardianIdResponse create() => GetNurseryByGuardianIdResponse._(); + GetNurseryByGuardianIdResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetNurseryByGuardianIdResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetNurseryByGuardianIdResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.NurseryResponse get nurseries => $_getN(0); + @$pb.TagNumber(1) + set nurseries($9.NurseryResponse v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasNurseries() => $_has(0); + @$pb.TagNumber(1) + void clearNurseries() => clearField(1); + @$pb.TagNumber(1) + $9.NurseryResponse ensureNurseries() => $_ensure(0); +} + +class CreateNurseryRequest extends $pb.GeneratedMessage { + factory CreateNurseryRequest({ + $core.String? email, + $core.String? password, + $core.String? name, + $core.String? phoneNumber, + $core.String? address, + }) { + final $result = create(); + if (email != null) { + $result.email = email; + } + if (password != null) { + $result.password = password; + } + if (name != null) { + $result.name = name; + } + if (phoneNumber != null) { + $result.phoneNumber = phoneNumber; + } + if (address != null) { + $result.address = address; + } + return $result; + } + CreateNurseryRequest._() : super(); + factory CreateNurseryRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory CreateNurseryRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'CreateNurseryRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'email') + ..aOS(2, _omitFieldNames ? '' : 'password') + ..aOS(3, _omitFieldNames ? '' : 'name') + ..aOS(4, _omitFieldNames ? '' : 'phoneNumber') + ..aOS(5, _omitFieldNames ? '' : 'address') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + CreateNurseryRequest clone() => CreateNurseryRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + CreateNurseryRequest copyWith(void Function(CreateNurseryRequest) updates) => super.copyWith((message) => updates(message as CreateNurseryRequest)) as CreateNurseryRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static CreateNurseryRequest create() => CreateNurseryRequest._(); + CreateNurseryRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static CreateNurseryRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CreateNurseryRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get email => $_getSZ(0); + @$pb.TagNumber(1) + set email($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasEmail() => $_has(0); + @$pb.TagNumber(1) + void clearEmail() => clearField(1); + + @$pb.TagNumber(2) + $core.String get password => $_getSZ(1); + @$pb.TagNumber(2) + set password($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasPassword() => $_has(1); + @$pb.TagNumber(2) + void clearPassword() => clearField(2); + + @$pb.TagNumber(3) + $core.String get name => $_getSZ(2); + @$pb.TagNumber(3) + set name($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasName() => $_has(2); + @$pb.TagNumber(3) + void clearName() => clearField(3); + + @$pb.TagNumber(4) + $core.String get phoneNumber => $_getSZ(3); + @$pb.TagNumber(4) + set phoneNumber($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasPhoneNumber() => $_has(3); + @$pb.TagNumber(4) + void clearPhoneNumber() => clearField(4); + + @$pb.TagNumber(5) + $core.String get address => $_getSZ(4); + @$pb.TagNumber(5) + set address($core.String v) { $_setString(4, v); } + @$pb.TagNumber(5) + $core.bool hasAddress() => $_has(4); + @$pb.TagNumber(5) + void clearAddress() => clearField(5); +} + +class CreateNurseryResponse extends $pb.GeneratedMessage { + factory CreateNurseryResponse({ + $9.NurseryResponse? nursery, + }) { + final $result = create(); + if (nursery != null) { + $result.nursery = nursery; + } + return $result; + } + CreateNurseryResponse._() : super(); + factory CreateNurseryResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory CreateNurseryResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'CreateNurseryResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.NurseryResponse>(1, _omitFieldNames ? '' : 'nursery', subBuilder: $9.NurseryResponse.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + CreateNurseryResponse clone() => CreateNurseryResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + CreateNurseryResponse copyWith(void Function(CreateNurseryResponse) updates) => super.copyWith((message) => updates(message as CreateNurseryResponse)) as CreateNurseryResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static CreateNurseryResponse create() => CreateNurseryResponse._(); + CreateNurseryResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static CreateNurseryResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CreateNurseryResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.NurseryResponse get nursery => $_getN(0); + @$pb.TagNumber(1) + set nursery($9.NurseryResponse v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasNursery() => $_has(0); + @$pb.TagNumber(1) + void clearNursery() => clearField(1); + @$pb.TagNumber(1) + $9.NurseryResponse ensureNursery() => $_ensure(0); +} + +class NurseryLoginRequest extends $pb.GeneratedMessage { + factory NurseryLoginRequest({ + $core.String? email, + $core.String? password, + }) { + final $result = create(); + if (email != null) { + $result.email = email; + } + if (password != null) { + $result.password = password; + } + return $result; + } + NurseryLoginRequest._() : super(); + factory NurseryLoginRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory NurseryLoginRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'NurseryLoginRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'email') + ..aOS(2, _omitFieldNames ? '' : 'password') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + NurseryLoginRequest clone() => NurseryLoginRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + NurseryLoginRequest copyWith(void Function(NurseryLoginRequest) updates) => super.copyWith((message) => updates(message as NurseryLoginRequest)) as NurseryLoginRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static NurseryLoginRequest create() => NurseryLoginRequest._(); + NurseryLoginRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static NurseryLoginRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static NurseryLoginRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get email => $_getSZ(0); + @$pb.TagNumber(1) + set email($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasEmail() => $_has(0); + @$pb.TagNumber(1) + void clearEmail() => clearField(1); + + @$pb.TagNumber(2) + $core.String get password => $_getSZ(1); + @$pb.TagNumber(2) + set password($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasPassword() => $_has(1); + @$pb.TagNumber(2) + void clearPassword() => clearField(2); +} + +class NurseryLoginResponse extends $pb.GeneratedMessage { + factory NurseryLoginResponse({ + $core.bool? success, + $9.NurseryResponse? nursery, + }) { + final $result = create(); + if (success != null) { + $result.success = success; + } + if (nursery != null) { + $result.nursery = nursery; + } + return $result; + } + NurseryLoginResponse._() : super(); + factory NurseryLoginResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory NurseryLoginResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'NurseryLoginResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOB(1, _omitFieldNames ? '' : 'success') + ..aOM<$9.NurseryResponse>(2, _omitFieldNames ? '' : 'nursery', subBuilder: $9.NurseryResponse.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + NurseryLoginResponse clone() => NurseryLoginResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + NurseryLoginResponse copyWith(void Function(NurseryLoginResponse) updates) => super.copyWith((message) => updates(message as NurseryLoginResponse)) as NurseryLoginResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static NurseryLoginResponse create() => NurseryLoginResponse._(); + NurseryLoginResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static NurseryLoginResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static NurseryLoginResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.bool get success => $_getBF(0); + @$pb.TagNumber(1) + set success($core.bool v) { $_setBool(0, v); } + @$pb.TagNumber(1) + $core.bool hasSuccess() => $_has(0); + @$pb.TagNumber(1) + void clearSuccess() => clearField(1); + + @$pb.TagNumber(2) + $9.NurseryResponse get nursery => $_getN(1); + @$pb.TagNumber(2) + set nursery($9.NurseryResponse v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasNursery() => $_has(1); + @$pb.TagNumber(2) + void clearNursery() => clearField(2); + @$pb.TagNumber(2) + $9.NurseryResponse ensureNursery() => $_ensure(1); +} + +class UpdateNurseryRequest extends $pb.GeneratedMessage { + factory UpdateNurseryRequest({ + $core.String? id, + $core.String? name, + $core.String? address, + $core.String? phoneNumber, + $core.String? email, + $core.String? password, + $10.FieldMask? updateMask, + }) { + final $result = create(); + if (id != null) { + $result.id = id; + } + if (name != null) { + $result.name = name; + } + if (address != null) { + $result.address = address; + } + if (phoneNumber != null) { + $result.phoneNumber = phoneNumber; + } + if (email != null) { + $result.email = email; + } + if (password != null) { + $result.password = password; + } + if (updateMask != null) { + $result.updateMask = updateMask; + } + return $result; + } + UpdateNurseryRequest._() : super(); + factory UpdateNurseryRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory UpdateNurseryRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'UpdateNurseryRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'id') + ..aOS(2, _omitFieldNames ? '' : 'name') + ..aOS(3, _omitFieldNames ? '' : 'address') + ..aOS(4, _omitFieldNames ? '' : 'phoneNumber') + ..aOS(5, _omitFieldNames ? '' : 'email') + ..aOS(6, _omitFieldNames ? '' : 'password') + ..aOM<$10.FieldMask>(7, _omitFieldNames ? '' : 'updateMask', subBuilder: $10.FieldMask.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + UpdateNurseryRequest clone() => UpdateNurseryRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + UpdateNurseryRequest copyWith(void Function(UpdateNurseryRequest) updates) => super.copyWith((message) => updates(message as UpdateNurseryRequest)) as UpdateNurseryRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static UpdateNurseryRequest create() => UpdateNurseryRequest._(); + UpdateNurseryRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static UpdateNurseryRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static UpdateNurseryRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get id => $_getSZ(0); + @$pb.TagNumber(1) + set id($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get name => $_getSZ(1); + @$pb.TagNumber(2) + set name($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasName() => $_has(1); + @$pb.TagNumber(2) + void clearName() => clearField(2); + + @$pb.TagNumber(3) + $core.String get address => $_getSZ(2); + @$pb.TagNumber(3) + set address($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasAddress() => $_has(2); + @$pb.TagNumber(3) + void clearAddress() => clearField(3); + + @$pb.TagNumber(4) + $core.String get phoneNumber => $_getSZ(3); + @$pb.TagNumber(4) + set phoneNumber($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasPhoneNumber() => $_has(3); + @$pb.TagNumber(4) + void clearPhoneNumber() => clearField(4); + + @$pb.TagNumber(5) + $core.String get email => $_getSZ(4); + @$pb.TagNumber(5) + set email($core.String v) { $_setString(4, v); } + @$pb.TagNumber(5) + $core.bool hasEmail() => $_has(4); + @$pb.TagNumber(5) + void clearEmail() => clearField(5); + + @$pb.TagNumber(6) + $core.String get password => $_getSZ(5); + @$pb.TagNumber(6) + set password($core.String v) { $_setString(5, v); } + @$pb.TagNumber(6) + $core.bool hasPassword() => $_has(5); + @$pb.TagNumber(6) + void clearPassword() => clearField(6); + + @$pb.TagNumber(7) + $10.FieldMask get updateMask => $_getN(6); + @$pb.TagNumber(7) + set updateMask($10.FieldMask v) { setField(7, v); } + @$pb.TagNumber(7) + $core.bool hasUpdateMask() => $_has(6); + @$pb.TagNumber(7) + void clearUpdateMask() => clearField(7); + @$pb.TagNumber(7) + $10.FieldMask ensureUpdateMask() => $_ensure(6); +} + +class UpdateNurseryResponse extends $pb.GeneratedMessage { + factory UpdateNurseryResponse({ + $9.NurseryResponse? nursery, + }) { + final $result = create(); + if (nursery != null) { + $result.nursery = nursery; + } + return $result; + } + UpdateNurseryResponse._() : super(); + factory UpdateNurseryResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory UpdateNurseryResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'UpdateNurseryResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.NurseryResponse>(1, _omitFieldNames ? '' : 'nursery', subBuilder: $9.NurseryResponse.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + UpdateNurseryResponse clone() => UpdateNurseryResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + UpdateNurseryResponse copyWith(void Function(UpdateNurseryResponse) updates) => super.copyWith((message) => updates(message as UpdateNurseryResponse)) as UpdateNurseryResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static UpdateNurseryResponse create() => UpdateNurseryResponse._(); + UpdateNurseryResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static UpdateNurseryResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static UpdateNurseryResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.NurseryResponse get nursery => $_getN(0); + @$pb.TagNumber(1) + set nursery($9.NurseryResponse v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasNursery() => $_has(0); + @$pb.TagNumber(1) + void clearNursery() => clearField(1); + @$pb.TagNumber(1) + $9.NurseryResponse ensureNursery() => $_ensure(0); +} + + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/nursery.pbenum.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/nursery.pbenum.dart new file mode 100644 index 00000000..4c9437d1 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/nursery.pbenum.dart @@ -0,0 +1,11 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/nursery.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/nursery.pbgrpc.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/nursery.pbgrpc.dart new file mode 100644 index 00000000..bba1d2a7 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/nursery.pbgrpc.dart @@ -0,0 +1,119 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/nursery.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:async' as $async; +import 'dart:core' as $core; + +import 'package:grpc/service_api.dart' as $grpc; +import 'package:protobuf/protobuf.dart' as $pb; + +import 'nursery.pb.dart' as $6; + +export 'nursery.pb.dart'; + +@$pb.GrpcServiceName('where_child_bus.v1.NurseryService') +class NurseryServiceClient extends $grpc.Client { + static final _$getNurseryByGuardianId = $grpc.ClientMethod<$6.GetNurseryByGuardianIdRequest, $6.GetNurseryByGuardianIdResponse>( + '/where_child_bus.v1.NurseryService/GetNurseryByGuardianId', + ($6.GetNurseryByGuardianIdRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $6.GetNurseryByGuardianIdResponse.fromBuffer(value)); + static final _$createNursery = $grpc.ClientMethod<$6.CreateNurseryRequest, $6.CreateNurseryResponse>( + '/where_child_bus.v1.NurseryService/CreateNursery', + ($6.CreateNurseryRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $6.CreateNurseryResponse.fromBuffer(value)); + static final _$nurseryLogin = $grpc.ClientMethod<$6.NurseryLoginRequest, $6.NurseryLoginResponse>( + '/where_child_bus.v1.NurseryService/NurseryLogin', + ($6.NurseryLoginRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $6.NurseryLoginResponse.fromBuffer(value)); + static final _$updateNursery = $grpc.ClientMethod<$6.UpdateNurseryRequest, $6.UpdateNurseryResponse>( + '/where_child_bus.v1.NurseryService/UpdateNursery', + ($6.UpdateNurseryRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $6.UpdateNurseryResponse.fromBuffer(value)); + + NurseryServiceClient($grpc.ClientChannel channel, + {$grpc.CallOptions? options, + $core.Iterable<$grpc.ClientInterceptor>? interceptors}) + : super(channel, options: options, + interceptors: interceptors); + + $grpc.ResponseFuture<$6.GetNurseryByGuardianIdResponse> getNurseryByGuardianId($6.GetNurseryByGuardianIdRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getNurseryByGuardianId, request, options: options); + } + + $grpc.ResponseFuture<$6.CreateNurseryResponse> createNursery($6.CreateNurseryRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$createNursery, request, options: options); + } + + $grpc.ResponseFuture<$6.NurseryLoginResponse> nurseryLogin($6.NurseryLoginRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$nurseryLogin, request, options: options); + } + + $grpc.ResponseFuture<$6.UpdateNurseryResponse> updateNursery($6.UpdateNurseryRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$updateNursery, request, options: options); + } +} + +@$pb.GrpcServiceName('where_child_bus.v1.NurseryService') +abstract class NurseryServiceBase extends $grpc.Service { + $core.String get $name => 'where_child_bus.v1.NurseryService'; + + NurseryServiceBase() { + $addMethod($grpc.ServiceMethod<$6.GetNurseryByGuardianIdRequest, $6.GetNurseryByGuardianIdResponse>( + 'GetNurseryByGuardianId', + getNurseryByGuardianId_Pre, + false, + false, + ($core.List<$core.int> value) => $6.GetNurseryByGuardianIdRequest.fromBuffer(value), + ($6.GetNurseryByGuardianIdResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$6.CreateNurseryRequest, $6.CreateNurseryResponse>( + 'CreateNursery', + createNursery_Pre, + false, + false, + ($core.List<$core.int> value) => $6.CreateNurseryRequest.fromBuffer(value), + ($6.CreateNurseryResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$6.NurseryLoginRequest, $6.NurseryLoginResponse>( + 'NurseryLogin', + nurseryLogin_Pre, + false, + false, + ($core.List<$core.int> value) => $6.NurseryLoginRequest.fromBuffer(value), + ($6.NurseryLoginResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$6.UpdateNurseryRequest, $6.UpdateNurseryResponse>( + 'UpdateNursery', + updateNursery_Pre, + false, + false, + ($core.List<$core.int> value) => $6.UpdateNurseryRequest.fromBuffer(value), + ($6.UpdateNurseryResponse value) => value.writeToBuffer())); + } + + $async.Future<$6.GetNurseryByGuardianIdResponse> getNurseryByGuardianId_Pre($grpc.ServiceCall call, $async.Future<$6.GetNurseryByGuardianIdRequest> request) async { + return getNurseryByGuardianId(call, await request); + } + + $async.Future<$6.CreateNurseryResponse> createNursery_Pre($grpc.ServiceCall call, $async.Future<$6.CreateNurseryRequest> request) async { + return createNursery(call, await request); + } + + $async.Future<$6.NurseryLoginResponse> nurseryLogin_Pre($grpc.ServiceCall call, $async.Future<$6.NurseryLoginRequest> request) async { + return nurseryLogin(call, await request); + } + + $async.Future<$6.UpdateNurseryResponse> updateNursery_Pre($grpc.ServiceCall call, $async.Future<$6.UpdateNurseryRequest> request) async { + return updateNursery(call, await request); + } + + $async.Future<$6.GetNurseryByGuardianIdResponse> getNurseryByGuardianId($grpc.ServiceCall call, $6.GetNurseryByGuardianIdRequest request); + $async.Future<$6.CreateNurseryResponse> createNursery($grpc.ServiceCall call, $6.CreateNurseryRequest request); + $async.Future<$6.NurseryLoginResponse> nurseryLogin($grpc.ServiceCall call, $6.NurseryLoginRequest request); + $async.Future<$6.UpdateNurseryResponse> updateNursery($grpc.ServiceCall call, $6.UpdateNurseryRequest request); +} diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/nursery.pbjson.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/nursery.pbjson.dart new file mode 100644 index 00000000..1480c20c --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/nursery.pbjson.dart @@ -0,0 +1,135 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/nursery.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use getNurseryByGuardianIdRequestDescriptor instead') +const GetNurseryByGuardianIdRequest$json = { + '1': 'GetNurseryByGuardianIdRequest', + '2': [ + {'1': 'guardian_id', '3': 1, '4': 1, '5': 9, '10': 'guardianId'}, + ], +}; + +/// Descriptor for `GetNurseryByGuardianIdRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getNurseryByGuardianIdRequestDescriptor = $convert.base64Decode( + 'Ch1HZXROdXJzZXJ5QnlHdWFyZGlhbklkUmVxdWVzdBIfCgtndWFyZGlhbl9pZBgBIAEoCVIKZ3' + 'VhcmRpYW5JZA=='); + +@$core.Deprecated('Use getNurseryByGuardianIdResponseDescriptor instead') +const GetNurseryByGuardianIdResponse$json = { + '1': 'GetNurseryByGuardianIdResponse', + '2': [ + {'1': 'nurseries', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.NurseryResponse', '10': 'nurseries'}, + ], +}; + +/// Descriptor for `GetNurseryByGuardianIdResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getNurseryByGuardianIdResponseDescriptor = $convert.base64Decode( + 'Ch5HZXROdXJzZXJ5QnlHdWFyZGlhbklkUmVzcG9uc2USQQoJbnVyc2VyaWVzGAEgASgLMiMud2' + 'hlcmVfY2hpbGRfYnVzLnYxLk51cnNlcnlSZXNwb25zZVIJbnVyc2VyaWVz'); + +@$core.Deprecated('Use createNurseryRequestDescriptor instead') +const CreateNurseryRequest$json = { + '1': 'CreateNurseryRequest', + '2': [ + {'1': 'email', '3': 1, '4': 1, '5': 9, '10': 'email'}, + {'1': 'password', '3': 2, '4': 1, '5': 9, '10': 'password'}, + {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, + {'1': 'phone_number', '3': 4, '4': 1, '5': 9, '10': 'phoneNumber'}, + {'1': 'address', '3': 5, '4': 1, '5': 9, '10': 'address'}, + ], +}; + +/// Descriptor for `CreateNurseryRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List createNurseryRequestDescriptor = $convert.base64Decode( + 'ChRDcmVhdGVOdXJzZXJ5UmVxdWVzdBIUCgVlbWFpbBgBIAEoCVIFZW1haWwSGgoIcGFzc3dvcm' + 'QYAiABKAlSCHBhc3N3b3JkEhIKBG5hbWUYAyABKAlSBG5hbWUSIQoMcGhvbmVfbnVtYmVyGAQg' + 'ASgJUgtwaG9uZU51bWJlchIYCgdhZGRyZXNzGAUgASgJUgdhZGRyZXNz'); + +@$core.Deprecated('Use createNurseryResponseDescriptor instead') +const CreateNurseryResponse$json = { + '1': 'CreateNurseryResponse', + '2': [ + {'1': 'nursery', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.NurseryResponse', '10': 'nursery'}, + ], +}; + +/// Descriptor for `CreateNurseryResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List createNurseryResponseDescriptor = $convert.base64Decode( + 'ChVDcmVhdGVOdXJzZXJ5UmVzcG9uc2USPQoHbnVyc2VyeRgBIAEoCzIjLndoZXJlX2NoaWxkX2' + 'J1cy52MS5OdXJzZXJ5UmVzcG9uc2VSB251cnNlcnk='); + +@$core.Deprecated('Use nurseryLoginRequestDescriptor instead') +const NurseryLoginRequest$json = { + '1': 'NurseryLoginRequest', + '2': [ + {'1': 'email', '3': 1, '4': 1, '5': 9, '10': 'email'}, + {'1': 'password', '3': 2, '4': 1, '5': 9, '10': 'password'}, + ], +}; + +/// Descriptor for `NurseryLoginRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List nurseryLoginRequestDescriptor = $convert.base64Decode( + 'ChNOdXJzZXJ5TG9naW5SZXF1ZXN0EhQKBWVtYWlsGAEgASgJUgVlbWFpbBIaCghwYXNzd29yZB' + 'gCIAEoCVIIcGFzc3dvcmQ='); + +@$core.Deprecated('Use nurseryLoginResponseDescriptor instead') +const NurseryLoginResponse$json = { + '1': 'NurseryLoginResponse', + '2': [ + {'1': 'success', '3': 1, '4': 1, '5': 8, '10': 'success'}, + {'1': 'nursery', '3': 2, '4': 1, '5': 11, '6': '.where_child_bus.v1.NurseryResponse', '10': 'nursery'}, + ], +}; + +/// Descriptor for `NurseryLoginResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List nurseryLoginResponseDescriptor = $convert.base64Decode( + 'ChROdXJzZXJ5TG9naW5SZXNwb25zZRIYCgdzdWNjZXNzGAEgASgIUgdzdWNjZXNzEj0KB251cn' + 'NlcnkYAiABKAsyIy53aGVyZV9jaGlsZF9idXMudjEuTnVyc2VyeVJlc3BvbnNlUgdudXJzZXJ5'); + +@$core.Deprecated('Use updateNurseryRequestDescriptor instead') +const UpdateNurseryRequest$json = { + '1': 'UpdateNurseryRequest', + '2': [ + {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, + {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'}, + {'1': 'address', '3': 3, '4': 1, '5': 9, '10': 'address'}, + {'1': 'phone_number', '3': 4, '4': 1, '5': 9, '10': 'phoneNumber'}, + {'1': 'email', '3': 5, '4': 1, '5': 9, '10': 'email'}, + {'1': 'password', '3': 6, '4': 1, '5': 9, '10': 'password'}, + {'1': 'update_mask', '3': 7, '4': 1, '5': 11, '6': '.google.protobuf.FieldMask', '10': 'updateMask'}, + ], +}; + +/// Descriptor for `UpdateNurseryRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List updateNurseryRequestDescriptor = $convert.base64Decode( + 'ChRVcGRhdGVOdXJzZXJ5UmVxdWVzdBIOCgJpZBgBIAEoCVICaWQSEgoEbmFtZRgCIAEoCVIEbm' + 'FtZRIYCgdhZGRyZXNzGAMgASgJUgdhZGRyZXNzEiEKDHBob25lX251bWJlchgEIAEoCVILcGhv' + 'bmVOdW1iZXISFAoFZW1haWwYBSABKAlSBWVtYWlsEhoKCHBhc3N3b3JkGAYgASgJUghwYXNzd2' + '9yZBI7Cgt1cGRhdGVfbWFzaxgHIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2tSCnVw' + 'ZGF0ZU1hc2s='); + +@$core.Deprecated('Use updateNurseryResponseDescriptor instead') +const UpdateNurseryResponse$json = { + '1': 'UpdateNurseryResponse', + '2': [ + {'1': 'nursery', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.NurseryResponse', '10': 'nursery'}, + ], +}; + +/// Descriptor for `UpdateNurseryResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List updateNurseryResponseDescriptor = $convert.base64Decode( + 'ChVVcGRhdGVOdXJzZXJ5UmVzcG9uc2USPQoHbnVyc2VyeRgBIAEoCzIjLndoZXJlX2NoaWxkX2' + 'J1cy52MS5OdXJzZXJ5UmVzcG9uc2VSB251cnNlcnk='); + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/resources.pb.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/resources.pb.dart new file mode 100644 index 00000000..3bca6ac1 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/resources.pb.dart @@ -0,0 +1,1640 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/resources.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +import '../../google/protobuf/timestamp.pb.dart' as $8; +import 'resources.pbenum.dart'; + +export 'resources.pbenum.dart'; + +class Nursery extends $pb.GeneratedMessage { + factory Nursery({ + $core.String? id, + $core.String? nurseryCode, + $core.String? name, + $core.String? address, + $core.String? phoneNumber, + $core.String? email, + $core.String? hashedPassword, + $8.Timestamp? createdAt, + $8.Timestamp? updatedAt, + }) { + final $result = create(); + if (id != null) { + $result.id = id; + } + if (nurseryCode != null) { + $result.nurseryCode = nurseryCode; + } + if (name != null) { + $result.name = name; + } + if (address != null) { + $result.address = address; + } + if (phoneNumber != null) { + $result.phoneNumber = phoneNumber; + } + if (email != null) { + $result.email = email; + } + if (hashedPassword != null) { + $result.hashedPassword = hashedPassword; + } + if (createdAt != null) { + $result.createdAt = createdAt; + } + if (updatedAt != null) { + $result.updatedAt = updatedAt; + } + return $result; + } + Nursery._() : super(); + factory Nursery.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Nursery.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Nursery', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'id') + ..aOS(2, _omitFieldNames ? '' : 'nurseryCode') + ..aOS(3, _omitFieldNames ? '' : 'name') + ..aOS(4, _omitFieldNames ? '' : 'address') + ..aOS(5, _omitFieldNames ? '' : 'phoneNumber') + ..aOS(6, _omitFieldNames ? '' : 'email') + ..aOS(7, _omitFieldNames ? '' : 'hashedPassword') + ..aOM<$8.Timestamp>(8, _omitFieldNames ? '' : 'createdAt', subBuilder: $8.Timestamp.create) + ..aOM<$8.Timestamp>(9, _omitFieldNames ? '' : 'updatedAt', subBuilder: $8.Timestamp.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Nursery clone() => Nursery()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Nursery copyWith(void Function(Nursery) updates) => super.copyWith((message) => updates(message as Nursery)) as Nursery; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Nursery create() => Nursery._(); + Nursery createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Nursery getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Nursery? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get id => $_getSZ(0); + @$pb.TagNumber(1) + set id($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get nurseryCode => $_getSZ(1); + @$pb.TagNumber(2) + set nurseryCode($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasNurseryCode() => $_has(1); + @$pb.TagNumber(2) + void clearNurseryCode() => clearField(2); + + @$pb.TagNumber(3) + $core.String get name => $_getSZ(2); + @$pb.TagNumber(3) + set name($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasName() => $_has(2); + @$pb.TagNumber(3) + void clearName() => clearField(3); + + @$pb.TagNumber(4) + $core.String get address => $_getSZ(3); + @$pb.TagNumber(4) + set address($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasAddress() => $_has(3); + @$pb.TagNumber(4) + void clearAddress() => clearField(4); + + @$pb.TagNumber(5) + $core.String get phoneNumber => $_getSZ(4); + @$pb.TagNumber(5) + set phoneNumber($core.String v) { $_setString(4, v); } + @$pb.TagNumber(5) + $core.bool hasPhoneNumber() => $_has(4); + @$pb.TagNumber(5) + void clearPhoneNumber() => clearField(5); + + @$pb.TagNumber(6) + $core.String get email => $_getSZ(5); + @$pb.TagNumber(6) + set email($core.String v) { $_setString(5, v); } + @$pb.TagNumber(6) + $core.bool hasEmail() => $_has(5); + @$pb.TagNumber(6) + void clearEmail() => clearField(6); + + @$pb.TagNumber(7) + $core.String get hashedPassword => $_getSZ(6); + @$pb.TagNumber(7) + set hashedPassword($core.String v) { $_setString(6, v); } + @$pb.TagNumber(7) + $core.bool hasHashedPassword() => $_has(6); + @$pb.TagNumber(7) + void clearHashedPassword() => clearField(7); + + @$pb.TagNumber(8) + $8.Timestamp get createdAt => $_getN(7); + @$pb.TagNumber(8) + set createdAt($8.Timestamp v) { setField(8, v); } + @$pb.TagNumber(8) + $core.bool hasCreatedAt() => $_has(7); + @$pb.TagNumber(8) + void clearCreatedAt() => clearField(8); + @$pb.TagNumber(8) + $8.Timestamp ensureCreatedAt() => $_ensure(7); + + @$pb.TagNumber(9) + $8.Timestamp get updatedAt => $_getN(8); + @$pb.TagNumber(9) + set updatedAt($8.Timestamp v) { setField(9, v); } + @$pb.TagNumber(9) + $core.bool hasUpdatedAt() => $_has(8); + @$pb.TagNumber(9) + void clearUpdatedAt() => clearField(9); + @$pb.TagNumber(9) + $8.Timestamp ensureUpdatedAt() => $_ensure(8); +} + +class NurseryResponse extends $pb.GeneratedMessage { + factory NurseryResponse({ + $core.String? id, + $core.String? nurseryCode, + $core.String? name, + $core.String? address, + $core.String? phoneNumber, + $core.String? email, + $8.Timestamp? createdAt, + $8.Timestamp? updatedAt, + }) { + final $result = create(); + if (id != null) { + $result.id = id; + } + if (nurseryCode != null) { + $result.nurseryCode = nurseryCode; + } + if (name != null) { + $result.name = name; + } + if (address != null) { + $result.address = address; + } + if (phoneNumber != null) { + $result.phoneNumber = phoneNumber; + } + if (email != null) { + $result.email = email; + } + if (createdAt != null) { + $result.createdAt = createdAt; + } + if (updatedAt != null) { + $result.updatedAt = updatedAt; + } + return $result; + } + NurseryResponse._() : super(); + factory NurseryResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory NurseryResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'NurseryResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'id') + ..aOS(2, _omitFieldNames ? '' : 'nurseryCode') + ..aOS(3, _omitFieldNames ? '' : 'name') + ..aOS(4, _omitFieldNames ? '' : 'address') + ..aOS(5, _omitFieldNames ? '' : 'phoneNumber') + ..aOS(6, _omitFieldNames ? '' : 'email') + ..aOM<$8.Timestamp>(7, _omitFieldNames ? '' : 'createdAt', subBuilder: $8.Timestamp.create) + ..aOM<$8.Timestamp>(8, _omitFieldNames ? '' : 'updatedAt', subBuilder: $8.Timestamp.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + NurseryResponse clone() => NurseryResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + NurseryResponse copyWith(void Function(NurseryResponse) updates) => super.copyWith((message) => updates(message as NurseryResponse)) as NurseryResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static NurseryResponse create() => NurseryResponse._(); + NurseryResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static NurseryResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static NurseryResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get id => $_getSZ(0); + @$pb.TagNumber(1) + set id($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get nurseryCode => $_getSZ(1); + @$pb.TagNumber(2) + set nurseryCode($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasNurseryCode() => $_has(1); + @$pb.TagNumber(2) + void clearNurseryCode() => clearField(2); + + @$pb.TagNumber(3) + $core.String get name => $_getSZ(2); + @$pb.TagNumber(3) + set name($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasName() => $_has(2); + @$pb.TagNumber(3) + void clearName() => clearField(3); + + @$pb.TagNumber(4) + $core.String get address => $_getSZ(3); + @$pb.TagNumber(4) + set address($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasAddress() => $_has(3); + @$pb.TagNumber(4) + void clearAddress() => clearField(4); + + @$pb.TagNumber(5) + $core.String get phoneNumber => $_getSZ(4); + @$pb.TagNumber(5) + set phoneNumber($core.String v) { $_setString(4, v); } + @$pb.TagNumber(5) + $core.bool hasPhoneNumber() => $_has(4); + @$pb.TagNumber(5) + void clearPhoneNumber() => clearField(5); + + @$pb.TagNumber(6) + $core.String get email => $_getSZ(5); + @$pb.TagNumber(6) + set email($core.String v) { $_setString(5, v); } + @$pb.TagNumber(6) + $core.bool hasEmail() => $_has(5); + @$pb.TagNumber(6) + void clearEmail() => clearField(6); + + /// ハッシュ化されたパスワードは除外 + @$pb.TagNumber(7) + $8.Timestamp get createdAt => $_getN(6); + @$pb.TagNumber(7) + set createdAt($8.Timestamp v) { setField(7, v); } + @$pb.TagNumber(7) + $core.bool hasCreatedAt() => $_has(6); + @$pb.TagNumber(7) + void clearCreatedAt() => clearField(7); + @$pb.TagNumber(7) + $8.Timestamp ensureCreatedAt() => $_ensure(6); + + @$pb.TagNumber(8) + $8.Timestamp get updatedAt => $_getN(7); + @$pb.TagNumber(8) + set updatedAt($8.Timestamp v) { setField(8, v); } + @$pb.TagNumber(8) + $core.bool hasUpdatedAt() => $_has(7); + @$pb.TagNumber(8) + void clearUpdatedAt() => clearField(8); + @$pb.TagNumber(8) + $8.Timestamp ensureUpdatedAt() => $_ensure(7); +} + +class Guardian extends $pb.GeneratedMessage { + factory Guardian({ + $core.String? id, + $core.String? nurseryId, + $core.String? name, + $core.String? email, + $core.String? phoneNumber, + $core.String? hashedPassword, + $core.bool? isUseMorningBus, + $core.bool? isUseEveningBus, + $8.Timestamp? createdAt, + $8.Timestamp? updatedAt, + }) { + final $result = create(); + if (id != null) { + $result.id = id; + } + if (nurseryId != null) { + $result.nurseryId = nurseryId; + } + if (name != null) { + $result.name = name; + } + if (email != null) { + $result.email = email; + } + if (phoneNumber != null) { + $result.phoneNumber = phoneNumber; + } + if (hashedPassword != null) { + $result.hashedPassword = hashedPassword; + } + if (isUseMorningBus != null) { + $result.isUseMorningBus = isUseMorningBus; + } + if (isUseEveningBus != null) { + $result.isUseEveningBus = isUseEveningBus; + } + if (createdAt != null) { + $result.createdAt = createdAt; + } + if (updatedAt != null) { + $result.updatedAt = updatedAt; + } + return $result; + } + Guardian._() : super(); + factory Guardian.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Guardian.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Guardian', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'id') + ..aOS(2, _omitFieldNames ? '' : 'nurseryId') + ..aOS(3, _omitFieldNames ? '' : 'name') + ..aOS(4, _omitFieldNames ? '' : 'email') + ..aOS(5, _omitFieldNames ? '' : 'phoneNumber') + ..aOS(6, _omitFieldNames ? '' : 'hashedPassword') + ..aOB(7, _omitFieldNames ? '' : 'isUseMorningBus') + ..aOB(8, _omitFieldNames ? '' : 'isUseEveningBus') + ..aOM<$8.Timestamp>(9, _omitFieldNames ? '' : 'createdAt', subBuilder: $8.Timestamp.create) + ..aOM<$8.Timestamp>(10, _omitFieldNames ? '' : 'updatedAt', subBuilder: $8.Timestamp.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Guardian clone() => Guardian()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Guardian copyWith(void Function(Guardian) updates) => super.copyWith((message) => updates(message as Guardian)) as Guardian; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Guardian create() => Guardian._(); + Guardian createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Guardian getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Guardian? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get id => $_getSZ(0); + @$pb.TagNumber(1) + set id($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get nurseryId => $_getSZ(1); + @$pb.TagNumber(2) + set nurseryId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasNurseryId() => $_has(1); + @$pb.TagNumber(2) + void clearNurseryId() => clearField(2); + + @$pb.TagNumber(3) + $core.String get name => $_getSZ(2); + @$pb.TagNumber(3) + set name($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasName() => $_has(2); + @$pb.TagNumber(3) + void clearName() => clearField(3); + + @$pb.TagNumber(4) + $core.String get email => $_getSZ(3); + @$pb.TagNumber(4) + set email($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasEmail() => $_has(3); + @$pb.TagNumber(4) + void clearEmail() => clearField(4); + + @$pb.TagNumber(5) + $core.String get phoneNumber => $_getSZ(4); + @$pb.TagNumber(5) + set phoneNumber($core.String v) { $_setString(4, v); } + @$pb.TagNumber(5) + $core.bool hasPhoneNumber() => $_has(4); + @$pb.TagNumber(5) + void clearPhoneNumber() => clearField(5); + + @$pb.TagNumber(6) + $core.String get hashedPassword => $_getSZ(5); + @$pb.TagNumber(6) + set hashedPassword($core.String v) { $_setString(5, v); } + @$pb.TagNumber(6) + $core.bool hasHashedPassword() => $_has(5); + @$pb.TagNumber(6) + void clearHashedPassword() => clearField(6); + + @$pb.TagNumber(7) + $core.bool get isUseMorningBus => $_getBF(6); + @$pb.TagNumber(7) + set isUseMorningBus($core.bool v) { $_setBool(6, v); } + @$pb.TagNumber(7) + $core.bool hasIsUseMorningBus() => $_has(6); + @$pb.TagNumber(7) + void clearIsUseMorningBus() => clearField(7); + + @$pb.TagNumber(8) + $core.bool get isUseEveningBus => $_getBF(7); + @$pb.TagNumber(8) + set isUseEveningBus($core.bool v) { $_setBool(7, v); } + @$pb.TagNumber(8) + $core.bool hasIsUseEveningBus() => $_has(7); + @$pb.TagNumber(8) + void clearIsUseEveningBus() => clearField(8); + + @$pb.TagNumber(9) + $8.Timestamp get createdAt => $_getN(8); + @$pb.TagNumber(9) + set createdAt($8.Timestamp v) { setField(9, v); } + @$pb.TagNumber(9) + $core.bool hasCreatedAt() => $_has(8); + @$pb.TagNumber(9) + void clearCreatedAt() => clearField(9); + @$pb.TagNumber(9) + $8.Timestamp ensureCreatedAt() => $_ensure(8); + + @$pb.TagNumber(10) + $8.Timestamp get updatedAt => $_getN(9); + @$pb.TagNumber(10) + set updatedAt($8.Timestamp v) { setField(10, v); } + @$pb.TagNumber(10) + $core.bool hasUpdatedAt() => $_has(9); + @$pb.TagNumber(10) + void clearUpdatedAt() => clearField(10); + @$pb.TagNumber(10) + $8.Timestamp ensureUpdatedAt() => $_ensure(9); +} + +class GuardianResponse extends $pb.GeneratedMessage { + factory GuardianResponse({ + $core.String? id, + $core.String? nurseryId, + $core.String? name, + $core.String? email, + $core.String? phoneNumber, + $core.bool? isUseMorningBus, + $core.bool? isUseEveningBus, + $8.Timestamp? createdAt, + $8.Timestamp? updatedAt, + }) { + final $result = create(); + if (id != null) { + $result.id = id; + } + if (nurseryId != null) { + $result.nurseryId = nurseryId; + } + if (name != null) { + $result.name = name; + } + if (email != null) { + $result.email = email; + } + if (phoneNumber != null) { + $result.phoneNumber = phoneNumber; + } + if (isUseMorningBus != null) { + $result.isUseMorningBus = isUseMorningBus; + } + if (isUseEveningBus != null) { + $result.isUseEveningBus = isUseEveningBus; + } + if (createdAt != null) { + $result.createdAt = createdAt; + } + if (updatedAt != null) { + $result.updatedAt = updatedAt; + } + return $result; + } + GuardianResponse._() : super(); + factory GuardianResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GuardianResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GuardianResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'id') + ..aOS(2, _omitFieldNames ? '' : 'nurseryId') + ..aOS(3, _omitFieldNames ? '' : 'name') + ..aOS(4, _omitFieldNames ? '' : 'email') + ..aOS(5, _omitFieldNames ? '' : 'phoneNumber') + ..aOB(6, _omitFieldNames ? '' : 'isUseMorningBus') + ..aOB(7, _omitFieldNames ? '' : 'isUseEveningBus') + ..aOM<$8.Timestamp>(8, _omitFieldNames ? '' : 'createdAt', subBuilder: $8.Timestamp.create) + ..aOM<$8.Timestamp>(9, _omitFieldNames ? '' : 'updatedAt', subBuilder: $8.Timestamp.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GuardianResponse clone() => GuardianResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GuardianResponse copyWith(void Function(GuardianResponse) updates) => super.copyWith((message) => updates(message as GuardianResponse)) as GuardianResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GuardianResponse create() => GuardianResponse._(); + GuardianResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GuardianResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GuardianResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get id => $_getSZ(0); + @$pb.TagNumber(1) + set id($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get nurseryId => $_getSZ(1); + @$pb.TagNumber(2) + set nurseryId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasNurseryId() => $_has(1); + @$pb.TagNumber(2) + void clearNurseryId() => clearField(2); + + @$pb.TagNumber(3) + $core.String get name => $_getSZ(2); + @$pb.TagNumber(3) + set name($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasName() => $_has(2); + @$pb.TagNumber(3) + void clearName() => clearField(3); + + @$pb.TagNumber(4) + $core.String get email => $_getSZ(3); + @$pb.TagNumber(4) + set email($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasEmail() => $_has(3); + @$pb.TagNumber(4) + void clearEmail() => clearField(4); + + @$pb.TagNumber(5) + $core.String get phoneNumber => $_getSZ(4); + @$pb.TagNumber(5) + set phoneNumber($core.String v) { $_setString(4, v); } + @$pb.TagNumber(5) + $core.bool hasPhoneNumber() => $_has(4); + @$pb.TagNumber(5) + void clearPhoneNumber() => clearField(5); + + /// ハッシュ化されたパスワードは除外 + @$pb.TagNumber(6) + $core.bool get isUseMorningBus => $_getBF(5); + @$pb.TagNumber(6) + set isUseMorningBus($core.bool v) { $_setBool(5, v); } + @$pb.TagNumber(6) + $core.bool hasIsUseMorningBus() => $_has(5); + @$pb.TagNumber(6) + void clearIsUseMorningBus() => clearField(6); + + @$pb.TagNumber(7) + $core.bool get isUseEveningBus => $_getBF(6); + @$pb.TagNumber(7) + set isUseEveningBus($core.bool v) { $_setBool(6, v); } + @$pb.TagNumber(7) + $core.bool hasIsUseEveningBus() => $_has(6); + @$pb.TagNumber(7) + void clearIsUseEveningBus() => clearField(7); + + @$pb.TagNumber(8) + $8.Timestamp get createdAt => $_getN(7); + @$pb.TagNumber(8) + set createdAt($8.Timestamp v) { setField(8, v); } + @$pb.TagNumber(8) + $core.bool hasCreatedAt() => $_has(7); + @$pb.TagNumber(8) + void clearCreatedAt() => clearField(8); + @$pb.TagNumber(8) + $8.Timestamp ensureCreatedAt() => $_ensure(7); + + @$pb.TagNumber(9) + $8.Timestamp get updatedAt => $_getN(8); + @$pb.TagNumber(9) + set updatedAt($8.Timestamp v) { setField(9, v); } + @$pb.TagNumber(9) + $core.bool hasUpdatedAt() => $_has(8); + @$pb.TagNumber(9) + void clearUpdatedAt() => clearField(9); + @$pb.TagNumber(9) + $8.Timestamp ensureUpdatedAt() => $_ensure(8); +} + +class Bus extends $pb.GeneratedMessage { + factory Bus({ + $core.String? id, + $core.String? nurseryId, + $core.String? name, + $core.String? plateNumber, + BusStatus? busStatus, + $core.double? latitude, + $core.double? longitude, + $core.bool? enableFaceRecognition, + $core.String? nextStationId, + $8.Timestamp? createdAt, + $8.Timestamp? updatedAt, + $core.String? latestMorningRouteId, + $core.String? latestEveningRouteId, + }) { + final $result = create(); + if (id != null) { + $result.id = id; + } + if (nurseryId != null) { + $result.nurseryId = nurseryId; + } + if (name != null) { + $result.name = name; + } + if (plateNumber != null) { + $result.plateNumber = plateNumber; + } + if (busStatus != null) { + $result.busStatus = busStatus; + } + if (latitude != null) { + $result.latitude = latitude; + } + if (longitude != null) { + $result.longitude = longitude; + } + if (enableFaceRecognition != null) { + $result.enableFaceRecognition = enableFaceRecognition; + } + if (nextStationId != null) { + $result.nextStationId = nextStationId; + } + if (createdAt != null) { + $result.createdAt = createdAt; + } + if (updatedAt != null) { + $result.updatedAt = updatedAt; + } + if (latestMorningRouteId != null) { + $result.latestMorningRouteId = latestMorningRouteId; + } + if (latestEveningRouteId != null) { + $result.latestEveningRouteId = latestEveningRouteId; + } + return $result; + } + Bus._() : super(); + factory Bus.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Bus.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Bus', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'id') + ..aOS(2, _omitFieldNames ? '' : 'nurseryId') + ..aOS(3, _omitFieldNames ? '' : 'name') + ..aOS(4, _omitFieldNames ? '' : 'plateNumber') + ..e(5, _omitFieldNames ? '' : 'busStatus', $pb.PbFieldType.OE, defaultOrMaker: BusStatus.BUS_STATUS_UNSPECIFIED, valueOf: BusStatus.valueOf, enumValues: BusStatus.values) + ..a<$core.double>(6, _omitFieldNames ? '' : 'latitude', $pb.PbFieldType.OD) + ..a<$core.double>(7, _omitFieldNames ? '' : 'longitude', $pb.PbFieldType.OD) + ..aOB(8, _omitFieldNames ? '' : 'enableFaceRecognition') + ..aOS(11, _omitFieldNames ? '' : 'nextStationId') + ..aOM<$8.Timestamp>(12, _omitFieldNames ? '' : 'createdAt', subBuilder: $8.Timestamp.create) + ..aOM<$8.Timestamp>(13, _omitFieldNames ? '' : 'updatedAt', subBuilder: $8.Timestamp.create) + ..aOS(14, _omitFieldNames ? '' : 'latestMorningRouteId') + ..aOS(15, _omitFieldNames ? '' : 'latestEveningRouteId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Bus clone() => Bus()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Bus copyWith(void Function(Bus) updates) => super.copyWith((message) => updates(message as Bus)) as Bus; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Bus create() => Bus._(); + Bus createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Bus getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Bus? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get id => $_getSZ(0); + @$pb.TagNumber(1) + set id($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get nurseryId => $_getSZ(1); + @$pb.TagNumber(2) + set nurseryId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasNurseryId() => $_has(1); + @$pb.TagNumber(2) + void clearNurseryId() => clearField(2); + + @$pb.TagNumber(3) + $core.String get name => $_getSZ(2); + @$pb.TagNumber(3) + set name($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasName() => $_has(2); + @$pb.TagNumber(3) + void clearName() => clearField(3); + + @$pb.TagNumber(4) + $core.String get plateNumber => $_getSZ(3); + @$pb.TagNumber(4) + set plateNumber($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasPlateNumber() => $_has(3); + @$pb.TagNumber(4) + void clearPlateNumber() => clearField(4); + + @$pb.TagNumber(5) + BusStatus get busStatus => $_getN(4); + @$pb.TagNumber(5) + set busStatus(BusStatus v) { setField(5, v); } + @$pb.TagNumber(5) + $core.bool hasBusStatus() => $_has(4); + @$pb.TagNumber(5) + void clearBusStatus() => clearField(5); + + /// 緯度経度 + @$pb.TagNumber(6) + $core.double get latitude => $_getN(5); + @$pb.TagNumber(6) + set latitude($core.double v) { $_setDouble(5, v); } + @$pb.TagNumber(6) + $core.bool hasLatitude() => $_has(5); + @$pb.TagNumber(6) + void clearLatitude() => clearField(6); + + @$pb.TagNumber(7) + $core.double get longitude => $_getN(6); + @$pb.TagNumber(7) + set longitude($core.double v) { $_setDouble(6, v); } + @$pb.TagNumber(7) + $core.bool hasLongitude() => $_has(6); + @$pb.TagNumber(7) + void clearLongitude() => clearField(7); + + @$pb.TagNumber(8) + $core.bool get enableFaceRecognition => $_getBF(7); + @$pb.TagNumber(8) + set enableFaceRecognition($core.bool v) { $_setBool(7, v); } + @$pb.TagNumber(8) + $core.bool hasEnableFaceRecognition() => $_has(7); + @$pb.TagNumber(8) + void clearEnableFaceRecognition() => clearField(8); + + @$pb.TagNumber(11) + $core.String get nextStationId => $_getSZ(8); + @$pb.TagNumber(11) + set nextStationId($core.String v) { $_setString(8, v); } + @$pb.TagNumber(11) + $core.bool hasNextStationId() => $_has(8); + @$pb.TagNumber(11) + void clearNextStationId() => clearField(11); + + @$pb.TagNumber(12) + $8.Timestamp get createdAt => $_getN(9); + @$pb.TagNumber(12) + set createdAt($8.Timestamp v) { setField(12, v); } + @$pb.TagNumber(12) + $core.bool hasCreatedAt() => $_has(9); + @$pb.TagNumber(12) + void clearCreatedAt() => clearField(12); + @$pb.TagNumber(12) + $8.Timestamp ensureCreatedAt() => $_ensure(9); + + @$pb.TagNumber(13) + $8.Timestamp get updatedAt => $_getN(10); + @$pb.TagNumber(13) + set updatedAt($8.Timestamp v) { setField(13, v); } + @$pb.TagNumber(13) + $core.bool hasUpdatedAt() => $_has(10); + @$pb.TagNumber(13) + void clearUpdatedAt() => clearField(13); + @$pb.TagNumber(13) + $8.Timestamp ensureUpdatedAt() => $_ensure(10); + + @$pb.TagNumber(14) + $core.String get latestMorningRouteId => $_getSZ(11); + @$pb.TagNumber(14) + set latestMorningRouteId($core.String v) { $_setString(11, v); } + @$pb.TagNumber(14) + $core.bool hasLatestMorningRouteId() => $_has(11); + @$pb.TagNumber(14) + void clearLatestMorningRouteId() => clearField(14); + + @$pb.TagNumber(15) + $core.String get latestEveningRouteId => $_getSZ(12); + @$pb.TagNumber(15) + set latestEveningRouteId($core.String v) { $_setString(12, v); } + @$pb.TagNumber(15) + $core.bool hasLatestEveningRouteId() => $_has(12); + @$pb.TagNumber(15) + void clearLatestEveningRouteId() => clearField(15); +} + +class Child extends $pb.GeneratedMessage { + factory Child({ + $core.String? id, + $core.String? nurseryId, + $core.String? guardianId, + $core.String? name, + $core.int? age, + Sex? sex, + $core.bool? checkForMissingItems, + $core.bool? hasBag, + $core.bool? hasLunchBox, + $core.bool? hasWaterBottle, + $core.bool? hasUmbrella, + $core.bool? hasOther, + $8.Timestamp? createdAt, + $8.Timestamp? updatedAt, + }) { + final $result = create(); + if (id != null) { + $result.id = id; + } + if (nurseryId != null) { + $result.nurseryId = nurseryId; + } + if (guardianId != null) { + $result.guardianId = guardianId; + } + if (name != null) { + $result.name = name; + } + if (age != null) { + $result.age = age; + } + if (sex != null) { + $result.sex = sex; + } + if (checkForMissingItems != null) { + $result.checkForMissingItems = checkForMissingItems; + } + if (hasBag != null) { + $result.hasBag = hasBag; + } + if (hasLunchBox != null) { + $result.hasLunchBox = hasLunchBox; + } + if (hasWaterBottle != null) { + $result.hasWaterBottle = hasWaterBottle; + } + if (hasUmbrella != null) { + $result.hasUmbrella = hasUmbrella; + } + if (hasOther != null) { + $result.hasOther = hasOther; + } + if (createdAt != null) { + $result.createdAt = createdAt; + } + if (updatedAt != null) { + $result.updatedAt = updatedAt; + } + return $result; + } + Child._() : super(); + factory Child.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Child.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Child', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'id') + ..aOS(2, _omitFieldNames ? '' : 'nurseryId') + ..aOS(3, _omitFieldNames ? '' : 'guardianId') + ..aOS(4, _omitFieldNames ? '' : 'name') + ..a<$core.int>(5, _omitFieldNames ? '' : 'age', $pb.PbFieldType.O3) + ..e(6, _omitFieldNames ? '' : 'sex', $pb.PbFieldType.OE, defaultOrMaker: Sex.SEX_UNSPECIFIED, valueOf: Sex.valueOf, enumValues: Sex.values) + ..aOB(7, _omitFieldNames ? '' : 'checkForMissingItems') + ..aOB(8, _omitFieldNames ? '' : 'hasBag') + ..aOB(9, _omitFieldNames ? '' : 'hasLunchBox') + ..aOB(10, _omitFieldNames ? '' : 'hasWaterBottle') + ..aOB(11, _omitFieldNames ? '' : 'hasUmbrella') + ..aOB(12, _omitFieldNames ? '' : 'hasOther') + ..aOM<$8.Timestamp>(13, _omitFieldNames ? '' : 'createdAt', subBuilder: $8.Timestamp.create) + ..aOM<$8.Timestamp>(14, _omitFieldNames ? '' : 'updatedAt', subBuilder: $8.Timestamp.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Child clone() => Child()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Child copyWith(void Function(Child) updates) => super.copyWith((message) => updates(message as Child)) as Child; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Child create() => Child._(); + Child createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Child getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Child? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get id => $_getSZ(0); + @$pb.TagNumber(1) + set id($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get nurseryId => $_getSZ(1); + @$pb.TagNumber(2) + set nurseryId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasNurseryId() => $_has(1); + @$pb.TagNumber(2) + void clearNurseryId() => clearField(2); + + @$pb.TagNumber(3) + $core.String get guardianId => $_getSZ(2); + @$pb.TagNumber(3) + set guardianId($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasGuardianId() => $_has(2); + @$pb.TagNumber(3) + void clearGuardianId() => clearField(3); + + @$pb.TagNumber(4) + $core.String get name => $_getSZ(3); + @$pb.TagNumber(4) + set name($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasName() => $_has(3); + @$pb.TagNumber(4) + void clearName() => clearField(4); + + @$pb.TagNumber(5) + $core.int get age => $_getIZ(4); + @$pb.TagNumber(5) + set age($core.int v) { $_setSignedInt32(4, v); } + @$pb.TagNumber(5) + $core.bool hasAge() => $_has(4); + @$pb.TagNumber(5) + void clearAge() => clearField(5); + + @$pb.TagNumber(6) + Sex get sex => $_getN(5); + @$pb.TagNumber(6) + set sex(Sex v) { setField(6, v); } + @$pb.TagNumber(6) + $core.bool hasSex() => $_has(5); + @$pb.TagNumber(6) + void clearSex() => clearField(6); + + @$pb.TagNumber(7) + $core.bool get checkForMissingItems => $_getBF(6); + @$pb.TagNumber(7) + set checkForMissingItems($core.bool v) { $_setBool(6, v); } + @$pb.TagNumber(7) + $core.bool hasCheckForMissingItems() => $_has(6); + @$pb.TagNumber(7) + void clearCheckForMissingItems() => clearField(7); + + @$pb.TagNumber(8) + $core.bool get hasBag => $_getBF(7); + @$pb.TagNumber(8) + set hasBag($core.bool v) { $_setBool(7, v); } + @$pb.TagNumber(8) + $core.bool hasHasBag() => $_has(7); + @$pb.TagNumber(8) + void clearHasBag() => clearField(8); + + @$pb.TagNumber(9) + $core.bool get hasLunchBox => $_getBF(8); + @$pb.TagNumber(9) + set hasLunchBox($core.bool v) { $_setBool(8, v); } + @$pb.TagNumber(9) + $core.bool hasHasLunchBox() => $_has(8); + @$pb.TagNumber(9) + void clearHasLunchBox() => clearField(9); + + @$pb.TagNumber(10) + $core.bool get hasWaterBottle => $_getBF(9); + @$pb.TagNumber(10) + set hasWaterBottle($core.bool v) { $_setBool(9, v); } + @$pb.TagNumber(10) + $core.bool hasHasWaterBottle() => $_has(9); + @$pb.TagNumber(10) + void clearHasWaterBottle() => clearField(10); + + @$pb.TagNumber(11) + $core.bool get hasUmbrella => $_getBF(10); + @$pb.TagNumber(11) + set hasUmbrella($core.bool v) { $_setBool(10, v); } + @$pb.TagNumber(11) + $core.bool hasHasUmbrella() => $_has(10); + @$pb.TagNumber(11) + void clearHasUmbrella() => clearField(11); + + @$pb.TagNumber(12) + $core.bool get hasOther => $_getBF(11); + @$pb.TagNumber(12) + set hasOther($core.bool v) { $_setBool(11, v); } + @$pb.TagNumber(12) + $core.bool hasHasOther() => $_has(11); + @$pb.TagNumber(12) + void clearHasOther() => clearField(12); + + @$pb.TagNumber(13) + $8.Timestamp get createdAt => $_getN(12); + @$pb.TagNumber(13) + set createdAt($8.Timestamp v) { setField(13, v); } + @$pb.TagNumber(13) + $core.bool hasCreatedAt() => $_has(12); + @$pb.TagNumber(13) + void clearCreatedAt() => clearField(13); + @$pb.TagNumber(13) + $8.Timestamp ensureCreatedAt() => $_ensure(12); + + @$pb.TagNumber(14) + $8.Timestamp get updatedAt => $_getN(13); + @$pb.TagNumber(14) + set updatedAt($8.Timestamp v) { setField(14, v); } + @$pb.TagNumber(14) + $core.bool hasUpdatedAt() => $_has(13); + @$pb.TagNumber(14) + void clearUpdatedAt() => clearField(14); + @$pb.TagNumber(14) + $8.Timestamp ensureUpdatedAt() => $_ensure(13); +} + +class Station extends $pb.GeneratedMessage { + factory Station({ + $core.String? id, + $core.String? guardianId, + $core.double? latitude, + $core.double? longitude, + $8.Timestamp? createdAt, + $8.Timestamp? updatedAt, + }) { + final $result = create(); + if (id != null) { + $result.id = id; + } + if (guardianId != null) { + $result.guardianId = guardianId; + } + if (latitude != null) { + $result.latitude = latitude; + } + if (longitude != null) { + $result.longitude = longitude; + } + if (createdAt != null) { + $result.createdAt = createdAt; + } + if (updatedAt != null) { + $result.updatedAt = updatedAt; + } + return $result; + } + Station._() : super(); + factory Station.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Station.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Station', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'id') + ..aOS(2, _omitFieldNames ? '' : 'guardianId') + ..a<$core.double>(5, _omitFieldNames ? '' : 'latitude', $pb.PbFieldType.OD) + ..a<$core.double>(6, _omitFieldNames ? '' : 'longitude', $pb.PbFieldType.OD) + ..aOM<$8.Timestamp>(7, _omitFieldNames ? '' : 'createdAt', subBuilder: $8.Timestamp.create) + ..aOM<$8.Timestamp>(8, _omitFieldNames ? '' : 'updatedAt', subBuilder: $8.Timestamp.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Station clone() => Station()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Station copyWith(void Function(Station) updates) => super.copyWith((message) => updates(message as Station)) as Station; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Station create() => Station._(); + Station createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Station getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Station? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get id => $_getSZ(0); + @$pb.TagNumber(1) + set id($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get guardianId => $_getSZ(1); + @$pb.TagNumber(2) + set guardianId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasGuardianId() => $_has(1); + @$pb.TagNumber(2) + void clearGuardianId() => clearField(2); + + @$pb.TagNumber(5) + $core.double get latitude => $_getN(2); + @$pb.TagNumber(5) + set latitude($core.double v) { $_setDouble(2, v); } + @$pb.TagNumber(5) + $core.bool hasLatitude() => $_has(2); + @$pb.TagNumber(5) + void clearLatitude() => clearField(5); + + @$pb.TagNumber(6) + $core.double get longitude => $_getN(3); + @$pb.TagNumber(6) + set longitude($core.double v) { $_setDouble(3, v); } + @$pb.TagNumber(6) + $core.bool hasLongitude() => $_has(3); + @$pb.TagNumber(6) + void clearLongitude() => clearField(6); + + @$pb.TagNumber(7) + $8.Timestamp get createdAt => $_getN(4); + @$pb.TagNumber(7) + set createdAt($8.Timestamp v) { setField(7, v); } + @$pb.TagNumber(7) + $core.bool hasCreatedAt() => $_has(4); + @$pb.TagNumber(7) + void clearCreatedAt() => clearField(7); + @$pb.TagNumber(7) + $8.Timestamp ensureCreatedAt() => $_ensure(4); + + @$pb.TagNumber(8) + $8.Timestamp get updatedAt => $_getN(5); + @$pb.TagNumber(8) + set updatedAt($8.Timestamp v) { setField(8, v); } + @$pb.TagNumber(8) + $core.bool hasUpdatedAt() => $_has(5); + @$pb.TagNumber(8) + void clearUpdatedAt() => clearField(8); + @$pb.TagNumber(8) + $8.Timestamp ensureUpdatedAt() => $_ensure(5); +} + +class ChildBusAssociation extends $pb.GeneratedMessage { + factory ChildBusAssociation({ + $core.String? busRouteId, + $core.String? childId, + }) { + final $result = create(); + if (busRouteId != null) { + $result.busRouteId = busRouteId; + } + if (childId != null) { + $result.childId = childId; + } + return $result; + } + ChildBusAssociation._() : super(); + factory ChildBusAssociation.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ChildBusAssociation.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ChildBusAssociation', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'busRouteId') + ..aOS(2, _omitFieldNames ? '' : 'childId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ChildBusAssociation clone() => ChildBusAssociation()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ChildBusAssociation copyWith(void Function(ChildBusAssociation) updates) => super.copyWith((message) => updates(message as ChildBusAssociation)) as ChildBusAssociation; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static ChildBusAssociation create() => ChildBusAssociation._(); + ChildBusAssociation createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ChildBusAssociation getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ChildBusAssociation? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get busRouteId => $_getSZ(0); + @$pb.TagNumber(1) + set busRouteId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasBusRouteId() => $_has(0); + @$pb.TagNumber(1) + void clearBusRouteId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get childId => $_getSZ(1); + @$pb.TagNumber(2) + set childId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasChildId() => $_has(1); + @$pb.TagNumber(2) + void clearChildId() => clearField(2); +} + +class ChildPhoto extends $pb.GeneratedMessage { + factory ChildPhoto({ + $core.String? id, + $core.String? childId, + $core.List<$core.int>? photoData, + $8.Timestamp? createdAt, + $8.Timestamp? updatedAt, + }) { + final $result = create(); + if (id != null) { + $result.id = id; + } + if (childId != null) { + $result.childId = childId; + } + if (photoData != null) { + $result.photoData = photoData; + } + if (createdAt != null) { + $result.createdAt = createdAt; + } + if (updatedAt != null) { + $result.updatedAt = updatedAt; + } + return $result; + } + ChildPhoto._() : super(); + factory ChildPhoto.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ChildPhoto.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ChildPhoto', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'id') + ..aOS(2, _omitFieldNames ? '' : 'childId') + ..a<$core.List<$core.int>>(3, _omitFieldNames ? '' : 'photoData', $pb.PbFieldType.OY) + ..aOM<$8.Timestamp>(4, _omitFieldNames ? '' : 'createdAt', subBuilder: $8.Timestamp.create) + ..aOM<$8.Timestamp>(5, _omitFieldNames ? '' : 'updatedAt', subBuilder: $8.Timestamp.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ChildPhoto clone() => ChildPhoto()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ChildPhoto copyWith(void Function(ChildPhoto) updates) => super.copyWith((message) => updates(message as ChildPhoto)) as ChildPhoto; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static ChildPhoto create() => ChildPhoto._(); + ChildPhoto createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ChildPhoto getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ChildPhoto? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get id => $_getSZ(0); + @$pb.TagNumber(1) + set id($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get childId => $_getSZ(1); + @$pb.TagNumber(2) + set childId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasChildId() => $_has(1); + @$pb.TagNumber(2) + void clearChildId() => clearField(2); + + @$pb.TagNumber(3) + $core.List<$core.int> get photoData => $_getN(2); + @$pb.TagNumber(3) + set photoData($core.List<$core.int> v) { $_setBytes(2, v); } + @$pb.TagNumber(3) + $core.bool hasPhotoData() => $_has(2); + @$pb.TagNumber(3) + void clearPhotoData() => clearField(3); + + @$pb.TagNumber(4) + $8.Timestamp get createdAt => $_getN(3); + @$pb.TagNumber(4) + set createdAt($8.Timestamp v) { setField(4, v); } + @$pb.TagNumber(4) + $core.bool hasCreatedAt() => $_has(3); + @$pb.TagNumber(4) + void clearCreatedAt() => clearField(4); + @$pb.TagNumber(4) + $8.Timestamp ensureCreatedAt() => $_ensure(3); + + @$pb.TagNumber(5) + $8.Timestamp get updatedAt => $_getN(4); + @$pb.TagNumber(5) + set updatedAt($8.Timestamp v) { setField(5, v); } + @$pb.TagNumber(5) + $core.bool hasUpdatedAt() => $_has(4); + @$pb.TagNumber(5) + void clearUpdatedAt() => clearField(5); + @$pb.TagNumber(5) + $8.Timestamp ensureUpdatedAt() => $_ensure(4); +} + +class BoardingRecord extends $pb.GeneratedMessage { + factory BoardingRecord({ + $core.String? id, + $core.String? childId, + $core.String? busId, + $core.bool? isBoarding, + $8.Timestamp? timestamp, + }) { + final $result = create(); + if (id != null) { + $result.id = id; + } + if (childId != null) { + $result.childId = childId; + } + if (busId != null) { + $result.busId = busId; + } + if (isBoarding != null) { + $result.isBoarding = isBoarding; + } + if (timestamp != null) { + $result.timestamp = timestamp; + } + return $result; + } + BoardingRecord._() : super(); + factory BoardingRecord.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory BoardingRecord.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'BoardingRecord', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'id') + ..aOS(2, _omitFieldNames ? '' : 'childId') + ..aOS(3, _omitFieldNames ? '' : 'busId') + ..aOB(4, _omitFieldNames ? '' : 'isBoarding') + ..aOM<$8.Timestamp>(5, _omitFieldNames ? '' : 'timestamp', subBuilder: $8.Timestamp.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + BoardingRecord clone() => BoardingRecord()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + BoardingRecord copyWith(void Function(BoardingRecord) updates) => super.copyWith((message) => updates(message as BoardingRecord)) as BoardingRecord; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static BoardingRecord create() => BoardingRecord._(); + BoardingRecord createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static BoardingRecord getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static BoardingRecord? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get id => $_getSZ(0); + @$pb.TagNumber(1) + set id($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get childId => $_getSZ(1); + @$pb.TagNumber(2) + set childId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasChildId() => $_has(1); + @$pb.TagNumber(2) + void clearChildId() => clearField(2); + + @$pb.TagNumber(3) + $core.String get busId => $_getSZ(2); + @$pb.TagNumber(3) + set busId($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasBusId() => $_has(2); + @$pb.TagNumber(3) + void clearBusId() => clearField(3); + + @$pb.TagNumber(4) + $core.bool get isBoarding => $_getBF(3); + @$pb.TagNumber(4) + set isBoarding($core.bool v) { $_setBool(3, v); } + @$pb.TagNumber(4) + $core.bool hasIsBoarding() => $_has(3); + @$pb.TagNumber(4) + void clearIsBoarding() => clearField(4); + + @$pb.TagNumber(5) + $8.Timestamp get timestamp => $_getN(4); + @$pb.TagNumber(5) + set timestamp($8.Timestamp v) { setField(5, v); } + @$pb.TagNumber(5) + $core.bool hasTimestamp() => $_has(4); + @$pb.TagNumber(5) + void clearTimestamp() => clearField(5); + @$pb.TagNumber(5) + $8.Timestamp ensureTimestamp() => $_ensure(4); +} + +class BusRoute extends $pb.GeneratedMessage { + factory BusRoute({ + $core.String? id, + $core.String? busId, + $core.Iterable? orderedStations, + BusType? busType, + }) { + final $result = create(); + if (id != null) { + $result.id = id; + } + if (busId != null) { + $result.busId = busId; + } + if (orderedStations != null) { + $result.orderedStations.addAll(orderedStations); + } + if (busType != null) { + $result.busType = busType; + } + return $result; + } + BusRoute._() : super(); + factory BusRoute.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory BusRoute.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'BusRoute', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'id') + ..aOS(2, _omitFieldNames ? '' : 'busId') + ..pc(3, _omitFieldNames ? '' : 'orderedStations', $pb.PbFieldType.PM, subBuilder: Station.create) + ..e(4, _omitFieldNames ? '' : 'busType', $pb.PbFieldType.OE, defaultOrMaker: BusType.BUS_TYPE_UNSPECIFIED, valueOf: BusType.valueOf, enumValues: BusType.values) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + BusRoute clone() => BusRoute()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + BusRoute copyWith(void Function(BusRoute) updates) => super.copyWith((message) => updates(message as BusRoute)) as BusRoute; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static BusRoute create() => BusRoute._(); + BusRoute createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static BusRoute getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static BusRoute? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get id => $_getSZ(0); + @$pb.TagNumber(1) + set id($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get busId => $_getSZ(1); + @$pb.TagNumber(2) + set busId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasBusId() => $_has(1); + @$pb.TagNumber(2) + void clearBusId() => clearField(2); + + @$pb.TagNumber(3) + $core.List get orderedStations => $_getList(2); + + @$pb.TagNumber(4) + BusType get busType => $_getN(3); + @$pb.TagNumber(4) + set busType(BusType v) { setField(4, v); } + @$pb.TagNumber(4) + $core.bool hasBusType() => $_has(3); + @$pb.TagNumber(4) + void clearBusType() => clearField(4); +} + + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/resources.pbenum.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/resources.pbenum.dart new file mode 100644 index 00000000..969ec858 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/resources.pbenum.dart @@ -0,0 +1,89 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/resources.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +class BusStatus extends $pb.ProtobufEnum { + static const BusStatus BUS_STATUS_UNSPECIFIED = BusStatus._(0, _omitEnumNames ? '' : 'BUS_STATUS_UNSPECIFIED'); + static const BusStatus BUS_STATUS_STOPPED = BusStatus._(1, _omitEnumNames ? '' : 'BUS_STATUS_STOPPED'); + static const BusStatus BUS_STATUS_RUNNING = BusStatus._(2, _omitEnumNames ? '' : 'BUS_STATUS_RUNNING'); + static const BusStatus BUS_STATUS_MAINTENANCE = BusStatus._(3, _omitEnumNames ? '' : 'BUS_STATUS_MAINTENANCE'); + + static const $core.List values = [ + BUS_STATUS_UNSPECIFIED, + BUS_STATUS_STOPPED, + BUS_STATUS_RUNNING, + BUS_STATUS_MAINTENANCE, + ]; + + static final $core.Map<$core.int, BusStatus> _byValue = $pb.ProtobufEnum.initByValue(values); + static BusStatus? valueOf($core.int value) => _byValue[value]; + + const BusStatus._($core.int v, $core.String n) : super(v, n); +} + +class VehicleEvent extends $pb.ProtobufEnum { + static const VehicleEvent VEHICLE_EVENT_UNSPECIFIED = VehicleEvent._(0, _omitEnumNames ? '' : 'VEHICLE_EVENT_UNSPECIFIED'); + static const VehicleEvent VEHICLE_EVENT_GET_ON = VehicleEvent._(1, _omitEnumNames ? '' : 'VEHICLE_EVENT_GET_ON'); + static const VehicleEvent VEHICLE_EVENT_GET_OFF = VehicleEvent._(2, _omitEnumNames ? '' : 'VEHICLE_EVENT_GET_OFF'); + + static const $core.List values = [ + VEHICLE_EVENT_UNSPECIFIED, + VEHICLE_EVENT_GET_ON, + VEHICLE_EVENT_GET_OFF, + ]; + + static final $core.Map<$core.int, VehicleEvent> _byValue = $pb.ProtobufEnum.initByValue(values); + static VehicleEvent? valueOf($core.int value) => _byValue[value]; + + const VehicleEvent._($core.int v, $core.String n) : super(v, n); +} + +class Sex extends $pb.ProtobufEnum { + static const Sex SEX_UNSPECIFIED = Sex._(0, _omitEnumNames ? '' : 'SEX_UNSPECIFIED'); + static const Sex SEX_MAN = Sex._(1, _omitEnumNames ? '' : 'SEX_MAN'); + static const Sex SEX_WOMAN = Sex._(2, _omitEnumNames ? '' : 'SEX_WOMAN'); + static const Sex SEX_OTHER = Sex._(3, _omitEnumNames ? '' : 'SEX_OTHER'); + + static const $core.List values = [ + SEX_UNSPECIFIED, + SEX_MAN, + SEX_WOMAN, + SEX_OTHER, + ]; + + static final $core.Map<$core.int, Sex> _byValue = $pb.ProtobufEnum.initByValue(values); + static Sex? valueOf($core.int value) => _byValue[value]; + + const Sex._($core.int v, $core.String n) : super(v, n); +} + +class BusType extends $pb.ProtobufEnum { + static const BusType BUS_TYPE_UNSPECIFIED = BusType._(0, _omitEnumNames ? '' : 'BUS_TYPE_UNSPECIFIED'); + static const BusType BUS_TYPE_MORNING = BusType._(1, _omitEnumNames ? '' : 'BUS_TYPE_MORNING'); + static const BusType BUS_TYPE_EVENING = BusType._(2, _omitEnumNames ? '' : 'BUS_TYPE_EVENING'); + + static const $core.List values = [ + BUS_TYPE_UNSPECIFIED, + BUS_TYPE_MORNING, + BUS_TYPE_EVENING, + ]; + + static final $core.Map<$core.int, BusType> _byValue = $pb.ProtobufEnum.initByValue(values); + static BusType? valueOf($core.int value) => _byValue[value]; + + const BusType._($core.int v, $core.String n) : super(v, n); +} + + +const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names'); diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/resources.pbjson.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/resources.pbjson.dart new file mode 100644 index 00000000..85a058b0 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/resources.pbjson.dart @@ -0,0 +1,338 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/resources.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use busStatusDescriptor instead') +const BusStatus$json = { + '1': 'BusStatus', + '2': [ + {'1': 'BUS_STATUS_UNSPECIFIED', '2': 0}, + {'1': 'BUS_STATUS_STOPPED', '2': 1}, + {'1': 'BUS_STATUS_RUNNING', '2': 2}, + {'1': 'BUS_STATUS_MAINTENANCE', '2': 3}, + ], +}; + +/// Descriptor for `BusStatus`. Decode as a `google.protobuf.EnumDescriptorProto`. +final $typed_data.Uint8List busStatusDescriptor = $convert.base64Decode( + 'CglCdXNTdGF0dXMSGgoWQlVTX1NUQVRVU19VTlNQRUNJRklFRBAAEhYKEkJVU19TVEFUVVNfU1' + 'RPUFBFRBABEhYKEkJVU19TVEFUVVNfUlVOTklORxACEhoKFkJVU19TVEFUVVNfTUFJTlRFTkFO' + 'Q0UQAw=='); + +@$core.Deprecated('Use vehicleEventDescriptor instead') +const VehicleEvent$json = { + '1': 'VehicleEvent', + '2': [ + {'1': 'VEHICLE_EVENT_UNSPECIFIED', '2': 0}, + {'1': 'VEHICLE_EVENT_GET_ON', '2': 1}, + {'1': 'VEHICLE_EVENT_GET_OFF', '2': 2}, + ], +}; + +/// Descriptor for `VehicleEvent`. Decode as a `google.protobuf.EnumDescriptorProto`. +final $typed_data.Uint8List vehicleEventDescriptor = $convert.base64Decode( + 'CgxWZWhpY2xlRXZlbnQSHQoZVkVISUNMRV9FVkVOVF9VTlNQRUNJRklFRBAAEhgKFFZFSElDTE' + 'VfRVZFTlRfR0VUX09OEAESGQoVVkVISUNMRV9FVkVOVF9HRVRfT0ZGEAI='); + +@$core.Deprecated('Use sexDescriptor instead') +const Sex$json = { + '1': 'Sex', + '2': [ + {'1': 'SEX_UNSPECIFIED', '2': 0}, + {'1': 'SEX_MAN', '2': 1}, + {'1': 'SEX_WOMAN', '2': 2}, + {'1': 'SEX_OTHER', '2': 3}, + ], +}; + +/// Descriptor for `Sex`. Decode as a `google.protobuf.EnumDescriptorProto`. +final $typed_data.Uint8List sexDescriptor = $convert.base64Decode( + 'CgNTZXgSEwoPU0VYX1VOU1BFQ0lGSUVEEAASCwoHU0VYX01BThABEg0KCVNFWF9XT01BThACEg' + '0KCVNFWF9PVEhFUhAD'); + +@$core.Deprecated('Use busTypeDescriptor instead') +const BusType$json = { + '1': 'BusType', + '2': [ + {'1': 'BUS_TYPE_UNSPECIFIED', '2': 0}, + {'1': 'BUS_TYPE_MORNING', '2': 1}, + {'1': 'BUS_TYPE_EVENING', '2': 2}, + ], +}; + +/// Descriptor for `BusType`. Decode as a `google.protobuf.EnumDescriptorProto`. +final $typed_data.Uint8List busTypeDescriptor = $convert.base64Decode( + 'CgdCdXNUeXBlEhgKFEJVU19UWVBFX1VOU1BFQ0lGSUVEEAASFAoQQlVTX1RZUEVfTU9STklORx' + 'ABEhQKEEJVU19UWVBFX0VWRU5JTkcQAg=='); + +@$core.Deprecated('Use nurseryDescriptor instead') +const Nursery$json = { + '1': 'Nursery', + '2': [ + {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, + {'1': 'nursery_code', '3': 2, '4': 1, '5': 9, '10': 'nurseryCode'}, + {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, + {'1': 'address', '3': 4, '4': 1, '5': 9, '10': 'address'}, + {'1': 'phone_number', '3': 5, '4': 1, '5': 9, '10': 'phoneNumber'}, + {'1': 'email', '3': 6, '4': 1, '5': 9, '10': 'email'}, + {'1': 'hashed_password', '3': 7, '4': 1, '5': 9, '10': 'hashedPassword'}, + {'1': 'created_at', '3': 8, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'createdAt'}, + {'1': 'updated_at', '3': 9, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'updatedAt'}, + ], +}; + +/// Descriptor for `Nursery`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List nurseryDescriptor = $convert.base64Decode( + 'CgdOdXJzZXJ5Eg4KAmlkGAEgASgJUgJpZBIhCgxudXJzZXJ5X2NvZGUYAiABKAlSC251cnNlcn' + 'lDb2RlEhIKBG5hbWUYAyABKAlSBG5hbWUSGAoHYWRkcmVzcxgEIAEoCVIHYWRkcmVzcxIhCgxw' + 'aG9uZV9udW1iZXIYBSABKAlSC3Bob25lTnVtYmVyEhQKBWVtYWlsGAYgASgJUgVlbWFpbBInCg' + '9oYXNoZWRfcGFzc3dvcmQYByABKAlSDmhhc2hlZFBhc3N3b3JkEjkKCmNyZWF0ZWRfYXQYCCAB' + 'KAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wUgljcmVhdGVkQXQSOQoKdXBkYXRlZF9hdB' + 'gJIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBSCXVwZGF0ZWRBdA=='); + +@$core.Deprecated('Use nurseryResponseDescriptor instead') +const NurseryResponse$json = { + '1': 'NurseryResponse', + '2': [ + {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, + {'1': 'nursery_code', '3': 2, '4': 1, '5': 9, '10': 'nurseryCode'}, + {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, + {'1': 'address', '3': 4, '4': 1, '5': 9, '10': 'address'}, + {'1': 'phone_number', '3': 5, '4': 1, '5': 9, '10': 'phoneNumber'}, + {'1': 'email', '3': 6, '4': 1, '5': 9, '10': 'email'}, + {'1': 'created_at', '3': 7, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'createdAt'}, + {'1': 'updated_at', '3': 8, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'updatedAt'}, + ], +}; + +/// Descriptor for `NurseryResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List nurseryResponseDescriptor = $convert.base64Decode( + 'Cg9OdXJzZXJ5UmVzcG9uc2USDgoCaWQYASABKAlSAmlkEiEKDG51cnNlcnlfY29kZRgCIAEoCV' + 'ILbnVyc2VyeUNvZGUSEgoEbmFtZRgDIAEoCVIEbmFtZRIYCgdhZGRyZXNzGAQgASgJUgdhZGRy' + 'ZXNzEiEKDHBob25lX251bWJlchgFIAEoCVILcGhvbmVOdW1iZXISFAoFZW1haWwYBiABKAlSBW' + 'VtYWlsEjkKCmNyZWF0ZWRfYXQYByABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wUglj' + 'cmVhdGVkQXQSOQoKdXBkYXRlZF9hdBgIIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbX' + 'BSCXVwZGF0ZWRBdA=='); + +@$core.Deprecated('Use guardianDescriptor instead') +const Guardian$json = { + '1': 'Guardian', + '2': [ + {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, + {'1': 'nursery_id', '3': 2, '4': 1, '5': 9, '10': 'nurseryId'}, + {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, + {'1': 'email', '3': 4, '4': 1, '5': 9, '10': 'email'}, + {'1': 'phone_number', '3': 5, '4': 1, '5': 9, '10': 'phoneNumber'}, + {'1': 'hashed_password', '3': 6, '4': 1, '5': 9, '10': 'hashedPassword'}, + {'1': 'is_use_morning_bus', '3': 7, '4': 1, '5': 8, '10': 'isUseMorningBus'}, + {'1': 'is_use_evening_bus', '3': 8, '4': 1, '5': 8, '10': 'isUseEveningBus'}, + {'1': 'created_at', '3': 9, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'createdAt'}, + {'1': 'updated_at', '3': 10, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'updatedAt'}, + ], +}; + +/// Descriptor for `Guardian`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List guardianDescriptor = $convert.base64Decode( + 'CghHdWFyZGlhbhIOCgJpZBgBIAEoCVICaWQSHQoKbnVyc2VyeV9pZBgCIAEoCVIJbnVyc2VyeU' + 'lkEhIKBG5hbWUYAyABKAlSBG5hbWUSFAoFZW1haWwYBCABKAlSBWVtYWlsEiEKDHBob25lX251' + 'bWJlchgFIAEoCVILcGhvbmVOdW1iZXISJwoPaGFzaGVkX3Bhc3N3b3JkGAYgASgJUg5oYXNoZW' + 'RQYXNzd29yZBIrChJpc191c2VfbW9ybmluZ19idXMYByABKAhSD2lzVXNlTW9ybmluZ0J1cxIr' + 'ChJpc191c2VfZXZlbmluZ19idXMYCCABKAhSD2lzVXNlRXZlbmluZ0J1cxI5CgpjcmVhdGVkX2' + 'F0GAkgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcFIJY3JlYXRlZEF0EjkKCnVwZGF0' + 'ZWRfYXQYCiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wUgl1cGRhdGVkQXQ='); + +@$core.Deprecated('Use guardianResponseDescriptor instead') +const GuardianResponse$json = { + '1': 'GuardianResponse', + '2': [ + {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, + {'1': 'nursery_id', '3': 2, '4': 1, '5': 9, '10': 'nurseryId'}, + {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, + {'1': 'email', '3': 4, '4': 1, '5': 9, '10': 'email'}, + {'1': 'phone_number', '3': 5, '4': 1, '5': 9, '10': 'phoneNumber'}, + {'1': 'is_use_morning_bus', '3': 6, '4': 1, '5': 8, '10': 'isUseMorningBus'}, + {'1': 'is_use_evening_bus', '3': 7, '4': 1, '5': 8, '10': 'isUseEveningBus'}, + {'1': 'created_at', '3': 8, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'createdAt'}, + {'1': 'updated_at', '3': 9, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'updatedAt'}, + ], +}; + +/// Descriptor for `GuardianResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List guardianResponseDescriptor = $convert.base64Decode( + 'ChBHdWFyZGlhblJlc3BvbnNlEg4KAmlkGAEgASgJUgJpZBIdCgpudXJzZXJ5X2lkGAIgASgJUg' + 'ludXJzZXJ5SWQSEgoEbmFtZRgDIAEoCVIEbmFtZRIUCgVlbWFpbBgEIAEoCVIFZW1haWwSIQoM' + 'cGhvbmVfbnVtYmVyGAUgASgJUgtwaG9uZU51bWJlchIrChJpc191c2VfbW9ybmluZ19idXMYBi' + 'ABKAhSD2lzVXNlTW9ybmluZ0J1cxIrChJpc191c2VfZXZlbmluZ19idXMYByABKAhSD2lzVXNl' + 'RXZlbmluZ0J1cxI5CgpjcmVhdGVkX2F0GAggASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdG' + 'FtcFIJY3JlYXRlZEF0EjkKCnVwZGF0ZWRfYXQYCSABKAsyGi5nb29nbGUucHJvdG9idWYuVGlt' + 'ZXN0YW1wUgl1cGRhdGVkQXQ='); + +@$core.Deprecated('Use busDescriptor instead') +const Bus$json = { + '1': 'Bus', + '2': [ + {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, + {'1': 'nursery_id', '3': 2, '4': 1, '5': 9, '10': 'nurseryId'}, + {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, + {'1': 'plate_number', '3': 4, '4': 1, '5': 9, '10': 'plateNumber'}, + {'1': 'bus_status', '3': 5, '4': 1, '5': 14, '6': '.where_child_bus.v1.BusStatus', '10': 'busStatus'}, + {'1': 'latitude', '3': 6, '4': 1, '5': 1, '10': 'latitude'}, + {'1': 'longitude', '3': 7, '4': 1, '5': 1, '10': 'longitude'}, + {'1': 'enable_face_recognition', '3': 8, '4': 1, '5': 8, '10': 'enableFaceRecognition'}, + {'1': 'next_station_id', '3': 11, '4': 1, '5': 9, '10': 'nextStationId'}, + {'1': 'latest_morning_route_id', '3': 14, '4': 1, '5': 9, '10': 'latestMorningRouteId'}, + {'1': 'latest_evening_route_id', '3': 15, '4': 1, '5': 9, '10': 'latestEveningRouteId'}, + {'1': 'created_at', '3': 12, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'createdAt'}, + {'1': 'updated_at', '3': 13, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'updatedAt'}, + ], +}; + +/// Descriptor for `Bus`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List busDescriptor = $convert.base64Decode( + 'CgNCdXMSDgoCaWQYASABKAlSAmlkEh0KCm51cnNlcnlfaWQYAiABKAlSCW51cnNlcnlJZBISCg' + 'RuYW1lGAMgASgJUgRuYW1lEiEKDHBsYXRlX251bWJlchgEIAEoCVILcGxhdGVOdW1iZXISPAoK' + 'YnVzX3N0YXR1cxgFIAEoDjIdLndoZXJlX2NoaWxkX2J1cy52MS5CdXNTdGF0dXNSCWJ1c1N0YX' + 'R1cxIaCghsYXRpdHVkZRgGIAEoAVIIbGF0aXR1ZGUSHAoJbG9uZ2l0dWRlGAcgASgBUglsb25n' + 'aXR1ZGUSNgoXZW5hYmxlX2ZhY2VfcmVjb2duaXRpb24YCCABKAhSFWVuYWJsZUZhY2VSZWNvZ2' + '5pdGlvbhImCg9uZXh0X3N0YXRpb25faWQYCyABKAlSDW5leHRTdGF0aW9uSWQSNQoXbGF0ZXN0' + 'X21vcm5pbmdfcm91dGVfaWQYDiABKAlSFGxhdGVzdE1vcm5pbmdSb3V0ZUlkEjUKF2xhdGVzdF' + '9ldmVuaW5nX3JvdXRlX2lkGA8gASgJUhRsYXRlc3RFdmVuaW5nUm91dGVJZBI5CgpjcmVhdGVk' + 'X2F0GAwgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcFIJY3JlYXRlZEF0EjkKCnVwZG' + 'F0ZWRfYXQYDSABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wUgl1cGRhdGVkQXQ='); + +@$core.Deprecated('Use childDescriptor instead') +const Child$json = { + '1': 'Child', + '2': [ + {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, + {'1': 'nursery_id', '3': 2, '4': 1, '5': 9, '10': 'nurseryId'}, + {'1': 'guardian_id', '3': 3, '4': 1, '5': 9, '10': 'guardianId'}, + {'1': 'name', '3': 4, '4': 1, '5': 9, '10': 'name'}, + {'1': 'age', '3': 5, '4': 1, '5': 5, '10': 'age'}, + {'1': 'sex', '3': 6, '4': 1, '5': 14, '6': '.where_child_bus.v1.Sex', '10': 'sex'}, + {'1': 'check_for_missing_items', '3': 7, '4': 1, '5': 8, '10': 'checkForMissingItems'}, + {'1': 'has_bag', '3': 8, '4': 1, '5': 8, '10': 'hasBag'}, + {'1': 'has_lunch_box', '3': 9, '4': 1, '5': 8, '10': 'hasLunchBox'}, + {'1': 'has_water_bottle', '3': 10, '4': 1, '5': 8, '10': 'hasWaterBottle'}, + {'1': 'has_umbrella', '3': 11, '4': 1, '5': 8, '10': 'hasUmbrella'}, + {'1': 'has_other', '3': 12, '4': 1, '5': 8, '10': 'hasOther'}, + {'1': 'created_at', '3': 13, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'createdAt'}, + {'1': 'updated_at', '3': 14, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'updatedAt'}, + ], +}; + +/// Descriptor for `Child`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List childDescriptor = $convert.base64Decode( + 'CgVDaGlsZBIOCgJpZBgBIAEoCVICaWQSHQoKbnVyc2VyeV9pZBgCIAEoCVIJbnVyc2VyeUlkEh' + '8KC2d1YXJkaWFuX2lkGAMgASgJUgpndWFyZGlhbklkEhIKBG5hbWUYBCABKAlSBG5hbWUSEAoD' + 'YWdlGAUgASgFUgNhZ2USKQoDc2V4GAYgASgOMhcud2hlcmVfY2hpbGRfYnVzLnYxLlNleFIDc2' + 'V4EjUKF2NoZWNrX2Zvcl9taXNzaW5nX2l0ZW1zGAcgASgIUhRjaGVja0Zvck1pc3NpbmdJdGVt' + 'cxIXCgdoYXNfYmFnGAggASgIUgZoYXNCYWcSIgoNaGFzX2x1bmNoX2JveBgJIAEoCFILaGFzTH' + 'VuY2hCb3gSKAoQaGFzX3dhdGVyX2JvdHRsZRgKIAEoCFIOaGFzV2F0ZXJCb3R0bGUSIQoMaGFz' + 'X3VtYnJlbGxhGAsgASgIUgtoYXNVbWJyZWxsYRIbCgloYXNfb3RoZXIYDCABKAhSCGhhc090aG' + 'VyEjkKCmNyZWF0ZWRfYXQYDSABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wUgljcmVh' + 'dGVkQXQSOQoKdXBkYXRlZF9hdBgOIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBSCX' + 'VwZGF0ZWRBdA=='); + +@$core.Deprecated('Use stationDescriptor instead') +const Station$json = { + '1': 'Station', + '2': [ + {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, + {'1': 'guardian_id', '3': 2, '4': 1, '5': 9, '10': 'guardianId'}, + {'1': 'latitude', '3': 5, '4': 1, '5': 1, '10': 'latitude'}, + {'1': 'longitude', '3': 6, '4': 1, '5': 1, '10': 'longitude'}, + {'1': 'created_at', '3': 7, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'createdAt'}, + {'1': 'updated_at', '3': 8, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'updatedAt'}, + ], +}; + +/// Descriptor for `Station`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List stationDescriptor = $convert.base64Decode( + 'CgdTdGF0aW9uEg4KAmlkGAEgASgJUgJpZBIfCgtndWFyZGlhbl9pZBgCIAEoCVIKZ3VhcmRpYW' + '5JZBIaCghsYXRpdHVkZRgFIAEoAVIIbGF0aXR1ZGUSHAoJbG9uZ2l0dWRlGAYgASgBUglsb25n' + 'aXR1ZGUSOQoKY3JlYXRlZF9hdBgHIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBSCW' + 'NyZWF0ZWRBdBI5Cgp1cGRhdGVkX2F0GAggASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFt' + 'cFIJdXBkYXRlZEF0'); + +@$core.Deprecated('Use childBusAssociationDescriptor instead') +const ChildBusAssociation$json = { + '1': 'ChildBusAssociation', + '2': [ + {'1': 'bus_route_id', '3': 1, '4': 1, '5': 9, '10': 'busRouteId'}, + {'1': 'child_id', '3': 2, '4': 1, '5': 9, '10': 'childId'}, + ], +}; + +/// Descriptor for `ChildBusAssociation`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List childBusAssociationDescriptor = $convert.base64Decode( + 'ChNDaGlsZEJ1c0Fzc29jaWF0aW9uEiAKDGJ1c19yb3V0ZV9pZBgBIAEoCVIKYnVzUm91dGVJZB' + 'IZCghjaGlsZF9pZBgCIAEoCVIHY2hpbGRJZA=='); + +@$core.Deprecated('Use childPhotoDescriptor instead') +const ChildPhoto$json = { + '1': 'ChildPhoto', + '2': [ + {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, + {'1': 'child_id', '3': 2, '4': 1, '5': 9, '10': 'childId'}, + {'1': 'photo_data', '3': 3, '4': 1, '5': 12, '10': 'photoData'}, + {'1': 'created_at', '3': 4, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'createdAt'}, + {'1': 'updated_at', '3': 5, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'updatedAt'}, + ], +}; + +/// Descriptor for `ChildPhoto`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List childPhotoDescriptor = $convert.base64Decode( + 'CgpDaGlsZFBob3RvEg4KAmlkGAEgASgJUgJpZBIZCghjaGlsZF9pZBgCIAEoCVIHY2hpbGRJZB' + 'IdCgpwaG90b19kYXRhGAMgASgMUglwaG90b0RhdGESOQoKY3JlYXRlZF9hdBgEIAEoCzIaLmdv' + 'b2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBSCWNyZWF0ZWRBdBI5Cgp1cGRhdGVkX2F0GAUgASgLMh' + 'ouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcFIJdXBkYXRlZEF0'); + +@$core.Deprecated('Use boardingRecordDescriptor instead') +const BoardingRecord$json = { + '1': 'BoardingRecord', + '2': [ + {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, + {'1': 'child_id', '3': 2, '4': 1, '5': 9, '10': 'childId'}, + {'1': 'bus_id', '3': 3, '4': 1, '5': 9, '10': 'busId'}, + {'1': 'is_boarding', '3': 4, '4': 1, '5': 8, '10': 'isBoarding'}, + {'1': 'timestamp', '3': 5, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'timestamp'}, + ], +}; + +/// Descriptor for `BoardingRecord`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List boardingRecordDescriptor = $convert.base64Decode( + 'Cg5Cb2FyZGluZ1JlY29yZBIOCgJpZBgBIAEoCVICaWQSGQoIY2hpbGRfaWQYAiABKAlSB2NoaW' + 'xkSWQSFQoGYnVzX2lkGAMgASgJUgVidXNJZBIfCgtpc19ib2FyZGluZxgEIAEoCFIKaXNCb2Fy' + 'ZGluZxI4Cgl0aW1lc3RhbXAYBSABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wUgl0aW' + '1lc3RhbXA='); + +@$core.Deprecated('Use busRouteDescriptor instead') +const BusRoute$json = { + '1': 'BusRoute', + '2': [ + {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, + {'1': 'bus_id', '3': 2, '4': 1, '5': 9, '10': 'busId'}, + {'1': 'ordered_stations', '3': 3, '4': 3, '5': 11, '6': '.where_child_bus.v1.Station', '10': 'orderedStations'}, + {'1': 'bus_type', '3': 4, '4': 1, '5': 14, '6': '.where_child_bus.v1.BusType', '10': 'busType'}, + ], +}; + +/// Descriptor for `BusRoute`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List busRouteDescriptor = $convert.base64Decode( + 'CghCdXNSb3V0ZRIOCgJpZBgBIAEoCVICaWQSFQoGYnVzX2lkGAIgASgJUgVidXNJZBJGChBvcm' + 'RlcmVkX3N0YXRpb25zGAMgAygLMhsud2hlcmVfY2hpbGRfYnVzLnYxLlN0YXRpb25SD29yZGVy' + 'ZWRTdGF0aW9ucxI2CghidXNfdHlwZRgEIAEoDjIbLndoZXJlX2NoaWxkX2J1cy52MS5CdXNUeX' + 'BlUgdidXNUeXBl'); + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/resources.pbserver.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/resources.pbserver.dart new file mode 100644 index 00000000..39e55a87 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/resources.pbserver.dart @@ -0,0 +1,14 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/resources.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +export 'resources.pb.dart'; + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/station.pb.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/station.pb.dart new file mode 100644 index 00000000..60fb54a6 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/station.pb.dart @@ -0,0 +1,648 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/station.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +import '../../google/protobuf/field_mask.pb.dart' as $10; +import 'resources.pb.dart' as $9; +import 'resources.pbenum.dart' as $9; + +class UpdateStationLocationByGuardianIdRequest extends $pb.GeneratedMessage { + factory UpdateStationLocationByGuardianIdRequest({ + $core.String? guardianId, + $core.double? longitude, + $core.double? latitude, + }) { + final $result = create(); + if (guardianId != null) { + $result.guardianId = guardianId; + } + if (longitude != null) { + $result.longitude = longitude; + } + if (latitude != null) { + $result.latitude = latitude; + } + return $result; + } + UpdateStationLocationByGuardianIdRequest._() : super(); + factory UpdateStationLocationByGuardianIdRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory UpdateStationLocationByGuardianIdRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'UpdateStationLocationByGuardianIdRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'guardianId') + ..a<$core.double>(2, _omitFieldNames ? '' : 'longitude', $pb.PbFieldType.OD) + ..a<$core.double>(3, _omitFieldNames ? '' : 'latitude', $pb.PbFieldType.OD) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + UpdateStationLocationByGuardianIdRequest clone() => UpdateStationLocationByGuardianIdRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + UpdateStationLocationByGuardianIdRequest copyWith(void Function(UpdateStationLocationByGuardianIdRequest) updates) => super.copyWith((message) => updates(message as UpdateStationLocationByGuardianIdRequest)) as UpdateStationLocationByGuardianIdRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static UpdateStationLocationByGuardianIdRequest create() => UpdateStationLocationByGuardianIdRequest._(); + UpdateStationLocationByGuardianIdRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static UpdateStationLocationByGuardianIdRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static UpdateStationLocationByGuardianIdRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get guardianId => $_getSZ(0); + @$pb.TagNumber(1) + set guardianId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGuardianId() => $_has(0); + @$pb.TagNumber(1) + void clearGuardianId() => clearField(1); + + @$pb.TagNumber(2) + $core.double get longitude => $_getN(1); + @$pb.TagNumber(2) + set longitude($core.double v) { $_setDouble(1, v); } + @$pb.TagNumber(2) + $core.bool hasLongitude() => $_has(1); + @$pb.TagNumber(2) + void clearLongitude() => clearField(2); + + @$pb.TagNumber(3) + $core.double get latitude => $_getN(2); + @$pb.TagNumber(3) + set latitude($core.double v) { $_setDouble(2, v); } + @$pb.TagNumber(3) + $core.bool hasLatitude() => $_has(2); + @$pb.TagNumber(3) + void clearLatitude() => clearField(3); +} + +class UpdateStationLocationByGuardianIdResponse extends $pb.GeneratedMessage { + factory UpdateStationLocationByGuardianIdResponse({ + $9.Station? station, + }) { + final $result = create(); + if (station != null) { + $result.station = station; + } + return $result; + } + UpdateStationLocationByGuardianIdResponse._() : super(); + factory UpdateStationLocationByGuardianIdResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory UpdateStationLocationByGuardianIdResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'UpdateStationLocationByGuardianIdResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.Station>(1, _omitFieldNames ? '' : 'station', subBuilder: $9.Station.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + UpdateStationLocationByGuardianIdResponse clone() => UpdateStationLocationByGuardianIdResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + UpdateStationLocationByGuardianIdResponse copyWith(void Function(UpdateStationLocationByGuardianIdResponse) updates) => super.copyWith((message) => updates(message as UpdateStationLocationByGuardianIdResponse)) as UpdateStationLocationByGuardianIdResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static UpdateStationLocationByGuardianIdResponse create() => UpdateStationLocationByGuardianIdResponse._(); + UpdateStationLocationByGuardianIdResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static UpdateStationLocationByGuardianIdResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static UpdateStationLocationByGuardianIdResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.Station get station => $_getN(0); + @$pb.TagNumber(1) + set station($9.Station v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasStation() => $_has(0); + @$pb.TagNumber(1) + void clearStation() => clearField(1); + @$pb.TagNumber(1) + $9.Station ensureStation() => $_ensure(0); +} + +class GetStationListByBusIdRequest extends $pb.GeneratedMessage { + factory GetStationListByBusIdRequest({ + $core.String? busId, + }) { + final $result = create(); + if (busId != null) { + $result.busId = busId; + } + return $result; + } + GetStationListByBusIdRequest._() : super(); + factory GetStationListByBusIdRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetStationListByBusIdRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetStationListByBusIdRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'busId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetStationListByBusIdRequest clone() => GetStationListByBusIdRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetStationListByBusIdRequest copyWith(void Function(GetStationListByBusIdRequest) updates) => super.copyWith((message) => updates(message as GetStationListByBusIdRequest)) as GetStationListByBusIdRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetStationListByBusIdRequest create() => GetStationListByBusIdRequest._(); + GetStationListByBusIdRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetStationListByBusIdRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetStationListByBusIdRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get busId => $_getSZ(0); + @$pb.TagNumber(1) + set busId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasBusId() => $_has(0); + @$pb.TagNumber(1) + void clearBusId() => clearField(1); +} + +class GetStationListByBusIdResponse extends $pb.GeneratedMessage { + factory GetStationListByBusIdResponse({ + $core.Iterable<$9.Station>? stations, + $core.Iterable<$9.GuardianResponse>? guardians, + $core.Iterable<$9.Child>? children, + $core.Iterable<$9.ChildPhoto>? photos, + }) { + final $result = create(); + if (stations != null) { + $result.stations.addAll(stations); + } + if (guardians != null) { + $result.guardians.addAll(guardians); + } + if (children != null) { + $result.children.addAll(children); + } + if (photos != null) { + $result.photos.addAll(photos); + } + return $result; + } + GetStationListByBusIdResponse._() : super(); + factory GetStationListByBusIdResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetStationListByBusIdResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetStationListByBusIdResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..pc<$9.Station>(1, _omitFieldNames ? '' : 'stations', $pb.PbFieldType.PM, subBuilder: $9.Station.create) + ..pc<$9.GuardianResponse>(2, _omitFieldNames ? '' : 'guardians', $pb.PbFieldType.PM, subBuilder: $9.GuardianResponse.create) + ..pc<$9.Child>(3, _omitFieldNames ? '' : 'children', $pb.PbFieldType.PM, subBuilder: $9.Child.create) + ..pc<$9.ChildPhoto>(4, _omitFieldNames ? '' : 'photos', $pb.PbFieldType.PM, subBuilder: $9.ChildPhoto.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetStationListByBusIdResponse clone() => GetStationListByBusIdResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetStationListByBusIdResponse copyWith(void Function(GetStationListByBusIdResponse) updates) => super.copyWith((message) => updates(message as GetStationListByBusIdResponse)) as GetStationListByBusIdResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetStationListByBusIdResponse create() => GetStationListByBusIdResponse._(); + GetStationListByBusIdResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetStationListByBusIdResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetStationListByBusIdResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.List<$9.Station> get stations => $_getList(0); + + @$pb.TagNumber(2) + $core.List<$9.GuardianResponse> get guardians => $_getList(1); + + @$pb.TagNumber(3) + $core.List<$9.Child> get children => $_getList(2); + + @$pb.TagNumber(4) + $core.List<$9.ChildPhoto> get photos => $_getList(3); +} + +class GetUnregisteredStationListRequest extends $pb.GeneratedMessage { + factory GetUnregisteredStationListRequest({ + $core.String? busId, + }) { + final $result = create(); + if (busId != null) { + $result.busId = busId; + } + return $result; + } + GetUnregisteredStationListRequest._() : super(); + factory GetUnregisteredStationListRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetUnregisteredStationListRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetUnregisteredStationListRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'busId') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetUnregisteredStationListRequest clone() => GetUnregisteredStationListRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetUnregisteredStationListRequest copyWith(void Function(GetUnregisteredStationListRequest) updates) => super.copyWith((message) => updates(message as GetUnregisteredStationListRequest)) as GetUnregisteredStationListRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetUnregisteredStationListRequest create() => GetUnregisteredStationListRequest._(); + GetUnregisteredStationListRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetUnregisteredStationListRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetUnregisteredStationListRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get busId => $_getSZ(0); + @$pb.TagNumber(1) + set busId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasBusId() => $_has(0); + @$pb.TagNumber(1) + void clearBusId() => clearField(1); +} + +class GetUnregisteredStationListResponse extends $pb.GeneratedMessage { + factory GetUnregisteredStationListResponse({ + $core.Iterable<$9.Station>? stations, + $core.Iterable<$9.GuardianResponse>? guardians, + }) { + final $result = create(); + if (stations != null) { + $result.stations.addAll(stations); + } + if (guardians != null) { + $result.guardians.addAll(guardians); + } + return $result; + } + GetUnregisteredStationListResponse._() : super(); + factory GetUnregisteredStationListResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetUnregisteredStationListResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetUnregisteredStationListResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..pc<$9.Station>(1, _omitFieldNames ? '' : 'stations', $pb.PbFieldType.PM, subBuilder: $9.Station.create) + ..pc<$9.GuardianResponse>(2, _omitFieldNames ? '' : 'guardians', $pb.PbFieldType.PM, subBuilder: $9.GuardianResponse.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetUnregisteredStationListResponse clone() => GetUnregisteredStationListResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetUnregisteredStationListResponse copyWith(void Function(GetUnregisteredStationListResponse) updates) => super.copyWith((message) => updates(message as GetUnregisteredStationListResponse)) as GetUnregisteredStationListResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetUnregisteredStationListResponse create() => GetUnregisteredStationListResponse._(); + GetUnregisteredStationListResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetUnregisteredStationListResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetUnregisteredStationListResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.List<$9.Station> get stations => $_getList(0); + + @$pb.TagNumber(2) + $core.List<$9.GuardianResponse> get guardians => $_getList(1); +} + +class GetCorrectOrderStationListByBusIdRequest extends $pb.GeneratedMessage { + factory GetCorrectOrderStationListByBusIdRequest({ + $core.String? busId, + $9.BusType? busType, + }) { + final $result = create(); + if (busId != null) { + $result.busId = busId; + } + if (busType != null) { + $result.busType = busType; + } + return $result; + } + GetCorrectOrderStationListByBusIdRequest._() : super(); + factory GetCorrectOrderStationListByBusIdRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetCorrectOrderStationListByBusIdRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetCorrectOrderStationListByBusIdRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'busId') + ..e<$9.BusType>(2, _omitFieldNames ? '' : 'busType', $pb.PbFieldType.OE, defaultOrMaker: $9.BusType.BUS_TYPE_UNSPECIFIED, valueOf: $9.BusType.valueOf, enumValues: $9.BusType.values) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetCorrectOrderStationListByBusIdRequest clone() => GetCorrectOrderStationListByBusIdRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetCorrectOrderStationListByBusIdRequest copyWith(void Function(GetCorrectOrderStationListByBusIdRequest) updates) => super.copyWith((message) => updates(message as GetCorrectOrderStationListByBusIdRequest)) as GetCorrectOrderStationListByBusIdRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetCorrectOrderStationListByBusIdRequest create() => GetCorrectOrderStationListByBusIdRequest._(); + GetCorrectOrderStationListByBusIdRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetCorrectOrderStationListByBusIdRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetCorrectOrderStationListByBusIdRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get busId => $_getSZ(0); + @$pb.TagNumber(1) + set busId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasBusId() => $_has(0); + @$pb.TagNumber(1) + void clearBusId() => clearField(1); + + @$pb.TagNumber(2) + $9.BusType get busType => $_getN(1); + @$pb.TagNumber(2) + set busType($9.BusType v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasBusType() => $_has(1); + @$pb.TagNumber(2) + void clearBusType() => clearField(2); +} + +class GetCorrectOrderStationListByBusIdResponse extends $pb.GeneratedMessage { + factory GetCorrectOrderStationListByBusIdResponse({ + $9.BusRoute? busRoute, + }) { + final $result = create(); + if (busRoute != null) { + $result.busRoute = busRoute; + } + return $result; + } + GetCorrectOrderStationListByBusIdResponse._() : super(); + factory GetCorrectOrderStationListByBusIdResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetCorrectOrderStationListByBusIdResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetCorrectOrderStationListByBusIdResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.BusRoute>(1, _omitFieldNames ? '' : 'busRoute', subBuilder: $9.BusRoute.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetCorrectOrderStationListByBusIdResponse clone() => GetCorrectOrderStationListByBusIdResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetCorrectOrderStationListByBusIdResponse copyWith(void Function(GetCorrectOrderStationListByBusIdResponse) updates) => super.copyWith((message) => updates(message as GetCorrectOrderStationListByBusIdResponse)) as GetCorrectOrderStationListByBusIdResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetCorrectOrderStationListByBusIdResponse create() => GetCorrectOrderStationListByBusIdResponse._(); + GetCorrectOrderStationListByBusIdResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetCorrectOrderStationListByBusIdResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetCorrectOrderStationListByBusIdResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.BusRoute get busRoute => $_getN(0); + @$pb.TagNumber(1) + set busRoute($9.BusRoute v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasBusRoute() => $_has(0); + @$pb.TagNumber(1) + void clearBusRoute() => clearField(1); + @$pb.TagNumber(1) + $9.BusRoute ensureBusRoute() => $_ensure(0); +} + +class UpdateStationRequest extends $pb.GeneratedMessage { + factory UpdateStationRequest({ + $core.String? id, + $core.String? busId, + $core.double? latitude, + $core.double? longitude, + $10.FieldMask? updateMask, + }) { + final $result = create(); + if (id != null) { + $result.id = id; + } + if (busId != null) { + $result.busId = busId; + } + if (latitude != null) { + $result.latitude = latitude; + } + if (longitude != null) { + $result.longitude = longitude; + } + if (updateMask != null) { + $result.updateMask = updateMask; + } + return $result; + } + UpdateStationRequest._() : super(); + factory UpdateStationRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory UpdateStationRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'UpdateStationRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'id') + ..aOS(2, _omitFieldNames ? '' : 'busId') + ..a<$core.double>(3, _omitFieldNames ? '' : 'latitude', $pb.PbFieldType.OD) + ..a<$core.double>(4, _omitFieldNames ? '' : 'longitude', $pb.PbFieldType.OD) + ..aOM<$10.FieldMask>(5, _omitFieldNames ? '' : 'updateMask', subBuilder: $10.FieldMask.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + UpdateStationRequest clone() => UpdateStationRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + UpdateStationRequest copyWith(void Function(UpdateStationRequest) updates) => super.copyWith((message) => updates(message as UpdateStationRequest)) as UpdateStationRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static UpdateStationRequest create() => UpdateStationRequest._(); + UpdateStationRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static UpdateStationRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static UpdateStationRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get id => $_getSZ(0); + @$pb.TagNumber(1) + set id($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get busId => $_getSZ(1); + @$pb.TagNumber(2) + set busId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasBusId() => $_has(1); + @$pb.TagNumber(2) + void clearBusId() => clearField(2); + + @$pb.TagNumber(3) + $core.double get latitude => $_getN(2); + @$pb.TagNumber(3) + set latitude($core.double v) { $_setDouble(2, v); } + @$pb.TagNumber(3) + $core.bool hasLatitude() => $_has(2); + @$pb.TagNumber(3) + void clearLatitude() => clearField(3); + + @$pb.TagNumber(4) + $core.double get longitude => $_getN(3); + @$pb.TagNumber(4) + set longitude($core.double v) { $_setDouble(3, v); } + @$pb.TagNumber(4) + $core.bool hasLongitude() => $_has(3); + @$pb.TagNumber(4) + void clearLongitude() => clearField(4); + + @$pb.TagNumber(5) + $10.FieldMask get updateMask => $_getN(4); + @$pb.TagNumber(5) + set updateMask($10.FieldMask v) { setField(5, v); } + @$pb.TagNumber(5) + $core.bool hasUpdateMask() => $_has(4); + @$pb.TagNumber(5) + void clearUpdateMask() => clearField(5); + @$pb.TagNumber(5) + $10.FieldMask ensureUpdateMask() => $_ensure(4); +} + +class UpdateStationResponse extends $pb.GeneratedMessage { + factory UpdateStationResponse({ + $9.Station? station, + }) { + final $result = create(); + if (station != null) { + $result.station = station; + } + return $result; + } + UpdateStationResponse._() : super(); + factory UpdateStationResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory UpdateStationResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'UpdateStationResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'where_child_bus.v1'), createEmptyInstance: create) + ..aOM<$9.Station>(1, _omitFieldNames ? '' : 'station', subBuilder: $9.Station.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + UpdateStationResponse clone() => UpdateStationResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + UpdateStationResponse copyWith(void Function(UpdateStationResponse) updates) => super.copyWith((message) => updates(message as UpdateStationResponse)) as UpdateStationResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static UpdateStationResponse create() => UpdateStationResponse._(); + UpdateStationResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static UpdateStationResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static UpdateStationResponse? _defaultInstance; + + @$pb.TagNumber(1) + $9.Station get station => $_getN(0); + @$pb.TagNumber(1) + set station($9.Station v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasStation() => $_has(0); + @$pb.TagNumber(1) + void clearStation() => clearField(1); + @$pb.TagNumber(1) + $9.Station ensureStation() => $_ensure(0); +} + + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/station.pbenum.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/station.pbenum.dart new file mode 100644 index 00000000..ff272db7 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/station.pbenum.dart @@ -0,0 +1,11 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/station.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/station.pbgrpc.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/station.pbgrpc.dart new file mode 100644 index 00000000..a3703cd5 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/station.pbgrpc.dart @@ -0,0 +1,119 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/station.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:async' as $async; +import 'dart:core' as $core; + +import 'package:grpc/service_api.dart' as $grpc; +import 'package:protobuf/protobuf.dart' as $pb; + +import 'station.pb.dart' as $7; + +export 'station.pb.dart'; + +@$pb.GrpcServiceName('where_child_bus.v1.StationService') +class StationServiceClient extends $grpc.Client { + static final _$updateStationLocationByGuardianId = $grpc.ClientMethod<$7.UpdateStationLocationByGuardianIdRequest, $7.UpdateStationLocationByGuardianIdResponse>( + '/where_child_bus.v1.StationService/UpdateStationLocationByGuardianId', + ($7.UpdateStationLocationByGuardianIdRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $7.UpdateStationLocationByGuardianIdResponse.fromBuffer(value)); + static final _$getStationListByBusId = $grpc.ClientMethod<$7.GetStationListByBusIdRequest, $7.GetStationListByBusIdResponse>( + '/where_child_bus.v1.StationService/GetStationListByBusId', + ($7.GetStationListByBusIdRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $7.GetStationListByBusIdResponse.fromBuffer(value)); + static final _$getUnregisteredStationList = $grpc.ClientMethod<$7.GetUnregisteredStationListRequest, $7.GetUnregisteredStationListResponse>( + '/where_child_bus.v1.StationService/GetUnregisteredStationList', + ($7.GetUnregisteredStationListRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $7.GetUnregisteredStationListResponse.fromBuffer(value)); + static final _$updateStation = $grpc.ClientMethod<$7.UpdateStationRequest, $7.UpdateStationResponse>( + '/where_child_bus.v1.StationService/UpdateStation', + ($7.UpdateStationRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $7.UpdateStationResponse.fromBuffer(value)); + + StationServiceClient($grpc.ClientChannel channel, + {$grpc.CallOptions? options, + $core.Iterable<$grpc.ClientInterceptor>? interceptors}) + : super(channel, options: options, + interceptors: interceptors); + + $grpc.ResponseFuture<$7.UpdateStationLocationByGuardianIdResponse> updateStationLocationByGuardianId($7.UpdateStationLocationByGuardianIdRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$updateStationLocationByGuardianId, request, options: options); + } + + $grpc.ResponseFuture<$7.GetStationListByBusIdResponse> getStationListByBusId($7.GetStationListByBusIdRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getStationListByBusId, request, options: options); + } + + $grpc.ResponseFuture<$7.GetUnregisteredStationListResponse> getUnregisteredStationList($7.GetUnregisteredStationListRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getUnregisteredStationList, request, options: options); + } + + $grpc.ResponseFuture<$7.UpdateStationResponse> updateStation($7.UpdateStationRequest request, {$grpc.CallOptions? options}) { + return $createUnaryCall(_$updateStation, request, options: options); + } +} + +@$pb.GrpcServiceName('where_child_bus.v1.StationService') +abstract class StationServiceBase extends $grpc.Service { + $core.String get $name => 'where_child_bus.v1.StationService'; + + StationServiceBase() { + $addMethod($grpc.ServiceMethod<$7.UpdateStationLocationByGuardianIdRequest, $7.UpdateStationLocationByGuardianIdResponse>( + 'UpdateStationLocationByGuardianId', + updateStationLocationByGuardianId_Pre, + false, + false, + ($core.List<$core.int> value) => $7.UpdateStationLocationByGuardianIdRequest.fromBuffer(value), + ($7.UpdateStationLocationByGuardianIdResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$7.GetStationListByBusIdRequest, $7.GetStationListByBusIdResponse>( + 'GetStationListByBusId', + getStationListByBusId_Pre, + false, + false, + ($core.List<$core.int> value) => $7.GetStationListByBusIdRequest.fromBuffer(value), + ($7.GetStationListByBusIdResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$7.GetUnregisteredStationListRequest, $7.GetUnregisteredStationListResponse>( + 'GetUnregisteredStationList', + getUnregisteredStationList_Pre, + false, + false, + ($core.List<$core.int> value) => $7.GetUnregisteredStationListRequest.fromBuffer(value), + ($7.GetUnregisteredStationListResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$7.UpdateStationRequest, $7.UpdateStationResponse>( + 'UpdateStation', + updateStation_Pre, + false, + false, + ($core.List<$core.int> value) => $7.UpdateStationRequest.fromBuffer(value), + ($7.UpdateStationResponse value) => value.writeToBuffer())); + } + + $async.Future<$7.UpdateStationLocationByGuardianIdResponse> updateStationLocationByGuardianId_Pre($grpc.ServiceCall call, $async.Future<$7.UpdateStationLocationByGuardianIdRequest> request) async { + return updateStationLocationByGuardianId(call, await request); + } + + $async.Future<$7.GetStationListByBusIdResponse> getStationListByBusId_Pre($grpc.ServiceCall call, $async.Future<$7.GetStationListByBusIdRequest> request) async { + return getStationListByBusId(call, await request); + } + + $async.Future<$7.GetUnregisteredStationListResponse> getUnregisteredStationList_Pre($grpc.ServiceCall call, $async.Future<$7.GetUnregisteredStationListRequest> request) async { + return getUnregisteredStationList(call, await request); + } + + $async.Future<$7.UpdateStationResponse> updateStation_Pre($grpc.ServiceCall call, $async.Future<$7.UpdateStationRequest> request) async { + return updateStation(call, await request); + } + + $async.Future<$7.UpdateStationLocationByGuardianIdResponse> updateStationLocationByGuardianId($grpc.ServiceCall call, $7.UpdateStationLocationByGuardianIdRequest request); + $async.Future<$7.GetStationListByBusIdResponse> getStationListByBusId($grpc.ServiceCall call, $7.GetStationListByBusIdRequest request); + $async.Future<$7.GetUnregisteredStationListResponse> getUnregisteredStationList($grpc.ServiceCall call, $7.GetUnregisteredStationListRequest request); + $async.Future<$7.UpdateStationResponse> updateStation($grpc.ServiceCall call, $7.UpdateStationRequest request); +} diff --git a/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/station.pbjson.dart b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/station.pbjson.dart new file mode 100644 index 00000000..0a6db727 --- /dev/null +++ b/frontend/where_child_bus_api/lib/proto-gen/where_child_bus/v1/station.pbjson.dart @@ -0,0 +1,163 @@ +// +// Generated code. Do not modify. +// source: where_child_bus/v1/station.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use updateStationLocationByGuardianIdRequestDescriptor instead') +const UpdateStationLocationByGuardianIdRequest$json = { + '1': 'UpdateStationLocationByGuardianIdRequest', + '2': [ + {'1': 'guardian_id', '3': 1, '4': 1, '5': 9, '10': 'guardianId'}, + {'1': 'longitude', '3': 2, '4': 1, '5': 1, '10': 'longitude'}, + {'1': 'latitude', '3': 3, '4': 1, '5': 1, '10': 'latitude'}, + ], +}; + +/// Descriptor for `UpdateStationLocationByGuardianIdRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List updateStationLocationByGuardianIdRequestDescriptor = $convert.base64Decode( + 'CihVcGRhdGVTdGF0aW9uTG9jYXRpb25CeUd1YXJkaWFuSWRSZXF1ZXN0Eh8KC2d1YXJkaWFuX2' + 'lkGAEgASgJUgpndWFyZGlhbklkEhwKCWxvbmdpdHVkZRgCIAEoAVIJbG9uZ2l0dWRlEhoKCGxh' + 'dGl0dWRlGAMgASgBUghsYXRpdHVkZQ=='); + +@$core.Deprecated('Use updateStationLocationByGuardianIdResponseDescriptor instead') +const UpdateStationLocationByGuardianIdResponse$json = { + '1': 'UpdateStationLocationByGuardianIdResponse', + '2': [ + {'1': 'station', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.Station', '10': 'station'}, + ], +}; + +/// Descriptor for `UpdateStationLocationByGuardianIdResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List updateStationLocationByGuardianIdResponseDescriptor = $convert.base64Decode( + 'CilVcGRhdGVTdGF0aW9uTG9jYXRpb25CeUd1YXJkaWFuSWRSZXNwb25zZRI1CgdzdGF0aW9uGA' + 'EgASgLMhsud2hlcmVfY2hpbGRfYnVzLnYxLlN0YXRpb25SB3N0YXRpb24='); + +@$core.Deprecated('Use getStationListByBusIdRequestDescriptor instead') +const GetStationListByBusIdRequest$json = { + '1': 'GetStationListByBusIdRequest', + '2': [ + {'1': 'bus_id', '3': 1, '4': 1, '5': 9, '10': 'busId'}, + ], +}; + +/// Descriptor for `GetStationListByBusIdRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getStationListByBusIdRequestDescriptor = $convert.base64Decode( + 'ChxHZXRTdGF0aW9uTGlzdEJ5QnVzSWRSZXF1ZXN0EhUKBmJ1c19pZBgBIAEoCVIFYnVzSWQ='); + +@$core.Deprecated('Use getStationListByBusIdResponseDescriptor instead') +const GetStationListByBusIdResponse$json = { + '1': 'GetStationListByBusIdResponse', + '2': [ + {'1': 'stations', '3': 1, '4': 3, '5': 11, '6': '.where_child_bus.v1.Station', '10': 'stations'}, + {'1': 'guardians', '3': 2, '4': 3, '5': 11, '6': '.where_child_bus.v1.GuardianResponse', '10': 'guardians'}, + {'1': 'children', '3': 3, '4': 3, '5': 11, '6': '.where_child_bus.v1.Child', '10': 'children'}, + {'1': 'photos', '3': 4, '4': 3, '5': 11, '6': '.where_child_bus.v1.ChildPhoto', '10': 'photos'}, + ], +}; + +/// Descriptor for `GetStationListByBusIdResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getStationListByBusIdResponseDescriptor = $convert.base64Decode( + 'Ch1HZXRTdGF0aW9uTGlzdEJ5QnVzSWRSZXNwb25zZRI3CghzdGF0aW9ucxgBIAMoCzIbLndoZX' + 'JlX2NoaWxkX2J1cy52MS5TdGF0aW9uUghzdGF0aW9ucxJCCglndWFyZGlhbnMYAiADKAsyJC53' + 'aGVyZV9jaGlsZF9idXMudjEuR3VhcmRpYW5SZXNwb25zZVIJZ3VhcmRpYW5zEjUKCGNoaWxkcm' + 'VuGAMgAygLMhkud2hlcmVfY2hpbGRfYnVzLnYxLkNoaWxkUghjaGlsZHJlbhI2CgZwaG90b3MY' + 'BCADKAsyHi53aGVyZV9jaGlsZF9idXMudjEuQ2hpbGRQaG90b1IGcGhvdG9z'); + +@$core.Deprecated('Use getUnregisteredStationListRequestDescriptor instead') +const GetUnregisteredStationListRequest$json = { + '1': 'GetUnregisteredStationListRequest', + '2': [ + {'1': 'bus_id', '3': 1, '4': 1, '5': 9, '10': 'busId'}, + ], +}; + +/// Descriptor for `GetUnregisteredStationListRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getUnregisteredStationListRequestDescriptor = $convert.base64Decode( + 'CiFHZXRVbnJlZ2lzdGVyZWRTdGF0aW9uTGlzdFJlcXVlc3QSFQoGYnVzX2lkGAEgASgJUgVidX' + 'NJZA=='); + +@$core.Deprecated('Use getUnregisteredStationListResponseDescriptor instead') +const GetUnregisteredStationListResponse$json = { + '1': 'GetUnregisteredStationListResponse', + '2': [ + {'1': 'stations', '3': 1, '4': 3, '5': 11, '6': '.where_child_bus.v1.Station', '10': 'stations'}, + {'1': 'guardians', '3': 2, '4': 3, '5': 11, '6': '.where_child_bus.v1.GuardianResponse', '10': 'guardians'}, + ], +}; + +/// Descriptor for `GetUnregisteredStationListResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getUnregisteredStationListResponseDescriptor = $convert.base64Decode( + 'CiJHZXRVbnJlZ2lzdGVyZWRTdGF0aW9uTGlzdFJlc3BvbnNlEjcKCHN0YXRpb25zGAEgAygLMh' + 'sud2hlcmVfY2hpbGRfYnVzLnYxLlN0YXRpb25SCHN0YXRpb25zEkIKCWd1YXJkaWFucxgCIAMo' + 'CzIkLndoZXJlX2NoaWxkX2J1cy52MS5HdWFyZGlhblJlc3BvbnNlUglndWFyZGlhbnM='); + +@$core.Deprecated('Use getCorrectOrderStationListByBusIdRequestDescriptor instead') +const GetCorrectOrderStationListByBusIdRequest$json = { + '1': 'GetCorrectOrderStationListByBusIdRequest', + '2': [ + {'1': 'bus_id', '3': 1, '4': 1, '5': 9, '10': 'busId'}, + {'1': 'bus_type', '3': 2, '4': 1, '5': 14, '6': '.where_child_bus.v1.BusType', '10': 'busType'}, + ], +}; + +/// Descriptor for `GetCorrectOrderStationListByBusIdRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getCorrectOrderStationListByBusIdRequestDescriptor = $convert.base64Decode( + 'CihHZXRDb3JyZWN0T3JkZXJTdGF0aW9uTGlzdEJ5QnVzSWRSZXF1ZXN0EhUKBmJ1c19pZBgBIA' + 'EoCVIFYnVzSWQSNgoIYnVzX3R5cGUYAiABKA4yGy53aGVyZV9jaGlsZF9idXMudjEuQnVzVHlw' + 'ZVIHYnVzVHlwZQ=='); + +@$core.Deprecated('Use getCorrectOrderStationListByBusIdResponseDescriptor instead') +const GetCorrectOrderStationListByBusIdResponse$json = { + '1': 'GetCorrectOrderStationListByBusIdResponse', + '2': [ + {'1': 'bus_route', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.BusRoute', '10': 'busRoute'}, + ], +}; + +/// Descriptor for `GetCorrectOrderStationListByBusIdResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getCorrectOrderStationListByBusIdResponseDescriptor = $convert.base64Decode( + 'CilHZXRDb3JyZWN0T3JkZXJTdGF0aW9uTGlzdEJ5QnVzSWRSZXNwb25zZRI5CglidXNfcm91dG' + 'UYASABKAsyHC53aGVyZV9jaGlsZF9idXMudjEuQnVzUm91dGVSCGJ1c1JvdXRl'); + +@$core.Deprecated('Use updateStationRequestDescriptor instead') +const UpdateStationRequest$json = { + '1': 'UpdateStationRequest', + '2': [ + {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, + {'1': 'bus_id', '3': 2, '4': 1, '5': 9, '10': 'busId'}, + {'1': 'latitude', '3': 3, '4': 1, '5': 1, '10': 'latitude'}, + {'1': 'longitude', '3': 4, '4': 1, '5': 1, '10': 'longitude'}, + {'1': 'update_mask', '3': 5, '4': 1, '5': 11, '6': '.google.protobuf.FieldMask', '10': 'updateMask'}, + ], +}; + +/// Descriptor for `UpdateStationRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List updateStationRequestDescriptor = $convert.base64Decode( + 'ChRVcGRhdGVTdGF0aW9uUmVxdWVzdBIOCgJpZBgBIAEoCVICaWQSFQoGYnVzX2lkGAIgASgJUg' + 'VidXNJZBIaCghsYXRpdHVkZRgDIAEoAVIIbGF0aXR1ZGUSHAoJbG9uZ2l0dWRlGAQgASgBUgls' + 'b25naXR1ZGUSOwoLdXBkYXRlX21hc2sYBSABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYX' + 'NrUgp1cGRhdGVNYXNr'); + +@$core.Deprecated('Use updateStationResponseDescriptor instead') +const UpdateStationResponse$json = { + '1': 'UpdateStationResponse', + '2': [ + {'1': 'station', '3': 1, '4': 1, '5': 11, '6': '.where_child_bus.v1.Station', '10': 'station'}, + ], +}; + +/// Descriptor for `UpdateStationResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List updateStationResponseDescriptor = $convert.base64Decode( + 'ChVVcGRhdGVTdGF0aW9uUmVzcG9uc2USNQoHc3RhdGlvbhgBIAEoCzIbLndoZXJlX2NoaWxkX2' + 'J1cy52MS5TdGF0aW9uUgdzdGF0aW9u'); + diff --git a/frontend/where_child_bus_api/lib/where_child_bus_api.dart b/frontend/where_child_bus_api/lib/where_child_bus_api.dart new file mode 100644 index 00000000..a9b9f778 --- /dev/null +++ b/frontend/where_child_bus_api/lib/where_child_bus_api.dart @@ -0,0 +1,7 @@ +library where_child_bus_api; + +/// A Calculator. +class Calculator { + /// Returns [value] plus 1. + int addOne(int value) => value + 1; +} diff --git a/frontend/where_child_bus_api/pubspec.lock b/frontend/where_child_bus_api/pubspec.lock new file mode 100644 index 00000000..124648c2 --- /dev/null +++ b/frontend/where_child_bus_api/pubspec.lock @@ -0,0 +1,293 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + archive: + dependency: transitive + description: + name: archive + sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" + url: "https://pub.dev" + source: hosted + version: "3.4.10" + args: + dependency: transitive + description: + name: args + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + collection: + dependency: transitive + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 + url: "https://pub.dev" + source: hosted + version: "2.0.3" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + googleapis_auth: + dependency: transitive + description: + name: googleapis_auth + sha256: af7c3a3edf9d0de2e1e0a77e994fae0a581c525fa7012af4fa0d4a52ed9484da + url: "https://pub.dev" + source: hosted + version: "1.4.1" + grpc: + dependency: "direct main" + description: + name: grpc + sha256: e93ee3bce45c134bf44e9728119102358c7cd69de7832d9a874e2e74eb8cab40 + url: "https://pub.dev" + source: hosted + version: "3.2.4" + http: + dependency: transitive + description: + name: http + sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba + url: "https://pub.dev" + source: hosted + version: "1.2.0" + http2: + dependency: transitive + description: + name: http2 + sha256: "9ced024a160b77aba8fb8674e38f70875e321d319e6f303ec18e87bd5a4b0c1d" + url: "https://pub.dev" + source: hosted + version: "2.3.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + lints: + dependency: transitive + description: + name: lints + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" + source: hosted + version: "0.12.16" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" + source: hosted + version: "0.5.0" + meta: + dependency: transitive + description: + name: meta + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + url: "https://pub.dev" + source: hosted + version: "1.10.0" + path: + dependency: transitive + description: + name: path + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" + source: hosted + version: "1.8.3" + pointycastle: + dependency: transitive + description: + name: pointycastle + sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29" + url: "https://pub.dev" + source: hosted + version: "3.7.4" + protobuf: + dependency: "direct main" + description: + name: protobuf + sha256: "68645b24e0716782e58948f8467fd42a880f255096a821f9e7d0ec625b00c84d" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" + source: hosted + version: "0.6.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + web: + dependency: transitive + description: + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" + source: hosted + version: "0.3.0" +sdks: + dart: ">=3.2.6 <4.0.0" + flutter: ">=1.17.0" diff --git a/frontend/where_child_bus_api/pubspec.yaml b/frontend/where_child_bus_api/pubspec.yaml new file mode 100644 index 00000000..66471c48 --- /dev/null +++ b/frontend/where_child_bus_api/pubspec.yaml @@ -0,0 +1,56 @@ +name: where_child_bus_api +description: "A new Flutter package project." +version: 0.0.1 +homepage: + +environment: + sdk: '>=3.2.6 <4.0.0' + flutter: ">=1.17.0" + +dependencies: + flutter: + sdk: flutter + grpc: ^3.2.4 + protobuf: ^3.1.0 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^2.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # To add assets to your package, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + # + # For details regarding assets in packages, see + # https://flutter.dev/assets-and-images/#from-packages + # + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # To add custom fonts to your package, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts in packages, see + # https://flutter.dev/custom-fonts/#from-packages diff --git a/frontend/where_child_bus_api/test/where_child_bus_api_test.dart b/frontend/where_child_bus_api/test/where_child_bus_api_test.dart new file mode 100644 index 00000000..ad3d2dd2 --- /dev/null +++ b/frontend/where_child_bus_api/test/where_child_bus_api_test.dart @@ -0,0 +1,12 @@ +import 'package:flutter_test/flutter_test.dart'; + +import 'package:where_child_bus_api/where_child_bus_api.dart'; + +void main() { + test('adds one to input values', () { + final calculator = Calculator(); + expect(calculator.addOne(2), 3); + expect(calculator.addOne(-7), -6); + expect(calculator.addOne(0), 1); + }); +} diff --git a/frontend/where_child_bus_api/where_child_bus_api.iml b/frontend/where_child_bus_api/where_child_bus_api.iml new file mode 100644 index 00000000..975ffec2 --- /dev/null +++ b/frontend/where_child_bus_api/where_child_bus_api.iml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/frontend/where_child_bus_guardian/.gitignore b/frontend/where_child_bus_guardian/.gitignore new file mode 100644 index 00000000..1679e232 --- /dev/null +++ b/frontend/where_child_bus_guardian/.gitignore @@ -0,0 +1,47 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +#.env +.env + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ +.env + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/frontend/where_child_bus_guardian/.metadata b/frontend/where_child_bus_guardian/.metadata new file mode 100644 index 00000000..b5c370f3 --- /dev/null +++ b/frontend/where_child_bus_guardian/.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_guardian/README.md b/frontend/where_child_bus_guardian/README.md new file mode 100644 index 00000000..2802f1ec --- /dev/null +++ b/frontend/where_child_bus_guardian/README.md @@ -0,0 +1,16 @@ +# where_child_bus_guardian + +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_guardian/analysis_options.yaml b/frontend/where_child_bus_guardian/analysis_options.yaml new file mode 100644 index 00000000..0d290213 --- /dev/null +++ b/frontend/where_child_bus_guardian/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/frontend/where_child_bus_guardian/android/.gitignore b/frontend/where_child_bus_guardian/android/.gitignore new file mode 100644 index 00000000..2d6a2de9 --- /dev/null +++ b/frontend/where_child_bus_guardian/android/.gitignore @@ -0,0 +1,14 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +/secret.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_guardian/android/app/build.gradle b/frontend/where_child_bus_guardian/android/app/build.gradle new file mode 100644 index 00000000..b38c2415 --- /dev/null +++ b/frontend/where_child_bus_guardian/android/app/build.gradle @@ -0,0 +1,78 @@ +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_guardian" + compileSdkVersion 33 //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_guardian" + // 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. + minSdkVersion 21 //flutter.minSdkVersion + targetSdkVersion 33 //flutter.targetSdkVersion + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + manifestPlaceholders = [ + googleMapApiKey: secretProperties.getProperty('googleMap.apiKey'), + ] + } + + 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_guardian/android/app/src/debug/AndroidManifest.xml b/frontend/where_child_bus_guardian/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 00000000..399f6981 --- /dev/null +++ b/frontend/where_child_bus_guardian/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/frontend/where_child_bus_guardian/android/app/src/main/AndroidManifest.xml b/frontend/where_child_bus_guardian/android/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..d1fe40fa --- /dev/null +++ b/frontend/where_child_bus_guardian/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + diff --git a/frontend/where_child_bus_guardian/android/app/src/main/kotlin/com/example/where_child_bus_guardian/MainActivity.kt b/frontend/where_child_bus_guardian/android/app/src/main/kotlin/com/example/where_child_bus_guardian/MainActivity.kt new file mode 100644 index 00000000..75f7bafd --- /dev/null +++ b/frontend/where_child_bus_guardian/android/app/src/main/kotlin/com/example/where_child_bus_guardian/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.where_child_bus_guardian + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/frontend/where_child_bus_guardian/android/app/src/main/res/drawable-v21/launch_background.xml b/frontend/where_child_bus_guardian/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 00000000..f74085f3 --- /dev/null +++ b/frontend/where_child_bus_guardian/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/frontend/where_child_bus_guardian/android/app/src/main/res/drawable/launch_background.xml b/frontend/where_child_bus_guardian/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 00000000..304732f8 --- /dev/null +++ b/frontend/where_child_bus_guardian/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/frontend/where_child_bus_guardian/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/frontend/where_child_bus_guardian/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_guardian/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/frontend/where_child_bus_guardian/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/frontend/where_child_bus_guardian/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_guardian/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/frontend/where_child_bus_guardian/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/frontend/where_child_bus_guardian/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_guardian/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/frontend/where_child_bus_guardian/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/frontend/where_child_bus_guardian/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_guardian/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/frontend/where_child_bus_guardian/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/frontend/where_child_bus_guardian/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_guardian/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/frontend/where_child_bus_guardian/android/app/src/main/res/values-night/styles.xml b/frontend/where_child_bus_guardian/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 00000000..06952be7 --- /dev/null +++ b/frontend/where_child_bus_guardian/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/frontend/where_child_bus_guardian/android/app/src/main/res/values/styles.xml b/frontend/where_child_bus_guardian/android/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..cb1ef880 --- /dev/null +++ b/frontend/where_child_bus_guardian/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/frontend/where_child_bus_guardian/android/app/src/profile/AndroidManifest.xml b/frontend/where_child_bus_guardian/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 00000000..399f6981 --- /dev/null +++ b/frontend/where_child_bus_guardian/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/frontend/where_child_bus_guardian/android/build.gradle b/frontend/where_child_bus_guardian/android/build.gradle new file mode 100644 index 00000000..e83fb5da --- /dev/null +++ b/frontend/where_child_bus_guardian/android/build.gradle @@ -0,0 +1,30 @@ +buildscript { + ext.kotlin_version = '1.7.10' + 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_guardian/android/gradle.properties b/frontend/where_child_bus_guardian/android/gradle.properties new file mode 100644 index 00000000..598d13fe --- /dev/null +++ b/frontend/where_child_bus_guardian/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx4G +android.useAndroidX=true +android.enableJetifier=true diff --git a/frontend/where_child_bus_guardian/android/gradle/wrapper/gradle-wrapper.properties b/frontend/where_child_bus_guardian/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..3c472b99 --- /dev/null +++ b/frontend/where_child_bus_guardian/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_guardian/android/settings.gradle b/frontend/where_child_bus_guardian/android/settings.gradle new file mode 100644 index 00000000..7cd71285 --- /dev/null +++ b/frontend/where_child_bus_guardian/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_guardian/assets/images/child_photo_frame.png b/frontend/where_child_bus_guardian/assets/images/child_photo_frame.png new file mode 100644 index 00000000..90a441a2 Binary files /dev/null and b/frontend/where_child_bus_guardian/assets/images/child_photo_frame.png differ diff --git a/frontend/where_child_bus_guardian/ios/.gitignore b/frontend/where_child_bus_guardian/ios/.gitignore new file mode 100644 index 00000000..7a7f9873 --- /dev/null +++ b/frontend/where_child_bus_guardian/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_guardian/ios/Flutter/AppFrameworkInfo.plist b/frontend/where_child_bus_guardian/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 00000000..7c569640 --- /dev/null +++ b/frontend/where_child_bus_guardian/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_guardian/ios/Flutter/Debug.xcconfig b/frontend/where_child_bus_guardian/ios/Flutter/Debug.xcconfig new file mode 100644 index 00000000..592ceee8 --- /dev/null +++ b/frontend/where_child_bus_guardian/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/frontend/where_child_bus_guardian/ios/Flutter/Release.xcconfig b/frontend/where_child_bus_guardian/ios/Flutter/Release.xcconfig new file mode 100644 index 00000000..592ceee8 --- /dev/null +++ b/frontend/where_child_bus_guardian/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/frontend/where_child_bus_guardian/ios/Runner.xcodeproj/project.pbxproj b/frontend/where_child_bus_guardian/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 00000000..402b7026 --- /dev/null +++ b/frontend/where_child_bus_guardian/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.whereChildBusGuardian; + 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.whereChildBusGuardian.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.whereChildBusGuardian.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.whereChildBusGuardian.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.whereChildBusGuardian; + 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.whereChildBusGuardian; + 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_guardian/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/frontend/where_child_bus_guardian/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/frontend/where_child_bus_guardian/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/frontend/where_child_bus_guardian/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/frontend/where_child_bus_guardian/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/frontend/where_child_bus_guardian/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/frontend/where_child_bus_guardian/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/frontend/where_child_bus_guardian/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..f9b0d7c5 --- /dev/null +++ b/frontend/where_child_bus_guardian/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/frontend/where_child_bus_guardian/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/frontend/where_child_bus_guardian/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 00000000..87131a09 --- /dev/null +++ b/frontend/where_child_bus_guardian/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/where_child_bus_guardian/ios/Runner.xcworkspace/contents.xcworkspacedata b/frontend/where_child_bus_guardian/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..1d526a16 --- /dev/null +++ b/frontend/where_child_bus_guardian/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/frontend/where_child_bus_guardian/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/frontend/where_child_bus_guardian/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/frontend/where_child_bus_guardian/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/frontend/where_child_bus_guardian/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/frontend/where_child_bus_guardian/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..f9b0d7c5 --- /dev/null +++ b/frontend/where_child_bus_guardian/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/frontend/where_child_bus_guardian/ios/Runner/AppDelegate.swift b/frontend/where_child_bus_guardian/ios/Runner/AppDelegate.swift new file mode 100644 index 00000000..ddf68e5b --- /dev/null +++ b/frontend/where_child_bus_guardian/ios/Runner/AppDelegate.swift @@ -0,0 +1,18 @@ +import UIKit +import Flutter +import GoogleMaps +// import GooglePlaces +import flutter_config + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + // GMSPlacesClient.provideAPIKey(FlutterConfigPlugin.env(for: "GOOGLE_MAP_API_KEY")) + GMSServices.provideAPIKey(FlutterConfigPlugin.env(for: "IOS_GOOGLE_MAP_API_KEY")) + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d36b1fab --- /dev/null +++ b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 00000000..0bedcf2f --- /dev/null +++ b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/frontend/where_child_bus_guardian/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 00000000..89c2725b --- /dev/null +++ b/frontend/where_child_bus_guardian/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_guardian/ios/Runner/Base.lproj/LaunchScreen.storyboard b/frontend/where_child_bus_guardian/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..f2e259c7 --- /dev/null +++ b/frontend/where_child_bus_guardian/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/where_child_bus_guardian/ios/Runner/Base.lproj/Main.storyboard b/frontend/where_child_bus_guardian/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 00000000..f3c28516 --- /dev/null +++ b/frontend/where_child_bus_guardian/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/where_child_bus_guardian/ios/Runner/Info.plist b/frontend/where_child_bus_guardian/ios/Runner/Info.plist new file mode 100644 index 00000000..b47c57b5 --- /dev/null +++ b/frontend/where_child_bus_guardian/ios/Runner/Info.plist @@ -0,0 +1,73 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + + + NSPhotoLibraryUsageDescription + Photo Library Access Warning + NSCameraUsageDescription + Camera Library Access Warning + + + CFBundleDisplayName + Where Child Bus Guardian + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + where_child_bus_guardian + 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_guardian/ios/Runner/Runner-Bridging-Header.h b/frontend/where_child_bus_guardian/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 00000000..308a2a56 --- /dev/null +++ b/frontend/where_child_bus_guardian/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/frontend/where_child_bus_guardian/ios/RunnerTests/RunnerTests.swift b/frontend/where_child_bus_guardian/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 00000000..86a7c3b1 --- /dev/null +++ b/frontend/where_child_bus_guardian/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_guardian/lib/app.dart b/frontend/where_child_bus_guardian/lib/app.dart new file mode 100644 index 00000000..b6f15799 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/app.dart @@ -0,0 +1,78 @@ +import 'dart:developer' as developer; +import 'package:flutter/material.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart'; +import 'package:where_child_bus_guardian/pages/check_page/check_page.dart'; +import 'package:where_child_bus_guardian/pages/daily_page/daily_page.dart'; +import 'package:where_child_bus_guardian/pages/map_page/map_page.dart'; +import 'package:where_child_bus_guardian/pages/stop_bus_page/stop_bus_page.dart'; +import 'package:where_child_bus_guardian/service/get_running_bus_by_guardian_id.dart'; +import 'package:where_child_bus_guardian/util/guardian_data.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart'; +import 'package:where_child_bus_guardian/components/utils/half_circle_painter.dart'; +import 'package:where_child_bus_guardian/components/utils/custom_app_bar.dart'; +import 'package:where_child_bus_guardian/components/utils/custom_bottom_app_bar.dart'; + +class App extends StatefulWidget { + App({super.key}); + + @override + State createState() => _AppState(); +} + +class _AppState extends State { + int _selectedIndex = 0; + GuardianResponse guardian = GuardianResponse(); + bool _hasRunningBus = false; + + @override + void initState() { + super.initState(); + _initializeAppState(); + } + + Future _initializeAppState() async { + guardian = GuardianData().getGuardian(); + await _loadRunningBus(); + } + + Future _loadRunningBus() async { + try { + var busRes = await getRunningBusByGuardianIdService(guardian.id); + if (mounted) { + setState(() { + _hasRunningBus = true; + }); + } + } catch (e) { + if (mounted) { + setState(() { + _hasRunningBus = false; + }); + } + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: CustomAppBar( + selectedIndex: _selectedIndex, + ), + body: Padding( + padding: EdgeInsets.only(top: 30), + child: IndexedStack(index: _selectedIndex, children: [ + DailyPage(), + _hasRunningBus + ? MapPage() + : StopBusPage( + onPressed: _loadRunningBus, + ), + CheckPage(), + ])), + bottomNavigationBar: CustomWaveBottomBar( + selectedIndex: _selectedIndex, + onItemTapped: (index) => setState(() => _selectedIndex = index), + ), + ); + } +} diff --git a/frontend/where_child_bus_guardian/lib/components/utils/current_time_body.dart b/frontend/where_child_bus_guardian/lib/components/utils/current_time_body.dart new file mode 100644 index 00000000..81f61bf1 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/components/utils/current_time_body.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; +import 'current_time_widget.dart'; + +class CurrentTimeBody extends StatelessWidget { + @override + Widget build(BuildContext context) { + return SizedBox( + height: MediaQuery.of(context).size.height * 0.13, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + "現在時刻", + style: TextStyle(fontSize: 20), + ), + CurrentTimeWidget(), + ], + )); + } +} diff --git a/frontend/where_child_bus_guardian/lib/components/utils/current_time_widget.dart b/frontend/where_child_bus_guardian/lib/components/utils/current_time_widget.dart new file mode 100644 index 00000000..cf33b26a --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/components/utils/current_time_widget.dart @@ -0,0 +1,41 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; + +class CurrentTimeWidget extends StatefulWidget { + @override + State createState() => _CurrentTimeWidgetState(); +} + +class _CurrentTimeWidgetState extends State { + Timer? _timer; + String _currentTime = ''; + + @override + void initState() { + super.initState(); + _updateTime(); + _timer = Timer.periodic(Duration(seconds: 1), (Timer t) => _updateTime()); + } + + void _updateTime() { + setState(() { + final now = DateTime.now(); + _currentTime = + '${now.hour.toString().padLeft(2, '0')}:${now.minute.toString().padLeft(2, '0')}'; + }); + } + + @override + void dispose() { + _timer?.cancel(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Text( + _currentTime, + style: const TextStyle(fontSize: 50), + ); + } +} diff --git a/frontend/where_child_bus_guardian/lib/components/utils/custom_app_bar.dart b/frontend/where_child_bus_guardian/lib/components/utils/custom_app_bar.dart new file mode 100644 index 00000000..5d0e9c54 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/components/utils/custom_app_bar.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; +import 'package:where_child_bus_guardian/components/utils/half_circle_painter.dart'; + +class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { + final int selectedIndex; + + CustomAppBar({ + Key? key, + required this.selectedIndex, + }) : super(key: key); + + @override + Size get preferredSize => const Size.fromHeight(kToolbarHeight); + + @override + Widget build(BuildContext context) { + return AppBar( + backgroundColor: const Color.fromARGB(255, 255, 243, 190), + title: Text(''), + centerTitle: true, + bottom: PreferredSize( + preferredSize: Size.fromHeight(0), + child: CustomPaint( + painter: HalfCirclePainter(), + child: Container( + height: 0, + ), + ), + ), + flexibleSpace: layoutBuilder(), + ); + } + + LayoutBuilder layoutBuilder() { + return LayoutBuilder( + builder: (BuildContext context, BoxConstraints constraints) { + double appBarHeight = constraints.biggest.height; + return Center( + child: Container( + child: Text( + ['日々の記録', '地図', '乗車確認'][selectedIndex], + style: const TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.bold, + color: Color.fromARGB(255, 67, 55, 1)), + ), + // AppBarの高さに応じて位置を調整 + padding: EdgeInsets.only(top: appBarHeight / 2), + ), + ); + }, + ); + } +} diff --git a/frontend/where_child_bus_guardian/lib/components/utils/custom_bottom_app_bar.dart b/frontend/where_child_bus_guardian/lib/components/utils/custom_bottom_app_bar.dart new file mode 100644 index 00000000..53b9efc6 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/components/utils/custom_bottom_app_bar.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; +import 'package:where_child_bus_guardian/components/utils/wave_clipper.dart'; + +class CustomWaveBottomBar extends StatelessWidget { + final int selectedIndex; + final Function(int) onItemTapped; + + const CustomWaveBottomBar({ + Key? key, + required this.selectedIndex, + required this.onItemTapped, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return ClipPath( + clipper: WaveClipper(), + child: Container( + color: const Color.fromARGB(255, 147, 211, 241), + child: Padding( + padding: const EdgeInsets.only(top: 30.0, bottom: 10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: + List.generate(3, (index) => _buildBarItem(index, context)), + ), + ))); + } + + Widget _buildBarItem(int index, BuildContext context) { + final isSelected = index == selectedIndex; + // 例: アイコンとラベルのリストを定義 + final icons = [Icons.note_alt, Icons.bus_alert, Icons.notifications_active]; + final labels = ['日々の記録', '地図', '乗車確認']; + + return GestureDetector( + onTap: () => onItemTapped(index), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(icons[index], + color: isSelected + ? const Color.fromARGB(255, 28, 100, 160) + : Colors.white), + Text(labels[index], + style: TextStyle( + color: isSelected + ? const Color.fromARGB(255, 28, 100, 160) + : Colors.white)), + ], + ), + ); + } +} diff --git a/frontend/where_child_bus_guardian/lib/components/utils/google_map_view.dart b/frontend/where_child_bus_guardian/lib/components/utils/google_map_view.dart new file mode 100644 index 00000000..61ab545d --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/components/utils/google_map_view.dart @@ -0,0 +1,133 @@ +import 'package:flutter/material.dart'; +import 'dart:developer' as developer; +import 'dart:async'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:flutter_polyline_points/flutter_polyline_points.dart'; +import '../../pages/map_page/map_page.dart'; +import 'package:where_child_bus_guardian/util/google_map_manager.dart'; + +class GoogleMapView extends StatefulWidget { + final List waypoints; + double nurseryLatitude, nurseryLongitude; + double busLatitude, busLongitude; + + GoogleMapView( + {super.key, + required this.waypoints, + required this.nurseryLatitude, + required this.nurseryLongitude, + required this.busLatitude, + required this.busLongitude}); + + @override + State createState() => _GoogleMapView(); +} + +class _GoogleMapView extends State { + final CameraPosition _initialLocation = + const CameraPosition(target: LatLng(0.0, 0.0), zoom: 14); + + late GoogleMapController mapController; + Timer? _timer; + Map markers = {}; + Map polylines = {}; + List polylineCoordinates = []; + PolylinePoints polylinePoints = PolylinePoints(); + + @override + void initState() { + super.initState(); + + if (mounted) { + setState(() { + _addMarker(LatLng(widget.nurseryLatitude, widget.nurseryLongitude), + "保育園", BitmapDescriptor.defaultMarker); + + _addMarker(LatLng(widget.busLatitude, widget.busLongitude), "バス", + BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueBlue)); + + widget.waypoints.forEach((Waypoint waypoint) { + _addMarker(LatLng(waypoint.latitude, waypoint.longitude), + waypoint.name, BitmapDescriptor.defaultMarkerWithHue(90)); + }); + }); + } + } + + @override + void dispose() { + _timer?.cancel(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.only(right: 10.0, left: 10.0), + child: ClipRRect( + borderRadius: BorderRadius.circular(20.0), + child: SizedBox( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height * 0.5, + child: googleMapBody(), + ))); + } + + Widget googleMapBody() { + _addMarker(LatLng(widget.busLatitude, widget.busLongitude), "バス", + BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueBlue)); + + return GoogleMap( + initialCameraPosition: _initialLocation, + mapType: MapType.normal, + onMapCreated: (GoogleMapController controller) { + mapController = controller; + _getPolyline(widget.waypoints); + }, + markers: Set.of(markers.values), + polylines: Set.of(polylines.values), + ); + } + + void _addMarker(LatLng position, String id, BitmapDescriptor descriptor) { + MarkerId markerId = MarkerId(id); + Marker marker = + Marker(markerId: markerId, icon: descriptor, position: position); + setState(() { + markers[markerId] = marker; + }); + } + + void _addPolyline() { + PolylineId id = const PolylineId('poly'); + Polyline polyline = Polyline( + polylineId: id, + color: Colors.blue, + points: polylineCoordinates, + width: 5); + setState(() { + polylines[id] = polyline; + }); + } + + void _getPolyline(List waypoints) async { + try { + polylineCoordinates = await GoogleMapAPIManager().getPolylinePoints( + startLat: widget.nurseryLatitude.toString(), + startLng: widget.nurseryLongitude.toString(), + endLat: widget.nurseryLatitude.toString(), + endLng: widget.nurseryLongitude.toString(), + waypoints: waypoints, + ); + developer.log("polylineCoordinates: $polylineCoordinates", + name: "GetPolyline"); + _addPolyline(); + } catch (e) { + print(e); + } + + mapController.animateCamera(CameraUpdate.newCameraPosition(CameraPosition( + target: LatLng(widget.nurseryLatitude, widget.nurseryLongitude), + zoom: 14))); + } +} diff --git a/frontend/where_child_bus_guardian/lib/components/utils/half_circle_painter.dart b/frontend/where_child_bus_guardian/lib/components/utils/half_circle_painter.dart new file mode 100644 index 00000000..49636c13 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/components/utils/half_circle_painter.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; + +class HalfCirclePainter extends CustomPainter { + @override + void paint(Canvas canvas, Size size) { + final paint = Paint() + ..color = const Color.fromARGB(255, 255, 243, 190) // 凸の色 + ..style = PaintingStyle.fill; // 塗りつぶし + + final path = Path(); + + // 曲線の開始点 + path.moveTo(0, 0); + + // 曲線の描画 + // ここでは、始点から終点に向かって中間の制御点を使って曲線を描く + var controlPoint = Offset(size.width / 2, 50); // 制御点(曲線のピークを決定) + var endPoint = Offset(size.width, 0); // 終点 + + // 二次ベジェ曲線を描画 + path.quadraticBezierTo( + controlPoint.dx, + controlPoint.dy, + endPoint.dx, + endPoint.dy, + ); + + // パスを閉じる(省略可能、塗りつぶしの場合は必要) + path.lineTo(size.width, 0); + path.lineTo(0, 0); + canvas.drawPath(path, paint); + } + + @override + bool shouldRepaint(covariant CustomPainter oldDelegate) { + return false; + } +} diff --git a/frontend/where_child_bus_guardian/lib/components/utils/image_from_byte.dart b/frontend/where_child_bus_guardian/lib/components/utils/image_from_byte.dart new file mode 100644 index 00000000..98af072a --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/components/utils/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_guardian/lib/components/utils/wave_clipper.dart b/frontend/where_child_bus_guardian/lib/components/utils/wave_clipper.dart new file mode 100644 index 00000000..ad8a2c5a --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/components/utils/wave_clipper.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; + +class WaveClipper extends CustomClipper { + @override + Path getClip(Size size) { + var path = Path(); + + // 上部の開始点 + path.lineTo(0, 0); + + // 最初の波の下向きのカーブ + var firstDownControlPoint = Offset(size.width / 4, 40); + var firstDownEndPoint = Offset(size.width / 2, 20); + path.quadraticBezierTo( + firstDownControlPoint.dx, + firstDownControlPoint.dy, + firstDownEndPoint.dx, + firstDownEndPoint.dy, + ); + + // 二番目の波の上向きのカーブ + var secondUpControlPoint = Offset(size.width * 3 / 4, 0); + var secondUpEndPoint = Offset(size.width, 20); + path.quadraticBezierTo( + secondUpControlPoint.dx, + secondUpControlPoint.dy, + secondUpEndPoint.dx, + secondUpEndPoint.dy, + ); + + // パスを閉じる + path.lineTo(size.width, size.height); + path.lineTo(0, size.height); + path.close(); + + return path; + } + + @override + bool shouldReclip(CustomClipper oldClipper) => false; +} diff --git a/frontend/where_child_bus_guardian/lib/config/config.dart b/frontend/where_child_bus_guardian/lib/config/config.dart new file mode 100644 index 00000000..815a8ffa --- /dev/null +++ b/frontend/where_child_bus_guardian/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); + } + } +} + +final appConfig = AppConfig(); diff --git a/frontend/where_child_bus_guardian/lib/main.dart b/frontend/where_child_bus_guardian/lib/main.dart new file mode 100644 index 00000000..b2d28ed3 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/main.dart @@ -0,0 +1,50 @@ +import "dart:developer" as developer; +import 'package:flutter/material.dart'; +import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:google_fonts/google_fonts.dart'; + +import 'package:where_child_bus_guardian/config/config.dart'; +import 'package:where_child_bus_guardian/util/api/health_check.dart'; +import 'package:where_child_bus_guardian/pages/auth_page/auth_page.dart'; + +Future main() async { + await dotenv.load(fileName: '.env'); + WidgetsFlutterBinding.ensureInitialized(); + + try { + await appConfig.loadConfig(); + await serviceHealthCheck(); + } catch (error) { + developer.log("アプリの立ち上げに失敗しました", error: error); + } + + runApp(const MyApp()); +} + +class MyApp extends StatefulWidget { + const MyApp({super.key}); + + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State { + // Widget googleMap = const GoogleMapView(); + + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'hoicruise guardian', + theme: ThemeData( + colorScheme: ColorScheme.fromSeed( + background: const Color.fromARGB(255, 245, 255, 247), + seedColor: Colors.deepPurple), + textTheme: GoogleFonts.hachiMaruPopTextTheme( + Theme.of(context).textTheme, + ), + useMaterial3: true, + ), + home: const AuthPage(), + ); + } +} diff --git a/frontend/where_child_bus_guardian/lib/models/guardian_login_error.dart b/frontend/where_child_bus_guardian/lib/models/guardian_login_error.dart new file mode 100644 index 00000000..cfb05681 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/models/guardian_login_error.dart @@ -0,0 +1,9 @@ +enum GuardianLoginError { + unknown, + invalidCredentials, + serverError, + networkError, + databaseError, + fieldsDoNotFilled, + // 他のエラータイプをここに追加 +} diff --git a/frontend/where_child_bus_guardian/lib/pages/auth_page/auth_page.dart b/frontend/where_child_bus_guardian/lib/pages/auth_page/auth_page.dart new file mode 100644 index 00000000..5d07733c --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/pages/auth_page/auth_page.dart @@ -0,0 +1,144 @@ +import 'dart:developer' as developer; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:where_child_bus_guardian/app.dart'; +import 'package:where_child_bus_guardian/models/guardian_login_error.dart'; +import 'package:where_child_bus_guardian/util/api/guardian.dart'; +import 'package:where_child_bus_guardian/util/guardian_data.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/guardian.pb.dart'; + +class AuthPage extends StatefulWidget { + const AuthPage({super.key}); + + @override + State createState() => _AuthPageState(); +} + +class _AuthPageState extends State { + final _emailController = TextEditingController(); + final _passwordController = TextEditingController(); + + GuardianLoginError? _loginError; + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () => FocusScope.of(context).unfocus(), + child: Scaffold( + body: pageBody(), + ), + ); + } + + login() async { + BuildContext currentContext = context; + GuardianLoginResponse res; + + try { + // if (kDebugMode) { + // res = await guardianLogin("hogosya1@example.com", "password"); + // } else { + res = + await guardianLogin(_emailController.text, _passwordController.text); + if (_emailController.text.isEmpty || _passwordController.text.isEmpty) { + setState(() => _loginError = GuardianLoginError.fieldsDoNotFilled); + return; + // } + } + + if (res.success) { + print(res.success); + print(res.guardian.name); + GuardianData().setGuardian(res.guardian); + Navigator.pushReplacement( + currentContext, + MaterialPageRoute( + builder: (BuildContext context) => App(), + )); + } else { + setState(() => _loginError = GuardianLoginError.invalidCredentials); + } + } catch (error) { + developer.log("Login Failed for error: ", error: error); + if (mounted) { + setState(() => _loginError = GuardianLoginError.invalidCredentials); + } + } + } + + Widget pageBody() { + return Center( + child: Padding( + padding: const EdgeInsets.all(32), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + titleText(), + mailInputField(), + passwordInputField(), + spacer32(), + errorTextWidget(), + loginButton(), + ], + ), + ), + ); + } + + Widget titleText() => const Padding( + padding: EdgeInsets.only(bottom: 32), + child: Text('ほいくるーず', + style: TextStyle(fontSize: 32, fontWeight: FontWeight.bold)), + ); + + Widget mailInputField() => + textFieldWidget(_emailController, 'メールアドレス', TextInputType.emailAddress); + + Widget passwordInputField() => textFieldWidget( + _passwordController, 'パスワード', TextInputType.visiblePassword, + obscureText: true); + + Widget textFieldWidget(TextEditingController controller, String label, + TextInputType keyboardType, + {bool obscureText = false}) => + Padding( + padding: const EdgeInsets.all(8.0), + child: TextField( + decoration: InputDecoration( + border: const OutlineInputBorder(), labelText: label), + controller: controller, + obscureText: obscureText, + keyboardType: keyboardType, + ), + ); + + Widget spacer32() => const SizedBox(height: 32); + + Widget errorTextWidget() { + String errorText; + switch (_loginError) { + case GuardianLoginError.invalidCredentials: + errorText = "メールアドレスかパスワードが間違っています"; + break; + case GuardianLoginError.unknown: + errorText = "不明なエラーです"; + break; + case GuardianLoginError.fieldsDoNotFilled: + errorText = "パスワードとメールアドレスを入力してください"; + break; + default: + return Container(); + } + return Padding( + padding: const EdgeInsets.only(bottom: 8.0), + child: Text(errorText, + style: const TextStyle(color: Colors.red, fontSize: 13)), + ); + } + + Widget loginButton() => SizedBox( + width: MediaQuery.of(context).size.width * 0.6, + child: + ElevatedButton(onPressed: () => login(), child: const Text('ログイン')), + ); +} diff --git a/frontend/where_child_bus_guardian/lib/pages/check_page/check_page.dart b/frontend/where_child_bus_guardian/lib/pages/check_page/check_page.dart new file mode 100644 index 00000000..6b353609 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/pages/check_page/check_page.dart @@ -0,0 +1,97 @@ +import 'dart:developer' as developer; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:where_child_bus_guardian/components/utils/current_time_body.dart'; +import 'package:where_child_bus_guardian/pages/check_page/components/bus_toggle_button.dart'; +import 'package:where_child_bus_guardian/service/update_guardian_status.dart'; +import 'package:where_child_bus_guardian/util/guardian_data.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/guardian.pb.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart'; + +class CheckPage extends StatefulWidget { + const CheckPage({super.key}); + + @override + State createState() => _CheckPageState(); +} + +class _CheckPageState extends State { + final GuardianResponse guardian = GuardianData().getGuardian(); + + @override + Widget build(BuildContext context) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + CurrentTimeBody(), + const SizedBox( + height: 50, + ), + toggleSwitchBody(context), + Container( + width: MediaQuery.of(context).size.width * 0.1, + height: MediaQuery.of(context).size.height * 0.16, + decoration: const BoxDecoration( + color: Color.fromARGB(255, 220, 198, 161), + ), + ), + ], + ), + ); + } + + Widget toggleSwitchBody(BuildContext context) { + return Container( + padding: const EdgeInsets.all(20), + width: MediaQuery.of(context).size.width * 0.8, + decoration: BoxDecoration( + color: Color.fromARGB(255, 220, 198, 161), + borderRadius: BorderRadius.circular(10), + ), + alignment: Alignment.center, + child: Column( + children: [ + const Text( + "本日の乗車予定", + style: TextStyle(fontSize: 20), + ), + Padding( + padding: const EdgeInsets.only(top: 30), + child: Column( + children: [ + busTitleAndToggleButton( + "朝のバス", guardian.isUseMorningBus, true), + SizedBox( + height: 20, + ), + busTitleAndToggleButton( + "夕方のバス", guardian.isUseEveningBus, false), + ], + ), + ), + ], + )); + } + + Widget busTitleAndToggleButton( + String title, bool isRideBus, bool isMorningBus) { + return Column( + children: [ + Text( + title, + style: const TextStyle(fontSize: 18), + ), + const SizedBox( + height: 10, + ), + BusToggleButton( + guardian: guardian, + isMorningBus: isMorningBus, + isUseBus: isRideBus, + ), + ], + ); + } +} diff --git a/frontend/where_child_bus_guardian/lib/pages/check_page/components/bus_toggle_button.dart b/frontend/where_child_bus_guardian/lib/pages/check_page/components/bus_toggle_button.dart new file mode 100644 index 00000000..7aa40f81 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/pages/check_page/components/bus_toggle_button.dart @@ -0,0 +1,93 @@ +import "dart:developer" as developer; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_toggle_tab/flutter_toggle_tab.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart'; +import 'package:where_child_bus_api/proto-gen/google/protobuf/field_mask.pb.dart'; +import 'package:where_child_bus_guardian/service/update_guardian_status.dart'; + +class BusToggleButton extends StatefulWidget { + final GuardianResponse guardian; + final bool isMorningBus; + final bool isUseBus; + + const BusToggleButton({ + Key? key, + required this.guardian, + required this.isMorningBus, + required this.isUseBus, + }) : super(key: key); + + @override + State createState() => _BusToggleButton(); +} + +class _BusToggleButton extends State { + bool _isLoading = false; + bool _isUse = false; + + @override + void initState() { + super.initState(); + _isUse = widget.isUseBus; + } + + Future _updateHasItemStatus(bool isMorningBus, bool isUseBus) async { + try { + setState(() { + _isLoading = true; + }); + + List updateMaskName = []; + isMorningBus + ? updateMaskName = ["is_use_morning_bus"] + : updateMaskName = ["is_use_evening_bus"]; + await updateGuardianStatusService( + guardianId: widget.guardian.id, + isUseMorningBus: isMorningBus ? !isUseBus : null, + isUseEveningBus: isMorningBus ? null : !isUseBus, + updateMask: FieldMask(paths: updateMaskName), + ); + + if (mounted) { + setState(() { + _isUse = !_isUse; + _isLoading = false; + }); + } + } catch (e) { + if (kDebugMode) { + developer.log("バス乗車予定の更新に失敗: $e"); + } + } + } + + @override + Widget build(BuildContext context) { + int selectedIndex = _isUse ? 0 : 1; + return FlutterToggleTab( + width: 70, + height: 50, + borderRadius: 15, + selectedBackgroundColors: const [Colors.blue], + selectedTextStyle: const TextStyle( + color: Colors.white, + fontSize: 16, + ), + unSelectedTextStyle: const TextStyle( + color: Colors.black, + fontSize: 14, + ), + labels: const ["乗る", "乗らない"], + selectedIndex: selectedIndex, + selectedLabelIndex: (index) { + setState(() async { + if (!_isLoading) { + await _updateHasItemStatus(widget.isMorningBus, _isUse); + } + }); + }, + marginSelected: const EdgeInsets.symmetric(horizontal: 3, vertical: 4), + ); + } +} diff --git a/frontend/where_child_bus_guardian/lib/pages/daily_page/components/daily_record_body.dart b/frontend/where_child_bus_guardian/lib/pages/daily_page/components/daily_record_body.dart new file mode 100644 index 00000000..27159c0f --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/pages/daily_page/components/daily_record_body.dart @@ -0,0 +1,187 @@ +import "dart:developer" as developer; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/child.pb.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart'; +import 'package:where_child_bus_guardian/service/check_is_child_in_bus.dart'; +import 'package:where_child_bus_guardian/components/utils/image_from_byte.dart'; +import 'package:where_child_bus_guardian/pages/daily_page/components/has_item_state.dart'; +import '../../styles/styles.dart'; + +class DailyRecordBody extends StatefulWidget { + final Child child; + final ChildPhoto image; + final IconData icon; + final Color color; + + const DailyRecordBody({ + Key? key, + required this.child, + required this.image, + required this.icon, + required this.color, + }) : super(key: key); + + @override + State createState() => _DailyRecordBody(); +} + +class _DailyRecordBody extends State { + bool isBoarding = false; + bool hasBagState = false; + bool hasLunchBoxState = false; + bool hasWaterBottleState = false; + bool hasUmbrellaState = false; + + @override + void initState() { + super.initState(); + _loadBoardingStatus(); + } + + Future _loadBoardingStatus() async { + try { + CheckIsChildInBusResponse res = + await checkIsChildInBusService(widget.child.id); + if (mounted) { + setState(() { + isBoarding = res.isInBus; + }); + } + } catch (e) { + if (kDebugMode) { + developer.log("乗降状態のロード中にエラーが発生しました: $e"); + } + } + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + childFaceAndExpression(), + Padding( + padding: const EdgeInsets.only(top: 20, bottom: 10), + child: Text( + widget.child.name, + style: const TextStyle(fontSize: 24), + textAlign: TextAlign.center, + )), + statusIconAndStatusField( + context, Icons.directions_bus, isBoardingStatusField(context)), + statusIconAndStatusField( + context, Icons.business_center, childItemList(context)), + ], + ); + } + + Widget childFaceAndExpression() { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [photoFrameAndChildFace(), childExpressionIcon()], + ); + } + + Widget photoFrameAndChildFace() { + return Stack( + children: [ + Image.asset( + 'assets/images/child_photo_frame.png', + width: 170, + height: 170, + ), + Positioned( + top: 60, + right: 40, + child: ClipRRect( + borderRadius: BorderRadius.circular(10), + child: ImageFromBytes( + imageData: widget.image.photoData, + height: 90, + width: 90, + ), + )) + ], + ); + } + + //TODO: 将来的に表情を受け取り、アイコンを表示する + Widget childExpressionIcon() { + return SizedBox( + width: 100, + height: 100, + child: Icon( + widget.icon, + size: 100, + color: widget.color, + )); + } + + Widget statusIconAndStatusField( + BuildContext context, IconData icon, Widget statusField) { + return SizedBox( + width: MediaQuery.of(context).size.width, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Icon( + icon, + size: 80, + ), + statusField, + ], + )); + } + + Widget isBoardingStatusField(context) { + return Container( + margin: EdgeInsets.only( + right: MediaQuery.of(context).size.width * 0.05, + left: MediaQuery.of(context).size.width * 0.05), + alignment: Alignment.center, + width: MediaQuery.of(context).size.width * 0.4, + decoration: statusFieldDecoration(!isBoarding), + child: Padding( + padding: const EdgeInsets.all(5.0), + child: Text( + isBoarding ? "乗車中" : "降車済", + style: TextStyle( + fontSize: 25, + color: !isBoarding ? Colors.green[900] : Colors.red[900], + ), + textAlign: TextAlign.center, + )), + ); + } + + Widget childItemList(BuildContext context) { + return SizedBox( + width: MediaQuery.of(context).size.width * 0.5, + height: MediaQuery.of(context).size.height * 0.14, + child: Wrap( + direction: Axis.horizontal, + alignment: WrapAlignment.spaceBetween, + runAlignment: WrapAlignment.spaceBetween, + runSpacing: 4.0, + children: [ + HasItemState( + child: widget.child, + itemName: "かばん", + hasItem: widget.child.hasBag), + HasItemState( + child: widget.child, + itemName: "お弁当", + hasItem: widget.child.hasLunchBox), + HasItemState( + child: widget.child, + itemName: "水筒", + hasItem: widget.child.hasWaterBottle), + HasItemState( + child: widget.child, + itemName: "傘", + hasItem: widget.child.hasUmbrella), + ], + ), + ); + } +} diff --git a/frontend/where_child_bus_guardian/lib/pages/daily_page/components/daily_record_slider.dart b/frontend/where_child_bus_guardian/lib/pages/daily_page/components/daily_record_slider.dart new file mode 100644 index 00000000..2cf59ec0 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/pages/daily_page/components/daily_record_slider.dart @@ -0,0 +1,92 @@ +import 'package:flutter/material.dart'; +import 'package:carousel_slider/carousel_slider.dart'; +import 'package:where_child_bus_guardian/pages/daily_page/components/daily_record_body.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart'; + +//TODO:将来的に取得した表情データからアイコンと色を選択する +final List icons = [ + Icons.sentiment_satisfied, + Icons.sentiment_neutral, + Icons.sentiment_dissatisfied, + Icons.sentiment_satisfied, +]; +final List colors = [ + Color.fromARGB(255, 255, 0, 0), + Color.fromARGB(255, 0, 255, 0), + Color.fromARGB(255, 0, 0, 255), + Color.fromARGB(255, 255, 153, 0), +]; + +class DailyRecordSlider extends StatefulWidget { + final List children; + final List images; + final VoidCallback? callback; + + const DailyRecordSlider( + {Key? key, required this.children, required this.images, this.callback}) + : super(key: key); + + @override + _DailyRecordSlider createState() => _DailyRecordSlider(); +} + +class _DailyRecordSlider extends State { + int currentIndex = 0; + + @override + Widget build(BuildContext context) { + List recordList = widget.children.map((child) { + int index = widget.children.indexOf(child); + return DailyRecordBody( + child: child, + image: widget.images[index], + icon: icons[index], + color: colors[index], + ); + }).toList(); + + return Column( + children: [ + recordCarouselSlider(recordList), + SizedBox(height: MediaQuery.of(context).size.height * 0.005), + dotIndicator(recordList) + ], + ); + } + + Widget recordCarouselSlider(List recordList) { + return CarouselSlider( + items: recordList, + options: CarouselOptions( + height: MediaQuery.of(context).size.height * 0.55, + initialPage: 0, + autoPlay: false, + viewportFraction: 1, + enableInfiniteScroll: recordList.length > 1 ? true : false, + onPageChanged: ((index, reason) { + setState(() { + currentIndex = index; + }); + }), + ), + ); + } + + Widget dotIndicator(List recordList) { + return Row( + mainAxisAlignment: MainAxisAlignment.center, + children: recordList.map((url) { + int index = recordList.indexOf(url); + return Container( + width: 8.0, + height: 8.0, + margin: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 2.0), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: + currentIndex == index ? Colors.grey[800] : Colors.grey[500]), + ); + }).toList(), + ); + } +} diff --git a/frontend/where_child_bus_guardian/lib/pages/daily_page/components/has_item_state.dart b/frontend/where_child_bus_guardian/lib/pages/daily_page/components/has_item_state.dart new file mode 100644 index 00000000..1f697536 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/pages/daily_page/components/has_item_state.dart @@ -0,0 +1,148 @@ +import "dart:developer" as developer; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart'; +import 'package:where_child_bus_api/proto-gen/google/protobuf/field_mask.pb.dart'; +import 'package:where_child_bus_guardian/service/update_child_item_status.dart'; +import '../../styles/styles.dart'; + +class HasItemState extends StatefulWidget { + final Child child; + final String itemName; + final bool hasItem; + + const HasItemState({ + Key? key, + required this.child, + required this.itemName, + required this.hasItem, + }) : super(key: key); + + @override + State createState() => _HasItemState(); +} + +class _HasItemState extends State { + bool _isLoading = false; + bool _hasItem = false; + + @override + void initState() { + super.initState(); + _updateCheckForMissingItems(); + _hasItem = widget.hasItem; + } + + Future _updateCheckForMissingItems() async { + try { + if (widget.child.hasBag && + widget.child.hasLunchBox && + widget.child.hasWaterBottle && + widget.child.hasUmbrella) { + await updateChildItemStatusService( + childId: widget.child.id, + checkForMissingItems: true, + updateMask: FieldMask(paths: ["check_for_missing_items"])); + } else { + await updateChildItemStatusService( + childId: widget.child.id, + checkForMissingItems: false, + updateMask: FieldMask(paths: ["check_for_missing_items"])); + } + } catch (e) { + if (kDebugMode) { + developer.log("忘れ物の有無の更新に失敗: $e"); + } + } + } + + Future _updateHasItemStatus(String itemName, bool hasItem) async { + try { + setState(() { + _isLoading = true; + }); + List updateMaskName = []; + switch (itemName) { + case "かばん": + updateMaskName = ["has_bag"]; + break; + case "お弁当": + updateMaskName = ["has_lunch_box"]; + break; + case "水筒": + updateMaskName = ["has_water_bottle"]; + break; + case "傘": + updateMaskName = ["has_umbrella"]; + break; + } + + await updateChildItemStatusService( + childId: widget.child.id, + hasBag: itemName == "かばん" ? !hasItem : null, + hasLunchBox: itemName == "お弁当" ? !hasItem : null, + hasWaterBottle: itemName == "水筒" ? !hasItem : null, + hasUmbrella: itemName == "傘" ? !hasItem : null, + updateMask: FieldMask(paths: updateMaskName), + ); + + if (mounted) { + setState(() { + _hasItem = !_hasItem; + _isLoading = false; + }); + } + } catch (e) { + if (kDebugMode) { + developer.log("持ち物の状態の更新に失敗: $e"); + } + } + } + + @override + Widget build(BuildContext context) { + return Material( + color: _hasItem ? Colors.green[100] : Colors.red[100], + borderRadius: BorderRadius.circular(5), + elevation: 5, + child: InkWell( + onTap: () async { + if (!_isLoading) { + await _updateHasItemStatus(widget.itemName, _hasItem); + } + }, + child: SizedBox( + width: MediaQuery.of(context).size.width * 0.24, + child: Padding( + padding: const EdgeInsets.only( + top: 10.0, bottom: 10.0, left: 8.0), + child: Row( + children: [ + statusFieldIcon(_hasItem), + const SizedBox(width: 8), + Text( + widget.itemName, + style: statusFieldTextStyle(_hasItem), + textAlign: TextAlign.center, + ), + ], + ))))); + } + + Widget statusFieldIcon(bool hasItem) { + return SizedBox( + width: 20, + child: _isLoading + ? const SizedBox( + width: 5, + height: 20, + child: CircularProgressIndicator( + strokeWidth: 2, + color: Colors.grey, + )) + : _hasItem + ? const Icon(Icons.check, color: Colors.green) + : const Icon(Icons.error_outline, color: Colors.red), + ); + } +} diff --git a/frontend/where_child_bus_guardian/lib/pages/daily_page/daily_page.dart b/frontend/where_child_bus_guardian/lib/pages/daily_page/daily_page.dart new file mode 100644 index 00000000..e1c6b300 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/pages/daily_page/daily_page.dart @@ -0,0 +1,85 @@ +import "dart:developer" as developer; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:where_child_bus_guardian/components/utils/current_time_body.dart'; +import 'package:where_child_bus_guardian/pages/daily_page/components/daily_record_slider.dart'; +import 'package:where_child_bus_guardian/service/get_child_list_by_guardian_id.dart'; +import 'package:where_child_bus_guardian/util/guardian_data.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/child.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'; + +class DailyPage extends StatefulWidget { + const DailyPage({super.key}); + + @override + State createState() => _DailyPageState(); +} + +class _DailyPageState extends State { + List children = []; + List photos = []; + bool _isLoading = true; + bool _isFailLoading = false; + + @override + void initState() { + super.initState(); + _loadChildList(); + } + + Future _loadChildList() async { + try { + _isLoading = true; + GetChildListByGuardianIDResponse res = + await getChildListByGuardianIdService( + GuardianData().getGuardian().id); + if (mounted) { + setState(() { + children = res.children; + photos = res.photos; + _isLoading = false; + }); + } + } catch (e) { + if (kDebugMode) { + developer.log("園児リストのロード中にエラーが発生しました: $e"); + } + setState(() => {_isLoading = false, _isFailLoading = true}); + } + } + + @override + Widget build(BuildContext context) { + return _isLoading + ? const Center( + child: CircularProgressIndicator(), + ) + : Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CurrentTimeBody(), + if (_isFailLoading) loadFailText(), + if (children.isEmpty) noChildDataText(), + DailyRecordSlider(children: children, images: photos), + ], + ), + ); + } + + Widget loadFailText() { + return const Padding( + padding: EdgeInsets.all(20), + child: Text("園児のロードに失敗しました"), + ); + } + + Widget noChildDataText() { + return const Padding( + padding: EdgeInsets.all(20), + child: Text("園児が登録されていません"), + ); + } +} diff --git a/frontend/where_child_bus_guardian/lib/pages/map_page/components/arrival_time.dart b/frontend/where_child_bus_guardian/lib/pages/map_page/components/arrival_time.dart new file mode 100644 index 00000000..53f59d20 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/pages/map_page/components/arrival_time.dart @@ -0,0 +1,143 @@ +import 'package:flutter/material.dart'; +import "dart:developer" as developer; +import 'dart:async'; +import '../map_page.dart'; +import 'package:intl/intl.dart'; +import 'package:where_child_bus_guardian/util/google_map_manager.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart'; +import 'package:where_child_bus_guardian/util/arrival_time_manager.dart'; + +class ArrivalTime extends StatefulWidget { + final Bus bus; + final List waypoints; + final String nextStationId; + final double busLatitude, busLongitude; + final double guardianLatitude, guardianLongitude; + + const ArrivalTime({ + Key? key, + required this.bus, + required this.waypoints, + required this.nextStationId, + required this.busLatitude, + required this.busLongitude, + required this.guardianLatitude, + required this.guardianLongitude, + }) : super(key: key); + + @override + State createState() => _ArrivalTimeState(); +} + +class _ArrivalTimeState extends State { + String arrivalTimeText = "Loading..."; + String arrivalTimeAndCurrentText = "Loading..."; + Timer? _timer; + double nextStationLatitude = 0.0, nextStationLongitude = 0.0; + + @override + void initState() { + super.initState(); + initArrivalTime(); + } + + @override + void dispose() { + _timer?.cancel(); + super.dispose(); + } + + Future initArrivalTime() async { + loadStationCoordinates(); + await setArrivalTime(); + } + + Future loadStationCoordinates() async { + if (mounted) { + setState(() { + nextStationLatitude = getLatitudeForStation(widget.bus.nextStationId); + nextStationLongitude = getLongitudeForStation(widget.bus.nextStationId); + }); + } + } + + double getLatitudeForStation(String stationId) { + return widget.waypoints + .firstWhere((waypoint) => waypoint.name == stationId, + orElse: () => Waypoint(latitude: 0.0, longitude: 0.0, name: "")) + .latitude; + } + + double getLongitudeForStation(String stationId) { + return widget.waypoints + .firstWhere((waypoint) => waypoint.name == stationId, + orElse: () => Waypoint(latitude: 0.0, longitude: 0.0, name: "")) + .longitude; + } + + @override + Widget build(BuildContext context) { + _timer = Timer.periodic( + const Duration(minutes: 1), (Timer t) => initArrivalTime()); + + return Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + children: [ + Text( + "到着まで", + style: const TextStyle(fontSize: 20), + ), + Text("${arrivalTimeText}分", + style: arrivalTimeText == "Loading..." + ? const TextStyle(fontSize: 20) + : const TextStyle(fontSize: 30)) + ], + ), + Column( + children: [ + Text("到着予定時刻", style: const TextStyle(fontSize: 20)), + Text("${arrivalTimeAndCurrentText}", + style: arrivalTimeAndCurrentText == "Loading..." + ? const TextStyle(fontSize: 20) + : const TextStyle(fontSize: 30)) + ], + ), + ]); + } + + Future setArrivalTime() async { + try { + final durationInSeconds = + await ArrivalTimeManager.instance.getArrivalTime( + widget.busLatitude, + widget.busLongitude, + nextStationLatitude, + nextStationLongitude, + widget.guardianLatitude, + widget.guardianLongitude, + widget.waypoints, + ); + + developer.log("durationInSeconds: $durationInSeconds", + name: "ArrivalTime"); + + // 成功した取得のみで値を更新 失敗したときは前回の値を保持したままにする + if (durationInSeconds != null) { + if (mounted) { + setState(() { + arrivalTimeText = (durationInSeconds ~/ 60).toString(); + arrivalTimeAndCurrentText = DateFormat('HH:mm') + .format( + DateTime.now().add(Duration(seconds: durationInSeconds))) + .toString(); + }); + } + } + } catch (e) { + developer.log('到着時間の取得中にエラーが発生しました', error: e, name: "ArrivalTimeError"); + } + } +} diff --git a/frontend/where_child_bus_guardian/lib/pages/map_page/components/map_page_bottom.dart b/frontend/where_child_bus_guardian/lib/pages/map_page/components/map_page_bottom.dart new file mode 100644 index 00000000..5b1f7fce --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/pages/map_page/components/map_page_bottom.dart @@ -0,0 +1,78 @@ +import 'dart:developer' as developer; +import 'package:flutter/material.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart'; +import 'package:where_child_bus_guardian/pages/map_page/components/arrival_time.dart'; +import 'package:where_child_bus_guardian/pages/map_page/map_page.dart'; +import '../../styles/styles.dart'; +import 'package:where_child_bus_guardian/pages/map_page/components/arrival_time.dart'; + +class MapPageBottom extends StatefulWidget { + final GuardianResponse guardian; + final Bus bus; + final List stations; + final List waypoints; + final String nextStationId; + final double busLatitude; + final double busLongitude; + final double nurseryLatitude; + final double nurseryLongitude; + + const MapPageBottom( + {Key? key, + required this.guardian, + required this.bus, + required this.stations, + required this.waypoints, + required this.nextStationId, + required this.busLatitude, + required this.busLongitude, + required this.nurseryLatitude, + required this.nurseryLongitude}) + : super(key: key); + + @override + State createState() => _MapPageBottomState(); +} + +class _MapPageBottomState extends State { + Station guardianStation = Station(); + + @override + void initState() { + super.initState(); + _loadGuardianStationData(); + if (mounted) { + setState(() { + widget.guardian.isUseEveningBus = widget.guardian.isUseEveningBus; + widget.guardian.isUseEveningBus = widget.guardian.isUseEveningBus; + }); + } + } + + Future _loadGuardianStationData() async { + try { + widget.stations.forEach((station) { + if (station.guardianId == widget.guardian.id) { + setState(() { + guardianStation = station; + }); + } + }); + } catch (error) { + developer.log('停留所の読み込みに失敗しました: $error'); + } + } + + @override + Widget build(BuildContext context) { + return ArrivalTime( + bus: widget.bus, + waypoints: widget.waypoints, + nextStationId: widget.nextStationId, + busLatitude: widget.busLatitude, + busLongitude: widget.busLongitude, + guardianLatitude: guardianStation.latitude, + guardianLongitude: guardianStation.longitude, + ); + } +} diff --git a/frontend/where_child_bus_guardian/lib/pages/map_page/map_page.dart b/frontend/where_child_bus_guardian/lib/pages/map_page/map_page.dart new file mode 100644 index 00000000..21f9a6e3 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/pages/map_page/map_page.dart @@ -0,0 +1,260 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:developer' as developer; +import 'package:flutter/material.dart'; +import 'package:grpc/grpc.dart'; +import 'package:where_child_bus_guardian/components/utils/google_map_view.dart'; +import 'package:where_child_bus_guardian/config/config.dart'; +import 'package:where_child_bus_guardian/pages/map_page/components/arrival_time.dart'; +import 'package:where_child_bus_guardian/pages/map_page/components/map_page_bottom.dart'; +import 'package:where_child_bus_guardian/service/get_running_bus_by_guardian_id.dart'; +import 'package:where_child_bus_guardian/service/get_bus_route_by_bus_id.dart'; +import 'package:where_child_bus_guardian/service/get_nursery_by_guardian_id.dart'; +import 'package:where_child_bus_guardian/util/guardian_data.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/bus.pbgrpc.dart'; +import 'package:where_child_bus_guardian/util/google_map_manager.dart'; + +class Waypoint { + final double latitude; + final double longitude; + final String name; + + Waypoint( + {required this.latitude, required this.longitude, required this.name}); +} + +class MapPage extends StatefulWidget { + const MapPage({super.key}); + + @override + State createState() => _MapPageState(); +} + +class _MapPageState extends State { + final StreamController _streamController = + StreamController.broadcast(); + + List busRoutes = []; + List waypoints = []; + + final GuardianResponse guardian = GuardianData().getGuardian(); + Bus bus = Bus(); + NurseryResponse nursery = NurseryResponse(); + String? nurseryAddress; + String nextStationId = ""; + double busLatitude = 0.0; + double busLongitude = 0.0; + double nurseryLatitude = 0.0; + double nurseryLongitude = 0.0; + + bool _isFirstBusLocationUpdate = true; + bool _isLoading = false; + + @override + void initState() { + super.initState(); + developer.log("初期化開始", name: "Initialize"); + _initializePage(); + } + + Future trackBusContinuous() async { + final channel = ClientChannel(appConfig.grpcEndpoint, + port: appConfig.grpcPort, options: const ChannelOptions()); + final grpcClient = BusServiceClient(channel); + + try { + developer.log("バスの追跡開始", name: "TrackBusContinuous"); + // TrackBusContinuousRequestを生成して、バスの追跡を開始 + var request = TrackBusContinuousRequest(busId: bus.id); + await for (var response in grpcClient.trackBusContinuous(request)) { + // レスポンスを受け取り、緯度と経度を更新 + setState(() { + //このタイミングでインスタンスが再生成される + busLatitude = response.latitude; + busLongitude = response.longitude; + if (_isFirstBusLocationUpdate) { + _isFirstBusLocationUpdate = false; + } + developer.log("$busLatitude, $busLongitude", + name: "TrackBusContinuous"); + }); + await Future.delayed(const Duration(seconds: 1)); + } + } catch (error) { + developer.log("Caught Error", error: error); + } finally { + await channel.shutdown(); + } + } + + Future _initializePage() async { + setState(() { + _isLoading = true; + }); + + try { + await _loadBusData(); + developer.log("バスの読み込み完了", name: "LoadBusData"); + await _loadStationsData(); + developer.log("停留所の読み込み完了", name: "LoadStationsData"); + await _createWayPointsFromStations(); + developer.log("経由地の読み込み完了", name: "LoadWaypointData"); + await _loadNurseryData(); + await _getNurseryCoordinates(); + trackBusContinuous(); // ストリームではなく、直接リクエストを送信 + } catch (e) { + developer.log('初期化中にエラーが発生しました: $e'); + } finally { + if (mounted) { + setState(() { + _isLoading = false; + }); + } + } + } + + @override + void dispose() { + _streamController.close(); + super.dispose(); + } + + Future _loadBusData() async { + try { + var busRes = await getRunningBusByGuardianIdService(guardian.id); + if (mounted) { + setState(() { + bus = busRes.bus; + }); + } + } catch (error) { + developer.log('バスの読み込みに失敗しました: $error'); + } + } + + Future _loadStationsData() async { + try { + var busType = DateTime.now().hour <= 12 + ? BusType.BUS_TYPE_MORNING + : BusType.BUS_TYPE_EVENING; + developer.log('停留所リストの読み込み開始'); + var busRouteRes = await getBusRouteByBusService(bus.id, busType); + if (mounted) { + setState(() { + busRoutes = busRouteRes.busRoute.orderedStations; + }); + } + developer.log('map_page.dart stations: ${busRoutes}'); + } catch (error) { + developer.log('停留所リストの読み込みに失敗しました: $error'); + } + } + + Future _createWayPointsFromStations() async { + try { + developer.log("Waypointsの作成開始", name: "CreateWaypointsFromStations"); + if (mounted) { + for (var station in busRoutes) { + developer.log("Waypointsの作成中 ${station.id}", + name: "CreateWaypointsFromStations"); + waypoints.add(Waypoint( + latitude: station.latitude, + longitude: station.longitude, + name: station.id.toString())); + } + } + developer.log("Waypointsの作成終了 $waypoints", + name: "CreateWaypointsFromStations"); + } catch (error) { + developer.log('経由地の読み込みに失敗しました: $error'); + } + } + + Future _loadNurseryData() async { + try { + developer.log("保育園の読み込み開始", name: "LoadNurseryData"); + var nurseryRes = await getNurseryByGuardianIdService(guardian.id); + if (mounted) { + setState(() { + nursery = nurseryRes.nurseries; + nurseryAddress = nursery.address; + }); + } + } catch (error) { + developer.log('保育園の読み込みに失敗しました: $error'); + } + } + + Future _getNurseryCoordinates() async { + try { + Map data = + await GoogleMapAPIManager().geocodeAddress(nurseryAddress!); + if (mounted) { + setState(() { + final location = data['results'][0]['geometry']['location']; + nurseryLatitude = location['lat'] as double; + nurseryLongitude = location['lng'] as double; + }); + } + } catch (e) { + developer.log('座標の取得に失敗しました:', error: e); + } + } + + @override + Widget build(BuildContext context) { + return _isLoading + ? const Center( + child: CircularProgressIndicator(), + ) + : RefreshIndicator( + onRefresh: _initializePage, + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + GoogleMapView( + waypoints: waypoints, + nurseryLatitude: nurseryLatitude, + nurseryLongitude: nurseryLongitude, + busLatitude: busLatitude, + busLongitude: busLongitude, + ), + pageBottomWrapper(), + ], + ), + ), + ); + } + + Widget pageBottomWrapper() { + return SizedBox( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height * 0.2, + child: Padding( + padding: EdgeInsets.all(MediaQuery.of(context).size.width * 0.05), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + _isFirstBusLocationUpdate + ? const Center( + child: CircularProgressIndicator(), + ) + : MapPageBottom( + guardian: guardian, + bus: bus, + stations: busRoutes, + waypoints: waypoints, + nextStationId: nextStationId, + busLatitude: busLatitude, + busLongitude: busLongitude, + nurseryLatitude: nurseryLatitude, + nurseryLongitude: nurseryLongitude), + ], + ), + ), + ); + } +} diff --git a/frontend/where_child_bus_guardian/lib/pages/stop_bus_page/stop_bus_page.dart b/frontend/where_child_bus_guardian/lib/pages/stop_bus_page/stop_bus_page.dart new file mode 100644 index 00000000..4e4a1958 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/pages/stop_bus_page/stop_bus_page.dart @@ -0,0 +1,64 @@ +import 'package:flutter/material.dart'; + +class StopBusPage extends StatefulWidget { + Function onPressed; + + StopBusPage({super.key, required this.onPressed}); + + @override + State createState() => _StopBusPageState(); +} + +class _StopBusPageState extends State { + bool _isLoading = false; + + @override + Widget build(BuildContext context) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + '現在走行中のバスはありません', + style: TextStyle(fontSize: 20, color: Colors.red), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: SizedBox( + width: MediaQuery.of(context).size.width * 0.2, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: Colors.green[100], + foregroundColor: Colors.green[900]), + onPressed: _fetchData, + child: _isLoading + ? const Center( + child: SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator( + color: Colors.green, + ), + )) + : const Text('更新')), + ), + ), + ], + ), + ); + } + + void _fetchData() async { + if (mounted) { + setState(() { + _isLoading = true; + }); + } + await widget.onPressed(); + if (mounted) { + setState(() { + _isLoading = false; + }); + } + } +} diff --git a/frontend/where_child_bus_guardian/lib/pages/styles/styles.dart b/frontend/where_child_bus_guardian/lib/pages/styles/styles.dart new file mode 100644 index 00000000..4e2aa0e2 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/pages/styles/styles.dart @@ -0,0 +1,18 @@ +import 'package:flutter/material.dart'; + +BoxDecoration statusFieldDecoration(bool isTrue) { + return BoxDecoration( + borderRadius: BorderRadius.circular(5), + border: Border.all( + color: isTrue ? Colors.green : Colors.red, + ), + color: isTrue ? Colors.green[100] : Colors.red[100], + ); +} + +TextStyle statusFieldTextStyle(bool isTrue) { + return TextStyle( + fontSize: 16, + color: isTrue ? Colors.green[900] : Colors.red[900], + ); +} diff --git a/frontend/where_child_bus_guardian/lib/service/check_is_child_in_bus.dart b/frontend/where_child_bus_guardian/lib/service/check_is_child_in_bus.dart new file mode 100644 index 00000000..cb8fa172 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/service/check_is_child_in_bus.dart @@ -0,0 +1,12 @@ +import 'package:where_child_bus_guardian/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_guardian/lib/service/get_bus_route_by_bus_id.dart b/frontend/where_child_bus_guardian/lib/service/get_bus_route_by_bus_id.dart new file mode 100644 index 00000000..472df4dd --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/service/get_bus_route_by_bus_id.dart @@ -0,0 +1,14 @@ +import 'package:where_child_bus_guardian/util/api/bus_route.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/station.pb.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pbenum.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/bus_route.pbgrpc.dart'; + +Future getBusRouteByBusService( + String busId, BusType busType) async { + try { + var res = await getBusRouteByBusID(busId, busType); + return res; + } catch (error) { + return Future.error(error); + } +} diff --git a/frontend/where_child_bus_guardian/lib/service/get_child_list_by_guardian_id.dart b/frontend/where_child_bus_guardian/lib/service/get_child_list_by_guardian_id.dart new file mode 100644 index 00000000..2f834a8a --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/service/get_child_list_by_guardian_id.dart @@ -0,0 +1,12 @@ +import 'package:where_child_bus_guardian/util/api/child.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/child.pb.dart'; + +Future getChildListByGuardianIdService( + String guardianId) async { + try { + var res = await getChildListByGuardianId(guardianId); + return res; + } catch (error) { + return Future.error(error); + } +} diff --git a/frontend/where_child_bus_guardian/lib/service/get_nursery_by_guardian_id.dart b/frontend/where_child_bus_guardian/lib/service/get_nursery_by_guardian_id.dart new file mode 100644 index 00000000..69ad126c --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/service/get_nursery_by_guardian_id.dart @@ -0,0 +1,12 @@ +import 'package:where_child_bus_guardian/util/api/nursery.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/nursery.pb.dart'; + +Future getNurseryByGuardianIdService( + String guardianId) async { + try { + var res = await getNurseryByGuardianId(guardianId); + return res; + } catch (error) { + return Future.error(error); + } +} diff --git a/frontend/where_child_bus_guardian/lib/service/get_running_bus_by_guardian_id.dart b/frontend/where_child_bus_guardian/lib/service/get_running_bus_by_guardian_id.dart new file mode 100644 index 00000000..7a13f9f4 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/service/get_running_bus_by_guardian_id.dart @@ -0,0 +1,12 @@ +import 'package:where_child_bus_guardian/util/api/bus.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/bus.pb.dart'; + +Future getRunningBusByGuardianIdService( + String guardianId) async { + try { + var res = await getRunningBusByGuardianId(guardianId); + return res; + } catch (error) { + return Future.error(error); + } +} diff --git a/frontend/where_child_bus_guardian/lib/service/update_child_item_status.dart b/frontend/where_child_bus_guardian/lib/service/update_child_item_status.dart new file mode 100644 index 00000000..eaf538b3 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/service/update_child_item_status.dart @@ -0,0 +1,23 @@ +import "dart:developer" as developer; +import 'package:where_child_bus_api/proto-gen/google/protobuf/field_mask.pb.dart'; +import 'package:where_child_bus_guardian/util/api/child.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/child.pbgrpc.dart'; + +Future updateChildItemStatusService( + {String? childId, + bool? checkForMissingItems = false, + bool? hasBag = false, + bool? hasLunchBox = false, + bool? hasWaterBottle = false, + bool? hasUmbrella = false, + bool? hasOther = false, + FieldMask? updateMask}) async { + try { + var res = await updateChildItemStatus(childId, checkForMissingItems, hasBag, + hasLunchBox, hasWaterBottle, hasUmbrella, hasOther, updateMask); + return res; + } catch (error) { + developer.log("Caught Error:", error: error); + return Future.error(error); + } +} diff --git a/frontend/where_child_bus_guardian/lib/service/update_guardian_status.dart b/frontend/where_child_bus_guardian/lib/service/update_guardian_status.dart new file mode 100644 index 00000000..fbfbb158 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/service/update_guardian_status.dart @@ -0,0 +1,21 @@ +import "dart:developer" as developer; +import 'package:where_child_bus_api/proto-gen/google/protobuf/field_mask.pb.dart'; +import 'package:where_child_bus_guardian/util/api/guardian.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/guardian.pbgrpc.dart'; + +Future updateGuardianStatusService( + {String? guardianId, + bool? hasUmbrella = false, + bool? hasOther = false, + bool? isUseMorningBus = false, + bool? isUseEveningBus = false, + FieldMask? updateMask}) async { + try { + var res = await updateGuardianStatus( + guardianId, isUseMorningBus, isUseEveningBus, updateMask); + return res; + } catch (error) { + developer.log("Caught Error:", error: error); + return Future.error(error); + } +} diff --git a/frontend/where_child_bus_guardian/lib/util/api/bus.dart b/frontend/where_child_bus_guardian/lib/util/api/bus.dart new file mode 100644 index 00000000..e46b6ca5 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/util/api/bus.dart @@ -0,0 +1,58 @@ +import 'dart:async'; +import 'dart:developer' as developer; +import 'package:flutter/foundation.dart'; +import 'package:grpc/grpc.dart'; +import 'package:where_child_bus_guardian/config/config.dart'; +import "package:where_child_bus_api/proto-gen/where_child_bus/v1/bus.pbgrpc.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 T as Future; + } finally { + await channel.shutdown(); + } +} + +Future getRunningBusByGuardianId( + String guardianId) async { + return performGrpcCall((client) async { + var req = GetRunningBusByGuardianIdRequest(guardianId: guardianId); + return client.getRunningBusByGuardianId(req); + }); +} + +Stream trackBusContinuous( + TrackBusContinuousRequest request) async* { + final channel = ClientChannel( + appConfig.grpcEndpoint, + port: appConfig.grpcPort, + options: const ChannelOptions(), + ); + + final grpcClient = BusServiceClient(channel); + developer.log("ServiceClient created"); + final res = grpcClient.trackBusContinuous(request); + + try { + await for (var response in res) { + developer.log("Received response: $response"); + yield response; + } + } catch (error) { + developer.log("Caught Error:", error: error); + } finally { + await channel.shutdown(); + } +} diff --git a/frontend/where_child_bus_guardian/lib/util/api/bus_route.dart b/frontend/where_child_bus_guardian/lib/util/api/bus_route.dart new file mode 100644 index 00000000..affc0ffa --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/util/api/bus_route.dart @@ -0,0 +1,35 @@ +import 'dart:developer' as developer; +import 'package:flutter/foundation.dart'; +import 'package:grpc/grpc.dart'; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pbenum.dart'; +import 'package:where_child_bus_guardian/config/config.dart'; +import "package:where_child_bus_api/proto-gen/where_child_bus/v1/station.pbgrpc.dart"; +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/bus_route.pbgrpc.dart'; + +Future performGrpcCall( + Future Function(BusRouteServiceClient) grpcCall) async { + final channel = + ClientChannel(appConfig.grpcEndpoint, port: appConfig.grpcPort); + final grpcClient = BusRouteServiceClient(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 getBusRouteByBusID( + String busId, BusType busType) async { + return performGrpcCall((client) async { + var req = GetBusRouteByBusIDRequest(busId: busId, busType: busType); + return client.getBusRouteByBusID(req); + }); +} diff --git a/frontend/where_child_bus_guardian/lib/util/api/child.dart b/frontend/where_child_bus_guardian/lib/util/api/child.dart new file mode 100644 index 00000000..2cc0f6c5 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/util/api/child.dart @@ -0,0 +1,65 @@ +import 'dart:developer' as developer; +import 'package:flutter/foundation.dart'; +import 'package:grpc/grpc.dart'; +import 'package:where_child_bus_api/proto-gen/google/protobuf/field_mask.pb.dart'; +import 'package:where_child_bus_guardian/config/config.dart'; +import "package:where_child_bus_api/proto-gen/where_child_bus/v1/child.pbgrpc.dart"; + +Future performGrpcCall( + Future Function(ChildServiceClient) grpcCall) async { + final channel = + ClientChannel(appConfig.grpcEndpoint, port: appConfig.grpcPort); + final grpcClient = ChildServiceClient(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 getChildListByGuardianId( + String guardianId) async { + return performGrpcCall((client) async { + var req = GetChildListByGuardianIDRequest(guardianId: guardianId); + return client.getChildListByGuardianID(req); + }); +} + +Future checkIsChildInBus(String childId) async { + return performGrpcCall((client) async { + var req = CheckIsChildInBusRequest(childId: childId); + return client.checkIsChildInBus(req); + }); +} + +Future updateChildItemStatus( + String? childId, + bool? checkForMissingItems, + bool? hasBag, + bool? hasLunchBox, + bool? hasWaterBottle, + bool? hasUmbrella, + bool? hasOther, + FieldMask? updateMask) async { + return performGrpcCall((client) async { + var req = UpdateChildRequest( + childId: childId, + checkForMissingItems: checkForMissingItems, + hasBag: hasBag, + hasLunchBox: hasLunchBox, + hasWaterBottle: hasWaterBottle, + hasUmbrella: hasUmbrella, + hasOther: hasOther, + updateMask: updateMask, + ); + return client.updateChild(req); + }); +} diff --git a/frontend/where_child_bus_guardian/lib/util/api/guardian.dart b/frontend/where_child_bus_guardian/lib/util/api/guardian.dart new file mode 100644 index 00000000..e7f504eb --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/util/api/guardian.dart @@ -0,0 +1,68 @@ +import "dart:developer" as developer; +import "package:flutter/foundation.dart"; +import 'package:grpc/grpc.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/guardian.pbgrpc.dart"; +import "package:where_child_bus_guardian/config/config.dart"; + +Future guardianLogin( + String email, String password) async { + var channel = ClientChannel(appConfig.grpcEndpoint, port: appConfig.grpcPort); + + var grpcClient = GuardianServiceClient(channel); + + try { + var req = GuardianLoginRequest(email: email, password: password); + + //デバッグ時のみリクエストを表示 + if (kDebugMode) { + developer.log("リクエスト: $req"); + } + + var res = await grpcClient.guardianLogin(req); + if (kDebugMode) { + // developer.log("レスポンス $res"); + } + + await channel.shutdown(); + return res; + } catch (error) { + developer.log("Caught Error", error: error); + return Future.error(error); + } finally { + await channel.shutdown(); + } +} + +Future performGrpcCall( + Future Function(GuardianServiceClient) grpcCall) async { + final channel = + ClientChannel(appConfig.grpcEndpoint, port: appConfig.grpcPort); + final grpcClient = GuardianServiceClient(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 updateGuardianStatus(String? guardianId, + bool? isUseMorningBus, bool? isUseEveningBus, FieldMask? updateMask) async { + return performGrpcCall((client) async { + var req = UpdateGuardianRequest( + guardianId: guardianId, + isUseMorningBus: isUseMorningBus, + isUseEveningBus: isUseEveningBus, + updateMask: updateMask, + ); + return client.updateGuardian(req); + }); +} diff --git a/frontend/where_child_bus_guardian/lib/util/api/health_check.dart b/frontend/where_child_bus_guardian/lib/util/api/health_check.dart new file mode 100644 index 00000000..564d65ba --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/util/api/health_check.dart @@ -0,0 +1,29 @@ +import 'dart:async'; +import 'dart:developer' as developer; // エラーログに使用 +import 'package:grpc/grpc.dart'; +import "package:where_child_bus_api/proto-gen/where_child_bus/v1/health_check.pbgrpc.dart"; +import 'package:where_child_bus_guardian/config/config.dart'; + +Future serviceHealthCheck() async { + final channel = ClientChannel( + appConfig.grpcEndpoint, + port: appConfig.grpcPort, + ); + + final grpcClient = HealthcheckServiceClient(channel, + options: CallOptions(timeout: const Duration(seconds: 60))); + + try { + var rqst = PingRequest(); + rqst.name = "ping"; + PingResponse res = await grpcClient.ping(rqst); + print(res.message); + await channel.shutdown(); + return res; + } catch (error) { + developer.log('Caught error: $error'); + return Future.error(error); + } finally { + await channel.shutdown(); + } +} diff --git a/frontend/where_child_bus_guardian/lib/util/api/nursery.dart b/frontend/where_child_bus_guardian/lib/util/api/nursery.dart new file mode 100644 index 00000000..b6093c03 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/util/api/nursery.dart @@ -0,0 +1,33 @@ +import 'dart:developer' as developer; +import 'package:flutter/foundation.dart'; +import 'package:grpc/grpc.dart'; +import 'package:where_child_bus_guardian/config/config.dart'; +import "package:where_child_bus_api/proto-gen/where_child_bus/v1/nursery.pbgrpc.dart"; + +Future performGrpcCall( + Future Function(NurseryServiceClient) grpcCall) async { + final channel = + ClientChannel(appConfig.grpcEndpoint, port: appConfig.grpcPort); + final grpcClient = NurseryServiceClient(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 getNurseryByGuardianId( + String guardianId) async { + return performGrpcCall((client) async { + var req = GetNurseryByGuardianIdRequest(guardianId: guardianId); + return client.getNurseryByGuardianId(req); + }); +} diff --git a/frontend/where_child_bus_guardian/lib/util/arrival_time_manager.dart b/frontend/where_child_bus_guardian/lib/util/arrival_time_manager.dart new file mode 100644 index 00000000..8a8fbf01 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/util/arrival_time_manager.dart @@ -0,0 +1,75 @@ +import "dart:developer" as developer; +import 'dart:async'; +import 'package:where_child_bus_guardian/pages/map_page/map_page.dart'; +import 'package:where_child_bus_guardian/util/google_map_manager.dart'; + +class ArrivalTimeManager { + static final ArrivalTimeManager _instance = ArrivalTimeManager._internal(); + + ArrivalTimeManager._internal(); + + static ArrivalTimeManager get instance => _instance; + + Future getArrivalTime( + double busLatitude, + double busLongitude, + double nextStationLatitude, + double nextStationLongitude, + double guardianLatitude, + double guardianLongitude, + List waypoints) async { + String waypointsString = _generateWaypointsString( + waypoints, + nextStationLatitude, + nextStationLongitude, + guardianLatitude, + guardianLongitude); + + Map response = await GoogleMapAPIManager().getDirections( + startLat: busLatitude.toString(), + startLng: busLongitude.toString(), + endLat: guardianLatitude.toString(), + endLng: guardianLongitude.toString(), + waypoints: waypointsString, + ); + + return _parseDurationFromResponse(response); + } + + String _generateWaypointsString(List waypoints, double startLat, + double startLng, double endLat, double endLng) { + int startIndex = waypoints.indexWhere( + (point) => point.latitude == startLat && point.longitude == startLng); + int endIndex = waypoints.indexWhere( + (point) => point.latitude == endLat && point.longitude == endLng); + + if (startIndex == -1) { + startIndex = 0; + } + + if (endIndex == -1 || endIndex < startIndex) { + endIndex = waypoints.length; + } + + developer.log("$waypoints"); + + return waypoints + .sublist(startIndex, endIndex) + .map((point) => 'via:${point.latitude},${point.longitude}') + .join('|'); + } + + int? _parseDurationFromResponse(Map data) { + if (data == null) return null; + + if (data['routes'] == null || data['routes'].isEmpty) { + developer.log('No routes found.', + name: 'ArrivalTimeManager getRoutesError'); + return null; + } + + final route = data['routes'][0]; + final int duration = route['legs'][0]['duration']['value']; + return duration; + } +} diff --git a/frontend/where_child_bus_guardian/lib/util/google_map_manager.dart b/frontend/where_child_bus_guardian/lib/util/google_map_manager.dart new file mode 100644 index 00000000..a960ba29 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/util/google_map_manager.dart @@ -0,0 +1,112 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:http/http.dart' as http; +import 'dart:developer' as developer; +import 'dart:io' show Platform; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:flutter_polyline_points/flutter_polyline_points.dart'; +import 'package:where_child_bus_guardian/pages/map_page/map_page.dart'; + +class GoogleMapAPIManager { + static final GoogleMapAPIManager _instance = GoogleMapAPIManager._internal(); + final String googleApiKey; + Map _lastApiCallTimestamps = {}; + bool isFirstTime = true; + + GoogleMapAPIManager._internal() + : googleApiKey = Platform.isAndroid + ? dotenv.get("ANDROID_GOOGLE_MAP_API_KEY") + : Platform.isIOS + ? dotenv.get("IOS_GOOGLE_MAP_API_KEY") + : ""; + + factory GoogleMapAPIManager() { + return _instance; + } + // APIリクエストの頻度を制限するメソッド + void _throttleApiCall(String apiName) { + if (_lastApiCallTimestamps.containsKey(apiName)) { + final durationSinceLastCall = + DateTime.now().difference(_lastApiCallTimestamps[apiName]!); + if (durationSinceLastCall.inSeconds < 3) { + throw Exception( + 'Too many requests: $apiName can only be called once per minute.'); + } + } + _lastApiCallTimestamps[apiName] = DateTime.now(); + } + + // Google Maps APIへのリクエストを行うメソッド + Future _fetchFromGoogleAPI(String url, String apiName) async { + _throttleApiCall(apiName); + + final response = await http.get(Uri.parse(url)); + if (response.statusCode == 200) { + return response; + } else { + throw Exception('Failed to load data from Google Maps API'); + } + } + + // 方向取得のAPIを叩くメソッド + Future getDirections({ + required String startLat, + required String startLng, + required String endLat, + required String endLng, + String waypoints = '', + }) async { + developer.log( + '${startLat}, ${startLng}, ${endLat}, ${endLng}, ${waypoints}', + name: 'getDirections'); + String url = waypoints == '' + ? 'https://maps.googleapis.com/maps/api/directions/json?origin=$startLat,$startLng&destination=$endLat,$endLng&key=$googleApiKey' + : 'https://maps.googleapis.com/maps/api/directions/json?origin=$startLat,$startLng&destination=$endLat,$endLng&waypoints=$waypoints&key=$googleApiKey'; + final response = await _fetchFromGoogleAPI(url, 'getDirections'); + developer.log('${response.body}', name: "googleMapManager getDirections"); + return json.decode(response.body); + } + + // 住所から緯度経度を取得するAPIを叩くメソッド + Future geocodeAddress(String address) async { + String url = + 'https://maps.googleapis.com/maps/api/geocode/json?address=$address&key=$googleApiKey'; + final response = await _fetchFromGoogleAPI(url, 'geocodeAddress'); + developer.log('${response.body}', name: "geocodeAddress"); + return json.decode(response.body); + } + + // ポリラインの座標を取得するAPIを叩くメソッド + Future> getPolylinePoints({ + required String startLat, + required String startLng, + required String endLat, + required String endLng, + List waypoints = const [], + }) async { + PolylinePoints polylinePoints = PolylinePoints(); + List polylineCoordinates = []; + + List polylineWayPoints = waypoints + .map((waypoint) => PolylineWayPoint( + location: "${waypoint.latitude},${waypoint.longitude}")) + .toList(); + + PolylineResult result = await polylinePoints.getRouteBetweenCoordinates( + googleApiKey, + PointLatLng(double.parse(startLat), double.parse(startLng)), + PointLatLng(double.parse(endLat), double.parse(endLng)), + travelMode: TravelMode.driving, + wayPoints: polylineWayPoints, + ); + + if (result.points.isNotEmpty) { + result.points.forEach((PointLatLng point) { + polylineCoordinates.add(LatLng(point.latitude, point.longitude)); + }); + } + + return polylineCoordinates; + } +} diff --git a/frontend/where_child_bus_guardian/lib/util/guardian_data.dart b/frontend/where_child_bus_guardian/lib/util/guardian_data.dart new file mode 100644 index 00000000..6c624df0 --- /dev/null +++ b/frontend/where_child_bus_guardian/lib/util/guardian_data.dart @@ -0,0 +1,20 @@ +import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart'; + +class GuardianData { + static final GuardianData _singleton = GuardianData._internal(); + late GuardianResponse _guardian; + + factory GuardianData() { + return _singleton; + } + + GuardianData._internal(); + + void setGuardian(GuardianResponse guardian) { + _guardian = guardian; + } + + GuardianResponse getGuardian() { + return _guardian; + } +} diff --git a/frontend/where_child_bus_guardian/linux/.gitignore b/frontend/where_child_bus_guardian/linux/.gitignore new file mode 100644 index 00000000..d3896c98 --- /dev/null +++ b/frontend/where_child_bus_guardian/linux/.gitignore @@ -0,0 +1 @@ +flutter/ephemeral diff --git a/frontend/where_child_bus_guardian/linux/CMakeLists.txt b/frontend/where_child_bus_guardian/linux/CMakeLists.txt new file mode 100644 index 00000000..805c44d8 --- /dev/null +++ b/frontend/where_child_bus_guardian/linux/CMakeLists.txt @@ -0,0 +1,145 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.10) +project(runner LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "where_child_bus_guardian") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID +set(APPLICATION_ID "com.example.where_child_bus_guardian") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(SET CMP0063 NEW) + +# Load bundled libraries from the lib/ directory relative to the binary. +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") + +# Root filesystem for cross-building. +if(FLUTTER_TARGET_PLATFORM_SYSROOT) + set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endif() + +# Define build configuration options. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") +endif() + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_14) + target_compile_options(${TARGET} PRIVATE -Wall -Werror) + target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") + target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) + +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Define the application target. To change its name, change BINARY_NAME above, +# not the value here, or `flutter run` will no longer work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} + "main.cc" + "my_application.cc" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add dependency libraries. Add any application-specific dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) + +# Only the install-generated bundle's copy of the executable will launch +# correctly, since the resources must in the right relative locations. To avoid +# people trying to run the unbundled copy, put it in a subdirectory instead of +# the default top-level location. +set_target_properties(${BINARY_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" +) + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# By default, "installing" just makes a relocatable bundle in the build +# directory. +set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +# Start with a clean build bundle directory every time. +install(CODE " + file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") + " COMPONENT Runtime) + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) + install(FILES "${bundled_library}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endforeach(bundled_library) + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") + install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() diff --git a/frontend/where_child_bus_guardian/linux/flutter/CMakeLists.txt b/frontend/where_child_bus_guardian/linux/flutter/CMakeLists.txt new file mode 100644 index 00000000..d5bd0164 --- /dev/null +++ b/frontend/where_child_bus_guardian/linux/flutter/CMakeLists.txt @@ -0,0 +1,88 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.10) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. + +# Serves the same purpose as list(TRANSFORM ... PREPEND ...), +# which isn't available in 3.10. +function(list_prepend LIST_NAME PREFIX) + set(NEW_LIST "") + foreach(element ${${LIST_NAME}}) + list(APPEND NEW_LIST "${PREFIX}${element}") + endforeach(element) + set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) +endfunction() + +# === Flutter Library === +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) +pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) +pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) + +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "fl_basic_message_channel.h" + "fl_binary_codec.h" + "fl_binary_messenger.h" + "fl_dart_project.h" + "fl_engine.h" + "fl_json_message_codec.h" + "fl_json_method_codec.h" + "fl_message_codec.h" + "fl_method_call.h" + "fl_method_channel.h" + "fl_method_codec.h" + "fl_method_response.h" + "fl_plugin_registrar.h" + "fl_plugin_registry.h" + "fl_standard_message_codec.h" + "fl_standard_method_codec.h" + "fl_string_codec.h" + "fl_value.h" + "fl_view.h" + "flutter_linux.h" +) +list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") +target_link_libraries(flutter INTERFACE + PkgConfig::GTK + PkgConfig::GLIB + PkgConfig::GIO +) +add_dependencies(flutter flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CMAKE_CURRENT_BINARY_DIR}/_phony_ + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" + ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} +) diff --git a/frontend/where_child_bus_guardian/linux/flutter/generated_plugin_registrant.cc b/frontend/where_child_bus_guardian/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 00000000..e71a16d2 --- /dev/null +++ b/frontend/where_child_bus_guardian/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void fl_register_plugins(FlPluginRegistry* registry) { +} diff --git a/frontend/where_child_bus_guardian/linux/flutter/generated_plugin_registrant.h b/frontend/where_child_bus_guardian/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 00000000..e0f0a47b --- /dev/null +++ b/frontend/where_child_bus_guardian/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/frontend/where_child_bus_guardian/linux/flutter/generated_plugins.cmake b/frontend/where_child_bus_guardian/linux/flutter/generated_plugins.cmake new file mode 100644 index 00000000..2e1de87a --- /dev/null +++ b/frontend/where_child_bus_guardian/linux/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/frontend/where_child_bus_guardian/linux/main.cc b/frontend/where_child_bus_guardian/linux/main.cc new file mode 100644 index 00000000..e7c5c543 --- /dev/null +++ b/frontend/where_child_bus_guardian/linux/main.cc @@ -0,0 +1,6 @@ +#include "my_application.h" + +int main(int argc, char** argv) { + g_autoptr(MyApplication) app = my_application_new(); + return g_application_run(G_APPLICATION(app), argc, argv); +} diff --git a/frontend/where_child_bus_guardian/linux/my_application.cc b/frontend/where_child_bus_guardian/linux/my_application.cc new file mode 100644 index 00000000..1dbc4445 --- /dev/null +++ b/frontend/where_child_bus_guardian/linux/my_application.cc @@ -0,0 +1,104 @@ +#include "my_application.h" + +#include +#ifdef GDK_WINDOWING_X11 +#include +#endif + +#include "flutter/generated_plugin_registrant.h" + +struct _MyApplication { + GtkApplication parent_instance; + char** dart_entrypoint_arguments; +}; + +G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) + +// Implements GApplication::activate. +static void my_application_activate(GApplication* application) { + MyApplication* self = MY_APPLICATION(application); + GtkWindow* window = + GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); + + // Use a header bar when running in GNOME as this is the common style used + // by applications and is the setup most users will be using (e.g. Ubuntu + // desktop). + // If running on X and not using GNOME then just use a traditional title bar + // in case the window manager does more exotic layout, e.g. tiling. + // If running on Wayland assume the header bar will work (may need changing + // if future cases occur). + gboolean use_header_bar = TRUE; +#ifdef GDK_WINDOWING_X11 + GdkScreen* screen = gtk_window_get_screen(window); + if (GDK_IS_X11_SCREEN(screen)) { + const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); + if (g_strcmp0(wm_name, "GNOME Shell") != 0) { + use_header_bar = FALSE; + } + } +#endif + if (use_header_bar) { + GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); + gtk_widget_show(GTK_WIDGET(header_bar)); + gtk_header_bar_set_title(header_bar, "where_child_bus_guardian"); + gtk_header_bar_set_show_close_button(header_bar, TRUE); + gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); + } else { + gtk_window_set_title(window, "where_child_bus_guardian"); + } + + gtk_window_set_default_size(window, 1280, 720); + gtk_widget_show(GTK_WIDGET(window)); + + g_autoptr(FlDartProject) project = fl_dart_project_new(); + fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); + + FlView* view = fl_view_new(project); + gtk_widget_show(GTK_WIDGET(view)); + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); + + fl_register_plugins(FL_PLUGIN_REGISTRY(view)); + + gtk_widget_grab_focus(GTK_WIDGET(view)); +} + +// Implements GApplication::local_command_line. +static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { + MyApplication* self = MY_APPLICATION(application); + // Strip out the first argument as it is the binary name. + self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); + + g_autoptr(GError) error = nullptr; + if (!g_application_register(application, nullptr, &error)) { + g_warning("Failed to register: %s", error->message); + *exit_status = 1; + return TRUE; + } + + g_application_activate(application); + *exit_status = 0; + + return TRUE; +} + +// Implements GObject::dispose. +static void my_application_dispose(GObject* object) { + MyApplication* self = MY_APPLICATION(object); + g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); + G_OBJECT_CLASS(my_application_parent_class)->dispose(object); +} + +static void my_application_class_init(MyApplicationClass* klass) { + G_APPLICATION_CLASS(klass)->activate = my_application_activate; + G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; + G_OBJECT_CLASS(klass)->dispose = my_application_dispose; +} + +static void my_application_init(MyApplication* self) {} + +MyApplication* my_application_new() { + return MY_APPLICATION(g_object_new(my_application_get_type(), + "application-id", APPLICATION_ID, + "flags", G_APPLICATION_NON_UNIQUE, + nullptr)); +} diff --git a/frontend/where_child_bus_guardian/linux/my_application.h b/frontend/where_child_bus_guardian/linux/my_application.h new file mode 100644 index 00000000..72271d5e --- /dev/null +++ b/frontend/where_child_bus_guardian/linux/my_application.h @@ -0,0 +1,18 @@ +#ifndef FLUTTER_MY_APPLICATION_H_ +#define FLUTTER_MY_APPLICATION_H_ + +#include + +G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, + GtkApplication) + +/** + * my_application_new: + * + * Creates a new Flutter-based application. + * + * Returns: a new #MyApplication. + */ +MyApplication* my_application_new(); + +#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/frontend/where_child_bus_guardian/macos/.gitignore b/frontend/where_child_bus_guardian/macos/.gitignore new file mode 100644 index 00000000..746adbb6 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/.gitignore @@ -0,0 +1,7 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ diff --git a/frontend/where_child_bus_guardian/macos/Flutter/Flutter-Debug.xcconfig b/frontend/where_child_bus_guardian/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 00000000..c2efd0b6 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/frontend/where_child_bus_guardian/macos/Flutter/Flutter-Release.xcconfig b/frontend/where_child_bus_guardian/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 00000000..c2efd0b6 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/frontend/where_child_bus_guardian/macos/Flutter/GeneratedPluginRegistrant.swift b/frontend/where_child_bus_guardian/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 00000000..cccf817a --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,10 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { +} diff --git a/frontend/where_child_bus_guardian/macos/Runner.xcodeproj/project.pbxproj b/frontend/where_child_bus_guardian/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 00000000..e4f2b4ca --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,695 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC10EC2044A3C60003C045; + remoteInfo = Runner; + }; + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* where_child_bus_guardian.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "where_child_bus_guardian.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 331C80D2294CF70F00263BE5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C80D6294CF71000263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C80D7294CF71000263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 331C80D6294CF71000263BE5 /* RunnerTests */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* where_child_bus_guardian.app */, + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C80D1294CF70F00263BE5 /* Sources */, + 331C80D2294CF70F00263BE5 /* Frameworks */, + 331C80D3294CF70F00263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C80DA294CF71000263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* where_child_bus_guardian.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1430; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C80D4294CF70F00263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 33CC10EC2044A3C60003C045; + }; + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 331C80D4294CF70F00263BE5 /* RunnerTests */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C80D3294CF70F00263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C80D1294CF70F00263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC10EC2044A3C60003C045 /* Runner */; + targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; + }; + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 331C80DB294CF71000263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.whereChildBusGuardian.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/where_child_bus_guardian.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/where_child_bus_guardian"; + }; + name = Debug; + }; + 331C80DC294CF71000263BE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.whereChildBusGuardian.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/where_child_bus_guardian.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/where_child_bus_guardian"; + }; + name = Release; + }; + 331C80DD294CF71000263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.whereChildBusGuardian.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/where_child_bus_guardian.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/where_child_bus_guardian"; + }; + name = Profile; + }; + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + 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_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + 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_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + 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_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + 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_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + 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_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + 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_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C80DB294CF71000263BE5 /* Debug */, + 331C80DC294CF71000263BE5 /* Release */, + 331C80DD294CF71000263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/frontend/where_child_bus_guardian/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/frontend/where_child_bus_guardian/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/frontend/where_child_bus_guardian/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/frontend/where_child_bus_guardian/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 00000000..e156773d --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/where_child_bus_guardian/macos/Runner.xcworkspace/contents.xcworkspacedata b/frontend/where_child_bus_guardian/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..1d526a16 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/frontend/where_child_bus_guardian/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/frontend/where_child_bus_guardian/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/frontend/where_child_bus_guardian/macos/Runner/AppDelegate.swift b/frontend/where_child_bus_guardian/macos/Runner/AppDelegate.swift new file mode 100644 index 00000000..d53ef643 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Runner/AppDelegate.swift @@ -0,0 +1,9 @@ +import Cocoa +import FlutterMacOS + +@NSApplicationMain +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } +} diff --git a/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..a2ec33f1 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 00000000..82b6f9d9 Binary files /dev/null and b/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 00000000..13b35eba Binary files /dev/null and b/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 00000000..0a3f5fa4 Binary files /dev/null and b/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 00000000..bdb57226 Binary files /dev/null and b/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 00000000..f083318e Binary files /dev/null and b/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 00000000..326c0e72 Binary files /dev/null and b/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 00000000..2f1632cf Binary files /dev/null and b/frontend/where_child_bus_guardian/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/frontend/where_child_bus_guardian/macos/Runner/Base.lproj/MainMenu.xib b/frontend/where_child_bus_guardian/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 00000000..80e867a4 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/where_child_bus_guardian/macos/Runner/Configs/AppInfo.xcconfig b/frontend/where_child_bus_guardian/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 00000000..8e5febbd --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = where_child_bus_guardian + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.whereChildBusGuardian + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. diff --git a/frontend/where_child_bus_guardian/macos/Runner/Configs/Debug.xcconfig b/frontend/where_child_bus_guardian/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 00000000..36b0fd94 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/frontend/where_child_bus_guardian/macos/Runner/Configs/Release.xcconfig b/frontend/where_child_bus_guardian/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 00000000..dff4f495 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/frontend/where_child_bus_guardian/macos/Runner/Configs/Warnings.xcconfig b/frontend/where_child_bus_guardian/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 00000000..42bcbf47 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/frontend/where_child_bus_guardian/macos/Runner/DebugProfile.entitlements b/frontend/where_child_bus_guardian/macos/Runner/DebugProfile.entitlements new file mode 100644 index 00000000..dddb8a30 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.cs.allow-jit + + com.apple.security.network.server + + + diff --git a/frontend/where_child_bus_guardian/macos/Runner/Info.plist b/frontend/where_child_bus_guardian/macos/Runner/Info.plist new file mode 100644 index 00000000..4789daa6 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Runner/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/frontend/where_child_bus_guardian/macos/Runner/MainFlutterWindow.swift b/frontend/where_child_bus_guardian/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 00000000..3cc05eb2 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,15 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/frontend/where_child_bus_guardian/macos/Runner/Release.entitlements b/frontend/where_child_bus_guardian/macos/Runner/Release.entitlements new file mode 100644 index 00000000..852fa1a4 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/Runner/Release.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/frontend/where_child_bus_guardian/macos/RunnerTests/RunnerTests.swift b/frontend/where_child_bus_guardian/macos/RunnerTests/RunnerTests.swift new file mode 100644 index 00000000..5418c9f5 --- /dev/null +++ b/frontend/where_child_bus_guardian/macos/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import FlutterMacOS +import Cocoa +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_guardian/pubspec.lock b/frontend/where_child_bus_guardian/pubspec.lock new file mode 100644 index 00000000..186660c3 --- /dev/null +++ b/frontend/where_child_bus_guardian/pubspec.lock @@ -0,0 +1,609 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + archive: + dependency: transitive + description: + name: archive + sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" + url: "https://pub.dev" + source: hosted + version: "3.4.10" + args: + dependency: transitive + description: + name: args + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + carousel_slider: + dependency: "direct main" + description: + name: carousel_slider + sha256: "9c695cc963bf1d04a47bd6021f68befce8970bcd61d24938e1fb0918cf5d9c42" + url: "https://pub.dev" + source: hosted + version: "4.2.1" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + collection: + dependency: transitive + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + csslib: + dependency: transitive + description: + name: csslib + sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d + url: "https://pub.dev" + source: hosted + version: "1.0.6" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flinq: + dependency: transitive + description: + name: flinq + sha256: "828d6cc2f2525f2c1fbf1803f1a526f4c6592068b70f46609131d0cc0562f514" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_config: + dependency: "direct main" + description: + name: flutter_config + sha256: a07e6156bb6e776e29c6357be433155acda87d1dab1a3f787a72091a1b71ffbf + url: "https://pub.dev" + source: hosted + version: "2.0.2" + flutter_dotenv: + dependency: "direct main" + description: + name: flutter_dotenv + sha256: "9357883bdd153ab78cbf9ffa07656e336b8bbb2b5a3ca596b0b27e119f7c7d77" + url: "https://pub.dev" + source: hosted + version: "5.1.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 + url: "https://pub.dev" + source: hosted + version: "2.0.3" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: b068ffc46f82a55844acfa4fdbb61fad72fa2aef0905548419d97f0f95c456da + url: "https://pub.dev" + source: hosted + version: "2.0.17" + flutter_polyline_points: + dependency: "direct main" + description: + name: flutter_polyline_points + sha256: "0e07862139cb65a88789cd6efbe284c0b6f1fcb5ed5ec87781759c48190d84b9" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_state_notifier: + dependency: "direct main" + description: + name: flutter_state_notifier + sha256: bd8d4eabd4b74f11733409305369c112fa2f7989290f73ee75ae2cbfcf04b8a3 + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_toggle_tab: + dependency: "direct main" + description: + name: flutter_toggle_tab + sha256: "90ad0d050f656df677998825f985637d010117a1793828cd7e6dadada4ecd2c5" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + google_directions_api: + dependency: "direct main" + description: + name: google_directions_api + sha256: a901c60830b442652c8285631aa11bba3e84c43e77ddf9a2797f8e6398fa5043 + url: "https://pub.dev" + source: hosted + version: "0.10.0" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + sha256: f0b8d115a13ecf827013ec9fc883390ccc0e87a96ed5347a3114cac177ef18e8 + url: "https://pub.dev" + source: hosted + version: "6.1.0" + google_maps: + dependency: transitive + description: + name: google_maps + sha256: "555d5d736339b0478e821167ac521c810d7b51c3b2734e6802a9f046b64ea37a" + url: "https://pub.dev" + source: hosted + version: "6.3.0" + google_maps_flutter: + dependency: "direct main" + description: + name: google_maps_flutter + sha256: ae66fef3e71261d7df2eff29b2a119e190b2884325ecaa55321b1e17b5504066 + url: "https://pub.dev" + source: hosted + version: "2.5.3" + google_maps_flutter_android: + dependency: transitive + description: + name: google_maps_flutter_android + sha256: "714530f865f13bb3b9505c58821c3baed5d247a871724acf5d2ea5808fbed02c" + url: "https://pub.dev" + source: hosted + version: "2.6.2" + google_maps_flutter_ios: + dependency: transitive + description: + name: google_maps_flutter_ios + sha256: "29503b5159da2308a66212c3827963998bfb943ba073e2114fb2d486b47fd2c8" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + google_maps_flutter_platform_interface: + dependency: transitive + description: + name: google_maps_flutter_platform_interface + sha256: "6060779f020638a8eedeb0fb14234818e5fa32ec45a4653d6428ab436e2bbc64" + url: "https://pub.dev" + source: hosted + version: "2.4.3" + google_maps_flutter_web: + dependency: transitive + description: + name: google_maps_flutter_web + sha256: "6245721c160d6f531c1ef568cf9bef8d660cd585a982aa75121269030163785a" + url: "https://pub.dev" + source: hosted + version: "0.5.4+3" + google_polyline_algorithm: + dependency: transitive + description: + name: google_polyline_algorithm + sha256: "357874f00d3f93c3ba1bf4b4d9a154aa9ee87147c068238c1e8392012b686a03" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + googleapis_auth: + dependency: transitive + description: + name: googleapis_auth + sha256: af7c3a3edf9d0de2e1e0a77e994fae0a581c525fa7012af4fa0d4a52ed9484da + url: "https://pub.dev" + source: hosted + version: "1.4.1" + grpc: + dependency: "direct main" + description: + name: grpc + sha256: e93ee3bce45c134bf44e9728119102358c7cd69de7832d9a874e2e74eb8cab40 + url: "https://pub.dev" + source: hosted + version: "3.2.4" + html: + dependency: transitive + description: + name: html + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + url: "https://pub.dev" + source: hosted + version: "0.15.4" + http: + dependency: transitive + description: + name: http + sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba + url: "https://pub.dev" + source: hosted + version: "1.2.0" + http2: + dependency: transitive + description: + name: http2 + sha256: "9ced024a160b77aba8fb8674e38f70875e321d319e6f303ec18e87bd5a4b0c1d" + url: "https://pub.dev" + source: hosted + version: "2.3.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + intl: + dependency: "direct main" + description: + name: intl + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + url: "https://pub.dev" + source: hosted + version: "0.19.0" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + js_wrapping: + dependency: transitive + description: + name: js_wrapping + sha256: e385980f7c76a8c1c9a560dfb623b890975841542471eade630b2871d243851c + url: "https://pub.dev" + source: hosted + version: "0.7.4" + lints: + dependency: transitive + description: + name: lints + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" + source: hosted + version: "0.12.16" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" + source: hosted + version: "0.5.0" + meta: + dependency: transitive + description: + name: meta + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + url: "https://pub.dev" + source: hosted + version: "1.10.0" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + path: + dependency: transitive + description: + name: path + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" + source: hosted + version: "1.8.3" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + platform: + dependency: transitive + description: + name: platform + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + url: "https://pub.dev" + source: hosted + version: "3.1.4" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pointycastle: + dependency: transitive + description: + name: pointycastle + sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29" + url: "https://pub.dev" + source: hosted + version: "3.7.4" + protobuf: + dependency: "direct main" + description: + name: protobuf + sha256: "68645b24e0716782e58948f8467fd42a880f255096a821f9e7d0ec625b00c84d" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + provider: + dependency: transitive + description: + name: provider + sha256: "9a96a0a19b594dbc5bf0f1f27d2bc67d5f95957359b461cd9feb44ed6ae75096" + url: "https://pub.dev" + source: hosted + version: "6.1.1" + sanitize_html: + dependency: transitive + description: + name: sanitize_html + sha256: "12669c4a913688a26555323fb9cec373d8f9fbe091f2d01c40c723b33caa8989" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + state_notifier: + dependency: transitive + description: + name: state_notifier + sha256: b8677376aa54f2d7c58280d5a007f9e8774f1968d1fb1c096adcb4792fba29bb + url: "https://pub.dev" + source: hosted + version: "1.0.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" + source: hosted + version: "0.6.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + web: + dependency: transitive + description: + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" + source: hosted + version: "0.3.0" + where_child_bus_api: + dependency: "direct main" + description: + path: "../where_child_bus_api" + relative: true + source: path + version: "0.0.1" + win32: + dependency: transitive + description: + name: win32 + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" + url: "https://pub.dev" + source: hosted + version: "5.2.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + url: "https://pub.dev" + source: hosted + version: "1.0.4" +sdks: + dart: ">=3.2.6 <4.0.0" + flutter: ">=3.16.6" diff --git a/frontend/where_child_bus_guardian/pubspec.yaml b/frontend/where_child_bus_guardian/pubspec.yaml new file mode 100644 index 00000000..c5e82b42 --- /dev/null +++ b/frontend/where_child_bus_guardian/pubspec.yaml @@ -0,0 +1,41 @@ +name: where_child_bus_guardian +description: "WhereChildBus Guardian" +publish_to: "none" + +version: 1.0.0+1 + +environment: + sdk: ">=3.2.6 <4.0.0" + +dependencies: + flutter: + sdk: flutter + grpc: ^3.2.4 + protobuf: ^3.1.0 + flutter_dotenv: ^5.1.0 + + cupertino_icons: ^1.0.2 + flutter_toggle_tab: ^1.4.1 + carousel_slider: ^4.2.1 + flutter_state_notifier: ^1.0.0 + google_maps_flutter: ^2.5.3 + flutter_polyline_points: ^2.0.0 + google_directions_api: ^0.10.0 + intl: ^0.19.0 + where_child_bus_api: + path: ../where_child_bus_api + google_fonts: ^6.1.0 + flutter_config: ^2.0.2 + + +dev_dependencies: + flutter_test: + sdk: flutter + + flutter_lints: ^2.0.0 + +flutter: + uses-material-design: true + assets: + - assets/images/ + - .env diff --git a/frontend/where_child_bus_guardian/test/widget_test.dart b/frontend/where_child_bus_guardian/test/widget_test.dart new file mode 100644 index 00000000..ab73b3a2 --- /dev/null +++ b/frontend/where_child_bus_guardian/test/widget_test.dart @@ -0,0 +1 @@ +void main() {} diff --git a/frontend/where_child_bus_guardian/web/favicon.png b/frontend/where_child_bus_guardian/web/favicon.png new file mode 100644 index 00000000..8aaa46ac Binary files /dev/null and b/frontend/where_child_bus_guardian/web/favicon.png differ diff --git a/frontend/where_child_bus_guardian/web/icons/Icon-192.png b/frontend/where_child_bus_guardian/web/icons/Icon-192.png new file mode 100644 index 00000000..b749bfef Binary files /dev/null and b/frontend/where_child_bus_guardian/web/icons/Icon-192.png differ diff --git a/frontend/where_child_bus_guardian/web/icons/Icon-512.png b/frontend/where_child_bus_guardian/web/icons/Icon-512.png new file mode 100644 index 00000000..88cfd48d Binary files /dev/null and b/frontend/where_child_bus_guardian/web/icons/Icon-512.png differ diff --git a/frontend/where_child_bus_guardian/web/icons/Icon-maskable-192.png b/frontend/where_child_bus_guardian/web/icons/Icon-maskable-192.png new file mode 100644 index 00000000..eb9b4d76 Binary files /dev/null and b/frontend/where_child_bus_guardian/web/icons/Icon-maskable-192.png differ diff --git a/frontend/where_child_bus_guardian/web/icons/Icon-maskable-512.png b/frontend/where_child_bus_guardian/web/icons/Icon-maskable-512.png new file mode 100644 index 00000000..d69c5669 Binary files /dev/null and b/frontend/where_child_bus_guardian/web/icons/Icon-maskable-512.png differ diff --git a/frontend/where_child_bus_guardian/web/index.html b/frontend/where_child_bus_guardian/web/index.html new file mode 100644 index 00000000..7f84743a --- /dev/null +++ b/frontend/where_child_bus_guardian/web/index.html @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + where_child_bus_guardian + + + + + + + + + + diff --git a/frontend/where_child_bus_guardian/web/manifest.json b/frontend/where_child_bus_guardian/web/manifest.json new file mode 100644 index 00000000..e00c1458 --- /dev/null +++ b/frontend/where_child_bus_guardian/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "where_child_bus_guardian", + "short_name": "where_child_bus_guardian", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "icons/Icon-maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/Icon-maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/frontend/where_child_bus_guardian/windows/.gitignore b/frontend/where_child_bus_guardian/windows/.gitignore new file mode 100644 index 00000000..d492d0d9 --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/.gitignore @@ -0,0 +1,17 @@ +flutter/ephemeral/ + +# Visual Studio user-specific files. +*.suo +*.user +*.userosscache +*.sln.docstates + +# Visual Studio build-related files. +x64/ +x86/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ diff --git a/frontend/where_child_bus_guardian/windows/CMakeLists.txt b/frontend/where_child_bus_guardian/windows/CMakeLists.txt new file mode 100644 index 00000000..af550d8c --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/CMakeLists.txt @@ -0,0 +1,108 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.14) +project(where_child_bus_guardian LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "where_child_bus_guardian") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(VERSION 3.14...3.25) + +# Define build configuration option. +get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(IS_MULTICONFIG) + set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" + CACHE STRING "" FORCE) +else() + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") + endif() +endif() +# Define settings for the Profile build mode. +set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") +set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") +set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") +set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") + +# Use Unicode for all projects. +add_definitions(-DUNICODE -D_UNICODE) + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_17) + target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") + target_compile_options(${TARGET} PRIVATE /EHsc) + target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") + target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# Support files are copied into place next to the executable, so that it can +# run in place. This is done instead of making a separate bundle (as on Linux) +# so that building and running from within Visual Studio will work. +set(BUILD_BUNDLE_DIR "$") +# Make the "install" step default, as it's required to run. +set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +if(PLUGIN_BUNDLED_LIBRARIES) + install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + CONFIGURATIONS Profile;Release + COMPONENT Runtime) diff --git a/frontend/where_child_bus_guardian/windows/flutter/CMakeLists.txt b/frontend/where_child_bus_guardian/windows/flutter/CMakeLists.txt new file mode 100644 index 00000000..903f4899 --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/flutter/CMakeLists.txt @@ -0,0 +1,109 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.14) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. +set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") + +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + +# === Flutter Library === +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "flutter_export.h" + "flutter_windows.h" + "flutter_messenger.h" + "flutter_plugin_registrar.h" + "flutter_texture_registrar.h" +) +list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") +add_dependencies(flutter flutter_assemble) + +# === Wrapper === +list(APPEND CPP_WRAPPER_SOURCES_CORE + "core_implementations.cc" + "standard_codec.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_PLUGIN + "plugin_registrar.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_APP + "flutter_engine.cc" + "flutter_view_controller.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") + +# Wrapper sources needed for a plugin. +add_library(flutter_wrapper_plugin STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} +) +apply_standard_settings(flutter_wrapper_plugin) +set_target_properties(flutter_wrapper_plugin PROPERTIES + POSITION_INDEPENDENT_CODE ON) +set_target_properties(flutter_wrapper_plugin PROPERTIES + CXX_VISIBILITY_PRESET hidden) +target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) +target_include_directories(flutter_wrapper_plugin PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_plugin flutter_assemble) + +# Wrapper sources needed for the runner. +add_library(flutter_wrapper_app STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_APP} +) +apply_standard_settings(flutter_wrapper_app) +target_link_libraries(flutter_wrapper_app PUBLIC flutter) +target_include_directories(flutter_wrapper_app PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_app flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") +set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} + ${PHONY_OUTPUT} + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" + ${FLUTTER_TARGET_PLATFORM} $ + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} +) diff --git a/frontend/where_child_bus_guardian/windows/flutter/generated_plugin_registrant.cc b/frontend/where_child_bus_guardian/windows/flutter/generated_plugin_registrant.cc new file mode 100644 index 00000000..8b6d4680 --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void RegisterPlugins(flutter::PluginRegistry* registry) { +} diff --git a/frontend/where_child_bus_guardian/windows/flutter/generated_plugin_registrant.h b/frontend/where_child_bus_guardian/windows/flutter/generated_plugin_registrant.h new file mode 100644 index 00000000..dc139d85 --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void RegisterPlugins(flutter::PluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/frontend/where_child_bus_guardian/windows/flutter/generated_plugins.cmake b/frontend/where_child_bus_guardian/windows/flutter/generated_plugins.cmake new file mode 100644 index 00000000..b93c4c30 --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/frontend/where_child_bus_guardian/windows/runner/CMakeLists.txt b/frontend/where_child_bus_guardian/windows/runner/CMakeLists.txt new file mode 100644 index 00000000..394917c0 --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/runner/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.14) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} WIN32 + "flutter_window.cpp" + "main.cpp" + "utils.cpp" + "win32_window.cpp" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" + "Runner.rc" + "runner.exe.manifest" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the build version. +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") + +# Disable Windows macros that collide with C++ standard library functions. +target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") + +# Add dependency libraries and include directories. Add any application-specific +# dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) +target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/frontend/where_child_bus_guardian/windows/runner/Runner.rc b/frontend/where_child_bus_guardian/windows/runner/Runner.rc new file mode 100644 index 00000000..b21e27b5 --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/runner/Runner.rc @@ -0,0 +1,121 @@ +// Microsoft Visual C++ generated resource script. +// +#pragma code_page(65001) +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_APP_ICON ICON "resources\\app_icon.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) +#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD +#else +#define VERSION_AS_NUMBER 1,0,0,0 +#endif + +#if defined(FLUTTER_VERSION) +#define VERSION_AS_STRING FLUTTER_VERSION +#else +#define VERSION_AS_STRING "1.0.0" +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_AS_NUMBER + PRODUCTVERSION VERSION_AS_NUMBER + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "com.example" "\0" + VALUE "FileDescription", "where_child_bus_guardian" "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "where_child_bus_guardian" "\0" + VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" + VALUE "OriginalFilename", "where_child_bus_guardian.exe" "\0" + VALUE "ProductName", "where_child_bus_guardian" "\0" + VALUE "ProductVersion", VERSION_AS_STRING "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/frontend/where_child_bus_guardian/windows/runner/flutter_window.cpp b/frontend/where_child_bus_guardian/windows/runner/flutter_window.cpp new file mode 100644 index 00000000..955ee303 --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/runner/flutter_window.cpp @@ -0,0 +1,71 @@ +#include "flutter_window.h" + +#include + +#include "flutter/generated_plugin_registrant.h" + +FlutterWindow::FlutterWindow(const flutter::DartProject& project) + : project_(project) {} + +FlutterWindow::~FlutterWindow() {} + +bool FlutterWindow::OnCreate() { + if (!Win32Window::OnCreate()) { + return false; + } + + RECT frame = GetClientArea(); + + // The size here must match the window dimensions to avoid unnecessary surface + // creation / destruction in the startup path. + flutter_controller_ = std::make_unique( + frame.right - frame.left, frame.bottom - frame.top, project_); + // Ensure that basic setup of the controller was successful. + if (!flutter_controller_->engine() || !flutter_controller_->view()) { + return false; + } + RegisterPlugins(flutter_controller_->engine()); + SetChildContent(flutter_controller_->view()->GetNativeWindow()); + + flutter_controller_->engine()->SetNextFrameCallback([&]() { + this->Show(); + }); + + // Flutter can complete the first frame before the "show window" callback is + // registered. The following call ensures a frame is pending to ensure the + // window is shown. It is a no-op if the first frame hasn't completed yet. + flutter_controller_->ForceRedraw(); + + return true; +} + +void FlutterWindow::OnDestroy() { + if (flutter_controller_) { + flutter_controller_ = nullptr; + } + + Win32Window::OnDestroy(); +} + +LRESULT +FlutterWindow::MessageHandler(HWND hwnd, UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + // Give Flutter, including plugins, an opportunity to handle window messages. + if (flutter_controller_) { + std::optional result = + flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, + lparam); + if (result) { + return *result; + } + } + + switch (message) { + case WM_FONTCHANGE: + flutter_controller_->engine()->ReloadSystemFonts(); + break; + } + + return Win32Window::MessageHandler(hwnd, message, wparam, lparam); +} diff --git a/frontend/where_child_bus_guardian/windows/runner/flutter_window.h b/frontend/where_child_bus_guardian/windows/runner/flutter_window.h new file mode 100644 index 00000000..6da0652f --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/runner/flutter_window.h @@ -0,0 +1,33 @@ +#ifndef RUNNER_FLUTTER_WINDOW_H_ +#define RUNNER_FLUTTER_WINDOW_H_ + +#include +#include + +#include + +#include "win32_window.h" + +// A window that does nothing but host a Flutter view. +class FlutterWindow : public Win32Window { + public: + // Creates a new FlutterWindow hosting a Flutter view running |project|. + explicit FlutterWindow(const flutter::DartProject& project); + virtual ~FlutterWindow(); + + protected: + // Win32Window: + bool OnCreate() override; + void OnDestroy() override; + LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, + LPARAM const lparam) noexcept override; + + private: + // The project to run. + flutter::DartProject project_; + + // The Flutter instance hosted by this window. + std::unique_ptr flutter_controller_; +}; + +#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/frontend/where_child_bus_guardian/windows/runner/main.cpp b/frontend/where_child_bus_guardian/windows/runner/main.cpp new file mode 100644 index 00000000..4f3938ec --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/runner/main.cpp @@ -0,0 +1,43 @@ +#include +#include +#include + +#include "flutter_window.h" +#include "utils.h" + +int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, + _In_ wchar_t *command_line, _In_ int show_command) { + // Attach to console when present (e.g., 'flutter run') or create a + // new console when running with a debugger. + if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { + CreateAndAttachConsole(); + } + + // Initialize COM, so that it is available for use in the library and/or + // plugins. + ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + + flutter::DartProject project(L"data"); + + std::vector command_line_arguments = + GetCommandLineArguments(); + + project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); + + FlutterWindow window(project); + Win32Window::Point origin(10, 10); + Win32Window::Size size(1280, 720); + if (!window.Create(L"where_child_bus_guardian", origin, size)) { + return EXIT_FAILURE; + } + window.SetQuitOnClose(true); + + ::MSG msg; + while (::GetMessage(&msg, nullptr, 0, 0)) { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + + ::CoUninitialize(); + return EXIT_SUCCESS; +} diff --git a/frontend/where_child_bus_guardian/windows/runner/resource.h b/frontend/where_child_bus_guardian/windows/runner/resource.h new file mode 100644 index 00000000..66a65d1e --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/runner/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Runner.rc +// +#define IDI_APP_ICON 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/frontend/where_child_bus_guardian/windows/runner/resources/app_icon.ico b/frontend/where_child_bus_guardian/windows/runner/resources/app_icon.ico new file mode 100644 index 00000000..c04e20ca Binary files /dev/null and b/frontend/where_child_bus_guardian/windows/runner/resources/app_icon.ico differ diff --git a/frontend/where_child_bus_guardian/windows/runner/runner.exe.manifest b/frontend/where_child_bus_guardian/windows/runner/runner.exe.manifest new file mode 100644 index 00000000..a42ea768 --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/runner/runner.exe.manifest @@ -0,0 +1,20 @@ + + + + + PerMonitorV2 + + + + + + + + + + + + + + + diff --git a/frontend/where_child_bus_guardian/windows/runner/utils.cpp b/frontend/where_child_bus_guardian/windows/runner/utils.cpp new file mode 100644 index 00000000..b2b08734 --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/runner/utils.cpp @@ -0,0 +1,65 @@ +#include "utils.h" + +#include +#include +#include +#include + +#include + +void CreateAndAttachConsole() { + if (::AllocConsole()) { + FILE *unused; + if (freopen_s(&unused, "CONOUT$", "w", stdout)) { + _dup2(_fileno(stdout), 1); + } + if (freopen_s(&unused, "CONOUT$", "w", stderr)) { + _dup2(_fileno(stdout), 2); + } + std::ios::sync_with_stdio(); + FlutterDesktopResyncOutputStreams(); + } +} + +std::vector GetCommandLineArguments() { + // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. + int argc; + wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); + if (argv == nullptr) { + return std::vector(); + } + + std::vector command_line_arguments; + + // Skip the first argument as it's the binary name. + for (int i = 1; i < argc; i++) { + command_line_arguments.push_back(Utf8FromUtf16(argv[i])); + } + + ::LocalFree(argv); + + return command_line_arguments; +} + +std::string Utf8FromUtf16(const wchar_t* utf16_string) { + if (utf16_string == nullptr) { + return std::string(); + } + int target_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + -1, nullptr, 0, nullptr, nullptr) + -1; // remove the trailing null character + int input_length = (int)wcslen(utf16_string); + std::string utf8_string; + if (target_length <= 0 || target_length > utf8_string.max_size()) { + return utf8_string; + } + utf8_string.resize(target_length); + int converted_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + input_length, utf8_string.data(), target_length, nullptr, nullptr); + if (converted_length == 0) { + return std::string(); + } + return utf8_string; +} diff --git a/frontend/where_child_bus_guardian/windows/runner/utils.h b/frontend/where_child_bus_guardian/windows/runner/utils.h new file mode 100644 index 00000000..3879d547 --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/runner/utils.h @@ -0,0 +1,19 @@ +#ifndef RUNNER_UTILS_H_ +#define RUNNER_UTILS_H_ + +#include +#include + +// Creates a console for the process, and redirects stdout and stderr to +// it for both the runner and the Flutter library. +void CreateAndAttachConsole(); + +// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string +// encoded in UTF-8. Returns an empty std::string on failure. +std::string Utf8FromUtf16(const wchar_t* utf16_string); + +// Gets the command line arguments passed in as a std::vector, +// encoded in UTF-8. Returns an empty std::vector on failure. +std::vector GetCommandLineArguments(); + +#endif // RUNNER_UTILS_H_ diff --git a/frontend/where_child_bus_guardian/windows/runner/win32_window.cpp b/frontend/where_child_bus_guardian/windows/runner/win32_window.cpp new file mode 100644 index 00000000..60608d0f --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/runner/win32_window.cpp @@ -0,0 +1,288 @@ +#include "win32_window.h" + +#include +#include + +#include "resource.h" + +namespace { + +/// Window attribute that enables dark mode window decorations. +/// +/// Redefined in case the developer's machine has a Windows SDK older than +/// version 10.0.22000.0. +/// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute +#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE +#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 +#endif + +constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; + +/// Registry key for app theme preference. +/// +/// A value of 0 indicates apps should use dark mode. A non-zero or missing +/// value indicates apps should use light mode. +constexpr const wchar_t kGetPreferredBrightnessRegKey[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; +constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; + +// The number of Win32Window objects that currently exist. +static int g_active_window_count = 0; + +using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); + +// Scale helper to convert logical scaler values to physical using passed in +// scale factor +int Scale(int source, double scale_factor) { + return static_cast(source * scale_factor); +} + +// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. +// This API is only needed for PerMonitor V1 awareness mode. +void EnableFullDpiSupportIfAvailable(HWND hwnd) { + HMODULE user32_module = LoadLibraryA("User32.dll"); + if (!user32_module) { + return; + } + auto enable_non_client_dpi_scaling = + reinterpret_cast( + GetProcAddress(user32_module, "EnableNonClientDpiScaling")); + if (enable_non_client_dpi_scaling != nullptr) { + enable_non_client_dpi_scaling(hwnd); + } + FreeLibrary(user32_module); +} + +} // namespace + +// Manages the Win32Window's window class registration. +class WindowClassRegistrar { + public: + ~WindowClassRegistrar() = default; + + // Returns the singleton registrar instance. + static WindowClassRegistrar* GetInstance() { + if (!instance_) { + instance_ = new WindowClassRegistrar(); + } + return instance_; + } + + // Returns the name of the window class, registering the class if it hasn't + // previously been registered. + const wchar_t* GetWindowClass(); + + // Unregisters the window class. Should only be called if there are no + // instances of the window. + void UnregisterWindowClass(); + + private: + WindowClassRegistrar() = default; + + static WindowClassRegistrar* instance_; + + bool class_registered_ = false; +}; + +WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; + +const wchar_t* WindowClassRegistrar::GetWindowClass() { + if (!class_registered_) { + WNDCLASS window_class{}; + window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); + window_class.lpszClassName = kWindowClassName; + window_class.style = CS_HREDRAW | CS_VREDRAW; + window_class.cbClsExtra = 0; + window_class.cbWndExtra = 0; + window_class.hInstance = GetModuleHandle(nullptr); + window_class.hIcon = + LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); + window_class.hbrBackground = 0; + window_class.lpszMenuName = nullptr; + window_class.lpfnWndProc = Win32Window::WndProc; + RegisterClass(&window_class); + class_registered_ = true; + } + return kWindowClassName; +} + +void WindowClassRegistrar::UnregisterWindowClass() { + UnregisterClass(kWindowClassName, nullptr); + class_registered_ = false; +} + +Win32Window::Win32Window() { + ++g_active_window_count; +} + +Win32Window::~Win32Window() { + --g_active_window_count; + Destroy(); +} + +bool Win32Window::Create(const std::wstring& title, + const Point& origin, + const Size& size) { + Destroy(); + + const wchar_t* window_class = + WindowClassRegistrar::GetInstance()->GetWindowClass(); + + const POINT target_point = {static_cast(origin.x), + static_cast(origin.y)}; + HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); + UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); + double scale_factor = dpi / 96.0; + + HWND window = CreateWindow( + window_class, title.c_str(), WS_OVERLAPPEDWINDOW, + Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), + Scale(size.width, scale_factor), Scale(size.height, scale_factor), + nullptr, nullptr, GetModuleHandle(nullptr), this); + + if (!window) { + return false; + } + + UpdateTheme(window); + + return OnCreate(); +} + +bool Win32Window::Show() { + return ShowWindow(window_handle_, SW_SHOWNORMAL); +} + +// static +LRESULT CALLBACK Win32Window::WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + if (message == WM_NCCREATE) { + auto window_struct = reinterpret_cast(lparam); + SetWindowLongPtr(window, GWLP_USERDATA, + reinterpret_cast(window_struct->lpCreateParams)); + + auto that = static_cast(window_struct->lpCreateParams); + EnableFullDpiSupportIfAvailable(window); + that->window_handle_ = window; + } else if (Win32Window* that = GetThisFromHandle(window)) { + return that->MessageHandler(window, message, wparam, lparam); + } + + return DefWindowProc(window, message, wparam, lparam); +} + +LRESULT +Win32Window::MessageHandler(HWND hwnd, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + switch (message) { + case WM_DESTROY: + window_handle_ = nullptr; + Destroy(); + if (quit_on_close_) { + PostQuitMessage(0); + } + return 0; + + case WM_DPICHANGED: { + auto newRectSize = reinterpret_cast(lparam); + LONG newWidth = newRectSize->right - newRectSize->left; + LONG newHeight = newRectSize->bottom - newRectSize->top; + + SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, + newHeight, SWP_NOZORDER | SWP_NOACTIVATE); + + return 0; + } + case WM_SIZE: { + RECT rect = GetClientArea(); + if (child_content_ != nullptr) { + // Size and position the child window. + MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, TRUE); + } + return 0; + } + + case WM_ACTIVATE: + if (child_content_ != nullptr) { + SetFocus(child_content_); + } + return 0; + + case WM_DWMCOLORIZATIONCOLORCHANGED: + UpdateTheme(hwnd); + return 0; + } + + return DefWindowProc(window_handle_, message, wparam, lparam); +} + +void Win32Window::Destroy() { + OnDestroy(); + + if (window_handle_) { + DestroyWindow(window_handle_); + window_handle_ = nullptr; + } + if (g_active_window_count == 0) { + WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); + } +} + +Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { + return reinterpret_cast( + GetWindowLongPtr(window, GWLP_USERDATA)); +} + +void Win32Window::SetChildContent(HWND content) { + child_content_ = content; + SetParent(content, window_handle_); + RECT frame = GetClientArea(); + + MoveWindow(content, frame.left, frame.top, frame.right - frame.left, + frame.bottom - frame.top, true); + + SetFocus(child_content_); +} + +RECT Win32Window::GetClientArea() { + RECT frame; + GetClientRect(window_handle_, &frame); + return frame; +} + +HWND Win32Window::GetHandle() { + return window_handle_; +} + +void Win32Window::SetQuitOnClose(bool quit_on_close) { + quit_on_close_ = quit_on_close; +} + +bool Win32Window::OnCreate() { + // No-op; provided for subclasses. + return true; +} + +void Win32Window::OnDestroy() { + // No-op; provided for subclasses. +} + +void Win32Window::UpdateTheme(HWND const window) { + DWORD light_mode; + DWORD light_mode_size = sizeof(light_mode); + LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, + kGetPreferredBrightnessRegValue, + RRF_RT_REG_DWORD, nullptr, &light_mode, + &light_mode_size); + + if (result == ERROR_SUCCESS) { + BOOL enable_dark_mode = light_mode == 0; + DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, + &enable_dark_mode, sizeof(enable_dark_mode)); + } +} diff --git a/frontend/where_child_bus_guardian/windows/runner/win32_window.h b/frontend/where_child_bus_guardian/windows/runner/win32_window.h new file mode 100644 index 00000000..e901dde6 --- /dev/null +++ b/frontend/where_child_bus_guardian/windows/runner/win32_window.h @@ -0,0 +1,102 @@ +#ifndef RUNNER_WIN32_WINDOW_H_ +#define RUNNER_WIN32_WINDOW_H_ + +#include + +#include +#include +#include + +// A class abstraction for a high DPI-aware Win32 Window. Intended to be +// inherited from by classes that wish to specialize with custom +// rendering and input handling +class Win32Window { + public: + struct Point { + unsigned int x; + unsigned int y; + Point(unsigned int x, unsigned int y) : x(x), y(y) {} + }; + + struct Size { + unsigned int width; + unsigned int height; + Size(unsigned int width, unsigned int height) + : width(width), height(height) {} + }; + + Win32Window(); + virtual ~Win32Window(); + + // Creates a win32 window with |title| that is positioned and sized using + // |origin| and |size|. New windows are created on the default monitor. Window + // sizes are specified to the OS in physical pixels, hence to ensure a + // consistent size this function will scale the inputted width and height as + // as appropriate for the default monitor. The window is invisible until + // |Show| is called. Returns true if the window was created successfully. + bool Create(const std::wstring& title, const Point& origin, const Size& size); + + // Show the current window. Returns true if the window was successfully shown. + bool Show(); + + // Release OS resources associated with window. + void Destroy(); + + // Inserts |content| into the window tree. + void SetChildContent(HWND content); + + // Returns the backing Window handle to enable clients to set icon and other + // window properties. Returns nullptr if the window has been destroyed. + HWND GetHandle(); + + // If true, closing this window will quit the application. + void SetQuitOnClose(bool quit_on_close); + + // Return a RECT representing the bounds of the current client area. + RECT GetClientArea(); + + protected: + // Processes and route salient window messages for mouse handling, + // size change and DPI. Delegates handling of these to member overloads that + // inheriting classes can handle. + virtual LRESULT MessageHandler(HWND window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Called when CreateAndShow is called, allowing subclass window-related + // setup. Subclasses should return false if setup fails. + virtual bool OnCreate(); + + // Called when Destroy is called. + virtual void OnDestroy(); + + private: + friend class WindowClassRegistrar; + + // OS callback called by message pump. Handles the WM_NCCREATE message which + // is passed when the non-client area is being created and enables automatic + // non-client DPI scaling so that the non-client area automatically + // responds to changes in DPI. All other messages are handled by + // MessageHandler. + static LRESULT CALLBACK WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Retrieves a class instance pointer for |window| + static Win32Window* GetThisFromHandle(HWND const window) noexcept; + + // Update the window frame's theme to match the system theme. + static void UpdateTheme(HWND const window); + + bool quit_on_close_ = false; + + // window handle for top level window. + HWND window_handle_ = nullptr; + + // window handle for hosted content. + HWND child_content_ = nullptr; +}; + +#endif // RUNNER_WIN32_WINDOW_H_ diff --git a/machine_learning/.gitignore b/machine_learning/.gitignore new file mode 100644 index 00000000..2728105a --- /dev/null +++ b/machine_learning/.gitignore @@ -0,0 +1,239 @@ +# Created by https://www.toptal.com/developers/gitignore/api/macos,python,visualstudiocode +# Edit at https://www.toptal.com/developers/gitignore?templates=macos,python,visualstudiocode + +## local +secrets/ + +src/face_detect_model/pickle/* +src/face_detect_model/DetectFaceAndClip/img +src/face_detect_model/DetectFaceAndClip/detce_img + +debug_sh_files/ + +### 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 + +### Python ### + + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +### Python Patch ### +# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration +poetry.toml + +# ruff +.ruff_cache/ + +# LSP config files +pyrightconfig.json + +### 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 + +# End of https://www.toptal.com/developers/gitignore/api/macos,python,visualstudiocode \ No newline at end of file diff --git a/machine_learning/.python-version b/machine_learning/.python-version new file mode 100644 index 00000000..375f5cab --- /dev/null +++ b/machine_learning/.python-version @@ -0,0 +1 @@ +3.11.6 diff --git a/machine_learning/Dockerfile b/machine_learning/Dockerfile new file mode 100644 index 00000000..af01ace8 --- /dev/null +++ b/machine_learning/Dockerfile @@ -0,0 +1,38 @@ +# ベースイメージ +FROM python:3.11.6-slim + +# ビルド引数を定義 +ARG GCP_PROJECT_ID +ARG BUCKET_NAME_FOR_ML + +# 作業ディレクトリの設定 +WORKDIR /machine-learning + +# pipのアップグレード +RUN pip install --upgrade pip + +# 必要なパッケージのインストール +COPY ./requirements.lock /machine-learning/ + +RUN sed '/-e/d' requirements.lock > requirements.txt +RUN pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu + +# 必要なライブラリをインストール +RUN apt-get update && apt-get install -y \ + libgl1-mesa-glx \ + libglib2.0-0 + +# アプリケーションコードをコピー +COPY ./src /machine-learning/src + +# .envファイルを作成し、ビルド引数の値を書き込む +RUN mkdir -p /machine-learning/secrets && \ + echo "PROJECT_ID=$GCP_PROJECT_ID" > /machine-learning/secrets/.env && \ + echo "BUCKET_NAME=$BUCKET_NAME_FOR_ML" >> /machine-learning/secrets/.env && \ + echo "BUCKET_NAME_FOR_FACE=$BUCKET_NAME_FOR_FACE" >> /machine-learning/secrets/.env + +# 環境変数PATHの設定 +ENV PYTHONPATH "${PYTHONPATH}:/machine-learning/src/" + +# サーバー起動 +ENTRYPOINT ["python", "src/proto-gen/machine_learning/v1/server.py"] \ No newline at end of file diff --git a/machine_learning/Dockerfile_local b/machine_learning/Dockerfile_local new file mode 100644 index 00000000..c0c6d4ad --- /dev/null +++ b/machine_learning/Dockerfile_local @@ -0,0 +1,20 @@ +FROM python:3.11.6-slim + +WORKDIR /machine-learning +COPY ./requirements.lock /machine-learning/ + +RUN sed '/-e/d' requirements.lock > requirements.txt +RUN pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu + +# 必要なライブラリをインストール +RUN apt-get update && apt-get install -y \ + libgl1-mesa-glx \ + libglib2.0-0 + +COPY ./src /machine-learning/src +COPY ./secrets /machine-learning/secrets + +ENV PYTHONPATH "${PYTHONPATH}:/machine-learning/src/" + +# TODO: server.pyをproto-genから切り出し +ENTRYPOINT ["python", "src/proto-gen/machine_learning/v1/server.py"] diff --git a/machine_learning/README.md b/machine_learning/README.md new file mode 100644 index 00000000..e69de29b diff --git a/machine_learning/pyproject.toml b/machine_learning/pyproject.toml new file mode 100644 index 00000000..4a09a5c4 --- /dev/null +++ b/machine_learning/pyproject.toml @@ -0,0 +1,41 @@ +[project] +name = "wherechildbus" +version = "0.1.0" +description = "Add your description here" +authors = [] +dependencies = [ + "opencv-python>=4.9.0.80", + "torch>=2.2.0", + "torchvision>=0.17.0", + "numpy>=1.24.4", + "pyyaml>=6.0.1", + "tqdm>=4.66.2", + "google-cloud-storage>=2.14.0", + "python-dotenv>=1.0.1", + "grpcio>=1.60.1", + "grpcio_reflection>=1.60.1", + "grpcio-status>=1.60.1", + "googleapis-common-protos>=1.62.0", +] +readme = "README.md" +requires-python = ">= 3.8" + +[project.scripts] +hello = "wherechildbus:hello" + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.rye] +managed = true +dev-dependencies = [ + "watchdog>=4.0.0", +] + +[tool.hatch.metadata] +allow-direct-references = true + +[tool.hatch.build.targets.wheel] +packages = ["src/face_detect_model", "src/proto_gen"] + diff --git a/machine_learning/requirements-dev.lock b/machine_learning/requirements-dev.lock new file mode 100644 index 00000000..9b211b21 --- /dev/null +++ b/machine_learning/requirements-dev.lock @@ -0,0 +1,46 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: false + +-e file:. +cachetools==5.3.2 +certifi==2024.2.2 +charset-normalizer==3.3.2 +filelock==3.13.1 +fsspec==2024.2.0 +google-api-core==2.17.0 +google-auth==2.27.0 +google-cloud-core==2.4.1 +google-cloud-storage==2.14.0 +google-crc32c==1.5.0 +google-resumable-media==2.7.0 +googleapis-common-protos==1.62.0 +grpcio==1.60.1 +grpcio-reflection==1.60.1 +grpcio-status==1.60.1 +idna==3.6 +jinja2==3.1.3 +markupsafe==2.1.5 +mpmath==1.3.0 +networkx==3.2.1 +numpy==1.26.4 +opencv-python==4.9.0.80 +pillow==10.2.0 +protobuf==4.25.2 +pyasn1==0.5.1 +pyasn1-modules==0.3.0 +python-dotenv==1.0.1 +pyyaml==6.0.1 +requests==2.31.0 +rsa==4.9 +sympy==1.12 +torch==2.2.0 +torchvision==0.17.0 +tqdm==4.66.2 +typing-extensions==4.9.0 +urllib3==2.2.0 +watchdog==4.0.0 diff --git a/machine_learning/requirements.lock b/machine_learning/requirements.lock new file mode 100644 index 00000000..63848425 --- /dev/null +++ b/machine_learning/requirements.lock @@ -0,0 +1,45 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: false + +-e file:. +cachetools==5.3.2 +certifi==2024.2.2 +charset-normalizer==3.3.2 +filelock==3.13.1 +fsspec==2024.2.0 +google-api-core==2.17.0 +google-auth==2.27.0 +google-cloud-core==2.4.1 +google-cloud-storage==2.14.0 +google-crc32c==1.5.0 +google-resumable-media==2.7.0 +googleapis-common-protos==1.62.0 +grpcio==1.60.1 +grpcio-reflection==1.60.1 +grpcio-status==1.60.1 +idna==3.6 +jinja2==3.1.3 +markupsafe==2.1.5 +mpmath==1.3.0 +networkx==3.2.1 +numpy==1.26.4 +opencv-python==4.9.0.80 +pillow==10.2.0 +protobuf==4.25.2 +pyasn1==0.5.1 +pyasn1-modules==0.3.0 +python-dotenv==1.0.1 +pyyaml==6.0.1 +requests==2.31.0 +rsa==4.9 +sympy==1.12 +torch==2.2.0 +torchvision==0.17.0 +tqdm==4.66.2 +typing-extensions==4.9.0 +urllib3==2.2.0 diff --git a/machine_learning/src/face_detect_model/DetectFaceAndClip/__init__.py b/machine_learning/src/face_detect_model/DetectFaceAndClip/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/machine_learning/src/face_detect_model/DetectFaceAndClip/detectFaceAndClip.py b/machine_learning/src/face_detect_model/DetectFaceAndClip/detectFaceAndClip.py new file mode 100644 index 00000000..a7f92a49 --- /dev/null +++ b/machine_learning/src/face_detect_model/DetectFaceAndClip/detectFaceAndClip.py @@ -0,0 +1,197 @@ +import argparse +import logging +import os + +import cv2 +import google.cloud.storage as gcs +import numpy as np +import yaml +from dotenv import load_dotenv +from face_detect_model.DetectFaceAndClip.detectFaceUtil import ( + clip_and_resize_face, + detect_face, + load_cascade, +) +from face_detect_model.gcp_util import ( + get_blobs, + get_bucket, + init_client, + save_face_image_to_remote, +) +from google.cloud.storage import Blob, Bucket + +load_dotenv("secrets/.env") + +logging.basicConfig( + format="%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s", + datefmt="%m/%d/%Y %H:%M:%S", + level=logging.INFO, +) +logger = logging.getLogger(__name__) + +# TODO: GCSに関する処理を別ファイルに切り出す + + +def load_image(args: argparse.Namespace, blobs=None): + """画像の読み込みを行うラッパー関数""" + if args.env == "local": + return load_image_from_local(args.image_dir_path) + elif args.env == "remote": + return load_image_from_remote(blobs) + + +def load_image_from_local(image_dir_path: str): + images = [] + for image_path in os.listdir(image_dir_path): + logger.info(f"loading: {image_path}") + image = cv2.imread(image_dir_path + image_path) + if image is None: + logger.error(f"Can not find or load : {image_path}") + continue + images.append(image) + return images + + +def load_image_from_remote(blobs: list): + images = [] + for blob in blobs: + logger.info(f"loading: {blob.name}") + if blob.name.endswith("/"): + logger.info(f"skip: {blob.name}") + continue + + # バイトデータから numpy 配列を作成 + image_data = blob.download_as_string() + image_array = np.frombuffer(image_data, dtype=np.uint8) + + # cv2.imdecode でバイト配列を画像に変換 + image = cv2.imdecode(image_array, cv2.IMREAD_COLOR) + if image is None: + logger.error(f"Can not load: {blob.name}") + continue + images.append(image) + return images + + +def init_save_dir(save_dir_path: str): + os.makedirs(save_dir_path, exist_ok=True) + for file in os.listdir(save_dir_path): + file_path = os.path.join(save_dir_path, file) + if os.path.isfile(file_path): + os.remove(file_path) + + +def save_face_image_to_local(face: np.ndarray, save_dir: str, save_file_name: str): + """クリップされた顔画像を保存する""" + os.makedirs(save_dir, exist_ok=True) + + save_path = os.path.join(save_dir, save_file_name) + cv2.imwrite(save_path, face) + + +def detect_face_and_clip(args: argparse.Namespace, config: dict): + face_cascade_path = config["face_detect"]["cascade_path"] + image_size = ( + config["face_detect"]["clip_size"]["height"], + config["face_detect"]["clip_size"]["width"], + ) + + # 保存先ディレクトリの作成,存在した場合は中身を削除 + if args.env == "local": + init_save_dir(args.save_dir_path) + + # GCSとの接続 + if args.env == "remote": + client = init_client() + BUCKET_NAME = os.environ.get("BUCKET_NAME") + bucket = get_bucket(client, BUCKET_NAME) + + # Haar Cascadeの読み込み + face_cascade = load_cascade(face_cascade_path) + + if args.env == "local": + images = load_image(args) + elif args.env == "remote": + SOURCE_BLOB_NAME = f"{args.nursery_id}/{args.child_id}/raw/" + blobs = get_blobs(bucket, SOURCE_BLOB_NAME) + images = load_image(args, blobs=blobs) + else: + raise ValueError(f"Invalid env: {args.env}") + + if len(images) == 0: + logger.error("No face Detected") + + logger.info("Detecting faces...") + detect_face_num = 0 + for image in images: + faces = detect_face( + image, + face_cascade, + scaleFactor=config["face_detect"]["scale_factor"], + minNeighbors=config["face_detect"]["min_neighbors"], + minSize=( + config["face_detect"]["min_size"]["height"], + config["face_detect"]["min_size"]["width"], + ), + ) + + # 検出された各顔に対して処理 + for face in faces: + clipped_face = clip_and_resize_face(face, image, image_size) + if args.env == "local": + save_file_name = f"{detect_face_num}.png" + logger.info(f"save: {save_file_name}") + save_face_image_to_local( + clipped_face, args.save_dir_path, save_file_name + ) + elif args.env == "remote": + save_blob_name = f"{args.nursery_id}/{args.child_id}/clipped/{args.child_id}-{detect_face_num}.png" + logger.info(f"save: {save_blob_name}") + save_face_image_to_remote(clipped_face, save_blob_name, bucket) + detect_face_num += 1 + + +def main(args: argparse.Namespace): + logger.info(f"env: {args.env}") + with open("src/face_detect_model/config.yaml", "r") as f: + config = yaml.safe_load(f) + + detect_face_and_clip(args, config) + + logger.info("Done") + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + env_subparsers = parser.add_subparsers(dest="env") + + local_parser = env_subparsers.add_parser("local") + local_parser.add_argument( + "--image_dir_path", + type=str, + help="画像のディレクトリパス", + required=True, + ) + local_parser.add_argument( + "--save_dir_path", + type=str, + help="保存先のディレクトリパス", + required=True, + ) + + remote_parser = env_subparsers.add_parser("remote") + remote_parser.add_argument( + "--nursery_id", + type=str, + help="保育園・幼稚園のID", + required=True, + ) + remote_parser.add_argument( + "--child_id", + type=str, + help="園児のID", + required=True, + ) + + args = parser.parse_args() + main(args) diff --git a/machine_learning/src/face_detect_model/DetectFaceAndClip/detectFaceUtil.py b/machine_learning/src/face_detect_model/DetectFaceAndClip/detectFaceUtil.py new file mode 100644 index 00000000..71db5e56 --- /dev/null +++ b/machine_learning/src/face_detect_model/DetectFaceAndClip/detectFaceUtil.py @@ -0,0 +1,24 @@ +import cv2 + + +def load_cascade(cascade_path): + """Haar Cascadeを読み込む""" + return cv2.CascadeClassifier(cv2.data.haarcascades + cascade_path) + + +def detect_face( + image, face_cascade, scaleFactor=1.1, minNeighbors=15, minSize=(50, 50) +): + """画像から顔を検出する""" + faces = face_cascade.detectMultiScale( + image, scaleFactor=scaleFactor, minNeighbors=minNeighbors, minSize=minSize + ) + return faces + + +def clip_and_resize_face(face, image, image_size): + """検出された顔をクリップし、指定サイズにリサイズする""" + (x, y, w, h) = face + face_roi = image[y : y + h, x : x + w] + resized_face = cv2.resize(face_roi, image_size, interpolation=cv2.INTER_CUBIC) + return resized_face diff --git a/machine_learning/src/face_detect_model/__init__.py b/machine_learning/src/face_detect_model/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/machine_learning/src/face_detect_model/config.yaml b/machine_learning/src/face_detect_model/config.yaml new file mode 100644 index 00000000..7353ffa6 --- /dev/null +++ b/machine_learning/src/face_detect_model/config.yaml @@ -0,0 +1,32 @@ +model: + hidden_size: 120 + in_channels: 1 + Conv2d: + kernel_size: 3 + out_channels_1: 16 + out_channels_2: 32 + pooling: + kernel_size: 2 + stride: 2 +face_detect: + cascade_path: "haarcascade_frontalface_default.xml" + scale_factor: 1.1 + min_neighbors: 7 + min_size: { width: 30, height: 30 } + clip_size: { width: 100, height: 100 } +dataset: + augmentation: + num_variations: 30 + ratio: + train: 0.8 + valid: 0.1 + test: 0.1 +train: + epoch: 5 + learning_rate: 0.0005 + train_batch_size: 1 + valid_batch_size: 1 + test_batch_size: 1 + validate_interval: 6 + save_model_dir: "src/face_detect_model/pickle/mock_model/" + test_model_path: "src/face_detect_model/pickle/mock_model/best_model.pth" diff --git a/machine_learning/src/face_detect_model/data/faceDetectDataset.py b/machine_learning/src/face_detect_model/data/faceDetectDataset.py new file mode 100644 index 00000000..dd49dde1 --- /dev/null +++ b/machine_learning/src/face_detect_model/data/faceDetectDataset.py @@ -0,0 +1,96 @@ +import os + +import torch +from face_detect_model.gcp_util import get_blobs, get_bucket +from face_detect_model.util import ( + get_augment_transform, + get_augment_transform_for_gray, + get_default_transforms, + get_default_transforms_for_gray, + load_image_from_remote, +) +from PIL import Image + + +# (child_id, image)のタプルを返す +class FaceDetectDataset(torch.utils.data.Dataset): + def __init__(self, args, config, client): + self.args = args + self.config = config + + if config["model"]["in_channels"] == 1: + default_transform = get_default_transforms_for_gray() + argument_transform = get_augment_transform_for_gray() + elif config["model"]["in_channels"] == 3: + default_transform = get_default_transforms() + argument_transform = get_augment_transform() + + bucket_name = os.environ.get("BUCKET_NAME") + bucket = get_bucket(client, bucket_name) + + self.face_data = [] + self.label_name_dict = {} + self.name_label_dict = {} + self.label_num = 0 + + label_image_list = [] + for child_id in args.child_ids: + SOURCE_BLOB_NAME = f"{args.nursery_id}/{child_id}/clipped/" + + blobs = get_blobs(bucket, SOURCE_BLOB_NAME) + label_image_list.extend( + load_image_from_remote( + blobs=blobs, color_channel=config["model"]["in_channels"] + ) + ) + + for label, image in label_image_list: + if label not in self.name_label_dict: + self._add_label(label) + + label_tensor = self._convert_label_to_tensor(label) + image_pil = self._convert_image_to_pil(image) + + self.face_data.append((label_tensor, default_transform(image_pil))) + + augmented_images = self.augment_image( + image_pil, + transforms=argument_transform, + num_variations=self.config["dataset"]["augmentation"]["num_variations"], + ) + for aug_img in augmented_images: + self.face_data.append((label_tensor, aug_img)) + + def _convert_label_to_tensor(self, label: str): + return torch.tensor(self.name_label_dict[label], dtype=torch.int64) + + def _convert_image_to_pil(self, image): + return Image.fromarray(image) + + def _add_label(self, label: str): + self.label_name_dict[self.label_num] = label + self.name_label_dict[label] = self.label_num + self.label_num += 1 + + def augment_image(self, image, transforms, num_variations=100): + # ランダムな変換を適用するための拡張設定を強化 + augmented_images = [] + for _ in range(num_variations): + augmented_image = transforms(image) + augmented_images.append(augmented_image) + return augmented_images + + def __len__(self): + return len(self.face_data) + + def __getitem__(self, idx): + return self.face_data[idx] + + def get_idx_label_dict(self): + return self.label_name_dict + + def get_label_num(self): + return self.label_num + + def get_image_shape(self): + return self.face_data[0][1].shape diff --git a/machine_learning/src/face_detect_model/gcp_util.py b/machine_learning/src/face_detect_model/gcp_util.py new file mode 100644 index 00000000..bcd5589d --- /dev/null +++ b/machine_learning/src/face_detect_model/gcp_util.py @@ -0,0 +1,72 @@ +import os +import time + +import cv2 +import google.cloud.storage as gcs +import numpy as np +from face_detect_model.util import logger +from google.cloud.storage import Blob, Bucket + + +def init_client(): + # NOTE: gcloud auth application-default loginにて事前に認証 + PROJECT_ID = os.environ.get("PROJECT_ID") + logger.info(f"Initialized GCS client. {PROJECT_ID}") + + client = gcs.Client(PROJECT_ID) + if client is None: + raise RuntimeError("Failed to initialize client.") + else: + return client + + +def get_bucket(client: gcs.Client, bucket_name: str): + logger.info(f"Getting bucket '{bucket_name}'...") + bucket = client.bucket(bucket_name) + logger.info(f"Got bucket {bucket_name} in GCS.") + if bucket.exists(): + return bucket + else: + raise ValueError(f"Failed to {bucket_name} does not exist.") + + +def get_blobs(bucket: Bucket, blob_name: str): + logger.info(f"Getting blobs with prefix '{blob_name}'...") + # blobsの中身に対するエラーハンドリング + tries = 10 + retry_interval = 1 + for i in range(0, tries): + try: + blobs = list(bucket.list_blobs(prefix=blob_name)) + logger.info(f"Got blobs from {blob_name} in GCS.") + if len(blobs) == 0: + logger.info(f"No blobs found in {blob_name}.") + raise ValueError(f"No blobs found in {blob_name}.") + return blobs + except Exception as e: + if i + 1 == tries: + raise ValueError( + f"Failed to get blobs from '{blob_name}' due to an error: {e}" + ) + time.sleep(retry_interval) + logger.info("リトライ回数:{}回目".format(i + 1)) + continue + + +def decode_face_image_from_ndaarray(face_image: np.ndarray): + _, encoded_image = cv2.imencode(".png", face_image) + png_clipped_face_data = encoded_image.tobytes() + return png_clipped_face_data + + +def save_face_image_to_remote( + face_image: np.ndarray, + save_blob_name: str, + bucket: Bucket, +): + """クリップされた顔画像をGCSに保存する""" + png_cliped_face_data = decode_face_image_from_ndaarray(face_image) + + save_blob = Blob(save_blob_name, bucket) + save_blob.upload_from_string(data=png_cliped_face_data, content_type="image/png") + logger.info(f"Saved face image to {save_blob_name} in GCS.") diff --git a/machine_learning/src/face_detect_model/main.py b/machine_learning/src/face_detect_model/main.py new file mode 100644 index 00000000..7c3f9023 --- /dev/null +++ b/machine_learning/src/face_detect_model/main.py @@ -0,0 +1,108 @@ +import argparse +import os + +import torch +import yaml +from dotenv import load_dotenv +from face_detect_model.data.faceDetectDataset import FaceDetectDataset +from face_detect_model.gcp_util import get_bucket, init_client +from face_detect_model.model.faceDetectModel import FaceDetectModel +from face_detect_model.trainer import Trainer +from face_detect_model.util import logger, save_pickle_to_gcs, switch_to_bus_type + +load_dotenv("secrets/.env") + + +def TrainAndTest(args: argparse.Namespace, config: dict): + args.device = torch.device("cuda" if torch.cuda.is_available() else "cpu") + logger.info(f"Your env is : {args.device}") + + logger.info("client Initializing") + client = init_client() + + # datasetの読み込み + logger.info("dataset Initializing") + dataset = FaceDetectDataset(args, config, client) + + train_data_size = int(len(dataset) * config["dataset"]["ratio"]["train"]) + valid_data_size = int(len(dataset) * config["dataset"]["ratio"]["valid"]) + test_data_size = len(dataset) - train_data_size - valid_data_size + + train_dataset, valid_dataset, test_dataset = torch.utils.data.random_split( + dataset, + [ + train_data_size, + valid_data_size, + test_data_size, + ], + ) + + idx_to_label = dataset.get_idx_label_dict() + if args.mode == "train": + bucket = get_bucket( + client, + os.environ.get("BUCKET_NAME_FOR_MODEL"), + ) + save_pickle_to_gcs( + bucket=bucket, + upload_model_path=f"{args.nursery_id}/{args.bus_id}/idx_to_label_{switch_to_bus_type(args.bus_type)}.pth", + obj=idx_to_label, + ) + logger.info("idx_to_label is saved") + + # modelの読み込み + logger.info("model Initializing") + num_classes = dataset.get_label_num() + image_shape = dataset.get_image_shape() + + face_detect_model = FaceDetectModel( + config, num_classes=num_classes, input_dim=image_shape + ) + face_detect_model.to(args.device) + + # trainerの読み込み + trainer = Trainer( + args, + config, + client, + face_detect_model, + train_dataset, + valid_dataset, + test_dataset, + ) + if args.mode == "train": + # 学習 + trainer.train() + logger.info("Done training!") + elif args.mode == "test": + # テスト + face_detect_model.load_state_dict( + torch.load(config["train"]["test_model_path"]) + ) + trainer.test() + else: # TODO: 他のモードを実装する + raise ValueError("invalid mode") + + +def main(args: argparse.Namespace): + # TODO: configに関するsanity_checkを実装する + with open("src/face_detect_model/config.yaml", "r") as f: + config = yaml.safe_load(f) + TrainAndTest(args, config) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--mode", type=str, choices=["train", "test"], default="train") + parser.add_argument("--nursery_id", type=str) + parser.add_argument( + "--child_ids", + type=str, + nargs="*", + ) + parser.add_argument("--bus_id", type=str) + parser.add_argument("--bus_type", type=int) + + args = parser.parse_args() + + main(args) diff --git a/machine_learning/src/face_detect_model/model/faceDetectModel.py b/machine_learning/src/face_detect_model/model/faceDetectModel.py new file mode 100644 index 00000000..5bb38969 --- /dev/null +++ b/machine_learning/src/face_detect_model/model/faceDetectModel.py @@ -0,0 +1,71 @@ +import torch.nn as nn + + +def compute_conv_output_size(L_in, kernel_size, stride=1, padding=0, dilation=1): + """畳み込み層を通過した後の出力サイズを計算する関数""" + L_out = int((L_in + 2 * padding - dilation * (kernel_size - 1) - 1) / stride + 1) + return L_out + + +class FaceDetectModel(nn.Module): + def __init__(self, config: dict, num_classes: int, input_dim: tuple): + """顔検出モデルの初期化 + Args: + config (dict): モデル設定 + num_classes (int): 出力クラス数 + input_dim (tuple): 入力画像の次元 (チャンネル, 高さ, 幅) + """ + super(FaceDetectModel, self).__init__() + self.config = config + + in_channels = config["model"]["in_channels"] + kernel_size = config["model"]["Conv2d"]["kernel_size"] + out_channels_1 = config["model"]["Conv2d"]["out_channels_1"] + out_channels_2 = config["model"]["Conv2d"]["out_channels_2"] + pooling_kernel_size = config["model"]["pooling"]["kernel_size"] + pooling_stride = config["model"]["pooling"]["stride"] + + self.relu = nn.ReLU() + self.pool = nn.MaxPool2d(kernel_size=pooling_kernel_size, stride=pooling_stride) + + self.conv1 = nn.Conv2d( + in_channels=in_channels, + out_channels=out_channels_1, + kernel_size=kernel_size, + ) + self.conv2 = nn.Conv2d( + in_channels=out_channels_1, + out_channels=out_channels_2, + kernel_size=kernel_size, + ) + + self.flatten = nn.Flatten() + + # 入力特徴マップのサイズを畳み込み層とプーリング層を通過した後のサイズで更新 + size = compute_conv_output_size(input_dim[1], kernel_size) + size = compute_conv_output_size( + size, pooling_kernel_size, stride=pooling_stride + ) + size = compute_conv_output_size(size, kernel_size) + size = compute_conv_output_size( + size, pooling_kernel_size, stride=pooling_stride + ) + + # 最終的な特徴マップのサイズに基づいてLinear層の入力サイズを設定 + linear_input_size = out_channels_2 * size * size + + self.linear = nn.Linear(linear_input_size, config["model"]["hidden_size"]) + self.classifier = nn.Linear(config["model"]["hidden_size"], num_classes) + + def forward(self, x): + x = self.conv1(x) + x = self.relu(x) + x = self.pool(x) + x = self.conv2(x) + x = self.relu(x) + x = self.pool(x) + x = self.flatten(x) + x = self.linear(x) + x = self.relu(x) + x = self.classifier(x) + return x diff --git a/machine_learning/src/face_detect_model/pred.py b/machine_learning/src/face_detect_model/pred.py new file mode 100644 index 00000000..a67fb23b --- /dev/null +++ b/machine_learning/src/face_detect_model/pred.py @@ -0,0 +1,190 @@ +import argparse +import os +import time + +import torch +import yaml +from dotenv import load_dotenv + +load_dotenv("secrets/.env") + +from face_detect_model.DetectFaceAndClip.detectFaceUtil import ( + clip_and_resize_face, + detect_face, + load_cascade, +) +from face_detect_model.gcp_util import ( + get_bucket, + init_client, + save_face_image_to_remote, +) +from face_detect_model.model.faceDetectModel import FaceDetectModel +from face_detect_model.util import ( + get_default_transforms_for_gray, + load_image_from_binary, + load_pickle_to_gcs, + logger, + switch_to_bus_type, + smile_detecter, +) + + +def load_model(model_pickle, config, num_classes, input_shape) -> FaceDetectModel: + try: + model = FaceDetectModel(config, num_classes, input_shape) + model.load_state_dict(model_pickle) + except Exception as e: + raise ValueError(f"Failed to load model due to an error: {e}") + return model + + +def get_clipped_face(image, faces, image_size): + clipped_faces = [] + for face in faces: + clipped_face = clip_and_resize_face(face, image, image_size) + clipped_faces.append(clipped_face) + return clipped_faces + + +def detect_face_and_clip_from_image(image, config): + face_cascade_path = config["face_detect"]["cascade_path"] + image_size = ( + config["face_detect"]["clip_size"]["height"], + config["face_detect"]["clip_size"]["width"], + ) + + # Haar Cascadeの読み込み + face_cascade = load_cascade(face_cascade_path) + + faces = detect_face( + image, + face_cascade, + scaleFactor=config["face_detect"]["scale_factor"], + minNeighbors=config["face_detect"]["min_neighbors"], + minSize=( + config["face_detect"]["min_size"]["height"], + config["face_detect"]["min_size"]["width"], + ), + ) + + clipped_faces = get_clipped_face(image, faces, image_size) + return clipped_faces + + +def convert_to_tensor_from_images(clipped_face_images): + transforms = get_default_transforms_for_gray() + image_tensors = [] + for clipped_face_image in clipped_face_images: + image_tensor = transforms(clipped_face_image) + image_tensors.append(image_tensor) + return image_tensors + + +def get_clipped_faces_from_images(args, config, detecter, save_bucket): + all_faces = [] + for video_clip in args.video_chunk: + image = load_image_from_binary(args, video_clip) + clipped_faces = detect_face_and_clip_from_image(image, config) + if len(clipped_faces) > 0: + # timestampをファイル名に含めて保存 + for clipped_face in clipped_faces: + smile_degree = detecter.detect_smile_degree(clipped_face) + logger.info(f"Smile degree: {smile_degree}") + smile_image = detecter.add_smile_degree_to_image(image, smile_degree) + now = time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime()) + save_face_image_to_remote( + smile_image, + f"{args.nursery_id}/{args.bus_id}/{now}_{smile_degree}.png", + save_bucket, + ) + all_faces.extend(clipped_faces) + return all_faces + + +def get_model_input_shape(tensor): + return tensor.shape + + +def pred_child_from_tensor(model, input_image_tensor): + output = model(input_image_tensor.unsqueeze(0)) + logger.info(f"Predicted present: {torch.nn.functional.softmax(output, dim=1)}") + pred = output.argmax(dim=1) + return pred + + +def get_pred_child(model, input_image_tensors, idx_to_label_dict): + pred_child_ids = set() + + # TODO: 複数枚をバッチで処理する + for input_image_tensor in input_image_tensors: + pred = pred_child_from_tensor(model, input_image_tensor) + child_id = idx_to_label_dict[pred.item()] + logger.info(f"Predicted child id: {child_id}") + pred_child_ids.add(child_id) + + return pred_child_ids + + +def pred_child_from_images(args, config): + client = init_client() + bucket_name = os.environ.get("BUCKET_NAME_FOR_MODEL") + bucket_name_for_image = os.environ.get("BUCKET_NAME_FOR_FACE") + bucket = get_bucket(client, bucket_name) + bucket_for_face = get_bucket(client, bucket_name_for_image) + idx_to_label_dict_bucket_path = f"{args.nursery_id}/{args.bus_id}/idx_to_label_{switch_to_bus_type(args.bus_type)}.pth" + + idx_to_label_dict = load_pickle_to_gcs(bucket, idx_to_label_dict_bucket_path) + model_class_num = len(idx_to_label_dict) + + detecter = smile_detecter() + clipped_faces = get_clipped_faces_from_images( + args, config, detecter, bucket_for_face + ) + + if len(clipped_faces) == 0: + logger.info("No face detected.") + return [] + + input_image_tensors = convert_to_tensor_from_images(clipped_faces) + + model_bucket_path = ( + f"{args.nursery_id}/{args.bus_id}/model_{switch_to_bus_type(args.bus_type)}.pth" + ) + input_shape = get_model_input_shape(input_image_tensors[0]) + logger.info(f"Input shape: {input_shape}") + model_pickle = load_pickle_to_gcs(bucket, model_bucket_path) + model = load_model( + model_pickle=model_pickle, + config=config, + num_classes=model_class_num, + input_shape=input_shape, + ) + model.eval() + + logger.info("Start predicting child id") + pred_child_ids = get_pred_child(model, input_image_tensors, idx_to_label_dict) + logger.info(f"Predicted child ids: {pred_child_ids}") + logger.info("Done") + + return list(pred_child_ids) + + +def main(args): + with open("src/face_detect_model/config.yaml", "r") as f: + config = yaml.safe_load(f) + pred_child_ids_list = pred_child_from_images(args, config) + return pred_child_ids_list + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--nursery_id", type=str, required=True) + parser.add_argument("--bus_id", type=str, required=True) + parser.add_argument("--bus_type", type=int, required=True) + + args = parser.parse_args() + args.video_chunk = [[]] + args.photo_height = 240 + args.photo_width = 320 + + main(args) diff --git a/machine_learning/src/face_detect_model/trainer.py b/machine_learning/src/face_detect_model/trainer.py new file mode 100644 index 00000000..a3e50137 --- /dev/null +++ b/machine_learning/src/face_detect_model/trainer.py @@ -0,0 +1,154 @@ +import argparse +import os + +import google.cloud.storage as gcs +import torch +import torch.nn as nn +from face_detect_model.data.faceDetectDataset import FaceDetectDataset +from face_detect_model.gcp_util import get_bucket +from face_detect_model.model.faceDetectModel import FaceDetectModel +from face_detect_model.util import logger, save_pickle_to_gcs, switch_to_bus_type + + +class Trainer: + def __init__( + self, + args: argparse.Namespace, + config: dict, + client: gcs.Client, + model: FaceDetectModel, + train_dataset: FaceDetectDataset, + valid_dataset: FaceDetectDataset, + test_dataset: FaceDetectDataset, + ): + logger.info("Initializing Trainer...") + self.args = args + self.config = config + self.model = model + + self.criterion = torch.nn.CrossEntropyLoss() + self.optimizer = torch.optim.Adam( + self.model.parameters(), lr=config["train"]["learning_rate"] + ) + self.softmax = nn.Softmax(dim=1) + + self.epoch = 1 + self.step_num = 1 + + self.best_loss = float("inf") + + self.train_dataset = train_dataset + self.valid_dataset = valid_dataset + self.test_dataset = test_dataset + + self.train_dataloader = torch.utils.data.DataLoader( + self.train_dataset, + batch_size=config["train"]["train_batch_size"], + shuffle=True, + ) + self.valid_dataloader = torch.utils.data.DataLoader( + self.valid_dataset, + batch_size=config["train"]["valid_batch_size"], + shuffle=False, + ) + self.test_dataloader = torch.utils.data.DataLoader( + self.test_dataset, + batch_size=config["train"]["test_batch_size"], + shuffle=False, + ) + + self.bucket = get_bucket( + client, + os.environ.get("BUCKET_NAME_FOR_MODEL"), + ) + logger.info("Bucket is ready") + + # XXX: local用の保存先 + # self.save_model_dir = config["train"]["save_model_dir"] + # if not os.path.exists(self.save_model_dir): + # os.makedirs(self.save_model_dir) + + def train(self): + logger.info("Start Training") + for _ in range(self.config["train"]["epoch"]): + self.model.train() + for label, image in self.train_dataloader: + self.step(label, image) + self.end_epoch() + + if self.epoch % self.config["train"]["validate_interval"] == 0: + self.validate() + + self.test() + save_pickle_to_gcs( + bucket=self.bucket, + upload_model_path=f"{self.args.nursery_id}/{self.args.bus_id}/model_{switch_to_bus_type(self.args.bus_type)}.pth", + obj=self.model.state_dict(), + ) + + def step(self, label: torch.Tensor, image: torch.Tensor): + self.optimizer.zero_grad() + + output = self.model(image.to(self.args.device)) + + loss = self.criterion(output, label) + loss.backward() + self.optimizer.step() + + self.last_loss = loss.item() + self.step_num += 1 + + def end_epoch(self): + logger.info(f"Epoch {self.epoch} Loss: {self.last_loss}") + + if self.last_loss < self.best_loss: + self.best_loss = self.last_loss + # XXX: local用の保存先 + # self.save_model(self.save_model_dir + "best_model.pth") + + self.epoch += 1 + self.step_num = 1 + + def validate(self): + self.model.eval() + collect_list = [] + pred_list = [] + for label, image in self.valid_dataloader: + output = self.model(image.to(self.args.device)) + output = self.softmax(output) + + pred = torch.argmax(output, 1) + + pred_list.append(pred) + collect_list.append(label) + + accuracy = self.calc_accuracy(pred_list, collect_list) + logger.info(f"########## Epoch {self.epoch} ##########") + logger.info(f"Validation Accuracy: {accuracy}") + + def test(self): + self.model.eval() + collect_list = [] + pred_list = [] + for label, image in self.test_dataloader: + with torch.no_grad(): + output = self.model(image.to(self.args.device)) + output = self.softmax(output) + + pred = torch.argmax(output, 1) + + pred_list.append(pred) + collect_list.append(label) + + accuracy = self.calc_accuracy(pred_list, collect_list) + logger.info("########## Test ##########") + logger.info(f"Test Accuracy: {accuracy}") + + def calc_accuracy(self, pred_list, collect_list): + pred = torch.cat(pred_list) + collect = torch.cat(collect_list) + accuracy = (pred == collect).sum().item() / len(collect) + return accuracy + + def save_model(self, save_path: str): + torch.save(self.model.state_dict(), save_path) diff --git a/machine_learning/src/face_detect_model/util.py b/machine_learning/src/face_detect_model/util.py new file mode 100644 index 00000000..e40f191a --- /dev/null +++ b/machine_learning/src/face_detect_model/util.py @@ -0,0 +1,254 @@ +import logging +import os +import random +import re + +import cv2 +import numpy as np +import torch +from generated.machine_learning.v1.func_args import FaceDetectAndClip_Args +from google.cloud.storage import Bucket +from torchvision import transforms + +logging.basicConfig( + format="%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s", + datefmt="%m/%d/%Y %H:%M:%S", + level=logging.INFO, +) +logger = logging.getLogger(__name__) + + +def set_seed(seed): + random.seed(seed) + torch.manual_seed(seed) + torch.cuda.manual_seed(seed) + torch.cuda.manual_seed_all(seed) + + +def get_child_id(blob_name: str): + # UUIDの正規表現パターン + uuid_pattern = r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" + + # 正規表現でUUIDを検索 + uuids = re.findall(uuid_pattern, blob_name) + + # 目的のUUIDを取得(2番目に現れるUUID) + child_id = uuids[1] if len(uuids) > 1 else None + return child_id + + +# TODO: gRPC用に生成されたファイルを用いることができないか検証し,置換 +def switch_to_bus_type(bus_type_num: int): + bus_type_str = "BUS_TYPE_" + if bus_type_num == 0: + return bus_type_str + "UNSPECIFIED" + elif bus_type_num == 1: + return bus_type_str + "MORNING" + elif bus_type_num == 2: + return bus_type_str + "EVENING" + else: + raise ValueError(f"Invalid bus_type: {bus_type_num}") + + +def load_image_from_remote(blobs: list, color_channel: int): + images = [] + for blob in blobs: + logger.info(f"loading: {blob.name}") + if _is_valid_file(blob.name) is False: + logger.info(f"skip: {blob.name}") + continue + + # バイトデータから numpy 配列を作成 + image_data = blob.download_as_string() + image_array = np.frombuffer(image_data, dtype=np.uint8) + + # cv2.imdecode でバイト配列を画像に変換 + image = cv2.imdecode(image_array, cv2.IMREAD_COLOR) + + if color_channel == 3: + image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # BGRからRGBに変換 + elif color_channel == 1: + image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) + else: + raise ValueError(f"Invalid color_channel: {color_channel}") + + if image is None: + logger.error(f"Can not load: {blob.name}") + continue + child_id = get_child_id(blob.name) + images.append((child_id, image)) + return images + + +def load_image_from_binary(args: FaceDetectAndClip_Args, binary: bytes): + image_array = np.frombuffer(binary, dtype=np.uint8) + image = image_array.reshape((args.photo_height, args.photo_width)) + # 画像を回転 + image = np.rot90(image, k=3) + + # TODO: GSCへの画像保存 + if image is None: + raise ValueError("Can not load image from binary.") + return image + + +def get_default_transforms(): + return transforms.Compose( + [ + transforms.ToTensor(), + transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), + ] + ) + + +def get_default_transforms_for_gray(): + return transforms.Compose( + [ + transforms.ToTensor(), + transforms.Normalize(mean=[0.5], std=[0.5]), + ] + ) + + +def get_augment_transform(): + return transforms.Compose( + [ + transforms.RandomCrop((100, 100)), + transforms.RandomHorizontalFlip(p=0.5), + transforms.RandomVerticalFlip(p=0.5), + transforms.RandomApply([transforms.RandomRotation(degrees=180)], p=0.5), + transforms.RandomApply( + [ + transforms.RandomAffine( + degrees=0, translate=(0.1, 0.1), scale=(0.8, 1.2) + ) + ], + p=0.5, + ), + transforms.ToTensor(), + transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), + ] + ) + + +def get_augment_transform_for_gray(): + return transforms.Compose( + [ + transforms.RandomCrop((100, 100)), + transforms.RandomHorizontalFlip(p=0.5), + transforms.RandomVerticalFlip(p=0.5), + transforms.RandomApply([transforms.RandomRotation(degrees=180)], p=0.5), + transforms.RandomApply( + [ + transforms.RandomAffine( + degrees=0, translate=(0.1, 0.1), scale=(0.8, 1.2) + ) + ], + p=0.5, + ), + transforms.ToTensor(), + transforms.Normalize(mean=[0.5], std=[0.5]), + ] + ) + + +def _is_valid_file(file_name): + VALID_EXTENSIONS = {".png"} + return os.path.splitext(file_name)[1].lower() in VALID_EXTENSIONS + + +def save_pickle_to_gcs(bucket: Bucket, upload_model_path: str, obj: object): + logger.info(f"Saving pickle to {upload_model_path}") + blob = bucket.blob(upload_model_path) + with blob.open("wb", ignore_flush=True) as f: + torch.save(obj, f) + logger.info(f"pickle saved to {upload_model_path}") + + +def load_pickle_to_gcs(bucket: Bucket, obj_path: str) -> object: + logger.info(f"Loading pickle from {obj_path}") + blob = bucket.blob(obj_path) + with blob.open("rb") as f: + model = torch.load(f) + logger.info(f"pickle loaded from {obj_path}") + return model + + +class smile_detecter: + def __init__( + self, scaleFactor=1.1, minNeighbors=10, cascade_path="haarcascade_smile.xml" + ): + self.scaleFactor = scaleFactor + self.minNeighbors = minNeighbors + self.smile_cascade = self.get_casecade(cascade_path) + + def get_casecade(self, cascade_path): + cascade = cv2.CascadeClassifier(cv2.data.haarcascades + cascade_path) + if cascade is None: + raise ValueError(f"Can not load cascade: {cascade_path}") + return cascade + + def detect_smile_degree(self, gray_image): + smile = self.smile_cascade.detectMultiScale( + gray_image, scaleFactor=self.scaleFactor, minNeighbors=self.minNeighbors + ) + if len(smile) > 0: + (_, _, sw, sh) = smile[0] + smile_area = sw * sh + # 仮定として、顔の最大30%が笑顔の面積となる場合 + max_smile_area = (gray_image.shape[0] * gray_image.shape[1]) * 0.25 + # 実際の笑顔の面積を最大笑顔面積で割り、100を掛けて正規化 + smile_degree = (smile_area / max_smile_area) * 100 + # 100を超える値を100に制限 + smile_degree = min(smile_degree, 100) + return smile_degree + else: + return 0 + + def add_smile_degree_to_image( + self, image, smile_degree, font_scale=0.7, thickness=2 + ): + # 画像の高さと幅を取得 + height, width = image.shape[:2] + + # テキストを追加する位置(画像の下部中央付近) + position = (10, height - 10) # 下部に少し余白を残す + + # テキストのフォント + font = cv2.FONT_HERSHEY_SIMPLEX + + # テキストの色(BGR形式) + color = (255, 255, 255) # 白色 + + # テキストの背景色 + background_color = (0, 0, 0) # 黒色 + + # 小数点以下1桁まで表示 + smile_degree = round(smile_degree, 1) + + # テキストの背景を描画(背景に少し余白を持たせるためにテキストサイズを計算) + (text_width, text_height), _ = cv2.getTextSize( + f"Smile degree: {smile_degree}", font, font_scale, thickness + ) + image_copy = image.copy() + cv2.rectangle( + image_copy, + position, + (position[0] + text_width, position[1] + text_height + 10), + background_color, + -1, + ) + + # テキストを画像に追加 + cv2.putText( + image_copy, + f"Smile degree: {smile_degree}", + position, + font, + font_scale, + color, + thickness, + cv2.LINE_AA, + ) + + return image_copy diff --git a/machine_learning/src/generated/machine_learning/v1/func_args.py b/machine_learning/src/generated/machine_learning/v1/func_args.py new file mode 100644 index 00000000..e59ffed2 --- /dev/null +++ b/machine_learning/src/generated/machine_learning/v1/func_args.py @@ -0,0 +1,29 @@ +from dataclasses import dataclass + + +@dataclass +class Pred_Args: + nursery_id: str + bus_id: str + bus_type: int + video_chunk: list[str] + vehicle_event: str + photo_height: int + photo_width: int + + +@dataclass +class Train_Args: + nursery_id: str + child_ids: str + bus_id: str + bus_type: int + seed: int + mode: str + + +@dataclass +class FaceDetectAndClip_Args: + nursery_id: str + child_id: str + env: str diff --git a/machine_learning/src/generated/machine_learning/v1/health_check_pb2.py b/machine_learning/src/generated/machine_learning/v1/health_check_pb2.py new file mode 100644 index 00000000..a6997700 --- /dev/null +++ b/machine_learning/src/generated/machine_learning/v1/health_check_pb2.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: machine_learning/v1/health_check.proto +# Protobuf Python Version: 4.25.2 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n&machine_learning/v1/health_check.proto\x12\x13machine_learning.v1\"!\n\x0bPingRequest\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\"(\n\x0cPingResponse\x12\x18\n\x07message\x18\x01 \x01(\tR\x07message2a\n\x12HealthcheckService\x12K\n\x04Ping\x12 .machine_learning.v1.PingRequest\x1a!.machine_learning.v1.PingResponseB\xfe\x01\n\x17\x63om.machine_learning.v1B\x10HealthCheckProtoP\x01Zhgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/machine_learning/v1;machine_learningv1\xa2\x02\x03MXX\xaa\x02\x12MachineLearning.V1\xca\x02\x12MachineLearning\\V1\xe2\x02\x1eMachineLearning\\V1\\GPBMetadata\xea\x02\x13MachineLearning::V1b\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'machine_learning.v1.health_check_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\027com.machine_learning.v1B\020HealthCheckProtoP\001Zhgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/machine_learning/v1;machine_learningv1\242\002\003MXX\252\002\022MachineLearning.V1\312\002\022MachineLearning\\V1\342\002\036MachineLearning\\V1\\GPBMetadata\352\002\023MachineLearning::V1' + _globals['_PINGREQUEST']._serialized_start=63 + _globals['_PINGREQUEST']._serialized_end=96 + _globals['_PINGRESPONSE']._serialized_start=98 + _globals['_PINGRESPONSE']._serialized_end=138 + _globals['_HEALTHCHECKSERVICE']._serialized_start=140 + _globals['_HEALTHCHECKSERVICE']._serialized_end=237 +# @@protoc_insertion_point(module_scope) diff --git a/machine_learning/src/generated/machine_learning/v1/health_check_pb2.pyi b/machine_learning/src/generated/machine_learning/v1/health_check_pb2.pyi new file mode 100644 index 00000000..fb2e805c --- /dev/null +++ b/machine_learning/src/generated/machine_learning/v1/health_check_pb2.pyi @@ -0,0 +1,17 @@ +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Optional as _Optional + +DESCRIPTOR: _descriptor.FileDescriptor + +class PingRequest(_message.Message): + __slots__ = ("name",) + NAME_FIELD_NUMBER: _ClassVar[int] + name: str + def __init__(self, name: _Optional[str] = ...) -> None: ... + +class PingResponse(_message.Message): + __slots__ = ("message",) + MESSAGE_FIELD_NUMBER: _ClassVar[int] + message: str + def __init__(self, message: _Optional[str] = ...) -> None: ... diff --git a/machine_learning/src/generated/machine_learning/v1/health_check_pb2_grpc.py b/machine_learning/src/generated/machine_learning/v1/health_check_pb2_grpc.py new file mode 100644 index 00000000..b4c7ae61 --- /dev/null +++ b/machine_learning/src/generated/machine_learning/v1/health_check_pb2_grpc.py @@ -0,0 +1,81 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from generated.machine_learning.v1 import ( + health_check_pb2 as machine__learning_dot_v1_dot_health__check__pb2, +) + + +class HealthcheckServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.Ping = channel.unary_unary( + "/machine_learning.v1.HealthcheckService/Ping", + request_serializer=machine__learning_dot_v1_dot_health__check__pb2.PingRequest.SerializeToString, + response_deserializer=machine__learning_dot_v1_dot_health__check__pb2.PingResponse.FromString, + ) + + +class HealthcheckServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def Ping(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + +def add_HealthcheckServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + "Ping": grpc.unary_unary_rpc_method_handler( + servicer.Ping, + request_deserializer=machine__learning_dot_v1_dot_health__check__pb2.PingRequest.FromString, + response_serializer=machine__learning_dot_v1_dot_health__check__pb2.PingResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + "machine_learning.v1.HealthcheckService", rpc_method_handlers + ) + server.add_generic_rpc_handlers((generic_handler,)) + + +# This class is part of an EXPERIMENTAL API. +class HealthcheckService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def Ping( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/machine_learning.v1.HealthcheckService/Ping", + machine__learning_dot_v1_dot_health__check__pb2.PingRequest.SerializeToString, + machine__learning_dot_v1_dot_health__check__pb2.PingResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) diff --git a/machine_learning/src/generated/machine_learning/v1/machine_learning_pb2.py b/machine_learning/src/generated/machine_learning/v1/machine_learning_pb2.py new file mode 100644 index 00000000..b6ed6620 --- /dev/null +++ b/machine_learning/src/generated/machine_learning/v1/machine_learning_pb2.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: machine_learning/v1/machine_learning.proto +# Protobuf Python Version: 4.25.2 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from generated.where_child_bus.v1 import ( + bus_pb2 as where__child__bus_dot_v1_dot_bus__pb2, +) +from generated.where_child_bus.v1 import ( + resources_pb2 as where__child__bus_dot_v1_dot_resources__pb2, +) + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( + b'\n*machine_learning/v1/machine_learning.proto\x12\x13machine_learning.v1\x1a\x1cwhere_child_bus/v1/bus.proto\x1a"where_child_bus/v1/resources.proto"\x99\x01\n\x0cTrainRequest\x12\x1d\n\nnursery_id\x18\x01 \x01(\tR\tnurseryId\x12\x15\n\x06\x62us_id\x18\x02 \x01(\tR\x05\x62usId\x12\x1b\n\tchild_ids\x18\x03 \x03(\tR\x08\x63hildIds\x12\x36\n\x08\x62us_type\x18\x04 \x01(\x0e\x32\x1b.where_child_bus.v1.BusTypeR\x07\x62usType"D\n\rTrainResponse\x12\x33\n\x06status\x18\x01 \x01(\x0e\x32\x1b.machine_learning.v1.StatusR\x06status"L\n\x0cPredResponse\x12\x1f\n\x0bis_detected\x18\x01 \x01(\x08R\nisDetected\x12\x1b\n\tchild_ids\x18\x02 \x03(\tR\x08\x63hildIds"T\n\x18\x46\x61\x63\x65\x44\x65tectAndClipRequest\x12\x1d\n\nnursery_id\x18\x01 \x01(\tR\tnurseryId\x12\x19\n\x08\x63hild_id\x18\x02 \x01(\tR\x07\x63hildId":\n\x19\x46\x61\x63\x65\x44\x65tectAndClipResponse\x12\x1d\n\nis_started\x18\x01 \x01(\x08R\tisStarted*r\n\x06Status\x12\x16\n\x12STATUS_UNSPECIFIED\x10\x00\x12\x12\n\x0eSTATUS_SUCCESS\x10\x01\x12\x15\n\x11STATUS_PROCESSING\x10\x02\x12\x11\n\rSTATUS_FAILED\x10\x03\x12\x12\n\x0eSTATUS_WAITING\x10\x04\x32\xb8\x02\n\x16MachineLearningService\x12P\n\x05Train\x12!.machine_learning.v1.TrainRequest\x1a".machine_learning.v1.TrainResponse0\x01\x12X\n\x04Pred\x12).where_child_bus.v1.StreamBusVideoRequest\x1a!.machine_learning.v1.PredResponse(\x01\x30\x01\x12r\n\x11\x46\x61\x63\x65\x44\x65tectAndClip\x12-.machine_learning.v1.FaceDetectAndClipRequest\x1a..machine_learning.v1.FaceDetectAndClipResponseB\x82\x02\n\x17\x63om.machine_learning.v1B\x14MachineLearningProtoP\x01Zhgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/machine_learning/v1;machine_learningv1\xa2\x02\x03MXX\xaa\x02\x12MachineLearning.V1\xca\x02\x12MachineLearning\\V1\xe2\x02\x1eMachineLearning\\V1\\GPBMetadata\xea\x02\x13MachineLearning::V1b\x06proto3' +) + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages( + DESCRIPTOR, "machine_learning.v1.machine_learning_pb2", _globals +) +if _descriptor._USE_C_DESCRIPTORS == False: + _globals["DESCRIPTOR"]._options = None + _globals["DESCRIPTOR"]._serialized_options = ( + b"\n\027com.machine_learning.v1B\024MachineLearningProtoP\001Zhgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/machine_learning/v1;machine_learningv1\242\002\003MXX\252\002\022MachineLearning.V1\312\002\022MachineLearning\\V1\342\002\036MachineLearning\\V1\\GPBMetadata\352\002\023MachineLearning::V1" + ) + _globals["_STATUS"]._serialized_start = 583 + _globals["_STATUS"]._serialized_end = 697 + _globals["_TRAINREQUEST"]._serialized_start = 134 + _globals["_TRAINREQUEST"]._serialized_end = 287 + _globals["_TRAINRESPONSE"]._serialized_start = 289 + _globals["_TRAINRESPONSE"]._serialized_end = 357 + _globals["_PREDRESPONSE"]._serialized_start = 359 + _globals["_PREDRESPONSE"]._serialized_end = 435 + _globals["_FACEDETECTANDCLIPREQUEST"]._serialized_start = 437 + _globals["_FACEDETECTANDCLIPREQUEST"]._serialized_end = 521 + _globals["_FACEDETECTANDCLIPRESPONSE"]._serialized_start = 523 + _globals["_FACEDETECTANDCLIPRESPONSE"]._serialized_end = 581 + _globals["_MACHINELEARNINGSERVICE"]._serialized_start = 700 + _globals["_MACHINELEARNINGSERVICE"]._serialized_end = 1012 +# @@protoc_insertion_point(module_scope) diff --git a/machine_learning/src/generated/machine_learning/v1/machine_learning_pb2.pyi b/machine_learning/src/generated/machine_learning/v1/machine_learning_pb2.pyi new file mode 100644 index 00000000..2d6612a6 --- /dev/null +++ b/machine_learning/src/generated/machine_learning/v1/machine_learning_pb2.pyi @@ -0,0 +1,62 @@ +from where_child_bus.v1 import bus_pb2 as _bus_pb2 +from where_child_bus.v1 import resources_pb2 as _resources_pb2 +from google.protobuf.internal import containers as _containers +from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class Status(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + STATUS_UNSPECIFIED: _ClassVar[Status] + STATUS_SUCCESS: _ClassVar[Status] + STATUS_PROCESSING: _ClassVar[Status] + STATUS_FAILED: _ClassVar[Status] + STATUS_WAITING: _ClassVar[Status] +STATUS_UNSPECIFIED: Status +STATUS_SUCCESS: Status +STATUS_PROCESSING: Status +STATUS_FAILED: Status +STATUS_WAITING: Status + +class TrainRequest(_message.Message): + __slots__ = ("nursery_id", "bus_id", "child_ids", "bus_type") + NURSERY_ID_FIELD_NUMBER: _ClassVar[int] + BUS_ID_FIELD_NUMBER: _ClassVar[int] + CHILD_IDS_FIELD_NUMBER: _ClassVar[int] + BUS_TYPE_FIELD_NUMBER: _ClassVar[int] + nursery_id: str + bus_id: str + child_ids: _containers.RepeatedScalarFieldContainer[str] + bus_type: _resources_pb2.BusType + def __init__(self, nursery_id: _Optional[str] = ..., bus_id: _Optional[str] = ..., child_ids: _Optional[_Iterable[str]] = ..., bus_type: _Optional[_Union[_resources_pb2.BusType, str]] = ...) -> None: ... + +class TrainResponse(_message.Message): + __slots__ = ("status",) + STATUS_FIELD_NUMBER: _ClassVar[int] + status: Status + def __init__(self, status: _Optional[_Union[Status, str]] = ...) -> None: ... + +class PredResponse(_message.Message): + __slots__ = ("is_detected", "child_ids") + IS_DETECTED_FIELD_NUMBER: _ClassVar[int] + CHILD_IDS_FIELD_NUMBER: _ClassVar[int] + is_detected: bool + child_ids: _containers.RepeatedScalarFieldContainer[str] + def __init__(self, is_detected: bool = ..., child_ids: _Optional[_Iterable[str]] = ...) -> None: ... + +class FaceDetectAndClipRequest(_message.Message): + __slots__ = ("nursery_id", "child_id") + NURSERY_ID_FIELD_NUMBER: _ClassVar[int] + CHILD_ID_FIELD_NUMBER: _ClassVar[int] + nursery_id: str + child_id: str + def __init__(self, nursery_id: _Optional[str] = ..., child_id: _Optional[str] = ...) -> None: ... + +class FaceDetectAndClipResponse(_message.Message): + __slots__ = ("is_started",) + IS_STARTED_FIELD_NUMBER: _ClassVar[int] + is_started: bool + def __init__(self, is_started: bool = ...) -> None: ... diff --git a/machine_learning/src/generated/machine_learning/v1/machine_learning_pb2_grpc.py b/machine_learning/src/generated/machine_learning/v1/machine_learning_pb2_grpc.py new file mode 100644 index 00000000..63d74f64 --- /dev/null +++ b/machine_learning/src/generated/machine_learning/v1/machine_learning_pb2_grpc.py @@ -0,0 +1,174 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from generated.machine_learning.v1 import ( + machine_learning_pb2 as machine__learning_dot_v1_dot_machine__learning__pb2, +) +from generated.where_child_bus.v1 import ( + bus_pb2 as where__child__bus_dot_v1_dot_bus__pb2, +) + + +class MachineLearningServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.Train = channel.unary_stream( + "/machine_learning.v1.MachineLearningService/Train", + request_serializer=machine__learning_dot_v1_dot_machine__learning__pb2.TrainRequest.SerializeToString, + response_deserializer=machine__learning_dot_v1_dot_machine__learning__pb2.TrainResponse.FromString, + ) + self.Pred = channel.stream_stream( + "/machine_learning.v1.MachineLearningService/Pred", + request_serializer=where__child__bus_dot_v1_dot_bus__pb2.StreamBusVideoRequest.SerializeToString, + response_deserializer=machine__learning_dot_v1_dot_machine__learning__pb2.PredResponse.FromString, + ) + self.FaceDetectAndClip = channel.unary_unary( + "/machine_learning.v1.MachineLearningService/FaceDetectAndClip", + request_serializer=machine__learning_dot_v1_dot_machine__learning__pb2.FaceDetectAndClipRequest.SerializeToString, + response_deserializer=machine__learning_dot_v1_dot_machine__learning__pb2.FaceDetectAndClipResponse.FromString, + ) + + +class MachineLearningServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def Train(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def Pred(self, request_iterator, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def FaceDetectAndClip(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + +def add_MachineLearningServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + "Train": grpc.unary_stream_rpc_method_handler( + servicer.Train, + request_deserializer=machine__learning_dot_v1_dot_machine__learning__pb2.TrainRequest.FromString, + response_serializer=machine__learning_dot_v1_dot_machine__learning__pb2.TrainResponse.SerializeToString, + ), + "Pred": grpc.stream_stream_rpc_method_handler( + servicer.Pred, + request_deserializer=where__child__bus_dot_v1_dot_bus__pb2.StreamBusVideoRequest.FromString, + response_serializer=machine__learning_dot_v1_dot_machine__learning__pb2.PredResponse.SerializeToString, + ), + "FaceDetectAndClip": grpc.unary_unary_rpc_method_handler( + servicer.FaceDetectAndClip, + request_deserializer=machine__learning_dot_v1_dot_machine__learning__pb2.FaceDetectAndClipRequest.FromString, + response_serializer=machine__learning_dot_v1_dot_machine__learning__pb2.FaceDetectAndClipResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + "machine_learning.v1.MachineLearningService", rpc_method_handlers + ) + server.add_generic_rpc_handlers((generic_handler,)) + + +# This class is part of an EXPERIMENTAL API. +class MachineLearningService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def Train( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_stream( + request, + target, + "/machine_learning.v1.MachineLearningService/Train", + machine__learning_dot_v1_dot_machine__learning__pb2.TrainRequest.SerializeToString, + machine__learning_dot_v1_dot_machine__learning__pb2.TrainResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def Pred( + request_iterator, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.stream_stream( + request_iterator, + target, + "/machine_learning.v1.MachineLearningService/Pred", + where__child__bus_dot_v1_dot_bus__pb2.StreamBusVideoRequest.SerializeToString, + machine__learning_dot_v1_dot_machine__learning__pb2.PredResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def FaceDetectAndClip( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/machine_learning.v1.MachineLearningService/FaceDetectAndClip", + machine__learning_dot_v1_dot_machine__learning__pb2.FaceDetectAndClipRequest.SerializeToString, + machine__learning_dot_v1_dot_machine__learning__pb2.FaceDetectAndClipResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) diff --git a/machine_learning/src/generated/where_child_bus/v1/bus_pb2.py b/machine_learning/src/generated/where_child_bus/v1/bus_pb2.py new file mode 100644 index 00000000..e5b5531f --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/bus_pb2.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: where_child_bus/v1/bus.proto +# Protobuf Python Version: 4.25.2 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from generated.where_child_bus.v1 import resources_pb2 as where__child__bus_dot_v1_dot_resources__pb2 +from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cwhere_child_bus/v1/bus.proto\x12\x12where_child_bus.v1\x1a\"where_child_bus/v1/resources.proto\x1a google/protobuf/field_mask.proto\"h\n\x10\x43reateBusRequest\x12\x1d\n\nnursery_id\x18\x01 \x01(\tR\tnurseryId\x12\x12\n\x04name\x18\x02 \x01(\tR\x04name\x12!\n\x0cplate_number\x18\x03 \x01(\tR\x0bplateNumber\">\n\x11\x43reateBusResponse\x12)\n\x03\x62us\x18\x01 \x01(\x0b\x32\x17.where_child_bus.v1.BusR\x03\x62us\"=\n\x1cGetBusListByNurseryIdRequest\x12\x1d\n\nnursery_id\x18\x01 \x01(\tR\tnurseryId\"N\n\x1dGetBusListByNurseryIdResponse\x12-\n\x05\x62uses\x18\x01 \x03(\x0b\x32\x17.where_child_bus.v1.BusR\x05\x62uses\"C\n GetRunningBusByGuardianIdRequest\x12\x1f\n\x0bguardian_id\x18\x01 \x01(\tR\nguardianId\"N\n!GetRunningBusByGuardianIdResponse\x12)\n\x03\x62us\x18\x01 \x01(\x0b\x32\x17.where_child_bus.v1.BusR\x03\x62us\"\xa5\x01\n\x16\x43hangeBusStatusRequest\x12\x15\n\x06\x62us_id\x18\x01 \x01(\tR\x05\x62usId\x12<\n\nbus_status\x18\x02 \x01(\x0e\x32\x1d.where_child_bus.v1.BusStatusR\tbusStatus\x12\x36\n\x08\x62us_type\x18\x03 \x01(\x0e\x32\x1b.where_child_bus.v1.BusTypeR\x07\x62usType\"D\n\x17\x43hangeBusStatusResponse\x12)\n\x03\x62us\x18\x01 \x01(\x0b\x32\x17.where_child_bus.v1.BusR\x03\x62us\"p\n\x1dSendLocationContinuousRequest\x12\x15\n\x06\x62us_id\x18\x01 \x01(\tR\x05\x62usId\x12\x1a\n\x08latitude\x18\x02 \x01(\x01R\x08latitude\x12\x1c\n\tlongitude\x18\x03 \x01(\x01R\tlongitude\" \n\x1eSendLocationContinuousResponse\"2\n\x19TrackBusContinuousRequest\x12\x15\n\x06\x62us_id\x18\x01 \x01(\tR\x05\x62usId\"\x95\x01\n\x1aTrackBusContinuousResponse\x12\x15\n\x06\x62us_id\x18\x01 \x01(\tR\x05\x62usId\x12\x1a\n\x08latitude\x18\x02 \x01(\x01R\x08latitude\x12\x1c\n\tlongitude\x18\x03 \x01(\x01R\tlongitude\x12&\n\x0fnext_station_id\x18\x04 \x01(\tR\rnextStationId\"\xb1\x02\n\x15StreamBusVideoRequest\x12\x15\n\x06\x62us_id\x18\x01 \x01(\tR\x05\x62usId\x12\x1d\n\nnursery_id\x18\x02 \x01(\tR\tnurseryId\x12\x36\n\x08\x62us_type\x18\x03 \x01(\x0e\x32\x1b.where_child_bus.v1.BusTypeR\x07\x62usType\x12\x45\n\rvehicle_event\x18\x04 \x01(\x0e\x32 .where_child_bus.v1.VehicleEventR\x0cvehicleEvent\x12\x1f\n\x0bvideo_chunk\x18\x05 \x03(\x0cR\nvideoChunk\x12!\n\x0cphoto_height\x18\x06 \x01(\x05R\x0bphotoHeight\x12\x1f\n\x0bphoto_width\x18\x07 \x01(\x05R\nphotoWidth\"p\n\x16StreamBusVideoResponse\x12\x1f\n\x0bis_detected\x18\x01 \x01(\x08R\nisDetected\x12\x35\n\x08\x63hildren\x18\x02 \x03(\x0b\x32\x19.where_child_bus.v1.ChildR\x08\x63hildren\"\xb7\x02\n\x10UpdateBusRequest\x12\x15\n\x06\x62us_id\x18\x01 \x01(\tR\x05\x62usId\x12\x12\n\x04name\x18\x02 \x01(\tR\x04name\x12!\n\x0cplate_number\x18\x03 \x01(\tR\x0bplateNumber\x12\x1a\n\x08latitude\x18\x04 \x01(\x01R\x08latitude\x12\x1c\n\tlongitude\x18\x05 \x01(\x01R\tlongitude\x12\x36\n\x17\x65nable_face_recognition\x18\x06 \x01(\x08R\x15\x65nableFaceRecognition\x12&\n\x0fnext_station_id\x18\t \x01(\tR\rnextStationId\x12;\n\x0bupdate_mask\x18\n \x01(\x0b\x32\x1a.google.protobuf.FieldMaskR\nupdateMask\">\n\x11UpdateBusResponse\x12)\n\x03\x62us\x18\x01 \x01(\x0b\x32\x17.where_child_bus.v1.BusR\x03\x62us2\x9d\x07\n\nBusService\x12X\n\tCreateBus\x12$.where_child_bus.v1.CreateBusRequest\x1a%.where_child_bus.v1.CreateBusResponse\x12|\n\x15GetBusListByNurseryId\x12\x30.where_child_bus.v1.GetBusListByNurseryIdRequest\x1a\x31.where_child_bus.v1.GetBusListByNurseryIdResponse\x12\x88\x01\n\x19GetRunningBusByGuardianId\x12\x34.where_child_bus.v1.GetRunningBusByGuardianIdRequest\x1a\x35.where_child_bus.v1.GetRunningBusByGuardianIdResponse\x12X\n\tUpdateBus\x12$.where_child_bus.v1.UpdateBusRequest\x1a%.where_child_bus.v1.UpdateBusResponse\x12j\n\x0f\x43hangeBusStatus\x12*.where_child_bus.v1.ChangeBusStatusRequest\x1a+.where_child_bus.v1.ChangeBusStatusResponse\x12\x81\x01\n\x16SendLocationContinuous\x12\x31.where_child_bus.v1.SendLocationContinuousRequest\x1a\x32.where_child_bus.v1.SendLocationContinuousResponse(\x01\x12u\n\x12TrackBusContinuous\x12-.where_child_bus.v1.TrackBusContinuousRequest\x1a..where_child_bus.v1.TrackBusContinuousResponse0\x01\x12k\n\x0eStreamBusVideo\x12).where_child_bus.v1.StreamBusVideoRequest\x1a*.where_child_bus.v1.StreamBusVideoResponse(\x01\x30\x01\x42\xeb\x01\n\x16\x63om.where_child_bus.v1B\x08\x42usProtoP\x01Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\xa2\x02\x03WXX\xaa\x02\x10WhereChildBus.V1\xca\x02\x10WhereChildBus\\V1\xe2\x02\x1cWhereChildBus\\V1\\GPBMetadata\xea\x02\x11WhereChildBus::V1b\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'where_child_bus.v1.bus_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\026com.where_child_bus.v1B\010BusProtoP\001Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\242\002\003WXX\252\002\020WhereChildBus.V1\312\002\020WhereChildBus\\V1\342\002\034WhereChildBus\\V1\\GPBMetadata\352\002\021WhereChildBus::V1' + _globals['_CREATEBUSREQUEST']._serialized_start=122 + _globals['_CREATEBUSREQUEST']._serialized_end=226 + _globals['_CREATEBUSRESPONSE']._serialized_start=228 + _globals['_CREATEBUSRESPONSE']._serialized_end=290 + _globals['_GETBUSLISTBYNURSERYIDREQUEST']._serialized_start=292 + _globals['_GETBUSLISTBYNURSERYIDREQUEST']._serialized_end=353 + _globals['_GETBUSLISTBYNURSERYIDRESPONSE']._serialized_start=355 + _globals['_GETBUSLISTBYNURSERYIDRESPONSE']._serialized_end=433 + _globals['_GETRUNNINGBUSBYGUARDIANIDREQUEST']._serialized_start=435 + _globals['_GETRUNNINGBUSBYGUARDIANIDREQUEST']._serialized_end=502 + _globals['_GETRUNNINGBUSBYGUARDIANIDRESPONSE']._serialized_start=504 + _globals['_GETRUNNINGBUSBYGUARDIANIDRESPONSE']._serialized_end=582 + _globals['_CHANGEBUSSTATUSREQUEST']._serialized_start=585 + _globals['_CHANGEBUSSTATUSREQUEST']._serialized_end=750 + _globals['_CHANGEBUSSTATUSRESPONSE']._serialized_start=752 + _globals['_CHANGEBUSSTATUSRESPONSE']._serialized_end=820 + _globals['_SENDLOCATIONCONTINUOUSREQUEST']._serialized_start=822 + _globals['_SENDLOCATIONCONTINUOUSREQUEST']._serialized_end=934 + _globals['_SENDLOCATIONCONTINUOUSRESPONSE']._serialized_start=936 + _globals['_SENDLOCATIONCONTINUOUSRESPONSE']._serialized_end=968 + _globals['_TRACKBUSCONTINUOUSREQUEST']._serialized_start=970 + _globals['_TRACKBUSCONTINUOUSREQUEST']._serialized_end=1020 + _globals['_TRACKBUSCONTINUOUSRESPONSE']._serialized_start=1023 + _globals['_TRACKBUSCONTINUOUSRESPONSE']._serialized_end=1172 + _globals['_STREAMBUSVIDEOREQUEST']._serialized_start=1175 + _globals['_STREAMBUSVIDEOREQUEST']._serialized_end=1480 + _globals['_STREAMBUSVIDEORESPONSE']._serialized_start=1482 + _globals['_STREAMBUSVIDEORESPONSE']._serialized_end=1594 + _globals['_UPDATEBUSREQUEST']._serialized_start=1597 + _globals['_UPDATEBUSREQUEST']._serialized_end=1908 + _globals['_UPDATEBUSRESPONSE']._serialized_start=1910 + _globals['_UPDATEBUSRESPONSE']._serialized_end=1972 + _globals['_BUSSERVICE']._serialized_start=1975 + _globals['_BUSSERVICE']._serialized_end=2900 +# @@protoc_insertion_point(module_scope) diff --git a/machine_learning/src/generated/where_child_bus/v1/bus_pb2.pyi b/machine_learning/src/generated/where_child_bus/v1/bus_pb2.pyi new file mode 100644 index 00000000..8d9faf7f --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/bus_pb2.pyi @@ -0,0 +1,148 @@ +from where_child_bus.v1 import resources_pb2 as _resources_pb2 +from google.protobuf import field_mask_pb2 as _field_mask_pb2 +from google.protobuf.internal import containers as _containers +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class CreateBusRequest(_message.Message): + __slots__ = ("nursery_id", "name", "plate_number") + NURSERY_ID_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + PLATE_NUMBER_FIELD_NUMBER: _ClassVar[int] + nursery_id: str + name: str + plate_number: str + def __init__(self, nursery_id: _Optional[str] = ..., name: _Optional[str] = ..., plate_number: _Optional[str] = ...) -> None: ... + +class CreateBusResponse(_message.Message): + __slots__ = ("bus",) + BUS_FIELD_NUMBER: _ClassVar[int] + bus: _resources_pb2.Bus + def __init__(self, bus: _Optional[_Union[_resources_pb2.Bus, _Mapping]] = ...) -> None: ... + +class GetBusListByNurseryIdRequest(_message.Message): + __slots__ = ("nursery_id",) + NURSERY_ID_FIELD_NUMBER: _ClassVar[int] + nursery_id: str + def __init__(self, nursery_id: _Optional[str] = ...) -> None: ... + +class GetBusListByNurseryIdResponse(_message.Message): + __slots__ = ("buses",) + BUSES_FIELD_NUMBER: _ClassVar[int] + buses: _containers.RepeatedCompositeFieldContainer[_resources_pb2.Bus] + def __init__(self, buses: _Optional[_Iterable[_Union[_resources_pb2.Bus, _Mapping]]] = ...) -> None: ... + +class GetRunningBusByGuardianIdRequest(_message.Message): + __slots__ = ("guardian_id",) + GUARDIAN_ID_FIELD_NUMBER: _ClassVar[int] + guardian_id: str + def __init__(self, guardian_id: _Optional[str] = ...) -> None: ... + +class GetRunningBusByGuardianIdResponse(_message.Message): + __slots__ = ("bus",) + BUS_FIELD_NUMBER: _ClassVar[int] + bus: _resources_pb2.Bus + def __init__(self, bus: _Optional[_Union[_resources_pb2.Bus, _Mapping]] = ...) -> None: ... + +class ChangeBusStatusRequest(_message.Message): + __slots__ = ("bus_id", "bus_status", "bus_type") + BUS_ID_FIELD_NUMBER: _ClassVar[int] + BUS_STATUS_FIELD_NUMBER: _ClassVar[int] + BUS_TYPE_FIELD_NUMBER: _ClassVar[int] + bus_id: str + bus_status: _resources_pb2.BusStatus + bus_type: _resources_pb2.BusType + def __init__(self, bus_id: _Optional[str] = ..., bus_status: _Optional[_Union[_resources_pb2.BusStatus, str]] = ..., bus_type: _Optional[_Union[_resources_pb2.BusType, str]] = ...) -> None: ... + +class ChangeBusStatusResponse(_message.Message): + __slots__ = ("bus",) + BUS_FIELD_NUMBER: _ClassVar[int] + bus: _resources_pb2.Bus + def __init__(self, bus: _Optional[_Union[_resources_pb2.Bus, _Mapping]] = ...) -> None: ... + +class SendLocationContinuousRequest(_message.Message): + __slots__ = ("bus_id", "latitude", "longitude") + BUS_ID_FIELD_NUMBER: _ClassVar[int] + LATITUDE_FIELD_NUMBER: _ClassVar[int] + LONGITUDE_FIELD_NUMBER: _ClassVar[int] + bus_id: str + latitude: float + longitude: float + def __init__(self, bus_id: _Optional[str] = ..., latitude: _Optional[float] = ..., longitude: _Optional[float] = ...) -> None: ... + +class SendLocationContinuousResponse(_message.Message): + __slots__ = () + def __init__(self) -> None: ... + +class TrackBusContinuousRequest(_message.Message): + __slots__ = ("bus_id",) + BUS_ID_FIELD_NUMBER: _ClassVar[int] + bus_id: str + def __init__(self, bus_id: _Optional[str] = ...) -> None: ... + +class TrackBusContinuousResponse(_message.Message): + __slots__ = ("bus_id", "latitude", "longitude", "next_station_id") + BUS_ID_FIELD_NUMBER: _ClassVar[int] + LATITUDE_FIELD_NUMBER: _ClassVar[int] + LONGITUDE_FIELD_NUMBER: _ClassVar[int] + NEXT_STATION_ID_FIELD_NUMBER: _ClassVar[int] + bus_id: str + latitude: float + longitude: float + next_station_id: str + def __init__(self, bus_id: _Optional[str] = ..., latitude: _Optional[float] = ..., longitude: _Optional[float] = ..., next_station_id: _Optional[str] = ...) -> None: ... + +class StreamBusVideoRequest(_message.Message): + __slots__ = ("bus_id", "nursery_id", "bus_type", "vehicle_event", "video_chunk", "photo_height", "photo_width") + BUS_ID_FIELD_NUMBER: _ClassVar[int] + NURSERY_ID_FIELD_NUMBER: _ClassVar[int] + BUS_TYPE_FIELD_NUMBER: _ClassVar[int] + VEHICLE_EVENT_FIELD_NUMBER: _ClassVar[int] + VIDEO_CHUNK_FIELD_NUMBER: _ClassVar[int] + PHOTO_HEIGHT_FIELD_NUMBER: _ClassVar[int] + PHOTO_WIDTH_FIELD_NUMBER: _ClassVar[int] + bus_id: str + nursery_id: str + bus_type: _resources_pb2.BusType + vehicle_event: _resources_pb2.VehicleEvent + video_chunk: _containers.RepeatedScalarFieldContainer[bytes] + photo_height: int + photo_width: int + def __init__(self, bus_id: _Optional[str] = ..., nursery_id: _Optional[str] = ..., bus_type: _Optional[_Union[_resources_pb2.BusType, str]] = ..., vehicle_event: _Optional[_Union[_resources_pb2.VehicleEvent, str]] = ..., video_chunk: _Optional[_Iterable[bytes]] = ..., photo_height: _Optional[int] = ..., photo_width: _Optional[int] = ...) -> None: ... + +class StreamBusVideoResponse(_message.Message): + __slots__ = ("is_detected", "children") + IS_DETECTED_FIELD_NUMBER: _ClassVar[int] + CHILDREN_FIELD_NUMBER: _ClassVar[int] + is_detected: bool + children: _containers.RepeatedCompositeFieldContainer[_resources_pb2.Child] + def __init__(self, is_detected: bool = ..., children: _Optional[_Iterable[_Union[_resources_pb2.Child, _Mapping]]] = ...) -> None: ... + +class UpdateBusRequest(_message.Message): + __slots__ = ("bus_id", "name", "plate_number", "latitude", "longitude", "enable_face_recognition", "next_station_id", "update_mask") + BUS_ID_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + PLATE_NUMBER_FIELD_NUMBER: _ClassVar[int] + LATITUDE_FIELD_NUMBER: _ClassVar[int] + LONGITUDE_FIELD_NUMBER: _ClassVar[int] + ENABLE_FACE_RECOGNITION_FIELD_NUMBER: _ClassVar[int] + NEXT_STATION_ID_FIELD_NUMBER: _ClassVar[int] + UPDATE_MASK_FIELD_NUMBER: _ClassVar[int] + bus_id: str + name: str + plate_number: str + latitude: float + longitude: float + enable_face_recognition: bool + next_station_id: str + update_mask: _field_mask_pb2.FieldMask + def __init__(self, bus_id: _Optional[str] = ..., name: _Optional[str] = ..., plate_number: _Optional[str] = ..., latitude: _Optional[float] = ..., longitude: _Optional[float] = ..., enable_face_recognition: bool = ..., next_station_id: _Optional[str] = ..., update_mask: _Optional[_Union[_field_mask_pb2.FieldMask, _Mapping]] = ...) -> None: ... + +class UpdateBusResponse(_message.Message): + __slots__ = ("bus",) + BUS_FIELD_NUMBER: _ClassVar[int] + bus: _resources_pb2.Bus + def __init__(self, bus: _Optional[_Union[_resources_pb2.Bus, _Mapping]] = ...) -> None: ... diff --git a/machine_learning/src/generated/where_child_bus/v1/bus_pb2_grpc.py b/machine_learning/src/generated/where_child_bus/v1/bus_pb2_grpc.py new file mode 100644 index 00000000..8b4d82f4 --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/bus_pb2_grpc.py @@ -0,0 +1,297 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from where_child_bus.v1 import bus_pb2 as where__child__bus_dot_v1_dot_bus__pb2 + + +class BusServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.CreateBus = channel.unary_unary( + '/where_child_bus.v1.BusService/CreateBus', + request_serializer=where__child__bus_dot_v1_dot_bus__pb2.CreateBusRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_bus__pb2.CreateBusResponse.FromString, + ) + self.GetBusListByNurseryId = channel.unary_unary( + '/where_child_bus.v1.BusService/GetBusListByNurseryId', + request_serializer=where__child__bus_dot_v1_dot_bus__pb2.GetBusListByNurseryIdRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_bus__pb2.GetBusListByNurseryIdResponse.FromString, + ) + self.GetRunningBusByGuardianId = channel.unary_unary( + '/where_child_bus.v1.BusService/GetRunningBusByGuardianId', + request_serializer=where__child__bus_dot_v1_dot_bus__pb2.GetRunningBusByGuardianIdRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_bus__pb2.GetRunningBusByGuardianIdResponse.FromString, + ) + self.UpdateBus = channel.unary_unary( + '/where_child_bus.v1.BusService/UpdateBus', + request_serializer=where__child__bus_dot_v1_dot_bus__pb2.UpdateBusRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_bus__pb2.UpdateBusResponse.FromString, + ) + self.ChangeBusStatus = channel.unary_unary( + '/where_child_bus.v1.BusService/ChangeBusStatus', + request_serializer=where__child__bus_dot_v1_dot_bus__pb2.ChangeBusStatusRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_bus__pb2.ChangeBusStatusResponse.FromString, + ) + self.SendLocationContinuous = channel.stream_unary( + '/where_child_bus.v1.BusService/SendLocationContinuous', + request_serializer=where__child__bus_dot_v1_dot_bus__pb2.SendLocationContinuousRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_bus__pb2.SendLocationContinuousResponse.FromString, + ) + self.TrackBusContinuous = channel.unary_stream( + '/where_child_bus.v1.BusService/TrackBusContinuous', + request_serializer=where__child__bus_dot_v1_dot_bus__pb2.TrackBusContinuousRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_bus__pb2.TrackBusContinuousResponse.FromString, + ) + self.StreamBusVideo = channel.stream_stream( + '/where_child_bus.v1.BusService/StreamBusVideo', + request_serializer=where__child__bus_dot_v1_dot_bus__pb2.StreamBusVideoRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_bus__pb2.StreamBusVideoResponse.FromString, + ) + + +class BusServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def CreateBus(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetBusListByNurseryId(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetRunningBusByGuardianId(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def UpdateBus(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def ChangeBusStatus(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SendLocationContinuous(self, request_iterator, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def TrackBusContinuous(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def StreamBusVideo(self, request_iterator, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_BusServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'CreateBus': grpc.unary_unary_rpc_method_handler( + servicer.CreateBus, + request_deserializer=where__child__bus_dot_v1_dot_bus__pb2.CreateBusRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_bus__pb2.CreateBusResponse.SerializeToString, + ), + 'GetBusListByNurseryId': grpc.unary_unary_rpc_method_handler( + servicer.GetBusListByNurseryId, + request_deserializer=where__child__bus_dot_v1_dot_bus__pb2.GetBusListByNurseryIdRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_bus__pb2.GetBusListByNurseryIdResponse.SerializeToString, + ), + 'GetRunningBusByGuardianId': grpc.unary_unary_rpc_method_handler( + servicer.GetRunningBusByGuardianId, + request_deserializer=where__child__bus_dot_v1_dot_bus__pb2.GetRunningBusByGuardianIdRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_bus__pb2.GetRunningBusByGuardianIdResponse.SerializeToString, + ), + 'UpdateBus': grpc.unary_unary_rpc_method_handler( + servicer.UpdateBus, + request_deserializer=where__child__bus_dot_v1_dot_bus__pb2.UpdateBusRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_bus__pb2.UpdateBusResponse.SerializeToString, + ), + 'ChangeBusStatus': grpc.unary_unary_rpc_method_handler( + servicer.ChangeBusStatus, + request_deserializer=where__child__bus_dot_v1_dot_bus__pb2.ChangeBusStatusRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_bus__pb2.ChangeBusStatusResponse.SerializeToString, + ), + 'SendLocationContinuous': grpc.stream_unary_rpc_method_handler( + servicer.SendLocationContinuous, + request_deserializer=where__child__bus_dot_v1_dot_bus__pb2.SendLocationContinuousRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_bus__pb2.SendLocationContinuousResponse.SerializeToString, + ), + 'TrackBusContinuous': grpc.unary_stream_rpc_method_handler( + servicer.TrackBusContinuous, + request_deserializer=where__child__bus_dot_v1_dot_bus__pb2.TrackBusContinuousRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_bus__pb2.TrackBusContinuousResponse.SerializeToString, + ), + 'StreamBusVideo': grpc.stream_stream_rpc_method_handler( + servicer.StreamBusVideo, + request_deserializer=where__child__bus_dot_v1_dot_bus__pb2.StreamBusVideoRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_bus__pb2.StreamBusVideoResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'where_child_bus.v1.BusService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class BusService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def CreateBus(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.BusService/CreateBus', + where__child__bus_dot_v1_dot_bus__pb2.CreateBusRequest.SerializeToString, + where__child__bus_dot_v1_dot_bus__pb2.CreateBusResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetBusListByNurseryId(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.BusService/GetBusListByNurseryId', + where__child__bus_dot_v1_dot_bus__pb2.GetBusListByNurseryIdRequest.SerializeToString, + where__child__bus_dot_v1_dot_bus__pb2.GetBusListByNurseryIdResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetRunningBusByGuardianId(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.BusService/GetRunningBusByGuardianId', + where__child__bus_dot_v1_dot_bus__pb2.GetRunningBusByGuardianIdRequest.SerializeToString, + where__child__bus_dot_v1_dot_bus__pb2.GetRunningBusByGuardianIdResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def UpdateBus(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.BusService/UpdateBus', + where__child__bus_dot_v1_dot_bus__pb2.UpdateBusRequest.SerializeToString, + where__child__bus_dot_v1_dot_bus__pb2.UpdateBusResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def ChangeBusStatus(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.BusService/ChangeBusStatus', + where__child__bus_dot_v1_dot_bus__pb2.ChangeBusStatusRequest.SerializeToString, + where__child__bus_dot_v1_dot_bus__pb2.ChangeBusStatusResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def SendLocationContinuous(request_iterator, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.stream_unary(request_iterator, target, '/where_child_bus.v1.BusService/SendLocationContinuous', + where__child__bus_dot_v1_dot_bus__pb2.SendLocationContinuousRequest.SerializeToString, + where__child__bus_dot_v1_dot_bus__pb2.SendLocationContinuousResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def TrackBusContinuous(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/where_child_bus.v1.BusService/TrackBusContinuous', + where__child__bus_dot_v1_dot_bus__pb2.TrackBusContinuousRequest.SerializeToString, + where__child__bus_dot_v1_dot_bus__pb2.TrackBusContinuousResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def StreamBusVideo(request_iterator, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.stream_stream(request_iterator, target, '/where_child_bus.v1.BusService/StreamBusVideo', + where__child__bus_dot_v1_dot_bus__pb2.StreamBusVideoRequest.SerializeToString, + where__child__bus_dot_v1_dot_bus__pb2.StreamBusVideoResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/machine_learning/src/generated/where_child_bus/v1/bus_route_pb2.py b/machine_learning/src/generated/where_child_bus/v1/bus_route_pb2.py new file mode 100644 index 00000000..6a65b1d4 --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/bus_route_pb2.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: where_child_bus/v1/bus_route.proto +# Protobuf Python Version: 4.25.2 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from where_child_bus.v1 import resources_pb2 as where__child__bus_dot_v1_dot_resources__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\"where_child_bus/v1/bus_route.proto\x12\x12where_child_bus.v1\x1a\"where_child_bus/v1/resources.proto\"\xa8\x01\n\x15\x43reateBusRouteRequest\x12\x15\n\x06\x62us_id\x18\x01 \x01(\tR\x05\x62usId\x12\x36\n\x08\x62us_type\x18\x02 \x01(\x0e\x32\x1b.where_child_bus.v1.BusTypeR\x07\x62usType\x12\x1d\n\nnursery_id\x18\x03 \x01(\tR\tnurseryId\x12!\n\x0cguardian_ids\x18\x04 \x03(\tR\x0bguardianIds\"S\n\x16\x43reateBusRouteResponse\x12\x39\n\tbus_route\x18\x01 \x01(\x0b\x32\x1c.where_child_bus.v1.BusRouteR\x08\x62usRoute\"j\n\x19GetBusRouteByBusIDRequest\x12\x15\n\x06\x62us_id\x18\x01 \x01(\tR\x05\x62usId\x12\x36\n\x08\x62us_type\x18\x02 \x01(\x0e\x32\x1b.where_child_bus.v1.BusTypeR\x07\x62usType\"W\n\x1aGetBusRouteByBusIDResponse\x12\x39\n\tbus_route\x18\x01 \x01(\x0b\x32\x1c.where_child_bus.v1.BusRouteR\x08\x62usRoute2\xef\x01\n\x0f\x42usRouteService\x12g\n\x0e\x43reateBusRoute\x12).where_child_bus.v1.CreateBusRouteRequest\x1a*.where_child_bus.v1.CreateBusRouteResponse\x12s\n\x12GetBusRouteByBusID\x12-.where_child_bus.v1.GetBusRouteByBusIDRequest\x1a..where_child_bus.v1.GetBusRouteByBusIDResponseB\xf0\x01\n\x16\x63om.where_child_bus.v1B\rBusRouteProtoP\x01Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\xa2\x02\x03WXX\xaa\x02\x10WhereChildBus.V1\xca\x02\x10WhereChildBus\\V1\xe2\x02\x1cWhereChildBus\\V1\\GPBMetadata\xea\x02\x11WhereChildBus::V1b\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'where_child_bus.v1.bus_route_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\026com.where_child_bus.v1B\rBusRouteProtoP\001Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\242\002\003WXX\252\002\020WhereChildBus.V1\312\002\020WhereChildBus\\V1\342\002\034WhereChildBus\\V1\\GPBMetadata\352\002\021WhereChildBus::V1' + _globals['_CREATEBUSROUTEREQUEST']._serialized_start=95 + _globals['_CREATEBUSROUTEREQUEST']._serialized_end=263 + _globals['_CREATEBUSROUTERESPONSE']._serialized_start=265 + _globals['_CREATEBUSROUTERESPONSE']._serialized_end=348 + _globals['_GETBUSROUTEBYBUSIDREQUEST']._serialized_start=350 + _globals['_GETBUSROUTEBYBUSIDREQUEST']._serialized_end=456 + _globals['_GETBUSROUTEBYBUSIDRESPONSE']._serialized_start=458 + _globals['_GETBUSROUTEBYBUSIDRESPONSE']._serialized_end=545 + _globals['_BUSROUTESERVICE']._serialized_start=548 + _globals['_BUSROUTESERVICE']._serialized_end=787 +# @@protoc_insertion_point(module_scope) diff --git a/machine_learning/src/generated/where_child_bus/v1/bus_route_pb2.pyi b/machine_learning/src/generated/where_child_bus/v1/bus_route_pb2.pyi new file mode 100644 index 00000000..d8b1e591 --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/bus_route_pb2.pyi @@ -0,0 +1,39 @@ +from where_child_bus.v1 import resources_pb2 as _resources_pb2 +from google.protobuf.internal import containers as _containers +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class CreateBusRouteRequest(_message.Message): + __slots__ = ("bus_id", "bus_type", "nursery_id", "guardian_ids") + BUS_ID_FIELD_NUMBER: _ClassVar[int] + BUS_TYPE_FIELD_NUMBER: _ClassVar[int] + NURSERY_ID_FIELD_NUMBER: _ClassVar[int] + GUARDIAN_IDS_FIELD_NUMBER: _ClassVar[int] + bus_id: str + bus_type: _resources_pb2.BusType + nursery_id: str + guardian_ids: _containers.RepeatedScalarFieldContainer[str] + def __init__(self, bus_id: _Optional[str] = ..., bus_type: _Optional[_Union[_resources_pb2.BusType, str]] = ..., nursery_id: _Optional[str] = ..., guardian_ids: _Optional[_Iterable[str]] = ...) -> None: ... + +class CreateBusRouteResponse(_message.Message): + __slots__ = ("bus_route",) + BUS_ROUTE_FIELD_NUMBER: _ClassVar[int] + bus_route: _resources_pb2.BusRoute + def __init__(self, bus_route: _Optional[_Union[_resources_pb2.BusRoute, _Mapping]] = ...) -> None: ... + +class GetBusRouteByBusIDRequest(_message.Message): + __slots__ = ("bus_id", "bus_type") + BUS_ID_FIELD_NUMBER: _ClassVar[int] + BUS_TYPE_FIELD_NUMBER: _ClassVar[int] + bus_id: str + bus_type: _resources_pb2.BusType + def __init__(self, bus_id: _Optional[str] = ..., bus_type: _Optional[_Union[_resources_pb2.BusType, str]] = ...) -> None: ... + +class GetBusRouteByBusIDResponse(_message.Message): + __slots__ = ("bus_route",) + BUS_ROUTE_FIELD_NUMBER: _ClassVar[int] + bus_route: _resources_pb2.BusRoute + def __init__(self, bus_route: _Optional[_Union[_resources_pb2.BusRoute, _Mapping]] = ...) -> None: ... diff --git a/machine_learning/src/generated/where_child_bus/v1/bus_route_pb2_grpc.py b/machine_learning/src/generated/where_child_bus/v1/bus_route_pb2_grpc.py new file mode 100644 index 00000000..2291a8a1 --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/bus_route_pb2_grpc.py @@ -0,0 +1,99 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from where_child_bus.v1 import bus_route_pb2 as where__child__bus_dot_v1_dot_bus__route__pb2 + + +class BusRouteServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.CreateBusRoute = channel.unary_unary( + '/where_child_bus.v1.BusRouteService/CreateBusRoute', + request_serializer=where__child__bus_dot_v1_dot_bus__route__pb2.CreateBusRouteRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_bus__route__pb2.CreateBusRouteResponse.FromString, + ) + self.GetBusRouteByBusID = channel.unary_unary( + '/where_child_bus.v1.BusRouteService/GetBusRouteByBusID', + request_serializer=where__child__bus_dot_v1_dot_bus__route__pb2.GetBusRouteByBusIDRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_bus__route__pb2.GetBusRouteByBusIDResponse.FromString, + ) + + +class BusRouteServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def CreateBusRoute(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetBusRouteByBusID(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_BusRouteServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'CreateBusRoute': grpc.unary_unary_rpc_method_handler( + servicer.CreateBusRoute, + request_deserializer=where__child__bus_dot_v1_dot_bus__route__pb2.CreateBusRouteRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_bus__route__pb2.CreateBusRouteResponse.SerializeToString, + ), + 'GetBusRouteByBusID': grpc.unary_unary_rpc_method_handler( + servicer.GetBusRouteByBusID, + request_deserializer=where__child__bus_dot_v1_dot_bus__route__pb2.GetBusRouteByBusIDRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_bus__route__pb2.GetBusRouteByBusIDResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'where_child_bus.v1.BusRouteService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class BusRouteService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def CreateBusRoute(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.BusRouteService/CreateBusRoute', + where__child__bus_dot_v1_dot_bus__route__pb2.CreateBusRouteRequest.SerializeToString, + where__child__bus_dot_v1_dot_bus__route__pb2.CreateBusRouteResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetBusRouteByBusID(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.BusRouteService/GetBusRouteByBusID', + where__child__bus_dot_v1_dot_bus__route__pb2.GetBusRouteByBusIDRequest.SerializeToString, + where__child__bus_dot_v1_dot_bus__route__pb2.GetBusRouteByBusIDResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/machine_learning/src/generated/where_child_bus/v1/child_pb2.py b/machine_learning/src/generated/where_child_bus/v1/child_pb2.py new file mode 100644 index 00000000..febe4511 --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/child_pb2.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: where_child_bus/v1/child.proto +# Protobuf Python Version: 4.25.2 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from where_child_bus.v1 import resources_pb2 as where__child__bus_dot_v1_dot_resources__pb2 +from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1ewhere_child_bus/v1/child.proto\x12\x12where_child_bus.v1\x1a\"where_child_bus/v1/resources.proto\x1a google/protobuf/field_mask.proto\"\xbd\x01\n\x12\x43reateChildRequest\x12\x1d\n\nnursery_id\x18\x01 \x01(\tR\tnurseryId\x12\x1f\n\x0bguardian_id\x18\x02 \x01(\tR\nguardianId\x12\x12\n\x04name\x18\x03 \x01(\tR\x04name\x12\x10\n\x03\x61ge\x18\x04 \x01(\x05R\x03\x61ge\x12)\n\x03sex\x18\x05 \x01(\x0e\x32\x17.where_child_bus.v1.SexR\x03sex\x12\x16\n\x06photos\x18\x06 \x03(\x0cR\x06photos\"F\n\x13\x43reateChildResponse\x12/\n\x05\x63hild\x18\x01 \x01(\x0b\x32\x19.where_child_bus.v1.ChildR\x05\x63hild\"?\n\x1eGetChildListByNurseryIDRequest\x12\x1d\n\nnursery_id\x18\x01 \x01(\tR\tnurseryId\"\x90\x01\n\x1fGetChildListByNurseryIDResponse\x12\x35\n\x08\x63hildren\x18\x01 \x03(\x0b\x32\x19.where_child_bus.v1.ChildR\x08\x63hildren\x12\x36\n\x06photos\x18\x02 \x03(\x0b\x32\x1e.where_child_bus.v1.ChildPhotoR\x06photos\"B\n\x1fGetChildListByGuardianIDRequest\x12\x1f\n\x0bguardian_id\x18\x01 \x01(\tR\nguardianId\"\x91\x01\n GetChildListByGuardianIDResponse\x12\x35\n\x08\x63hildren\x18\x01 \x03(\x0b\x32\x19.where_child_bus.v1.ChildR\x08\x63hildren\x12\x36\n\x06photos\x18\x02 \x03(\x0b\x32\x1e.where_child_bus.v1.ChildPhotoR\x06photos\"3\n\x1aGetChildListByBusIDRequest\x12\x15\n\x06\x62us_id\x18\x01 \x01(\tR\x05\x62usId\"\x8c\x01\n\x1bGetChildListByBusIDResponse\x12\x35\n\x08\x63hildren\x18\x01 \x03(\x0b\x32\x19.where_child_bus.v1.ChildR\x08\x63hildren\x12\x36\n\x06photos\x18\x02 \x03(\x0b\x32\x1e.where_child_bus.v1.ChildPhotoR\x06photos\"5\n\x18\x43heckIsChildInBusRequest\x12\x19\n\x08\x63hild_id\x18\x01 \x01(\tR\x07\x63hildId\"7\n\x19\x43heckIsChildInBusResponse\x12\x1a\n\tis_in_bus\x18\x01 \x01(\x08R\x07isInBus\"\x9b\x03\n\x12UpdateChildRequest\x12\x19\n\x08\x63hild_id\x18\x01 \x01(\tR\x07\x63hildId\x12\x12\n\x04name\x18\x02 \x01(\tR\x04name\x12\x10\n\x03\x61ge\x18\x03 \x01(\x05R\x03\x61ge\x12)\n\x03sex\x18\x04 \x01(\x0e\x32\x17.where_child_bus.v1.SexR\x03sex\x12\x35\n\x17\x63heck_for_missing_items\x18\x05 \x01(\x08R\x14\x63heckForMissingItems\x12\x17\n\x07has_bag\x18\x06 \x01(\x08R\x06hasBag\x12\"\n\rhas_lunch_box\x18\x07 \x01(\x08R\x0bhasLunchBox\x12(\n\x10has_water_bottle\x18\x08 \x01(\x08R\x0ehasWaterBottle\x12!\n\x0chas_umbrella\x18\t \x01(\x08R\x0bhasUmbrella\x12\x1b\n\thas_other\x18\n \x01(\x08R\x08hasOther\x12;\n\x0bupdate_mask\x18\x0b \x01(\x0b\x32\x1a.google.protobuf.FieldMaskR\nupdateMask\"F\n\x13UpdateChildResponse\x12/\n\x05\x63hild\x18\x01 \x01(\x0b\x32\x19.where_child_bus.v1.ChildR\x05\x63hild2\xc5\x05\n\x0c\x43hildService\x12^\n\x0b\x43reateChild\x12&.where_child_bus.v1.CreateChildRequest\x1a\'.where_child_bus.v1.CreateChildResponse\x12\x82\x01\n\x17GetChildListByNurseryID\x12\x32.where_child_bus.v1.GetChildListByNurseryIDRequest\x1a\x33.where_child_bus.v1.GetChildListByNurseryIDResponse\x12\x85\x01\n\x18GetChildListByGuardianID\x12\x33.where_child_bus.v1.GetChildListByGuardianIDRequest\x1a\x34.where_child_bus.v1.GetChildListByGuardianIDResponse\x12v\n\x13GetChildListByBusID\x12..where_child_bus.v1.GetChildListByBusIDRequest\x1a/.where_child_bus.v1.GetChildListByBusIDResponse\x12p\n\x11\x43heckIsChildInBus\x12,.where_child_bus.v1.CheckIsChildInBusRequest\x1a-.where_child_bus.v1.CheckIsChildInBusResponse\x12^\n\x0bUpdateChild\x12&.where_child_bus.v1.UpdateChildRequest\x1a\'.where_child_bus.v1.UpdateChildResponseB\xed\x01\n\x16\x63om.where_child_bus.v1B\nChildProtoP\x01Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\xa2\x02\x03WXX\xaa\x02\x10WhereChildBus.V1\xca\x02\x10WhereChildBus\\V1\xe2\x02\x1cWhereChildBus\\V1\\GPBMetadata\xea\x02\x11WhereChildBus::V1b\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'where_child_bus.v1.child_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\026com.where_child_bus.v1B\nChildProtoP\001Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\242\002\003WXX\252\002\020WhereChildBus.V1\312\002\020WhereChildBus\\V1\342\002\034WhereChildBus\\V1\\GPBMetadata\352\002\021WhereChildBus::V1' + _globals['_CREATECHILDREQUEST']._serialized_start=125 + _globals['_CREATECHILDREQUEST']._serialized_end=314 + _globals['_CREATECHILDRESPONSE']._serialized_start=316 + _globals['_CREATECHILDRESPONSE']._serialized_end=386 + _globals['_GETCHILDLISTBYNURSERYIDREQUEST']._serialized_start=388 + _globals['_GETCHILDLISTBYNURSERYIDREQUEST']._serialized_end=451 + _globals['_GETCHILDLISTBYNURSERYIDRESPONSE']._serialized_start=454 + _globals['_GETCHILDLISTBYNURSERYIDRESPONSE']._serialized_end=598 + _globals['_GETCHILDLISTBYGUARDIANIDREQUEST']._serialized_start=600 + _globals['_GETCHILDLISTBYGUARDIANIDREQUEST']._serialized_end=666 + _globals['_GETCHILDLISTBYGUARDIANIDRESPONSE']._serialized_start=669 + _globals['_GETCHILDLISTBYGUARDIANIDRESPONSE']._serialized_end=814 + _globals['_GETCHILDLISTBYBUSIDREQUEST']._serialized_start=816 + _globals['_GETCHILDLISTBYBUSIDREQUEST']._serialized_end=867 + _globals['_GETCHILDLISTBYBUSIDRESPONSE']._serialized_start=870 + _globals['_GETCHILDLISTBYBUSIDRESPONSE']._serialized_end=1010 + _globals['_CHECKISCHILDINBUSREQUEST']._serialized_start=1012 + _globals['_CHECKISCHILDINBUSREQUEST']._serialized_end=1065 + _globals['_CHECKISCHILDINBUSRESPONSE']._serialized_start=1067 + _globals['_CHECKISCHILDINBUSRESPONSE']._serialized_end=1122 + _globals['_UPDATECHILDREQUEST']._serialized_start=1125 + _globals['_UPDATECHILDREQUEST']._serialized_end=1536 + _globals['_UPDATECHILDRESPONSE']._serialized_start=1538 + _globals['_UPDATECHILDRESPONSE']._serialized_end=1608 + _globals['_CHILDSERVICE']._serialized_start=1611 + _globals['_CHILDSERVICE']._serialized_end=2320 +# @@protoc_insertion_point(module_scope) diff --git a/machine_learning/src/generated/where_child_bus/v1/child_pb2.pyi b/machine_learning/src/generated/where_child_bus/v1/child_pb2.pyi new file mode 100644 index 00000000..affd722c --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/child_pb2.pyi @@ -0,0 +1,116 @@ +from where_child_bus.v1 import resources_pb2 as _resources_pb2 +from google.protobuf import field_mask_pb2 as _field_mask_pb2 +from google.protobuf.internal import containers as _containers +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class CreateChildRequest(_message.Message): + __slots__ = ("nursery_id", "guardian_id", "name", "age", "sex", "photos") + NURSERY_ID_FIELD_NUMBER: _ClassVar[int] + GUARDIAN_ID_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + AGE_FIELD_NUMBER: _ClassVar[int] + SEX_FIELD_NUMBER: _ClassVar[int] + PHOTOS_FIELD_NUMBER: _ClassVar[int] + nursery_id: str + guardian_id: str + name: str + age: int + sex: _resources_pb2.Sex + photos: _containers.RepeatedScalarFieldContainer[bytes] + def __init__(self, nursery_id: _Optional[str] = ..., guardian_id: _Optional[str] = ..., name: _Optional[str] = ..., age: _Optional[int] = ..., sex: _Optional[_Union[_resources_pb2.Sex, str]] = ..., photos: _Optional[_Iterable[bytes]] = ...) -> None: ... + +class CreateChildResponse(_message.Message): + __slots__ = ("child",) + CHILD_FIELD_NUMBER: _ClassVar[int] + child: _resources_pb2.Child + def __init__(self, child: _Optional[_Union[_resources_pb2.Child, _Mapping]] = ...) -> None: ... + +class GetChildListByNurseryIDRequest(_message.Message): + __slots__ = ("nursery_id",) + NURSERY_ID_FIELD_NUMBER: _ClassVar[int] + nursery_id: str + def __init__(self, nursery_id: _Optional[str] = ...) -> None: ... + +class GetChildListByNurseryIDResponse(_message.Message): + __slots__ = ("children", "photos") + CHILDREN_FIELD_NUMBER: _ClassVar[int] + PHOTOS_FIELD_NUMBER: _ClassVar[int] + children: _containers.RepeatedCompositeFieldContainer[_resources_pb2.Child] + photos: _containers.RepeatedCompositeFieldContainer[_resources_pb2.ChildPhoto] + def __init__(self, children: _Optional[_Iterable[_Union[_resources_pb2.Child, _Mapping]]] = ..., photos: _Optional[_Iterable[_Union[_resources_pb2.ChildPhoto, _Mapping]]] = ...) -> None: ... + +class GetChildListByGuardianIDRequest(_message.Message): + __slots__ = ("guardian_id",) + GUARDIAN_ID_FIELD_NUMBER: _ClassVar[int] + guardian_id: str + def __init__(self, guardian_id: _Optional[str] = ...) -> None: ... + +class GetChildListByGuardianIDResponse(_message.Message): + __slots__ = ("children", "photos") + CHILDREN_FIELD_NUMBER: _ClassVar[int] + PHOTOS_FIELD_NUMBER: _ClassVar[int] + children: _containers.RepeatedCompositeFieldContainer[_resources_pb2.Child] + photos: _containers.RepeatedCompositeFieldContainer[_resources_pb2.ChildPhoto] + def __init__(self, children: _Optional[_Iterable[_Union[_resources_pb2.Child, _Mapping]]] = ..., photos: _Optional[_Iterable[_Union[_resources_pb2.ChildPhoto, _Mapping]]] = ...) -> None: ... + +class GetChildListByBusIDRequest(_message.Message): + __slots__ = ("bus_id",) + BUS_ID_FIELD_NUMBER: _ClassVar[int] + bus_id: str + def __init__(self, bus_id: _Optional[str] = ...) -> None: ... + +class GetChildListByBusIDResponse(_message.Message): + __slots__ = ("children", "photos") + CHILDREN_FIELD_NUMBER: _ClassVar[int] + PHOTOS_FIELD_NUMBER: _ClassVar[int] + children: _containers.RepeatedCompositeFieldContainer[_resources_pb2.Child] + photos: _containers.RepeatedCompositeFieldContainer[_resources_pb2.ChildPhoto] + def __init__(self, children: _Optional[_Iterable[_Union[_resources_pb2.Child, _Mapping]]] = ..., photos: _Optional[_Iterable[_Union[_resources_pb2.ChildPhoto, _Mapping]]] = ...) -> None: ... + +class CheckIsChildInBusRequest(_message.Message): + __slots__ = ("child_id",) + CHILD_ID_FIELD_NUMBER: _ClassVar[int] + child_id: str + def __init__(self, child_id: _Optional[str] = ...) -> None: ... + +class CheckIsChildInBusResponse(_message.Message): + __slots__ = ("is_in_bus",) + IS_IN_BUS_FIELD_NUMBER: _ClassVar[int] + is_in_bus: bool + def __init__(self, is_in_bus: bool = ...) -> None: ... + +class UpdateChildRequest(_message.Message): + __slots__ = ("child_id", "name", "age", "sex", "check_for_missing_items", "has_bag", "has_lunch_box", "has_water_bottle", "has_umbrella", "has_other", "update_mask") + CHILD_ID_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + AGE_FIELD_NUMBER: _ClassVar[int] + SEX_FIELD_NUMBER: _ClassVar[int] + CHECK_FOR_MISSING_ITEMS_FIELD_NUMBER: _ClassVar[int] + HAS_BAG_FIELD_NUMBER: _ClassVar[int] + HAS_LUNCH_BOX_FIELD_NUMBER: _ClassVar[int] + HAS_WATER_BOTTLE_FIELD_NUMBER: _ClassVar[int] + HAS_UMBRELLA_FIELD_NUMBER: _ClassVar[int] + HAS_OTHER_FIELD_NUMBER: _ClassVar[int] + UPDATE_MASK_FIELD_NUMBER: _ClassVar[int] + child_id: str + name: str + age: int + sex: _resources_pb2.Sex + check_for_missing_items: bool + has_bag: bool + has_lunch_box: bool + has_water_bottle: bool + has_umbrella: bool + has_other: bool + update_mask: _field_mask_pb2.FieldMask + def __init__(self, child_id: _Optional[str] = ..., name: _Optional[str] = ..., age: _Optional[int] = ..., sex: _Optional[_Union[_resources_pb2.Sex, str]] = ..., check_for_missing_items: bool = ..., has_bag: bool = ..., has_lunch_box: bool = ..., has_water_bottle: bool = ..., has_umbrella: bool = ..., has_other: bool = ..., update_mask: _Optional[_Union[_field_mask_pb2.FieldMask, _Mapping]] = ...) -> None: ... + +class UpdateChildResponse(_message.Message): + __slots__ = ("child",) + CHILD_FIELD_NUMBER: _ClassVar[int] + child: _resources_pb2.Child + def __init__(self, child: _Optional[_Union[_resources_pb2.Child, _Mapping]] = ...) -> None: ... diff --git a/machine_learning/src/generated/where_child_bus/v1/child_pb2_grpc.py b/machine_learning/src/generated/where_child_bus/v1/child_pb2_grpc.py new file mode 100644 index 00000000..d46ec0d9 --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/child_pb2_grpc.py @@ -0,0 +1,231 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from where_child_bus.v1 import child_pb2 as where__child__bus_dot_v1_dot_child__pb2 + + +class ChildServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.CreateChild = channel.unary_unary( + '/where_child_bus.v1.ChildService/CreateChild', + request_serializer=where__child__bus_dot_v1_dot_child__pb2.CreateChildRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_child__pb2.CreateChildResponse.FromString, + ) + self.GetChildListByNurseryID = channel.unary_unary( + '/where_child_bus.v1.ChildService/GetChildListByNurseryID', + request_serializer=where__child__bus_dot_v1_dot_child__pb2.GetChildListByNurseryIDRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_child__pb2.GetChildListByNurseryIDResponse.FromString, + ) + self.GetChildListByGuardianID = channel.unary_unary( + '/where_child_bus.v1.ChildService/GetChildListByGuardianID', + request_serializer=where__child__bus_dot_v1_dot_child__pb2.GetChildListByGuardianIDRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_child__pb2.GetChildListByGuardianIDResponse.FromString, + ) + self.GetChildListByBusID = channel.unary_unary( + '/where_child_bus.v1.ChildService/GetChildListByBusID', + request_serializer=where__child__bus_dot_v1_dot_child__pb2.GetChildListByBusIDRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_child__pb2.GetChildListByBusIDResponse.FromString, + ) + self.CheckIsChildInBus = channel.unary_unary( + '/where_child_bus.v1.ChildService/CheckIsChildInBus', + request_serializer=where__child__bus_dot_v1_dot_child__pb2.CheckIsChildInBusRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_child__pb2.CheckIsChildInBusResponse.FromString, + ) + self.UpdateChild = channel.unary_unary( + '/where_child_bus.v1.ChildService/UpdateChild', + request_serializer=where__child__bus_dot_v1_dot_child__pb2.UpdateChildRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_child__pb2.UpdateChildResponse.FromString, + ) + + +class ChildServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def CreateChild(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetChildListByNurseryID(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetChildListByGuardianID(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetChildListByBusID(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def CheckIsChildInBus(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def UpdateChild(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_ChildServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'CreateChild': grpc.unary_unary_rpc_method_handler( + servicer.CreateChild, + request_deserializer=where__child__bus_dot_v1_dot_child__pb2.CreateChildRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_child__pb2.CreateChildResponse.SerializeToString, + ), + 'GetChildListByNurseryID': grpc.unary_unary_rpc_method_handler( + servicer.GetChildListByNurseryID, + request_deserializer=where__child__bus_dot_v1_dot_child__pb2.GetChildListByNurseryIDRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_child__pb2.GetChildListByNurseryIDResponse.SerializeToString, + ), + 'GetChildListByGuardianID': grpc.unary_unary_rpc_method_handler( + servicer.GetChildListByGuardianID, + request_deserializer=where__child__bus_dot_v1_dot_child__pb2.GetChildListByGuardianIDRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_child__pb2.GetChildListByGuardianIDResponse.SerializeToString, + ), + 'GetChildListByBusID': grpc.unary_unary_rpc_method_handler( + servicer.GetChildListByBusID, + request_deserializer=where__child__bus_dot_v1_dot_child__pb2.GetChildListByBusIDRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_child__pb2.GetChildListByBusIDResponse.SerializeToString, + ), + 'CheckIsChildInBus': grpc.unary_unary_rpc_method_handler( + servicer.CheckIsChildInBus, + request_deserializer=where__child__bus_dot_v1_dot_child__pb2.CheckIsChildInBusRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_child__pb2.CheckIsChildInBusResponse.SerializeToString, + ), + 'UpdateChild': grpc.unary_unary_rpc_method_handler( + servicer.UpdateChild, + request_deserializer=where__child__bus_dot_v1_dot_child__pb2.UpdateChildRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_child__pb2.UpdateChildResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'where_child_bus.v1.ChildService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class ChildService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def CreateChild(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.ChildService/CreateChild', + where__child__bus_dot_v1_dot_child__pb2.CreateChildRequest.SerializeToString, + where__child__bus_dot_v1_dot_child__pb2.CreateChildResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetChildListByNurseryID(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.ChildService/GetChildListByNurseryID', + where__child__bus_dot_v1_dot_child__pb2.GetChildListByNurseryIDRequest.SerializeToString, + where__child__bus_dot_v1_dot_child__pb2.GetChildListByNurseryIDResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetChildListByGuardianID(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.ChildService/GetChildListByGuardianID', + where__child__bus_dot_v1_dot_child__pb2.GetChildListByGuardianIDRequest.SerializeToString, + where__child__bus_dot_v1_dot_child__pb2.GetChildListByGuardianIDResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetChildListByBusID(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.ChildService/GetChildListByBusID', + where__child__bus_dot_v1_dot_child__pb2.GetChildListByBusIDRequest.SerializeToString, + where__child__bus_dot_v1_dot_child__pb2.GetChildListByBusIDResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def CheckIsChildInBus(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.ChildService/CheckIsChildInBus', + where__child__bus_dot_v1_dot_child__pb2.CheckIsChildInBusRequest.SerializeToString, + where__child__bus_dot_v1_dot_child__pb2.CheckIsChildInBusResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def UpdateChild(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.ChildService/UpdateChild', + where__child__bus_dot_v1_dot_child__pb2.UpdateChildRequest.SerializeToString, + where__child__bus_dot_v1_dot_child__pb2.UpdateChildResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/machine_learning/src/generated/where_child_bus/v1/child_photo_pb2.py b/machine_learning/src/generated/where_child_bus/v1/child_photo_pb2.py new file mode 100644 index 00000000..b1182eaa --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/child_photo_pb2.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: where_child_bus/v1/child_photo.proto +# Protobuf Python Version: 4.25.2 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$where_child_bus/v1/child_photo.proto\x12\x12where_child_bus.v1\"6\n\x17\x44uplicationCheckRequest\x12\x1b\n\tchild_ids\x18\x01 \x03(\tR\x08\x63hildIds\"\x89\x01\n\x18\x44uplicationCheckResponse\x12#\n\ris_duplicated\x18\x01 \x01(\x08R\x0cisDuplicated\x12\x1b\n\tphoto_ids\x18\x02 \x03(\tR\x08photoIds\x12+\n\x11\x64uplicated_photos\x18\x03 \x03(\x0cR\x10\x64uplicatedPhotos\"+\n\x17\x44\x65leteChildPhotoRequest\x12\x10\n\x03ids\x18\x01 \x03(\tR\x03ids\"T\n\x18\x44\x65leteChildPhotoResponse\x12&\n\x0fis_success_list\x18\x01 \x03(\x08R\risSuccessList\x12\x10\n\x03ids\x18\x02 \x03(\tR\x03ids\"1\n\x14GetChildPhotoRequest\x12\x19\n\x08\x63hild_id\x18\x01 \x01(\tR\x07\x63hildId\"P\n\x12\x43hildPhotoResponse\x12$\n\x0e\x63hild_photo_id\x18\x01 \x01(\tR\x0c\x63hildPhotoId\x12\x14\n\x05photo\x18\x02 \x01(\x0cR\x05photo\"b\n\x15GetChildPhotoResponse\x12I\n\x0c\x63hild_photos\x18\x01 \x03(\x0b\x32&.where_child_bus.v1.ChildPhotoResponseR\x0b\x63hildPhotos2\xd7\x02\n\x11\x43hildPhotoService\x12m\n\x10\x44uplicationCheck\x12+.where_child_bus.v1.DuplicationCheckRequest\x1a,.where_child_bus.v1.DuplicationCheckResponse\x12m\n\x10\x44\x65leteChildPhoto\x12+.where_child_bus.v1.DeleteChildPhotoRequest\x1a,.where_child_bus.v1.DeleteChildPhotoResponse\x12\x64\n\rGetChildPhoto\x12(.where_child_bus.v1.GetChildPhotoRequest\x1a).where_child_bus.v1.GetChildPhotoResponseB\xf2\x01\n\x16\x63om.where_child_bus.v1B\x0f\x43hildPhotoProtoP\x01Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\xa2\x02\x03WXX\xaa\x02\x10WhereChildBus.V1\xca\x02\x10WhereChildBus\\V1\xe2\x02\x1cWhereChildBus\\V1\\GPBMetadata\xea\x02\x11WhereChildBus::V1b\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'where_child_bus.v1.child_photo_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\026com.where_child_bus.v1B\017ChildPhotoProtoP\001Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\242\002\003WXX\252\002\020WhereChildBus.V1\312\002\020WhereChildBus\\V1\342\002\034WhereChildBus\\V1\\GPBMetadata\352\002\021WhereChildBus::V1' + _globals['_DUPLICATIONCHECKREQUEST']._serialized_start=60 + _globals['_DUPLICATIONCHECKREQUEST']._serialized_end=114 + _globals['_DUPLICATIONCHECKRESPONSE']._serialized_start=117 + _globals['_DUPLICATIONCHECKRESPONSE']._serialized_end=254 + _globals['_DELETECHILDPHOTOREQUEST']._serialized_start=256 + _globals['_DELETECHILDPHOTOREQUEST']._serialized_end=299 + _globals['_DELETECHILDPHOTORESPONSE']._serialized_start=301 + _globals['_DELETECHILDPHOTORESPONSE']._serialized_end=385 + _globals['_GETCHILDPHOTOREQUEST']._serialized_start=387 + _globals['_GETCHILDPHOTOREQUEST']._serialized_end=436 + _globals['_CHILDPHOTORESPONSE']._serialized_start=438 + _globals['_CHILDPHOTORESPONSE']._serialized_end=518 + _globals['_GETCHILDPHOTORESPONSE']._serialized_start=520 + _globals['_GETCHILDPHOTORESPONSE']._serialized_end=618 + _globals['_CHILDPHOTOSERVICE']._serialized_start=621 + _globals['_CHILDPHOTOSERVICE']._serialized_end=964 +# @@protoc_insertion_point(module_scope) diff --git a/machine_learning/src/generated/where_child_bus/v1/child_photo_pb2.pyi b/machine_learning/src/generated/where_child_bus/v1/child_photo_pb2.pyi new file mode 100644 index 00000000..231461af --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/child_photo_pb2.pyi @@ -0,0 +1,56 @@ +from google.protobuf.internal import containers as _containers +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class DuplicationCheckRequest(_message.Message): + __slots__ = ("child_ids",) + CHILD_IDS_FIELD_NUMBER: _ClassVar[int] + child_ids: _containers.RepeatedScalarFieldContainer[str] + def __init__(self, child_ids: _Optional[_Iterable[str]] = ...) -> None: ... + +class DuplicationCheckResponse(_message.Message): + __slots__ = ("is_duplicated", "photo_ids", "duplicated_photos") + IS_DUPLICATED_FIELD_NUMBER: _ClassVar[int] + PHOTO_IDS_FIELD_NUMBER: _ClassVar[int] + DUPLICATED_PHOTOS_FIELD_NUMBER: _ClassVar[int] + is_duplicated: bool + photo_ids: _containers.RepeatedScalarFieldContainer[str] + duplicated_photos: _containers.RepeatedScalarFieldContainer[bytes] + def __init__(self, is_duplicated: bool = ..., photo_ids: _Optional[_Iterable[str]] = ..., duplicated_photos: _Optional[_Iterable[bytes]] = ...) -> None: ... + +class DeleteChildPhotoRequest(_message.Message): + __slots__ = ("ids",) + IDS_FIELD_NUMBER: _ClassVar[int] + ids: _containers.RepeatedScalarFieldContainer[str] + def __init__(self, ids: _Optional[_Iterable[str]] = ...) -> None: ... + +class DeleteChildPhotoResponse(_message.Message): + __slots__ = ("is_success_list", "ids") + IS_SUCCESS_LIST_FIELD_NUMBER: _ClassVar[int] + IDS_FIELD_NUMBER: _ClassVar[int] + is_success_list: _containers.RepeatedScalarFieldContainer[bool] + ids: _containers.RepeatedScalarFieldContainer[str] + def __init__(self, is_success_list: _Optional[_Iterable[bool]] = ..., ids: _Optional[_Iterable[str]] = ...) -> None: ... + +class GetChildPhotoRequest(_message.Message): + __slots__ = ("child_id",) + CHILD_ID_FIELD_NUMBER: _ClassVar[int] + child_id: str + def __init__(self, child_id: _Optional[str] = ...) -> None: ... + +class ChildPhotoResponse(_message.Message): + __slots__ = ("child_photo_id", "photo") + CHILD_PHOTO_ID_FIELD_NUMBER: _ClassVar[int] + PHOTO_FIELD_NUMBER: _ClassVar[int] + child_photo_id: str + photo: bytes + def __init__(self, child_photo_id: _Optional[str] = ..., photo: _Optional[bytes] = ...) -> None: ... + +class GetChildPhotoResponse(_message.Message): + __slots__ = ("child_photos",) + CHILD_PHOTOS_FIELD_NUMBER: _ClassVar[int] + child_photos: _containers.RepeatedCompositeFieldContainer[ChildPhotoResponse] + def __init__(self, child_photos: _Optional[_Iterable[_Union[ChildPhotoResponse, _Mapping]]] = ...) -> None: ... diff --git a/machine_learning/src/generated/where_child_bus/v1/child_photo_pb2_grpc.py b/machine_learning/src/generated/where_child_bus/v1/child_photo_pb2_grpc.py new file mode 100644 index 00000000..af91ae42 --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/child_photo_pb2_grpc.py @@ -0,0 +1,132 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from where_child_bus.v1 import child_photo_pb2 as where__child__bus_dot_v1_dot_child__photo__pb2 + + +class ChildPhotoServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.DuplicationCheck = channel.unary_unary( + '/where_child_bus.v1.ChildPhotoService/DuplicationCheck', + request_serializer=where__child__bus_dot_v1_dot_child__photo__pb2.DuplicationCheckRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_child__photo__pb2.DuplicationCheckResponse.FromString, + ) + self.DeleteChildPhoto = channel.unary_unary( + '/where_child_bus.v1.ChildPhotoService/DeleteChildPhoto', + request_serializer=where__child__bus_dot_v1_dot_child__photo__pb2.DeleteChildPhotoRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_child__photo__pb2.DeleteChildPhotoResponse.FromString, + ) + self.GetChildPhoto = channel.unary_unary( + '/where_child_bus.v1.ChildPhotoService/GetChildPhoto', + request_serializer=where__child__bus_dot_v1_dot_child__photo__pb2.GetChildPhotoRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_child__photo__pb2.GetChildPhotoResponse.FromString, + ) + + +class ChildPhotoServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def DuplicationCheck(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def DeleteChildPhoto(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetChildPhoto(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_ChildPhotoServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'DuplicationCheck': grpc.unary_unary_rpc_method_handler( + servicer.DuplicationCheck, + request_deserializer=where__child__bus_dot_v1_dot_child__photo__pb2.DuplicationCheckRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_child__photo__pb2.DuplicationCheckResponse.SerializeToString, + ), + 'DeleteChildPhoto': grpc.unary_unary_rpc_method_handler( + servicer.DeleteChildPhoto, + request_deserializer=where__child__bus_dot_v1_dot_child__photo__pb2.DeleteChildPhotoRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_child__photo__pb2.DeleteChildPhotoResponse.SerializeToString, + ), + 'GetChildPhoto': grpc.unary_unary_rpc_method_handler( + servicer.GetChildPhoto, + request_deserializer=where__child__bus_dot_v1_dot_child__photo__pb2.GetChildPhotoRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_child__photo__pb2.GetChildPhotoResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'where_child_bus.v1.ChildPhotoService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class ChildPhotoService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def DuplicationCheck(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.ChildPhotoService/DuplicationCheck', + where__child__bus_dot_v1_dot_child__photo__pb2.DuplicationCheckRequest.SerializeToString, + where__child__bus_dot_v1_dot_child__photo__pb2.DuplicationCheckResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def DeleteChildPhoto(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.ChildPhotoService/DeleteChildPhoto', + where__child__bus_dot_v1_dot_child__photo__pb2.DeleteChildPhotoRequest.SerializeToString, + where__child__bus_dot_v1_dot_child__photo__pb2.DeleteChildPhotoResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetChildPhoto(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.ChildPhotoService/GetChildPhoto', + where__child__bus_dot_v1_dot_child__photo__pb2.GetChildPhotoRequest.SerializeToString, + where__child__bus_dot_v1_dot_child__photo__pb2.GetChildPhotoResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/machine_learning/src/generated/where_child_bus/v1/guardian_pb2.py b/machine_learning/src/generated/where_child_bus/v1/guardian_pb2.py new file mode 100644 index 00000000..ac939a62 --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/guardian_pb2.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: where_child_bus/v1/guardian.proto +# Protobuf Python Version: 4.25.2 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from where_child_bus.v1 import resources_pb2 as where__child__bus_dot_v1_dot_resources__pb2 +from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!where_child_bus/v1/guardian.proto\x12\x12where_child_bus.v1\x1a\"where_child_bus/v1/resources.proto\x1a google/protobuf/field_mask.proto\"\xa3\x01\n\x15\x43reateGuardianRequest\x12!\n\x0cnursery_code\x18\x01 \x01(\tR\x0bnurseryCode\x12\x14\n\x05\x65mail\x18\x02 \x01(\tR\x05\x65mail\x12\x1a\n\x08password\x18\x03 \x01(\tR\x08password\x12\x12\n\x04name\x18\x04 \x01(\tR\x04name\x12!\n\x0cphone_number\x18\x05 \x01(\tR\x0bphoneNumber\"Z\n\x16\x43reateGuardianResponse\x12@\n\x08guardian\x18\x01 \x01(\x0b\x32$.where_child_bus.v1.GuardianResponseR\x08guardian\"H\n\x14GuardianLoginRequest\x12\x14\n\x05\x65mail\x18\x01 \x01(\tR\x05\x65mail\x12\x1a\n\x08password\x18\x02 \x01(\tR\x08password\"\xb2\x01\n\x15GuardianLoginResponse\x12\x18\n\x07success\x18\x01 \x01(\x08R\x07success\x12@\n\x08guardian\x18\x02 \x01(\x0b\x32$.where_child_bus.v1.GuardianResponseR\x08guardian\x12=\n\x07nursery\x18\x03 \x01(\x0b\x32#.where_child_bus.v1.NurseryResponseR\x07nursery\"6\n\x1dGetGuardianListByBusIdRequest\x12\x15\n\x06\x62us_id\x18\x01 \x01(\tR\x05\x62usId\"d\n\x1eGetGuardianListByBusIdResponse\x12\x42\n\tguardians\x18\x01 \x03(\x0b\x32$.where_child_bus.v1.GuardianResponseR\tguardians\"8\n\x1bGetGuardianByChildIdRequest\x12\x19\n\x08\x63hild_id\x18\x01 \x01(\tR\x07\x63hildId\"`\n\x1cGetGuardianByChildIdResponse\x12@\n\x08guardian\x18\x01 \x01(\x0b\x32$.where_child_bus.v1.GuardianResponseR\x08guardian\"B\n!GetGuardianListByNurseryIdRequest\x12\x1d\n\nnursery_id\x18\x01 \x01(\tR\tnurseryId\"h\n\"GetGuardianListByNurseryIdResponse\x12\x42\n\tguardians\x18\x01 \x03(\x0b\x32$.where_child_bus.v1.GuardianResponseR\tguardians\"\x9c\x02\n\x15UpdateGuardianRequest\x12\x1f\n\x0bguardian_id\x18\x01 \x01(\tR\nguardianId\x12\x12\n\x04name\x18\x02 \x01(\tR\x04name\x12\x14\n\x05\x65mail\x18\x03 \x01(\tR\x05\x65mail\x12!\n\x0cphone_number\x18\x04 \x01(\tR\x0bphoneNumber\x12+\n\x12is_use_morning_bus\x18\x05 \x01(\x08R\x0fisUseMorningBus\x12+\n\x12is_use_evening_bus\x18\x06 \x01(\x08R\x0fisUseEveningBus\x12;\n\x0bupdate_mask\x18\x0b \x01(\x0b\x32\x1a.google.protobuf.FieldMaskR\nupdateMask\"Z\n\x16UpdateGuardianResponse\x12@\n\x08guardian\x18\x01 \x01(\x0b\x32$.where_child_bus.v1.GuardianResponseR\x08guardian2\xd3\x05\n\x0fGuardianService\x12g\n\x0e\x43reateGuardian\x12).where_child_bus.v1.CreateGuardianRequest\x1a*.where_child_bus.v1.CreateGuardianResponse\x12\x64\n\rGuardianLogin\x12(.where_child_bus.v1.GuardianLoginRequest\x1a).where_child_bus.v1.GuardianLoginResponse\x12\x7f\n\x16GetGuardianListByBusId\x12\x31.where_child_bus.v1.GetGuardianListByBusIdRequest\x1a\x32.where_child_bus.v1.GetGuardianListByBusIdResponse\x12y\n\x14GetGuardianByChildId\x12/.where_child_bus.v1.GetGuardianByChildIdRequest\x1a\x30.where_child_bus.v1.GetGuardianByChildIdResponse\x12\x8b\x01\n\x1aGetGuardianListByNurseryId\x12\x35.where_child_bus.v1.GetGuardianListByNurseryIdRequest\x1a\x36.where_child_bus.v1.GetGuardianListByNurseryIdResponse\x12g\n\x0eUpdateGuardian\x12).where_child_bus.v1.UpdateGuardianRequest\x1a*.where_child_bus.v1.UpdateGuardianResponseB\xf0\x01\n\x16\x63om.where_child_bus.v1B\rGuardianProtoP\x01Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\xa2\x02\x03WXX\xaa\x02\x10WhereChildBus.V1\xca\x02\x10WhereChildBus\\V1\xe2\x02\x1cWhereChildBus\\V1\\GPBMetadata\xea\x02\x11WhereChildBus::V1b\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'where_child_bus.v1.guardian_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\026com.where_child_bus.v1B\rGuardianProtoP\001Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\242\002\003WXX\252\002\020WhereChildBus.V1\312\002\020WhereChildBus\\V1\342\002\034WhereChildBus\\V1\\GPBMetadata\352\002\021WhereChildBus::V1' + _globals['_CREATEGUARDIANREQUEST']._serialized_start=128 + _globals['_CREATEGUARDIANREQUEST']._serialized_end=291 + _globals['_CREATEGUARDIANRESPONSE']._serialized_start=293 + _globals['_CREATEGUARDIANRESPONSE']._serialized_end=383 + _globals['_GUARDIANLOGINREQUEST']._serialized_start=385 + _globals['_GUARDIANLOGINREQUEST']._serialized_end=457 + _globals['_GUARDIANLOGINRESPONSE']._serialized_start=460 + _globals['_GUARDIANLOGINRESPONSE']._serialized_end=638 + _globals['_GETGUARDIANLISTBYBUSIDREQUEST']._serialized_start=640 + _globals['_GETGUARDIANLISTBYBUSIDREQUEST']._serialized_end=694 + _globals['_GETGUARDIANLISTBYBUSIDRESPONSE']._serialized_start=696 + _globals['_GETGUARDIANLISTBYBUSIDRESPONSE']._serialized_end=796 + _globals['_GETGUARDIANBYCHILDIDREQUEST']._serialized_start=798 + _globals['_GETGUARDIANBYCHILDIDREQUEST']._serialized_end=854 + _globals['_GETGUARDIANBYCHILDIDRESPONSE']._serialized_start=856 + _globals['_GETGUARDIANBYCHILDIDRESPONSE']._serialized_end=952 + _globals['_GETGUARDIANLISTBYNURSERYIDREQUEST']._serialized_start=954 + _globals['_GETGUARDIANLISTBYNURSERYIDREQUEST']._serialized_end=1020 + _globals['_GETGUARDIANLISTBYNURSERYIDRESPONSE']._serialized_start=1022 + _globals['_GETGUARDIANLISTBYNURSERYIDRESPONSE']._serialized_end=1126 + _globals['_UPDATEGUARDIANREQUEST']._serialized_start=1129 + _globals['_UPDATEGUARDIANREQUEST']._serialized_end=1413 + _globals['_UPDATEGUARDIANRESPONSE']._serialized_start=1415 + _globals['_UPDATEGUARDIANRESPONSE']._serialized_end=1505 + _globals['_GUARDIANSERVICE']._serialized_start=1508 + _globals['_GUARDIANSERVICE']._serialized_end=2231 +# @@protoc_insertion_point(module_scope) diff --git a/machine_learning/src/generated/where_child_bus/v1/guardian_pb2.pyi b/machine_learning/src/generated/where_child_bus/v1/guardian_pb2.pyi new file mode 100644 index 00000000..5d451be4 --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/guardian_pb2.pyi @@ -0,0 +1,106 @@ +from where_child_bus.v1 import resources_pb2 as _resources_pb2 +from google.protobuf import field_mask_pb2 as _field_mask_pb2 +from google.protobuf.internal import containers as _containers +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class CreateGuardianRequest(_message.Message): + __slots__ = ("nursery_code", "email", "password", "name", "phone_number") + NURSERY_CODE_FIELD_NUMBER: _ClassVar[int] + EMAIL_FIELD_NUMBER: _ClassVar[int] + PASSWORD_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + PHONE_NUMBER_FIELD_NUMBER: _ClassVar[int] + nursery_code: str + email: str + password: str + name: str + phone_number: str + def __init__(self, nursery_code: _Optional[str] = ..., email: _Optional[str] = ..., password: _Optional[str] = ..., name: _Optional[str] = ..., phone_number: _Optional[str] = ...) -> None: ... + +class CreateGuardianResponse(_message.Message): + __slots__ = ("guardian",) + GUARDIAN_FIELD_NUMBER: _ClassVar[int] + guardian: _resources_pb2.GuardianResponse + def __init__(self, guardian: _Optional[_Union[_resources_pb2.GuardianResponse, _Mapping]] = ...) -> None: ... + +class GuardianLoginRequest(_message.Message): + __slots__ = ("email", "password") + EMAIL_FIELD_NUMBER: _ClassVar[int] + PASSWORD_FIELD_NUMBER: _ClassVar[int] + email: str + password: str + def __init__(self, email: _Optional[str] = ..., password: _Optional[str] = ...) -> None: ... + +class GuardianLoginResponse(_message.Message): + __slots__ = ("success", "guardian", "nursery") + SUCCESS_FIELD_NUMBER: _ClassVar[int] + GUARDIAN_FIELD_NUMBER: _ClassVar[int] + NURSERY_FIELD_NUMBER: _ClassVar[int] + success: bool + guardian: _resources_pb2.GuardianResponse + nursery: _resources_pb2.NurseryResponse + def __init__(self, success: bool = ..., guardian: _Optional[_Union[_resources_pb2.GuardianResponse, _Mapping]] = ..., nursery: _Optional[_Union[_resources_pb2.NurseryResponse, _Mapping]] = ...) -> None: ... + +class GetGuardianListByBusIdRequest(_message.Message): + __slots__ = ("bus_id",) + BUS_ID_FIELD_NUMBER: _ClassVar[int] + bus_id: str + def __init__(self, bus_id: _Optional[str] = ...) -> None: ... + +class GetGuardianListByBusIdResponse(_message.Message): + __slots__ = ("guardians",) + GUARDIANS_FIELD_NUMBER: _ClassVar[int] + guardians: _containers.RepeatedCompositeFieldContainer[_resources_pb2.GuardianResponse] + def __init__(self, guardians: _Optional[_Iterable[_Union[_resources_pb2.GuardianResponse, _Mapping]]] = ...) -> None: ... + +class GetGuardianByChildIdRequest(_message.Message): + __slots__ = ("child_id",) + CHILD_ID_FIELD_NUMBER: _ClassVar[int] + child_id: str + def __init__(self, child_id: _Optional[str] = ...) -> None: ... + +class GetGuardianByChildIdResponse(_message.Message): + __slots__ = ("guardian",) + GUARDIAN_FIELD_NUMBER: _ClassVar[int] + guardian: _resources_pb2.GuardianResponse + def __init__(self, guardian: _Optional[_Union[_resources_pb2.GuardianResponse, _Mapping]] = ...) -> None: ... + +class GetGuardianListByNurseryIdRequest(_message.Message): + __slots__ = ("nursery_id",) + NURSERY_ID_FIELD_NUMBER: _ClassVar[int] + nursery_id: str + def __init__(self, nursery_id: _Optional[str] = ...) -> None: ... + +class GetGuardianListByNurseryIdResponse(_message.Message): + __slots__ = ("guardians",) + GUARDIANS_FIELD_NUMBER: _ClassVar[int] + guardians: _containers.RepeatedCompositeFieldContainer[_resources_pb2.GuardianResponse] + def __init__(self, guardians: _Optional[_Iterable[_Union[_resources_pb2.GuardianResponse, _Mapping]]] = ...) -> None: ... + +class UpdateGuardianRequest(_message.Message): + __slots__ = ("guardian_id", "name", "email", "phone_number", "is_use_morning_bus", "is_use_evening_bus", "update_mask") + GUARDIAN_ID_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + EMAIL_FIELD_NUMBER: _ClassVar[int] + PHONE_NUMBER_FIELD_NUMBER: _ClassVar[int] + IS_USE_MORNING_BUS_FIELD_NUMBER: _ClassVar[int] + IS_USE_EVENING_BUS_FIELD_NUMBER: _ClassVar[int] + UPDATE_MASK_FIELD_NUMBER: _ClassVar[int] + guardian_id: str + name: str + email: str + phone_number: str + is_use_morning_bus: bool + is_use_evening_bus: bool + update_mask: _field_mask_pb2.FieldMask + def __init__(self, guardian_id: _Optional[str] = ..., name: _Optional[str] = ..., email: _Optional[str] = ..., phone_number: _Optional[str] = ..., is_use_morning_bus: bool = ..., is_use_evening_bus: bool = ..., update_mask: _Optional[_Union[_field_mask_pb2.FieldMask, _Mapping]] = ...) -> None: ... + +class UpdateGuardianResponse(_message.Message): + __slots__ = ("guardian",) + GUARDIAN_FIELD_NUMBER: _ClassVar[int] + guardian: _resources_pb2.GuardianResponse + def __init__(self, guardian: _Optional[_Union[_resources_pb2.GuardianResponse, _Mapping]] = ...) -> None: ... diff --git a/machine_learning/src/generated/where_child_bus/v1/guardian_pb2_grpc.py b/machine_learning/src/generated/where_child_bus/v1/guardian_pb2_grpc.py new file mode 100644 index 00000000..0de6966e --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/guardian_pb2_grpc.py @@ -0,0 +1,231 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from where_child_bus.v1 import guardian_pb2 as where__child__bus_dot_v1_dot_guardian__pb2 + + +class GuardianServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.CreateGuardian = channel.unary_unary( + '/where_child_bus.v1.GuardianService/CreateGuardian', + request_serializer=where__child__bus_dot_v1_dot_guardian__pb2.CreateGuardianRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_guardian__pb2.CreateGuardianResponse.FromString, + ) + self.GuardianLogin = channel.unary_unary( + '/where_child_bus.v1.GuardianService/GuardianLogin', + request_serializer=where__child__bus_dot_v1_dot_guardian__pb2.GuardianLoginRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_guardian__pb2.GuardianLoginResponse.FromString, + ) + self.GetGuardianListByBusId = channel.unary_unary( + '/where_child_bus.v1.GuardianService/GetGuardianListByBusId', + request_serializer=where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianListByBusIdRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianListByBusIdResponse.FromString, + ) + self.GetGuardianByChildId = channel.unary_unary( + '/where_child_bus.v1.GuardianService/GetGuardianByChildId', + request_serializer=where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianByChildIdRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianByChildIdResponse.FromString, + ) + self.GetGuardianListByNurseryId = channel.unary_unary( + '/where_child_bus.v1.GuardianService/GetGuardianListByNurseryId', + request_serializer=where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianListByNurseryIdRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianListByNurseryIdResponse.FromString, + ) + self.UpdateGuardian = channel.unary_unary( + '/where_child_bus.v1.GuardianService/UpdateGuardian', + request_serializer=where__child__bus_dot_v1_dot_guardian__pb2.UpdateGuardianRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_guardian__pb2.UpdateGuardianResponse.FromString, + ) + + +class GuardianServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def CreateGuardian(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GuardianLogin(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetGuardianListByBusId(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetGuardianByChildId(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetGuardianListByNurseryId(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def UpdateGuardian(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_GuardianServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'CreateGuardian': grpc.unary_unary_rpc_method_handler( + servicer.CreateGuardian, + request_deserializer=where__child__bus_dot_v1_dot_guardian__pb2.CreateGuardianRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_guardian__pb2.CreateGuardianResponse.SerializeToString, + ), + 'GuardianLogin': grpc.unary_unary_rpc_method_handler( + servicer.GuardianLogin, + request_deserializer=where__child__bus_dot_v1_dot_guardian__pb2.GuardianLoginRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_guardian__pb2.GuardianLoginResponse.SerializeToString, + ), + 'GetGuardianListByBusId': grpc.unary_unary_rpc_method_handler( + servicer.GetGuardianListByBusId, + request_deserializer=where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianListByBusIdRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianListByBusIdResponse.SerializeToString, + ), + 'GetGuardianByChildId': grpc.unary_unary_rpc_method_handler( + servicer.GetGuardianByChildId, + request_deserializer=where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianByChildIdRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianByChildIdResponse.SerializeToString, + ), + 'GetGuardianListByNurseryId': grpc.unary_unary_rpc_method_handler( + servicer.GetGuardianListByNurseryId, + request_deserializer=where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianListByNurseryIdRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianListByNurseryIdResponse.SerializeToString, + ), + 'UpdateGuardian': grpc.unary_unary_rpc_method_handler( + servicer.UpdateGuardian, + request_deserializer=where__child__bus_dot_v1_dot_guardian__pb2.UpdateGuardianRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_guardian__pb2.UpdateGuardianResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'where_child_bus.v1.GuardianService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class GuardianService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def CreateGuardian(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.GuardianService/CreateGuardian', + where__child__bus_dot_v1_dot_guardian__pb2.CreateGuardianRequest.SerializeToString, + where__child__bus_dot_v1_dot_guardian__pb2.CreateGuardianResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GuardianLogin(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.GuardianService/GuardianLogin', + where__child__bus_dot_v1_dot_guardian__pb2.GuardianLoginRequest.SerializeToString, + where__child__bus_dot_v1_dot_guardian__pb2.GuardianLoginResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetGuardianListByBusId(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.GuardianService/GetGuardianListByBusId', + where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianListByBusIdRequest.SerializeToString, + where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianListByBusIdResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetGuardianByChildId(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.GuardianService/GetGuardianByChildId', + where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianByChildIdRequest.SerializeToString, + where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianByChildIdResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetGuardianListByNurseryId(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.GuardianService/GetGuardianListByNurseryId', + where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianListByNurseryIdRequest.SerializeToString, + where__child__bus_dot_v1_dot_guardian__pb2.GetGuardianListByNurseryIdResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def UpdateGuardian(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.GuardianService/UpdateGuardian', + where__child__bus_dot_v1_dot_guardian__pb2.UpdateGuardianRequest.SerializeToString, + where__child__bus_dot_v1_dot_guardian__pb2.UpdateGuardianResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/machine_learning/src/generated/where_child_bus/v1/health_check_pb2.py b/machine_learning/src/generated/where_child_bus/v1/health_check_pb2.py new file mode 100644 index 00000000..81c56abf --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/health_check_pb2.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: where_child_bus/v1/health_check.proto +# Protobuf Python Version: 4.25.2 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n%where_child_bus/v1/health_check.proto\x12\x12where_child_bus.v1\"!\n\x0bPingRequest\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\"(\n\x0cPingResponse\x12\x18\n\x07message\x18\x01 \x01(\tR\x07message2_\n\x12HealthcheckService\x12I\n\x04Ping\x12\x1f.where_child_bus.v1.PingRequest\x1a .where_child_bus.v1.PingResponseB\xf3\x01\n\x16\x63om.where_child_bus.v1B\x10HealthCheckProtoP\x01Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\xa2\x02\x03WXX\xaa\x02\x10WhereChildBus.V1\xca\x02\x10WhereChildBus\\V1\xe2\x02\x1cWhereChildBus\\V1\\GPBMetadata\xea\x02\x11WhereChildBus::V1b\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'where_child_bus.v1.health_check_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\026com.where_child_bus.v1B\020HealthCheckProtoP\001Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\242\002\003WXX\252\002\020WhereChildBus.V1\312\002\020WhereChildBus\\V1\342\002\034WhereChildBus\\V1\\GPBMetadata\352\002\021WhereChildBus::V1' + _globals['_PINGREQUEST']._serialized_start=61 + _globals['_PINGREQUEST']._serialized_end=94 + _globals['_PINGRESPONSE']._serialized_start=96 + _globals['_PINGRESPONSE']._serialized_end=136 + _globals['_HEALTHCHECKSERVICE']._serialized_start=138 + _globals['_HEALTHCHECKSERVICE']._serialized_end=233 +# @@protoc_insertion_point(module_scope) diff --git a/machine_learning/src/generated/where_child_bus/v1/health_check_pb2.pyi b/machine_learning/src/generated/where_child_bus/v1/health_check_pb2.pyi new file mode 100644 index 00000000..fb2e805c --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/health_check_pb2.pyi @@ -0,0 +1,17 @@ +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Optional as _Optional + +DESCRIPTOR: _descriptor.FileDescriptor + +class PingRequest(_message.Message): + __slots__ = ("name",) + NAME_FIELD_NUMBER: _ClassVar[int] + name: str + def __init__(self, name: _Optional[str] = ...) -> None: ... + +class PingResponse(_message.Message): + __slots__ = ("message",) + MESSAGE_FIELD_NUMBER: _ClassVar[int] + message: str + def __init__(self, message: _Optional[str] = ...) -> None: ... diff --git a/machine_learning/src/generated/where_child_bus/v1/health_check_pb2_grpc.py b/machine_learning/src/generated/where_child_bus/v1/health_check_pb2_grpc.py new file mode 100644 index 00000000..f0f6381c --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/health_check_pb2_grpc.py @@ -0,0 +1,66 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from where_child_bus.v1 import health_check_pb2 as where__child__bus_dot_v1_dot_health__check__pb2 + + +class HealthcheckServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.Ping = channel.unary_unary( + '/where_child_bus.v1.HealthcheckService/Ping', + request_serializer=where__child__bus_dot_v1_dot_health__check__pb2.PingRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_health__check__pb2.PingResponse.FromString, + ) + + +class HealthcheckServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def Ping(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_HealthcheckServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'Ping': grpc.unary_unary_rpc_method_handler( + servicer.Ping, + request_deserializer=where__child__bus_dot_v1_dot_health__check__pb2.PingRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_health__check__pb2.PingResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'where_child_bus.v1.HealthcheckService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class HealthcheckService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def Ping(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.HealthcheckService/Ping', + where__child__bus_dot_v1_dot_health__check__pb2.PingRequest.SerializeToString, + where__child__bus_dot_v1_dot_health__check__pb2.PingResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/machine_learning/src/generated/where_child_bus/v1/nursery_pb2.py b/machine_learning/src/generated/where_child_bus/v1/nursery_pb2.py new file mode 100644 index 00000000..144b73b5 --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/nursery_pb2.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: where_child_bus/v1/nursery.proto +# Protobuf Python Version: 4.25.2 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from where_child_bus.v1 import resources_pb2 as where__child__bus_dot_v1_dot_resources__pb2 +from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n where_child_bus/v1/nursery.proto\x12\x12where_child_bus.v1\x1a\"where_child_bus/v1/resources.proto\x1a google/protobuf/field_mask.proto\"@\n\x1dGetNurseryByGuardianIdRequest\x12\x1f\n\x0bguardian_id\x18\x01 \x01(\tR\nguardianId\"c\n\x1eGetNurseryByGuardianIdResponse\x12\x41\n\tnurseries\x18\x01 \x01(\x0b\x32#.where_child_bus.v1.NurseryResponseR\tnurseries\"\x99\x01\n\x14\x43reateNurseryRequest\x12\x14\n\x05\x65mail\x18\x01 \x01(\tR\x05\x65mail\x12\x1a\n\x08password\x18\x02 \x01(\tR\x08password\x12\x12\n\x04name\x18\x03 \x01(\tR\x04name\x12!\n\x0cphone_number\x18\x04 \x01(\tR\x0bphoneNumber\x12\x18\n\x07\x61\x64\x64ress\x18\x05 \x01(\tR\x07\x61\x64\x64ress\"V\n\x15\x43reateNurseryResponse\x12=\n\x07nursery\x18\x01 \x01(\x0b\x32#.where_child_bus.v1.NurseryResponseR\x07nursery\"G\n\x13NurseryLoginRequest\x12\x14\n\x05\x65mail\x18\x01 \x01(\tR\x05\x65mail\x12\x1a\n\x08password\x18\x02 \x01(\tR\x08password\"o\n\x14NurseryLoginResponse\x12\x18\n\x07success\x18\x01 \x01(\x08R\x07success\x12=\n\x07nursery\x18\x02 \x01(\x0b\x32#.where_child_bus.v1.NurseryResponseR\x07nursery\"\xe6\x01\n\x14UpdateNurseryRequest\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n\x04name\x18\x02 \x01(\tR\x04name\x12\x18\n\x07\x61\x64\x64ress\x18\x03 \x01(\tR\x07\x61\x64\x64ress\x12!\n\x0cphone_number\x18\x04 \x01(\tR\x0bphoneNumber\x12\x14\n\x05\x65mail\x18\x05 \x01(\tR\x05\x65mail\x12\x1a\n\x08password\x18\x06 \x01(\tR\x08password\x12;\n\x0bupdate_mask\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskR\nupdateMask\"V\n\x15UpdateNurseryResponse\x12=\n\x07nursery\x18\x01 \x01(\x0b\x32#.where_child_bus.v1.NurseryResponseR\x07nursery2\xc0\x03\n\x0eNurseryService\x12\x7f\n\x16GetNurseryByGuardianId\x12\x31.where_child_bus.v1.GetNurseryByGuardianIdRequest\x1a\x32.where_child_bus.v1.GetNurseryByGuardianIdResponse\x12\x64\n\rCreateNursery\x12(.where_child_bus.v1.CreateNurseryRequest\x1a).where_child_bus.v1.CreateNurseryResponse\x12\x61\n\x0cNurseryLogin\x12\'.where_child_bus.v1.NurseryLoginRequest\x1a(.where_child_bus.v1.NurseryLoginResponse\x12\x64\n\rUpdateNursery\x12(.where_child_bus.v1.UpdateNurseryRequest\x1a).where_child_bus.v1.UpdateNurseryResponseB\xef\x01\n\x16\x63om.where_child_bus.v1B\x0cNurseryProtoP\x01Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\xa2\x02\x03WXX\xaa\x02\x10WhereChildBus.V1\xca\x02\x10WhereChildBus\\V1\xe2\x02\x1cWhereChildBus\\V1\\GPBMetadata\xea\x02\x11WhereChildBus::V1b\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'where_child_bus.v1.nursery_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\026com.where_child_bus.v1B\014NurseryProtoP\001Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\242\002\003WXX\252\002\020WhereChildBus.V1\312\002\020WhereChildBus\\V1\342\002\034WhereChildBus\\V1\\GPBMetadata\352\002\021WhereChildBus::V1' + _globals['_GETNURSERYBYGUARDIANIDREQUEST']._serialized_start=126 + _globals['_GETNURSERYBYGUARDIANIDREQUEST']._serialized_end=190 + _globals['_GETNURSERYBYGUARDIANIDRESPONSE']._serialized_start=192 + _globals['_GETNURSERYBYGUARDIANIDRESPONSE']._serialized_end=291 + _globals['_CREATENURSERYREQUEST']._serialized_start=294 + _globals['_CREATENURSERYREQUEST']._serialized_end=447 + _globals['_CREATENURSERYRESPONSE']._serialized_start=449 + _globals['_CREATENURSERYRESPONSE']._serialized_end=535 + _globals['_NURSERYLOGINREQUEST']._serialized_start=537 + _globals['_NURSERYLOGINREQUEST']._serialized_end=608 + _globals['_NURSERYLOGINRESPONSE']._serialized_start=610 + _globals['_NURSERYLOGINRESPONSE']._serialized_end=721 + _globals['_UPDATENURSERYREQUEST']._serialized_start=724 + _globals['_UPDATENURSERYREQUEST']._serialized_end=954 + _globals['_UPDATENURSERYRESPONSE']._serialized_start=956 + _globals['_UPDATENURSERYRESPONSE']._serialized_end=1042 + _globals['_NURSERYSERVICE']._serialized_start=1045 + _globals['_NURSERYSERVICE']._serialized_end=1493 +# @@protoc_insertion_point(module_scope) diff --git a/machine_learning/src/generated/where_child_bus/v1/nursery_pb2.pyi b/machine_learning/src/generated/where_child_bus/v1/nursery_pb2.pyi new file mode 100644 index 00000000..808c9f67 --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/nursery_pb2.pyi @@ -0,0 +1,79 @@ +from where_child_bus.v1 import resources_pb2 as _resources_pb2 +from google.protobuf import field_mask_pb2 as _field_mask_pb2 +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class GetNurseryByGuardianIdRequest(_message.Message): + __slots__ = ("guardian_id",) + GUARDIAN_ID_FIELD_NUMBER: _ClassVar[int] + guardian_id: str + def __init__(self, guardian_id: _Optional[str] = ...) -> None: ... + +class GetNurseryByGuardianIdResponse(_message.Message): + __slots__ = ("nurseries",) + NURSERIES_FIELD_NUMBER: _ClassVar[int] + nurseries: _resources_pb2.NurseryResponse + def __init__(self, nurseries: _Optional[_Union[_resources_pb2.NurseryResponse, _Mapping]] = ...) -> None: ... + +class CreateNurseryRequest(_message.Message): + __slots__ = ("email", "password", "name", "phone_number", "address") + EMAIL_FIELD_NUMBER: _ClassVar[int] + PASSWORD_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + PHONE_NUMBER_FIELD_NUMBER: _ClassVar[int] + ADDRESS_FIELD_NUMBER: _ClassVar[int] + email: str + password: str + name: str + phone_number: str + address: str + def __init__(self, email: _Optional[str] = ..., password: _Optional[str] = ..., name: _Optional[str] = ..., phone_number: _Optional[str] = ..., address: _Optional[str] = ...) -> None: ... + +class CreateNurseryResponse(_message.Message): + __slots__ = ("nursery",) + NURSERY_FIELD_NUMBER: _ClassVar[int] + nursery: _resources_pb2.NurseryResponse + def __init__(self, nursery: _Optional[_Union[_resources_pb2.NurseryResponse, _Mapping]] = ...) -> None: ... + +class NurseryLoginRequest(_message.Message): + __slots__ = ("email", "password") + EMAIL_FIELD_NUMBER: _ClassVar[int] + PASSWORD_FIELD_NUMBER: _ClassVar[int] + email: str + password: str + def __init__(self, email: _Optional[str] = ..., password: _Optional[str] = ...) -> None: ... + +class NurseryLoginResponse(_message.Message): + __slots__ = ("success", "nursery") + SUCCESS_FIELD_NUMBER: _ClassVar[int] + NURSERY_FIELD_NUMBER: _ClassVar[int] + success: bool + nursery: _resources_pb2.NurseryResponse + def __init__(self, success: bool = ..., nursery: _Optional[_Union[_resources_pb2.NurseryResponse, _Mapping]] = ...) -> None: ... + +class UpdateNurseryRequest(_message.Message): + __slots__ = ("id", "name", "address", "phone_number", "email", "password", "update_mask") + ID_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + ADDRESS_FIELD_NUMBER: _ClassVar[int] + PHONE_NUMBER_FIELD_NUMBER: _ClassVar[int] + EMAIL_FIELD_NUMBER: _ClassVar[int] + PASSWORD_FIELD_NUMBER: _ClassVar[int] + UPDATE_MASK_FIELD_NUMBER: _ClassVar[int] + id: str + name: str + address: str + phone_number: str + email: str + password: str + update_mask: _field_mask_pb2.FieldMask + def __init__(self, id: _Optional[str] = ..., name: _Optional[str] = ..., address: _Optional[str] = ..., phone_number: _Optional[str] = ..., email: _Optional[str] = ..., password: _Optional[str] = ..., update_mask: _Optional[_Union[_field_mask_pb2.FieldMask, _Mapping]] = ...) -> None: ... + +class UpdateNurseryResponse(_message.Message): + __slots__ = ("nursery",) + NURSERY_FIELD_NUMBER: _ClassVar[int] + nursery: _resources_pb2.NurseryResponse + def __init__(self, nursery: _Optional[_Union[_resources_pb2.NurseryResponse, _Mapping]] = ...) -> None: ... diff --git a/machine_learning/src/generated/where_child_bus/v1/nursery_pb2_grpc.py b/machine_learning/src/generated/where_child_bus/v1/nursery_pb2_grpc.py new file mode 100644 index 00000000..642aff51 --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/nursery_pb2_grpc.py @@ -0,0 +1,165 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from where_child_bus.v1 import nursery_pb2 as where__child__bus_dot_v1_dot_nursery__pb2 + + +class NurseryServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.GetNurseryByGuardianId = channel.unary_unary( + '/where_child_bus.v1.NurseryService/GetNurseryByGuardianId', + request_serializer=where__child__bus_dot_v1_dot_nursery__pb2.GetNurseryByGuardianIdRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_nursery__pb2.GetNurseryByGuardianIdResponse.FromString, + ) + self.CreateNursery = channel.unary_unary( + '/where_child_bus.v1.NurseryService/CreateNursery', + request_serializer=where__child__bus_dot_v1_dot_nursery__pb2.CreateNurseryRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_nursery__pb2.CreateNurseryResponse.FromString, + ) + self.NurseryLogin = channel.unary_unary( + '/where_child_bus.v1.NurseryService/NurseryLogin', + request_serializer=where__child__bus_dot_v1_dot_nursery__pb2.NurseryLoginRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_nursery__pb2.NurseryLoginResponse.FromString, + ) + self.UpdateNursery = channel.unary_unary( + '/where_child_bus.v1.NurseryService/UpdateNursery', + request_serializer=where__child__bus_dot_v1_dot_nursery__pb2.UpdateNurseryRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_nursery__pb2.UpdateNurseryResponse.FromString, + ) + + +class NurseryServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def GetNurseryByGuardianId(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def CreateNursery(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def NurseryLogin(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def UpdateNursery(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_NurseryServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'GetNurseryByGuardianId': grpc.unary_unary_rpc_method_handler( + servicer.GetNurseryByGuardianId, + request_deserializer=where__child__bus_dot_v1_dot_nursery__pb2.GetNurseryByGuardianIdRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_nursery__pb2.GetNurseryByGuardianIdResponse.SerializeToString, + ), + 'CreateNursery': grpc.unary_unary_rpc_method_handler( + servicer.CreateNursery, + request_deserializer=where__child__bus_dot_v1_dot_nursery__pb2.CreateNurseryRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_nursery__pb2.CreateNurseryResponse.SerializeToString, + ), + 'NurseryLogin': grpc.unary_unary_rpc_method_handler( + servicer.NurseryLogin, + request_deserializer=where__child__bus_dot_v1_dot_nursery__pb2.NurseryLoginRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_nursery__pb2.NurseryLoginResponse.SerializeToString, + ), + 'UpdateNursery': grpc.unary_unary_rpc_method_handler( + servicer.UpdateNursery, + request_deserializer=where__child__bus_dot_v1_dot_nursery__pb2.UpdateNurseryRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_nursery__pb2.UpdateNurseryResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'where_child_bus.v1.NurseryService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class NurseryService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def GetNurseryByGuardianId(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.NurseryService/GetNurseryByGuardianId', + where__child__bus_dot_v1_dot_nursery__pb2.GetNurseryByGuardianIdRequest.SerializeToString, + where__child__bus_dot_v1_dot_nursery__pb2.GetNurseryByGuardianIdResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def CreateNursery(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.NurseryService/CreateNursery', + where__child__bus_dot_v1_dot_nursery__pb2.CreateNurseryRequest.SerializeToString, + where__child__bus_dot_v1_dot_nursery__pb2.CreateNurseryResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def NurseryLogin(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.NurseryService/NurseryLogin', + where__child__bus_dot_v1_dot_nursery__pb2.NurseryLoginRequest.SerializeToString, + where__child__bus_dot_v1_dot_nursery__pb2.NurseryLoginResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def UpdateNursery(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.NurseryService/UpdateNursery', + where__child__bus_dot_v1_dot_nursery__pb2.UpdateNurseryRequest.SerializeToString, + where__child__bus_dot_v1_dot_nursery__pb2.UpdateNurseryResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/machine_learning/src/generated/where_child_bus/v1/resources_pb2.py b/machine_learning/src/generated/where_child_bus/v1/resources_pb2.py new file mode 100644 index 00000000..e2091305 --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/resources_pb2.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: where_child_bus/v1/resources.proto +# Protobuf Python Version: 4.25.2 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\"where_child_bus/v1/resources.proto\x12\x12where_child_bus.v1\x1a\x1fgoogle/protobuf/timestamp.proto\"\xc2\x02\n\x07Nursery\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12!\n\x0cnursery_code\x18\x02 \x01(\tR\x0bnurseryCode\x12\x12\n\x04name\x18\x03 \x01(\tR\x04name\x12\x18\n\x07\x61\x64\x64ress\x18\x04 \x01(\tR\x07\x61\x64\x64ress\x12!\n\x0cphone_number\x18\x05 \x01(\tR\x0bphoneNumber\x12\x14\n\x05\x65mail\x18\x06 \x01(\tR\x05\x65mail\x12\'\n\x0fhashed_password\x18\x07 \x01(\tR\x0ehashedPassword\x12\x39\n\ncreated_at\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\x12\x39\n\nupdated_at\x18\t \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tupdatedAt\"\xa1\x02\n\x0fNurseryResponse\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12!\n\x0cnursery_code\x18\x02 \x01(\tR\x0bnurseryCode\x12\x12\n\x04name\x18\x03 \x01(\tR\x04name\x12\x18\n\x07\x61\x64\x64ress\x18\x04 \x01(\tR\x07\x61\x64\x64ress\x12!\n\x0cphone_number\x18\x05 \x01(\tR\x0bphoneNumber\x12\x14\n\x05\x65mail\x18\x06 \x01(\tR\x05\x65mail\x12\x39\n\ncreated_at\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\x12\x39\n\nupdated_at\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tupdatedAt\"\xff\x02\n\x08Guardian\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x1d\n\nnursery_id\x18\x02 \x01(\tR\tnurseryId\x12\x12\n\x04name\x18\x03 \x01(\tR\x04name\x12\x14\n\x05\x65mail\x18\x04 \x01(\tR\x05\x65mail\x12!\n\x0cphone_number\x18\x05 \x01(\tR\x0bphoneNumber\x12\'\n\x0fhashed_password\x18\x06 \x01(\tR\x0ehashedPassword\x12+\n\x12is_use_morning_bus\x18\x07 \x01(\x08R\x0fisUseMorningBus\x12+\n\x12is_use_evening_bus\x18\x08 \x01(\x08R\x0fisUseEveningBus\x12\x39\n\ncreated_at\x18\t \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\x12\x39\n\nupdated_at\x18\n \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tupdatedAt\"\xde\x02\n\x10GuardianResponse\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x1d\n\nnursery_id\x18\x02 \x01(\tR\tnurseryId\x12\x12\n\x04name\x18\x03 \x01(\tR\x04name\x12\x14\n\x05\x65mail\x18\x04 \x01(\tR\x05\x65mail\x12!\n\x0cphone_number\x18\x05 \x01(\tR\x0bphoneNumber\x12+\n\x12is_use_morning_bus\x18\x06 \x01(\x08R\x0fisUseMorningBus\x12+\n\x12is_use_evening_bus\x18\x07 \x01(\x08R\x0fisUseEveningBus\x12\x39\n\ncreated_at\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\x12\x39\n\nupdated_at\x18\t \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tupdatedAt\"\xa7\x04\n\x03\x42us\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x1d\n\nnursery_id\x18\x02 \x01(\tR\tnurseryId\x12\x12\n\x04name\x18\x03 \x01(\tR\x04name\x12!\n\x0cplate_number\x18\x04 \x01(\tR\x0bplateNumber\x12<\n\nbus_status\x18\x05 \x01(\x0e\x32\x1d.where_child_bus.v1.BusStatusR\tbusStatus\x12\x1a\n\x08latitude\x18\x06 \x01(\x01R\x08latitude\x12\x1c\n\tlongitude\x18\x07 \x01(\x01R\tlongitude\x12\x36\n\x17\x65nable_face_recognition\x18\x08 \x01(\x08R\x15\x65nableFaceRecognition\x12&\n\x0fnext_station_id\x18\x0b \x01(\tR\rnextStationId\x12\x35\n\x17latest_morning_route_id\x18\x0e \x01(\tR\x14latestMorningRouteId\x12\x35\n\x17latest_evening_route_id\x18\x0f \x01(\tR\x14latestEveningRouteId\x12\x39\n\ncreated_at\x18\x0c \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\x12\x39\n\nupdated_at\x18\r \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tupdatedAt\"\xfc\x03\n\x05\x43hild\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x1d\n\nnursery_id\x18\x02 \x01(\tR\tnurseryId\x12\x1f\n\x0bguardian_id\x18\x03 \x01(\tR\nguardianId\x12\x12\n\x04name\x18\x04 \x01(\tR\x04name\x12\x10\n\x03\x61ge\x18\x05 \x01(\x05R\x03\x61ge\x12)\n\x03sex\x18\x06 \x01(\x0e\x32\x17.where_child_bus.v1.SexR\x03sex\x12\x35\n\x17\x63heck_for_missing_items\x18\x07 \x01(\x08R\x14\x63heckForMissingItems\x12\x17\n\x07has_bag\x18\x08 \x01(\x08R\x06hasBag\x12\"\n\rhas_lunch_box\x18\t \x01(\x08R\x0bhasLunchBox\x12(\n\x10has_water_bottle\x18\n \x01(\x08R\x0ehasWaterBottle\x12!\n\x0chas_umbrella\x18\x0b \x01(\x08R\x0bhasUmbrella\x12\x1b\n\thas_other\x18\x0c \x01(\x08R\x08hasOther\x12\x39\n\ncreated_at\x18\r \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\x12\x39\n\nupdated_at\x18\x0e \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tupdatedAt\"\xea\x01\n\x07Station\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x1f\n\x0bguardian_id\x18\x02 \x01(\tR\nguardianId\x12\x1a\n\x08latitude\x18\x05 \x01(\x01R\x08latitude\x12\x1c\n\tlongitude\x18\x06 \x01(\x01R\tlongitude\x12\x39\n\ncreated_at\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\x12\x39\n\nupdated_at\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tupdatedAt\"R\n\x13\x43hildBusAssociation\x12 \n\x0c\x62us_route_id\x18\x01 \x01(\tR\nbusRouteId\x12\x19\n\x08\x63hild_id\x18\x02 \x01(\tR\x07\x63hildId\"\xcc\x01\n\nChildPhoto\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x19\n\x08\x63hild_id\x18\x02 \x01(\tR\x07\x63hildId\x12\x1d\n\nphoto_data\x18\x03 \x01(\x0cR\tphotoData\x12\x39\n\ncreated_at\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\x12\x39\n\nupdated_at\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tupdatedAt\"\xad\x01\n\x0e\x42oardingRecord\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x19\n\x08\x63hild_id\x18\x02 \x01(\tR\x07\x63hildId\x12\x15\n\x06\x62us_id\x18\x03 \x01(\tR\x05\x62usId\x12\x1f\n\x0bis_boarding\x18\x04 \x01(\x08R\nisBoarding\x12\x38\n\ttimestamp\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\ttimestamp\"\xb1\x01\n\x08\x42usRoute\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x15\n\x06\x62us_id\x18\x02 \x01(\tR\x05\x62usId\x12\x46\n\x10ordered_stations\x18\x03 \x03(\x0b\x32\x1b.where_child_bus.v1.StationR\x0forderedStations\x12\x36\n\x08\x62us_type\x18\x04 \x01(\x0e\x32\x1b.where_child_bus.v1.BusTypeR\x07\x62usType*s\n\tBusStatus\x12\x1a\n\x16\x42US_STATUS_UNSPECIFIED\x10\x00\x12\x16\n\x12\x42US_STATUS_STOPPED\x10\x01\x12\x16\n\x12\x42US_STATUS_RUNNING\x10\x02\x12\x1a\n\x16\x42US_STATUS_MAINTENANCE\x10\x03*b\n\x0cVehicleEvent\x12\x1d\n\x19VEHICLE_EVENT_UNSPECIFIED\x10\x00\x12\x18\n\x14VEHICLE_EVENT_GET_ON\x10\x01\x12\x19\n\x15VEHICLE_EVENT_GET_OFF\x10\x02*E\n\x03Sex\x12\x13\n\x0fSEX_UNSPECIFIED\x10\x00\x12\x0b\n\x07SEX_MAN\x10\x01\x12\r\n\tSEX_WOMAN\x10\x02\x12\r\n\tSEX_OTHER\x10\x03*O\n\x07\x42usType\x12\x18\n\x14\x42US_TYPE_UNSPECIFIED\x10\x00\x12\x14\n\x10\x42US_TYPE_MORNING\x10\x01\x12\x14\n\x10\x42US_TYPE_EVENING\x10\x02\x42\xf1\x01\n\x16\x63om.where_child_bus.v1B\x0eResourcesProtoP\x01Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\xa2\x02\x03WXX\xaa\x02\x10WhereChildBus.V1\xca\x02\x10WhereChildBus\\V1\xe2\x02\x1cWhereChildBus\\V1\\GPBMetadata\xea\x02\x11WhereChildBus::V1b\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'where_child_bus.v1.resources_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\026com.where_child_bus.v1B\016ResourcesProtoP\001Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\242\002\003WXX\252\002\020WhereChildBus.V1\312\002\020WhereChildBus\\V1\342\002\034WhereChildBus\\V1\\GPBMetadata\352\002\021WhereChildBus::V1' + _globals['_BUSSTATUS']._serialized_start=3396 + _globals['_BUSSTATUS']._serialized_end=3511 + _globals['_VEHICLEEVENT']._serialized_start=3513 + _globals['_VEHICLEEVENT']._serialized_end=3611 + _globals['_SEX']._serialized_start=3613 + _globals['_SEX']._serialized_end=3682 + _globals['_BUSTYPE']._serialized_start=3684 + _globals['_BUSTYPE']._serialized_end=3763 + _globals['_NURSERY']._serialized_start=92 + _globals['_NURSERY']._serialized_end=414 + _globals['_NURSERYRESPONSE']._serialized_start=417 + _globals['_NURSERYRESPONSE']._serialized_end=706 + _globals['_GUARDIAN']._serialized_start=709 + _globals['_GUARDIAN']._serialized_end=1092 + _globals['_GUARDIANRESPONSE']._serialized_start=1095 + _globals['_GUARDIANRESPONSE']._serialized_end=1445 + _globals['_BUS']._serialized_start=1448 + _globals['_BUS']._serialized_end=1999 + _globals['_CHILD']._serialized_start=2002 + _globals['_CHILD']._serialized_end=2510 + _globals['_STATION']._serialized_start=2513 + _globals['_STATION']._serialized_end=2747 + _globals['_CHILDBUSASSOCIATION']._serialized_start=2749 + _globals['_CHILDBUSASSOCIATION']._serialized_end=2831 + _globals['_CHILDPHOTO']._serialized_start=2834 + _globals['_CHILDPHOTO']._serialized_end=3038 + _globals['_BOARDINGRECORD']._serialized_start=3041 + _globals['_BOARDINGRECORD']._serialized_end=3214 + _globals['_BUSROUTE']._serialized_start=3217 + _globals['_BUSROUTE']._serialized_end=3394 +# @@protoc_insertion_point(module_scope) diff --git a/machine_learning/src/generated/where_child_bus/v1/resources_pb2.pyi b/machine_learning/src/generated/where_child_bus/v1/resources_pb2.pyi new file mode 100644 index 00000000..423c71f7 --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/resources_pb2.pyi @@ -0,0 +1,262 @@ +from google.protobuf import timestamp_pb2 as _timestamp_pb2 +from google.protobuf.internal import containers as _containers +from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class BusStatus(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + BUS_STATUS_UNSPECIFIED: _ClassVar[BusStatus] + BUS_STATUS_STOPPED: _ClassVar[BusStatus] + BUS_STATUS_RUNNING: _ClassVar[BusStatus] + BUS_STATUS_MAINTENANCE: _ClassVar[BusStatus] + +class VehicleEvent(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + VEHICLE_EVENT_UNSPECIFIED: _ClassVar[VehicleEvent] + VEHICLE_EVENT_GET_ON: _ClassVar[VehicleEvent] + VEHICLE_EVENT_GET_OFF: _ClassVar[VehicleEvent] + +class Sex(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + SEX_UNSPECIFIED: _ClassVar[Sex] + SEX_MAN: _ClassVar[Sex] + SEX_WOMAN: _ClassVar[Sex] + SEX_OTHER: _ClassVar[Sex] + +class BusType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + BUS_TYPE_UNSPECIFIED: _ClassVar[BusType] + BUS_TYPE_MORNING: _ClassVar[BusType] + BUS_TYPE_EVENING: _ClassVar[BusType] +BUS_STATUS_UNSPECIFIED: BusStatus +BUS_STATUS_STOPPED: BusStatus +BUS_STATUS_RUNNING: BusStatus +BUS_STATUS_MAINTENANCE: BusStatus +VEHICLE_EVENT_UNSPECIFIED: VehicleEvent +VEHICLE_EVENT_GET_ON: VehicleEvent +VEHICLE_EVENT_GET_OFF: VehicleEvent +SEX_UNSPECIFIED: Sex +SEX_MAN: Sex +SEX_WOMAN: Sex +SEX_OTHER: Sex +BUS_TYPE_UNSPECIFIED: BusType +BUS_TYPE_MORNING: BusType +BUS_TYPE_EVENING: BusType + +class Nursery(_message.Message): + __slots__ = ("id", "nursery_code", "name", "address", "phone_number", "email", "hashed_password", "created_at", "updated_at") + ID_FIELD_NUMBER: _ClassVar[int] + NURSERY_CODE_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + ADDRESS_FIELD_NUMBER: _ClassVar[int] + PHONE_NUMBER_FIELD_NUMBER: _ClassVar[int] + EMAIL_FIELD_NUMBER: _ClassVar[int] + HASHED_PASSWORD_FIELD_NUMBER: _ClassVar[int] + CREATED_AT_FIELD_NUMBER: _ClassVar[int] + UPDATED_AT_FIELD_NUMBER: _ClassVar[int] + id: str + nursery_code: str + name: str + address: str + phone_number: str + email: str + hashed_password: str + created_at: _timestamp_pb2.Timestamp + updated_at: _timestamp_pb2.Timestamp + def __init__(self, id: _Optional[str] = ..., nursery_code: _Optional[str] = ..., name: _Optional[str] = ..., address: _Optional[str] = ..., phone_number: _Optional[str] = ..., email: _Optional[str] = ..., hashed_password: _Optional[str] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., updated_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... + +class NurseryResponse(_message.Message): + __slots__ = ("id", "nursery_code", "name", "address", "phone_number", "email", "created_at", "updated_at") + ID_FIELD_NUMBER: _ClassVar[int] + NURSERY_CODE_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + ADDRESS_FIELD_NUMBER: _ClassVar[int] + PHONE_NUMBER_FIELD_NUMBER: _ClassVar[int] + EMAIL_FIELD_NUMBER: _ClassVar[int] + CREATED_AT_FIELD_NUMBER: _ClassVar[int] + UPDATED_AT_FIELD_NUMBER: _ClassVar[int] + id: str + nursery_code: str + name: str + address: str + phone_number: str + email: str + created_at: _timestamp_pb2.Timestamp + updated_at: _timestamp_pb2.Timestamp + def __init__(self, id: _Optional[str] = ..., nursery_code: _Optional[str] = ..., name: _Optional[str] = ..., address: _Optional[str] = ..., phone_number: _Optional[str] = ..., email: _Optional[str] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., updated_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... + +class Guardian(_message.Message): + __slots__ = ("id", "nursery_id", "name", "email", "phone_number", "hashed_password", "is_use_morning_bus", "is_use_evening_bus", "created_at", "updated_at") + ID_FIELD_NUMBER: _ClassVar[int] + NURSERY_ID_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + EMAIL_FIELD_NUMBER: _ClassVar[int] + PHONE_NUMBER_FIELD_NUMBER: _ClassVar[int] + HASHED_PASSWORD_FIELD_NUMBER: _ClassVar[int] + IS_USE_MORNING_BUS_FIELD_NUMBER: _ClassVar[int] + IS_USE_EVENING_BUS_FIELD_NUMBER: _ClassVar[int] + CREATED_AT_FIELD_NUMBER: _ClassVar[int] + UPDATED_AT_FIELD_NUMBER: _ClassVar[int] + id: str + nursery_id: str + name: str + email: str + phone_number: str + hashed_password: str + is_use_morning_bus: bool + is_use_evening_bus: bool + created_at: _timestamp_pb2.Timestamp + updated_at: _timestamp_pb2.Timestamp + def __init__(self, id: _Optional[str] = ..., nursery_id: _Optional[str] = ..., name: _Optional[str] = ..., email: _Optional[str] = ..., phone_number: _Optional[str] = ..., hashed_password: _Optional[str] = ..., is_use_morning_bus: bool = ..., is_use_evening_bus: bool = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., updated_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... + +class GuardianResponse(_message.Message): + __slots__ = ("id", "nursery_id", "name", "email", "phone_number", "is_use_morning_bus", "is_use_evening_bus", "created_at", "updated_at") + ID_FIELD_NUMBER: _ClassVar[int] + NURSERY_ID_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + EMAIL_FIELD_NUMBER: _ClassVar[int] + PHONE_NUMBER_FIELD_NUMBER: _ClassVar[int] + IS_USE_MORNING_BUS_FIELD_NUMBER: _ClassVar[int] + IS_USE_EVENING_BUS_FIELD_NUMBER: _ClassVar[int] + CREATED_AT_FIELD_NUMBER: _ClassVar[int] + UPDATED_AT_FIELD_NUMBER: _ClassVar[int] + id: str + nursery_id: str + name: str + email: str + phone_number: str + is_use_morning_bus: bool + is_use_evening_bus: bool + created_at: _timestamp_pb2.Timestamp + updated_at: _timestamp_pb2.Timestamp + def __init__(self, id: _Optional[str] = ..., nursery_id: _Optional[str] = ..., name: _Optional[str] = ..., email: _Optional[str] = ..., phone_number: _Optional[str] = ..., is_use_morning_bus: bool = ..., is_use_evening_bus: bool = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., updated_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... + +class Bus(_message.Message): + __slots__ = ("id", "nursery_id", "name", "plate_number", "bus_status", "latitude", "longitude", "enable_face_recognition", "next_station_id", "latest_morning_route_id", "latest_evening_route_id", "created_at", "updated_at") + ID_FIELD_NUMBER: _ClassVar[int] + NURSERY_ID_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + PLATE_NUMBER_FIELD_NUMBER: _ClassVar[int] + BUS_STATUS_FIELD_NUMBER: _ClassVar[int] + LATITUDE_FIELD_NUMBER: _ClassVar[int] + LONGITUDE_FIELD_NUMBER: _ClassVar[int] + ENABLE_FACE_RECOGNITION_FIELD_NUMBER: _ClassVar[int] + NEXT_STATION_ID_FIELD_NUMBER: _ClassVar[int] + LATEST_MORNING_ROUTE_ID_FIELD_NUMBER: _ClassVar[int] + LATEST_EVENING_ROUTE_ID_FIELD_NUMBER: _ClassVar[int] + CREATED_AT_FIELD_NUMBER: _ClassVar[int] + UPDATED_AT_FIELD_NUMBER: _ClassVar[int] + id: str + nursery_id: str + name: str + plate_number: str + bus_status: BusStatus + latitude: float + longitude: float + enable_face_recognition: bool + next_station_id: str + latest_morning_route_id: str + latest_evening_route_id: str + created_at: _timestamp_pb2.Timestamp + updated_at: _timestamp_pb2.Timestamp + def __init__(self, id: _Optional[str] = ..., nursery_id: _Optional[str] = ..., name: _Optional[str] = ..., plate_number: _Optional[str] = ..., bus_status: _Optional[_Union[BusStatus, str]] = ..., latitude: _Optional[float] = ..., longitude: _Optional[float] = ..., enable_face_recognition: bool = ..., next_station_id: _Optional[str] = ..., latest_morning_route_id: _Optional[str] = ..., latest_evening_route_id: _Optional[str] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., updated_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... + +class Child(_message.Message): + __slots__ = ("id", "nursery_id", "guardian_id", "name", "age", "sex", "check_for_missing_items", "has_bag", "has_lunch_box", "has_water_bottle", "has_umbrella", "has_other", "created_at", "updated_at") + ID_FIELD_NUMBER: _ClassVar[int] + NURSERY_ID_FIELD_NUMBER: _ClassVar[int] + GUARDIAN_ID_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + AGE_FIELD_NUMBER: _ClassVar[int] + SEX_FIELD_NUMBER: _ClassVar[int] + CHECK_FOR_MISSING_ITEMS_FIELD_NUMBER: _ClassVar[int] + HAS_BAG_FIELD_NUMBER: _ClassVar[int] + HAS_LUNCH_BOX_FIELD_NUMBER: _ClassVar[int] + HAS_WATER_BOTTLE_FIELD_NUMBER: _ClassVar[int] + HAS_UMBRELLA_FIELD_NUMBER: _ClassVar[int] + HAS_OTHER_FIELD_NUMBER: _ClassVar[int] + CREATED_AT_FIELD_NUMBER: _ClassVar[int] + UPDATED_AT_FIELD_NUMBER: _ClassVar[int] + id: str + nursery_id: str + guardian_id: str + name: str + age: int + sex: 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: _timestamp_pb2.Timestamp + updated_at: _timestamp_pb2.Timestamp + def __init__(self, id: _Optional[str] = ..., nursery_id: _Optional[str] = ..., guardian_id: _Optional[str] = ..., name: _Optional[str] = ..., age: _Optional[int] = ..., sex: _Optional[_Union[Sex, str]] = ..., check_for_missing_items: bool = ..., has_bag: bool = ..., has_lunch_box: bool = ..., has_water_bottle: bool = ..., has_umbrella: bool = ..., has_other: bool = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., updated_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... + +class Station(_message.Message): + __slots__ = ("id", "guardian_id", "latitude", "longitude", "created_at", "updated_at") + ID_FIELD_NUMBER: _ClassVar[int] + GUARDIAN_ID_FIELD_NUMBER: _ClassVar[int] + LATITUDE_FIELD_NUMBER: _ClassVar[int] + LONGITUDE_FIELD_NUMBER: _ClassVar[int] + CREATED_AT_FIELD_NUMBER: _ClassVar[int] + UPDATED_AT_FIELD_NUMBER: _ClassVar[int] + id: str + guardian_id: str + latitude: float + longitude: float + created_at: _timestamp_pb2.Timestamp + updated_at: _timestamp_pb2.Timestamp + def __init__(self, id: _Optional[str] = ..., guardian_id: _Optional[str] = ..., latitude: _Optional[float] = ..., longitude: _Optional[float] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., updated_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... + +class ChildBusAssociation(_message.Message): + __slots__ = ("bus_route_id", "child_id") + BUS_ROUTE_ID_FIELD_NUMBER: _ClassVar[int] + CHILD_ID_FIELD_NUMBER: _ClassVar[int] + bus_route_id: str + child_id: str + def __init__(self, bus_route_id: _Optional[str] = ..., child_id: _Optional[str] = ...) -> None: ... + +class ChildPhoto(_message.Message): + __slots__ = ("id", "child_id", "photo_data", "created_at", "updated_at") + ID_FIELD_NUMBER: _ClassVar[int] + CHILD_ID_FIELD_NUMBER: _ClassVar[int] + PHOTO_DATA_FIELD_NUMBER: _ClassVar[int] + CREATED_AT_FIELD_NUMBER: _ClassVar[int] + UPDATED_AT_FIELD_NUMBER: _ClassVar[int] + id: str + child_id: str + photo_data: bytes + created_at: _timestamp_pb2.Timestamp + updated_at: _timestamp_pb2.Timestamp + def __init__(self, id: _Optional[str] = ..., child_id: _Optional[str] = ..., photo_data: _Optional[bytes] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., updated_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... + +class BoardingRecord(_message.Message): + __slots__ = ("id", "child_id", "bus_id", "is_boarding", "timestamp") + ID_FIELD_NUMBER: _ClassVar[int] + CHILD_ID_FIELD_NUMBER: _ClassVar[int] + BUS_ID_FIELD_NUMBER: _ClassVar[int] + IS_BOARDING_FIELD_NUMBER: _ClassVar[int] + TIMESTAMP_FIELD_NUMBER: _ClassVar[int] + id: str + child_id: str + bus_id: str + is_boarding: bool + timestamp: _timestamp_pb2.Timestamp + def __init__(self, id: _Optional[str] = ..., child_id: _Optional[str] = ..., bus_id: _Optional[str] = ..., is_boarding: bool = ..., timestamp: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... + +class BusRoute(_message.Message): + __slots__ = ("id", "bus_id", "ordered_stations", "bus_type") + ID_FIELD_NUMBER: _ClassVar[int] + BUS_ID_FIELD_NUMBER: _ClassVar[int] + ORDERED_STATIONS_FIELD_NUMBER: _ClassVar[int] + BUS_TYPE_FIELD_NUMBER: _ClassVar[int] + id: str + bus_id: str + ordered_stations: _containers.RepeatedCompositeFieldContainer[Station] + bus_type: BusType + def __init__(self, id: _Optional[str] = ..., bus_id: _Optional[str] = ..., ordered_stations: _Optional[_Iterable[_Union[Station, _Mapping]]] = ..., bus_type: _Optional[_Union[BusType, str]] = ...) -> None: ... diff --git a/machine_learning/src/generated/where_child_bus/v1/resources_pb2_grpc.py b/machine_learning/src/generated/where_child_bus/v1/resources_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/resources_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/machine_learning/src/generated/where_child_bus/v1/station_pb2.py b/machine_learning/src/generated/where_child_bus/v1/station_pb2.py new file mode 100644 index 00000000..1104de03 --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/station_pb2.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: where_child_bus/v1/station.proto +# Protobuf Python Version: 4.25.2 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from where_child_bus.v1 import resources_pb2 as where__child__bus_dot_v1_dot_resources__pb2 +from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n where_child_bus/v1/station.proto\x12\x12where_child_bus.v1\x1a\"where_child_bus/v1/resources.proto\x1a google/protobuf/field_mask.proto\"\x85\x01\n(UpdateStationLocationByGuardianIdRequest\x12\x1f\n\x0bguardian_id\x18\x01 \x01(\tR\nguardianId\x12\x1c\n\tlongitude\x18\x02 \x01(\x01R\tlongitude\x12\x1a\n\x08latitude\x18\x03 \x01(\x01R\x08latitude\"b\n)UpdateStationLocationByGuardianIdResponse\x12\x35\n\x07station\x18\x01 \x01(\x0b\x32\x1b.where_child_bus.v1.StationR\x07station\"5\n\x1cGetStationListByBusIdRequest\x12\x15\n\x06\x62us_id\x18\x01 \x01(\tR\x05\x62usId\"\x8b\x02\n\x1dGetStationListByBusIdResponse\x12\x37\n\x08stations\x18\x01 \x03(\x0b\x32\x1b.where_child_bus.v1.StationR\x08stations\x12\x42\n\tguardians\x18\x02 \x03(\x0b\x32$.where_child_bus.v1.GuardianResponseR\tguardians\x12\x35\n\x08\x63hildren\x18\x03 \x03(\x0b\x32\x19.where_child_bus.v1.ChildR\x08\x63hildren\x12\x36\n\x06photos\x18\x04 \x03(\x0b\x32\x1e.where_child_bus.v1.ChildPhotoR\x06photos\":\n!GetUnregisteredStationListRequest\x12\x15\n\x06\x62us_id\x18\x01 \x01(\tR\x05\x62usId\"\xa1\x01\n\"GetUnregisteredStationListResponse\x12\x37\n\x08stations\x18\x01 \x03(\x0b\x32\x1b.where_child_bus.v1.StationR\x08stations\x12\x42\n\tguardians\x18\x02 \x03(\x0b\x32$.where_child_bus.v1.GuardianResponseR\tguardians\"y\n(GetCorrectOrderStationListByBusIdRequest\x12\x15\n\x06\x62us_id\x18\x01 \x01(\tR\x05\x62usId\x12\x36\n\x08\x62us_type\x18\x02 \x01(\x0e\x32\x1b.where_child_bus.v1.BusTypeR\x07\x62usType\"f\n)GetCorrectOrderStationListByBusIdResponse\x12\x39\n\tbus_route\x18\x01 \x01(\x0b\x32\x1c.where_child_bus.v1.BusRouteR\x08\x62usRoute\"\xb4\x01\n\x14UpdateStationRequest\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x15\n\x06\x62us_id\x18\x02 \x01(\tR\x05\x62usId\x12\x1a\n\x08latitude\x18\x03 \x01(\x01R\x08latitude\x12\x1c\n\tlongitude\x18\x04 \x01(\x01R\tlongitude\x12;\n\x0bupdate_mask\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskR\nupdateMask\"N\n\x15UpdateStationResponse\x12\x35\n\x07station\x18\x01 \x01(\x0b\x32\x1b.where_child_bus.v1.StationR\x07station2\xa5\x04\n\x0eStationService\x12\xa0\x01\n!UpdateStationLocationByGuardianId\x12<.where_child_bus.v1.UpdateStationLocationByGuardianIdRequest\x1a=.where_child_bus.v1.UpdateStationLocationByGuardianIdResponse\x12|\n\x15GetStationListByBusId\x12\x30.where_child_bus.v1.GetStationListByBusIdRequest\x1a\x31.where_child_bus.v1.GetStationListByBusIdResponse\x12\x8b\x01\n\x1aGetUnregisteredStationList\x12\x35.where_child_bus.v1.GetUnregisteredStationListRequest\x1a\x36.where_child_bus.v1.GetUnregisteredStationListResponse\x12\x64\n\rUpdateStation\x12(.where_child_bus.v1.UpdateStationRequest\x1a).where_child_bus.v1.UpdateStationResponseB\xef\x01\n\x16\x63om.where_child_bus.v1B\x0cStationProtoP\x01Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\xa2\x02\x03WXX\xaa\x02\x10WhereChildBus.V1\xca\x02\x10WhereChildBus\\V1\xe2\x02\x1cWhereChildBus\\V1\\GPBMetadata\xea\x02\x11WhereChildBus::V1b\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'where_child_bus.v1.station_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\026com.where_child_bus.v1B\014StationProtoP\001Zfgithub.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go/where_child_bus/v1;where_child_busv1\242\002\003WXX\252\002\020WhereChildBus.V1\312\002\020WhereChildBus\\V1\342\002\034WhereChildBus\\V1\\GPBMetadata\352\002\021WhereChildBus::V1' + _globals['_UPDATESTATIONLOCATIONBYGUARDIANIDREQUEST']._serialized_start=127 + _globals['_UPDATESTATIONLOCATIONBYGUARDIANIDREQUEST']._serialized_end=260 + _globals['_UPDATESTATIONLOCATIONBYGUARDIANIDRESPONSE']._serialized_start=262 + _globals['_UPDATESTATIONLOCATIONBYGUARDIANIDRESPONSE']._serialized_end=360 + _globals['_GETSTATIONLISTBYBUSIDREQUEST']._serialized_start=362 + _globals['_GETSTATIONLISTBYBUSIDREQUEST']._serialized_end=415 + _globals['_GETSTATIONLISTBYBUSIDRESPONSE']._serialized_start=418 + _globals['_GETSTATIONLISTBYBUSIDRESPONSE']._serialized_end=685 + _globals['_GETUNREGISTEREDSTATIONLISTREQUEST']._serialized_start=687 + _globals['_GETUNREGISTEREDSTATIONLISTREQUEST']._serialized_end=745 + _globals['_GETUNREGISTEREDSTATIONLISTRESPONSE']._serialized_start=748 + _globals['_GETUNREGISTEREDSTATIONLISTRESPONSE']._serialized_end=909 + _globals['_GETCORRECTORDERSTATIONLISTBYBUSIDREQUEST']._serialized_start=911 + _globals['_GETCORRECTORDERSTATIONLISTBYBUSIDREQUEST']._serialized_end=1032 + _globals['_GETCORRECTORDERSTATIONLISTBYBUSIDRESPONSE']._serialized_start=1034 + _globals['_GETCORRECTORDERSTATIONLISTBYBUSIDRESPONSE']._serialized_end=1136 + _globals['_UPDATESTATIONREQUEST']._serialized_start=1139 + _globals['_UPDATESTATIONREQUEST']._serialized_end=1319 + _globals['_UPDATESTATIONRESPONSE']._serialized_start=1321 + _globals['_UPDATESTATIONRESPONSE']._serialized_end=1399 + _globals['_STATIONSERVICE']._serialized_start=1402 + _globals['_STATIONSERVICE']._serialized_end=1951 +# @@protoc_insertion_point(module_scope) diff --git a/machine_learning/src/generated/where_child_bus/v1/station_pb2.pyi b/machine_learning/src/generated/where_child_bus/v1/station_pb2.pyi new file mode 100644 index 00000000..73edef11 --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/station_pb2.pyi @@ -0,0 +1,90 @@ +from where_child_bus.v1 import resources_pb2 as _resources_pb2 +from google.protobuf import field_mask_pb2 as _field_mask_pb2 +from google.protobuf.internal import containers as _containers +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class UpdateStationLocationByGuardianIdRequest(_message.Message): + __slots__ = ("guardian_id", "longitude", "latitude") + GUARDIAN_ID_FIELD_NUMBER: _ClassVar[int] + LONGITUDE_FIELD_NUMBER: _ClassVar[int] + LATITUDE_FIELD_NUMBER: _ClassVar[int] + guardian_id: str + longitude: float + latitude: float + def __init__(self, guardian_id: _Optional[str] = ..., longitude: _Optional[float] = ..., latitude: _Optional[float] = ...) -> None: ... + +class UpdateStationLocationByGuardianIdResponse(_message.Message): + __slots__ = ("station",) + STATION_FIELD_NUMBER: _ClassVar[int] + station: _resources_pb2.Station + def __init__(self, station: _Optional[_Union[_resources_pb2.Station, _Mapping]] = ...) -> None: ... + +class GetStationListByBusIdRequest(_message.Message): + __slots__ = ("bus_id",) + BUS_ID_FIELD_NUMBER: _ClassVar[int] + bus_id: str + def __init__(self, bus_id: _Optional[str] = ...) -> None: ... + +class GetStationListByBusIdResponse(_message.Message): + __slots__ = ("stations", "guardians", "children", "photos") + STATIONS_FIELD_NUMBER: _ClassVar[int] + GUARDIANS_FIELD_NUMBER: _ClassVar[int] + CHILDREN_FIELD_NUMBER: _ClassVar[int] + PHOTOS_FIELD_NUMBER: _ClassVar[int] + stations: _containers.RepeatedCompositeFieldContainer[_resources_pb2.Station] + guardians: _containers.RepeatedCompositeFieldContainer[_resources_pb2.GuardianResponse] + children: _containers.RepeatedCompositeFieldContainer[_resources_pb2.Child] + photos: _containers.RepeatedCompositeFieldContainer[_resources_pb2.ChildPhoto] + def __init__(self, stations: _Optional[_Iterable[_Union[_resources_pb2.Station, _Mapping]]] = ..., guardians: _Optional[_Iterable[_Union[_resources_pb2.GuardianResponse, _Mapping]]] = ..., children: _Optional[_Iterable[_Union[_resources_pb2.Child, _Mapping]]] = ..., photos: _Optional[_Iterable[_Union[_resources_pb2.ChildPhoto, _Mapping]]] = ...) -> None: ... + +class GetUnregisteredStationListRequest(_message.Message): + __slots__ = ("bus_id",) + BUS_ID_FIELD_NUMBER: _ClassVar[int] + bus_id: str + def __init__(self, bus_id: _Optional[str] = ...) -> None: ... + +class GetUnregisteredStationListResponse(_message.Message): + __slots__ = ("stations", "guardians") + STATIONS_FIELD_NUMBER: _ClassVar[int] + GUARDIANS_FIELD_NUMBER: _ClassVar[int] + stations: _containers.RepeatedCompositeFieldContainer[_resources_pb2.Station] + guardians: _containers.RepeatedCompositeFieldContainer[_resources_pb2.GuardianResponse] + def __init__(self, stations: _Optional[_Iterable[_Union[_resources_pb2.Station, _Mapping]]] = ..., guardians: _Optional[_Iterable[_Union[_resources_pb2.GuardianResponse, _Mapping]]] = ...) -> None: ... + +class GetCorrectOrderStationListByBusIdRequest(_message.Message): + __slots__ = ("bus_id", "bus_type") + BUS_ID_FIELD_NUMBER: _ClassVar[int] + BUS_TYPE_FIELD_NUMBER: _ClassVar[int] + bus_id: str + bus_type: _resources_pb2.BusType + def __init__(self, bus_id: _Optional[str] = ..., bus_type: _Optional[_Union[_resources_pb2.BusType, str]] = ...) -> None: ... + +class GetCorrectOrderStationListByBusIdResponse(_message.Message): + __slots__ = ("bus_route",) + BUS_ROUTE_FIELD_NUMBER: _ClassVar[int] + bus_route: _resources_pb2.BusRoute + def __init__(self, bus_route: _Optional[_Union[_resources_pb2.BusRoute, _Mapping]] = ...) -> None: ... + +class UpdateStationRequest(_message.Message): + __slots__ = ("id", "bus_id", "latitude", "longitude", "update_mask") + ID_FIELD_NUMBER: _ClassVar[int] + BUS_ID_FIELD_NUMBER: _ClassVar[int] + LATITUDE_FIELD_NUMBER: _ClassVar[int] + LONGITUDE_FIELD_NUMBER: _ClassVar[int] + UPDATE_MASK_FIELD_NUMBER: _ClassVar[int] + id: str + bus_id: str + latitude: float + longitude: float + update_mask: _field_mask_pb2.FieldMask + def __init__(self, id: _Optional[str] = ..., bus_id: _Optional[str] = ..., latitude: _Optional[float] = ..., longitude: _Optional[float] = ..., update_mask: _Optional[_Union[_field_mask_pb2.FieldMask, _Mapping]] = ...) -> None: ... + +class UpdateStationResponse(_message.Message): + __slots__ = ("station",) + STATION_FIELD_NUMBER: _ClassVar[int] + station: _resources_pb2.Station + def __init__(self, station: _Optional[_Union[_resources_pb2.Station, _Mapping]] = ...) -> None: ... diff --git a/machine_learning/src/generated/where_child_bus/v1/station_pb2_grpc.py b/machine_learning/src/generated/where_child_bus/v1/station_pb2_grpc.py new file mode 100644 index 00000000..236c8e8d --- /dev/null +++ b/machine_learning/src/generated/where_child_bus/v1/station_pb2_grpc.py @@ -0,0 +1,165 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from where_child_bus.v1 import station_pb2 as where__child__bus_dot_v1_dot_station__pb2 + + +class StationServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.UpdateStationLocationByGuardianId = channel.unary_unary( + '/where_child_bus.v1.StationService/UpdateStationLocationByGuardianId', + request_serializer=where__child__bus_dot_v1_dot_station__pb2.UpdateStationLocationByGuardianIdRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_station__pb2.UpdateStationLocationByGuardianIdResponse.FromString, + ) + self.GetStationListByBusId = channel.unary_unary( + '/where_child_bus.v1.StationService/GetStationListByBusId', + request_serializer=where__child__bus_dot_v1_dot_station__pb2.GetStationListByBusIdRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_station__pb2.GetStationListByBusIdResponse.FromString, + ) + self.GetUnregisteredStationList = channel.unary_unary( + '/where_child_bus.v1.StationService/GetUnregisteredStationList', + request_serializer=where__child__bus_dot_v1_dot_station__pb2.GetUnregisteredStationListRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_station__pb2.GetUnregisteredStationListResponse.FromString, + ) + self.UpdateStation = channel.unary_unary( + '/where_child_bus.v1.StationService/UpdateStation', + request_serializer=where__child__bus_dot_v1_dot_station__pb2.UpdateStationRequest.SerializeToString, + response_deserializer=where__child__bus_dot_v1_dot_station__pb2.UpdateStationResponse.FromString, + ) + + +class StationServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def UpdateStationLocationByGuardianId(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetStationListByBusId(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetUnregisteredStationList(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def UpdateStation(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_StationServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'UpdateStationLocationByGuardianId': grpc.unary_unary_rpc_method_handler( + servicer.UpdateStationLocationByGuardianId, + request_deserializer=where__child__bus_dot_v1_dot_station__pb2.UpdateStationLocationByGuardianIdRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_station__pb2.UpdateStationLocationByGuardianIdResponse.SerializeToString, + ), + 'GetStationListByBusId': grpc.unary_unary_rpc_method_handler( + servicer.GetStationListByBusId, + request_deserializer=where__child__bus_dot_v1_dot_station__pb2.GetStationListByBusIdRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_station__pb2.GetStationListByBusIdResponse.SerializeToString, + ), + 'GetUnregisteredStationList': grpc.unary_unary_rpc_method_handler( + servicer.GetUnregisteredStationList, + request_deserializer=where__child__bus_dot_v1_dot_station__pb2.GetUnregisteredStationListRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_station__pb2.GetUnregisteredStationListResponse.SerializeToString, + ), + 'UpdateStation': grpc.unary_unary_rpc_method_handler( + servicer.UpdateStation, + request_deserializer=where__child__bus_dot_v1_dot_station__pb2.UpdateStationRequest.FromString, + response_serializer=where__child__bus_dot_v1_dot_station__pb2.UpdateStationResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'where_child_bus.v1.StationService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class StationService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def UpdateStationLocationByGuardianId(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.StationService/UpdateStationLocationByGuardianId', + where__child__bus_dot_v1_dot_station__pb2.UpdateStationLocationByGuardianIdRequest.SerializeToString, + where__child__bus_dot_v1_dot_station__pb2.UpdateStationLocationByGuardianIdResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetStationListByBusId(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.StationService/GetStationListByBusId', + where__child__bus_dot_v1_dot_station__pb2.GetStationListByBusIdRequest.SerializeToString, + where__child__bus_dot_v1_dot_station__pb2.GetStationListByBusIdResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetUnregisteredStationList(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.StationService/GetUnregisteredStationList', + where__child__bus_dot_v1_dot_station__pb2.GetUnregisteredStationListRequest.SerializeToString, + where__child__bus_dot_v1_dot_station__pb2.GetUnregisteredStationListResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def UpdateStation(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/where_child_bus.v1.StationService/UpdateStation', + where__child__bus_dot_v1_dot_station__pb2.UpdateStationRequest.SerializeToString, + where__child__bus_dot_v1_dot_station__pb2.UpdateStationResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/machine_learning/src/proto-gen/README.md b/machine_learning/src/proto-gen/README.md new file mode 100644 index 00000000..575ebdd8 --- /dev/null +++ b/machine_learning/src/proto-gen/README.md @@ -0,0 +1,18 @@ +# proto-gen + +`proto-gen`は、gRPC と Protocol Buffers を使用して API を定義し、Python クライアントのために生成されたコードをまとめたディレクトリです + +## クライアントの実装例 + +`where_child_bus/v1`ディレクトリ内の`client.py`に API クライアントの実装例が含まれています。このクライアントを使用して、API を介してバスに乗っている子供の位置情報を取得することができます。 + +## gRPC ファイルの修正 + +生成された`*_grpc.py`ファイルには、いくつかの場合において import 文が不足している可能性があります。この問題は、`import grpc.experimental`を追加することで解決できます。 + +### 解決方法 + +1. `*_grpc.py`ファイルを開きます。 +2. ファイルの先頭に`import grpc.experimental`を追加します。 + +これにより、不足していた import による問題が解決され、ファイルが正常に機能するようになります。 diff --git a/machine_learning/src/proto-gen/machine_learning/v1/error_util.py b/machine_learning/src/proto-gen/machine_learning/v1/error_util.py new file mode 100644 index 00000000..5bec4097 --- /dev/null +++ b/machine_learning/src/proto-gen/machine_learning/v1/error_util.py @@ -0,0 +1,23 @@ +from google.protobuf import any_pb2 +from google.rpc import code_pb2 +from google.rpc import error_details_pb2 +from google.rpc import status_pb2 + + +def create_service_error_status(error_message): + detail = any_pb2.Any() + detail.Pack( + error_details_pb2.QuotaFailure( + violations=[ + error_details_pb2.QuotaFailure.Violation( + subject=f"error {error_message}", + description="some error occured. Please check the error message.", + ) + ], + ) + ) + return status_pb2.Status( + code=code_pb2.RESOURCE_EXHAUSTED, + message="some error occured. Please check the error message.", + details=[detail], + ) diff --git a/machine_learning/src/proto-gen/machine_learning/v1/server.py b/machine_learning/src/proto-gen/machine_learning/v1/server.py new file mode 100644 index 00000000..3d57e1c2 --- /dev/null +++ b/machine_learning/src/proto-gen/machine_learning/v1/server.py @@ -0,0 +1,176 @@ +import logging +from concurrent import futures +from typing import Iterable +import traceback + + +import grpc + +from grpc_status import rpc_status +from grpc_reflection.v1alpha import reflection + + +from generated.machine_learning.v1 import health_check_pb2 +from generated.machine_learning.v1 import health_check_pb2_grpc +from generated.machine_learning.v1 import machine_learning_pb2 +from generated.machine_learning.v1 import machine_learning_pb2_grpc +from generated.where_child_bus.v1 import bus_pb2 +from generated.machine_learning.v1.func_args import ( + FaceDetectAndClip_Args, + Pred_Args, + Train_Args, +) + +from error_util import create_service_error_status + + +from face_detect_model.DetectFaceAndClip.detectFaceAndClip import ( + main as detect_face_and_clip_fn, +) +from face_detect_model.main import main as train_fn +from face_detect_model.pred import main as pred_fn +from generated.machine_learning.v1 import ( + health_check_pb2, + health_check_pb2_grpc, + machine_learning_pb2, + machine_learning_pb2_grpc, +) +from generated.machine_learning.v1.func_args import ( + FaceDetectAndClip_Args, + Pred_Args, + Train_Args, +) +from generated.where_child_bus.v1 import bus_pb2 +from grpc_reflection.v1alpha import reflection + + +class HealthCheckServiceServer( + machine_learning_pb2_grpc.MachineLearningServiceServicer +): + def Ping(self, request: health_check_pb2.PingRequest, context): + logging.info("RECV: %s" % request.name) + message = "Hello, %s!" % request.name + logging.info("SEND: %s" % message) + return health_check_pb2.PingResponse(message=message) + + +# TODO: error handling +# TODO: 非同期処理 +class MachineLearningServiceServicer( + machine_learning_pb2_grpc.MachineLearningServiceServicer +): + def __init__(self): + self.pred_fn = pred_fn + self.train_fn = train_fn + self.detect_face_and_clip_fn = detect_face_and_clip_fn + + def Pred(self, request_iterator: Iterable[bus_pb2.StreamBusVideoRequest], context): + for request in request_iterator: + logging.info("Pred Service Start") + try: + params = Pred_Args( + nursery_id=request.nursery_id, + bus_id=request.bus_id, + bus_type=request.bus_type, + video_chunk=request.video_chunk, + photo_height=request.photo_height, + photo_width=request.photo_width, + vehicle_event=request.vehicle_event, + ) + child_ids = self.pred_fn(params) + is_detected = len(child_ids) > 0 + yield machine_learning_pb2.PredResponse( + is_detected=is_detected, child_ids=child_ids + ) + except Exception: + e = traceback.format_exc() + logging.error(e) + rich_status = create_service_error_status(e) + context.abort_with_status(rpc_status.to_status(rich_status)) + child_ids = [] + is_detected = len(child_ids) > 0 + yield machine_learning_pb2.PredResponse( + is_detected=is_detected, child_ids=child_ids + ) + + def Train(self, request: machine_learning_pb2.TrainRequest, context): + logging.info("Train Service Start") + try: + params = Train_Args( + nursery_id=request.nursery_id, + child_ids=request.child_ids, + bus_id=request.bus_id, + bus_type=request.bus_type, + seed=42, + mode="train", + ) + self.train_status = machine_learning_pb2.STATUS_PROCESSING + yield machine_learning_pb2.TrainResponse(status=self.train_status) + self.train_fn(params) + self.train_status = machine_learning_pb2.STATUS_SUCCESS + yield machine_learning_pb2.TrainResponse(status=self.train_status) + except Exception: + e = traceback.format_exc() + logging.error(e) + rich_status = create_service_error_status(e) + context.abort_with_status(rpc_status.to_status(rich_status)) + self.train_status = machine_learning_pb2.STATUS_FAILED + yield machine_learning_pb2.TrainResponse(status=self.train_status) + + def FaceDetectAndClip( + self, + request: machine_learning_pb2.FaceDetectAndClipRequest, + context, + ): + logging.info("FaceDetectAndClip Service Start") + params = FaceDetectAndClip_Args( + nursery_id=request.nursery_id, + child_id=request.child_id, + env="remote", + ) + try: + self.detect_face_and_clip_fn(params) + is_started = True + except Exception: + is_started = False + e = traceback.format_exc() + logging.error(e) + rich_status = create_service_error_status(e) + context.abort_with_status(rpc_status.to_status(rich_status)) + + return machine_learning_pb2.FaceDetectAndClipResponse(is_started=is_started) + + +def serve(): + bind_address = "[::]:8080" + server = grpc.server(futures.ThreadPoolExecutor()) + health_check_pb2_grpc.add_HealthcheckServiceServicer_to_server( + HealthCheckServiceServer(), server + ) + machine_learning_pb2_grpc.add_MachineLearningServiceServicer_to_server( + MachineLearningServiceServicer(), server + ) + service_names = ( + health_check_pb2.DESCRIPTOR.services_by_name["HealthcheckService"].full_name, + machine_learning_pb2.DESCRIPTOR.services_by_name[ + "MachineLearningService" + ].full_name, + reflection.SERVICE_NAME, + ) + reflection.enable_server_reflection(service_names, server) + + server.add_insecure_port(bind_address) + server.start() + logging.info("Listening on %s.", bind_address) + server.wait_for_termination() + + +if __name__ == "__main__": + logging.info("Called server.py") + # NOTE: https://github.com/grpc/grpc/issues/17321 + # gRPCのPython環境でloggingを使う場合、server起動前にlogging.basicConfig()を実行する必要がある + logging.basicConfig( + level=logging.INFO, + format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", + ) + serve() diff --git a/machine_learning/src/proto-gen/where_child_bus/v1/client.py b/machine_learning/src/proto-gen/where_child_bus/v1/client.py new file mode 100644 index 00000000..861770d3 --- /dev/null +++ b/machine_learning/src/proto-gen/where_child_bus/v1/client.py @@ -0,0 +1,13 @@ +import grpc +import health_check_pb2 +import health_check_pb2_grpc + +ENDPOINT = "where-child-bus-grpc-k3dkun2lpq-uw.a.run.app:443" +with grpc.secure_channel(ENDPOINT, grpc.ssl_channel_credentials()) as channel: + stub = health_check_pb2_grpc.HealthcheckServiceStub(channel) + request = health_check_pb2.PingRequest() + stub.Ping(request) + request.name = "ping" + response = stub.Ping(request) + print(response.message) + channel.close() diff --git a/machine_learning/src/proto-gen/where_child_bus/v1/healthcheck.py b/machine_learning/src/proto-gen/where_child_bus/v1/healthcheck.py new file mode 100644 index 00000000..94ffd38c --- /dev/null +++ b/machine_learning/src/proto-gen/where_child_bus/v1/healthcheck.py @@ -0,0 +1,20 @@ +import os +import sys + +# このスクリプトが存在するディレクトリの親ディレクトリを検索パスに追加 +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + +import grpc +import health_check_pb2 +import health_check_pb2_grpc + +# gRPCクライアントの設定 +client = grpc.insecure_channel("where-child-bus-grpc-k3dkun2lpq-uw.a.run.app:443") +stub = health_check_pb2_grpc.HealthcheckServiceStub(client) + +reqst = health_check_pb2.PingRequest() +reqst.name = "ping" + +res = health_check_pb2.PingResponse(stub.Ping(reqst)) + +print(res.message) diff --git a/proto/buf.gen.yaml b/proto/buf.gen.yaml new file mode 100644 index 00000000..1d2176eb --- /dev/null +++ b/proto/buf.gen.yaml @@ -0,0 +1,32 @@ +version: v1 +managed: + enabled: true + go_package_prefix: + default: github.com/GreenTeaProgrammers/WhereChildBus/backend/proto-gen/go +plugins: + # Go用の設定 (サーバー側) + - plugin: buf.build/protocolbuffers/go + out: ../backend/proto-gen/go + opt: + - paths=source_relative + - plugin: buf.build/grpc/go + out: ../backend/proto-gen/go + opt: + - paths=source_relative + - require_unimplemented_servers=false + + # Python用の設定 (クライアント側) + - plugin: buf.build/grpc/python:v1.61.0 + out: + ../machine_learning/src/generated/ + # dependencies + - plugin: buf.build/protocolbuffers/python:v25.2 + out: ../machine_learning/src/generated/ + - plugin: buf.build/protocolbuffers/pyi:v25.2 + out: ../machine_learning/src/generated/ + + # Dart用の設定 (クライアント側) + - name: dart + out: ../frontend/where_child_bus_api/lib/proto-gen/ + opt: + - grpc diff --git a/proto/buf.yaml b/proto/buf.yaml new file mode 100644 index 00000000..1a519456 --- /dev/null +++ b/proto/buf.yaml @@ -0,0 +1,7 @@ +version: v1 +breaking: + use: + - FILE +lint: + use: + - DEFAULT diff --git a/proto/machine_learning/v1/health_check.proto b/proto/machine_learning/v1/health_check.proto new file mode 100644 index 00000000..a8aae4c1 --- /dev/null +++ b/proto/machine_learning/v1/health_check.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package machine_learning.v1; + +service HealthcheckService { + rpc Ping(PingRequest) returns (PingResponse); +} + +message PingRequest { + string name = 1; +} + +message PingResponse { + string message = 1; +} diff --git a/proto/machine_learning/v1/machine_learning.proto b/proto/machine_learning/v1/machine_learning.proto new file mode 100644 index 00000000..fc652516 --- /dev/null +++ b/proto/machine_learning/v1/machine_learning.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; + +package machine_learning.v1; +import "where_child_bus/v1/bus.proto"; +import "where_child_bus/v1/resources.proto"; + +service MachineLearningService { + rpc Train(TrainRequest) returns (stream TrainResponse); + rpc Pred(stream where_child_bus.v1.StreamBusVideoRequest) returns (stream PredResponse); + rpc FaceDetectAndClip(FaceDetectAndClipRequest) returns (FaceDetectAndClipResponse); +} + + +message TrainRequest { + string nursery_id = 1; + string bus_id = 2; + repeated string child_ids = 3; + where_child_bus.v1.BusType bus_type = 4; +} + +message TrainResponse { + Status status = 1; +} + +message PredResponse { + bool is_detected = 1; + repeated string child_ids = 2; +} + +message FaceDetectAndClipRequest { + string nursery_id = 1; + string child_id = 2; +} + +message FaceDetectAndClipResponse { + bool is_started = 1; +} + +enum Status { + STATUS_UNSPECIFIED = 0; + STATUS_SUCCESS = 1; + STATUS_PROCESSING = 2; + STATUS_FAILED = 3; + STATUS_WAITING = 4; +} diff --git a/proto/where_child_bus/v1/bus.proto b/proto/where_child_bus/v1/bus.proto new file mode 100644 index 00000000..0b12d032 --- /dev/null +++ b/proto/where_child_bus/v1/bus.proto @@ -0,0 +1,106 @@ +syntax = "proto3"; + +package where_child_bus.v1; + +import "where_child_bus/v1/resources.proto"; +import "google/protobuf/field_mask.proto"; + +service BusService { + rpc CreateBus(CreateBusRequest) returns (CreateBusResponse); + rpc GetBusListByNurseryId(GetBusListByNurseryIdRequest) returns (GetBusListByNurseryIdResponse); + rpc GetRunningBusByGuardianId(GetRunningBusByGuardianIdRequest) returns (GetRunningBusByGuardianIdResponse); + rpc UpdateBus(UpdateBusRequest) returns (UpdateBusResponse); + rpc ChangeBusStatus(ChangeBusStatusRequest) returns (ChangeBusStatusResponse); + + rpc SendLocationContinuous(stream SendLocationContinuousRequest) returns (SendLocationContinuousResponse); + rpc TrackBusContinuous(TrackBusContinuousRequest) returns (stream TrackBusContinuousResponse); + rpc StreamBusVideo(stream StreamBusVideoRequest) returns (stream StreamBusVideoResponse); +} + +message CreateBusRequest { + string nursery_id = 1; + string name = 2; + string plate_number = 3; +} + +message CreateBusResponse { + Bus bus = 1; +} + +message GetBusListByNurseryIdRequest { + string nursery_id = 1; +} + +message GetBusListByNurseryIdResponse { + repeated Bus buses = 1; +} + +message GetRunningBusByGuardianIdRequest { + string guardian_id = 1; +} + +message GetRunningBusByGuardianIdResponse { + Bus bus = 1; +} + +message ChangeBusStatusRequest { + string bus_id = 1; + BusStatus bus_status = 2; + BusType bus_type = 3; +} + +message ChangeBusStatusResponse { + Bus bus = 1; +} + +// Updated and newly defined messages for the adjusted RPCs +message SendLocationContinuousRequest { + string bus_id = 1; + double latitude = 2; + double longitude = 3; +} + +message SendLocationContinuousResponse { + // Custom empty response type to conform to Protobuf style guide +} + +message TrackBusContinuousRequest { + string bus_id = 1; +} + +message TrackBusContinuousResponse { + string bus_id = 1; + double latitude = 2; + double longitude = 3; + string next_station_id = 4; +} + +message StreamBusVideoRequest { + string bus_id = 1; + string nursery_id = 2; + BusType bus_type = 3; + VehicleEvent vehicle_event = 4; + repeated bytes video_chunk = 5; // Chunk of video data + int32 photo_height = 6; + int32 photo_width = 7; +} + +message StreamBusVideoResponse { + bool is_detected = 1; + repeated Child children = 2; +} + +message UpdateBusRequest { + string bus_id = 1; + string name = 2; + string plate_number = 3; + double latitude = 4; + double longitude = 5; + bool enable_face_recognition = 6; + string next_station_id = 9; + google.protobuf.FieldMask update_mask = 10; +} + +message UpdateBusResponse { + Bus bus = 1; +} diff --git a/proto/where_child_bus/v1/bus_route.proto b/proto/where_child_bus/v1/bus_route.proto new file mode 100644 index 00000000..bd2e7a6d --- /dev/null +++ b/proto/where_child_bus/v1/bus_route.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package where_child_bus.v1; + +import "where_child_bus/v1/resources.proto"; + +service BusRouteService { + rpc CreateBusRoute(CreateBusRouteRequest) returns (CreateBusRouteResponse ); + rpc GetBusRouteByBusID(GetBusRouteByBusIDRequest) returns (GetBusRouteByBusIDResponse); +} + +message CreateBusRouteRequest { + string bus_id = 1; + BusType bus_type = 2; + string nursery_id = 3; // 機械学習サーバーにわたすため + repeated string guardian_ids = 4; +} + +message CreateBusRouteResponse { + BusRoute bus_route = 1; +} + +message GetBusRouteByBusIDRequest { + string bus_id = 1; + BusType bus_type = 2; +} + +message GetBusRouteByBusIDResponse { + BusRoute bus_route = 1; +} diff --git a/proto/where_child_bus/v1/child.proto b/proto/where_child_bus/v1/child.proto new file mode 100644 index 00000000..9665b390 --- /dev/null +++ b/proto/where_child_bus/v1/child.proto @@ -0,0 +1,84 @@ +syntax = "proto3"; + +package where_child_bus.v1; + +import "where_child_bus/v1/resources.proto"; +import "google/protobuf/field_mask.proto"; + +service ChildService { + rpc CreateChild(CreateChildRequest) returns (CreateChildResponse); + rpc GetChildListByNurseryID(GetChildListByNurseryIDRequest) returns (GetChildListByNurseryIDResponse); + rpc GetChildListByGuardianID(GetChildListByGuardianIDRequest) returns (GetChildListByGuardianIDResponse); + rpc GetChildListByBusID(GetChildListByBusIDRequest) returns (GetChildListByBusIDResponse); + rpc CheckIsChildInBus(CheckIsChildInBusRequest) returns (CheckIsChildInBusResponse); + rpc UpdateChild(UpdateChildRequest) returns (UpdateChildResponse); +} + + +message CreateChildRequest { + string nursery_id = 1; + string guardian_id = 2; + string name = 3; + int32 age = 4; + Sex sex =5; + repeated bytes photos = 6; +} + +message CreateChildResponse { + Child child = 1; +} + +message GetChildListByNurseryIDRequest { + string nursery_id = 1; +} + +message GetChildListByNurseryIDResponse { + repeated Child children = 1; + repeated ChildPhoto photos = 2; +} + +message GetChildListByGuardianIDRequest { + string guardian_id = 1; +} + +message GetChildListByGuardianIDResponse { + repeated Child children = 1; + repeated ChildPhoto photos = 2; +} + +message GetChildListByBusIDRequest { + string bus_id = 1; +} + +message GetChildListByBusIDResponse { + repeated Child children = 1; + repeated ChildPhoto photos = 2; +} + +message CheckIsChildInBusRequest { + string child_id = 1; +} + +message CheckIsChildInBusResponse { + bool is_in_bus = 1; +} + +message UpdateChildRequest { + string child_id = 1; + string name = 2; + int32 age = 3; + Sex sex = 4; + bool check_for_missing_items = 5; + bool has_bag = 6; + bool has_lunch_box = 7; + bool has_water_bottle = 8; + bool has_umbrella = 9; + bool has_other = 10; + google.protobuf.FieldMask update_mask = 11; +} + + +message UpdateChildResponse { + Child child = 1; +} + diff --git a/proto/where_child_bus/v1/child_photo.proto b/proto/where_child_bus/v1/child_photo.proto new file mode 100644 index 00000000..54d43166 --- /dev/null +++ b/proto/where_child_bus/v1/child_photo.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; + +package where_child_bus.v1; + +service ChildPhotoService { + rpc DuplicationCheck(DuplicationCheckRequest) returns (DuplicationCheckResponse); + rpc DeleteChildPhoto(DeleteChildPhotoRequest) returns (DeleteChildPhotoResponse); + rpc GetChildPhoto(GetChildPhotoRequest) returns (GetChildPhotoResponse); +} + +message DuplicationCheckRequest { + repeated string child_ids = 1; +} + +message DuplicationCheckResponse { + bool is_duplicated = 1; + repeated string photo_ids = 2; + repeated bytes duplicated_photos = 3; +} + +message DeleteChildPhotoRequest { + repeated string ids = 1; +} + +message DeleteChildPhotoResponse { + repeated bool is_success_list = 1; + repeated string ids = 2; +} + +message GetChildPhotoRequest { + string child_id = 1; +} + +message ChildPhotoResponse { + string child_photo_id = 1; + bytes photo = 2; +} + + +message GetChildPhotoResponse { + repeated ChildPhotoResponse child_photos = 1; +} diff --git a/proto/where_child_bus/v1/guardian.proto b/proto/where_child_bus/v1/guardian.proto new file mode 100644 index 00000000..2fb4a3f0 --- /dev/null +++ b/proto/where_child_bus/v1/guardian.proto @@ -0,0 +1,76 @@ +syntax = "proto3"; + +package where_child_bus.v1; + +import "where_child_bus/v1/resources.proto"; +import "google/protobuf/field_mask.proto"; + +service GuardianService { + rpc CreateGuardian(CreateGuardianRequest) returns (CreateGuardianResponse); + rpc GuardianLogin(GuardianLoginRequest) returns (GuardianLoginResponse); + rpc GetGuardianListByBusId(GetGuardianListByBusIdRequest) returns (GetGuardianListByBusIdResponse); + rpc GetGuardianByChildId(GetGuardianByChildIdRequest) returns (GetGuardianByChildIdResponse); + rpc GetGuardianListByNurseryId(GetGuardianListByNurseryIdRequest) returns (GetGuardianListByNurseryIdResponse); + rpc UpdateGuardian(UpdateGuardianRequest) returns (UpdateGuardianResponse); +} + +message CreateGuardianRequest { + string nursery_code = 1; + string email = 2; + string password = 3; + string name = 4; + string phone_number = 5; +} + +message CreateGuardianResponse{ + GuardianResponse guardian = 1; +} + +message GuardianLoginRequest { + string email = 1; + string password = 2; +} + +message GuardianLoginResponse { + bool success = 1; + GuardianResponse guardian = 2; + NurseryResponse nursery = 3; +} + +message GetGuardianListByBusIdRequest { + string bus_id = 1; +} + +message GetGuardianListByBusIdResponse { + repeated GuardianResponse guardians = 1; +} + +message GetGuardianByChildIdRequest { + string child_id = 1; +} + +message GetGuardianByChildIdResponse { + GuardianResponse guardian = 1; +} + +message GetGuardianListByNurseryIdRequest { + string nursery_id = 1; +} + +message GetGuardianListByNurseryIdResponse { + repeated GuardianResponse guardians = 1; +} + +message UpdateGuardianRequest { + string guardian_id = 1; + string name = 2; + string email = 3; + string phone_number = 4; + bool is_use_morning_bus = 5; + bool is_use_evening_bus = 6; + google.protobuf.FieldMask update_mask = 11; +} + +message UpdateGuardianResponse { + GuardianResponse guardian = 1; +} diff --git a/proto/where_child_bus/v1/health_check.proto b/proto/where_child_bus/v1/health_check.proto new file mode 100644 index 00000000..e6b57bfa --- /dev/null +++ b/proto/where_child_bus/v1/health_check.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package where_child_bus.v1; + +service HealthcheckService { + rpc Ping(PingRequest) returns (PingResponse); +} + +message PingRequest { + string name = 1; +} + +message PingResponse { + string message = 1; +} diff --git a/proto/where_child_bus/v1/nursery.proto b/proto/where_child_bus/v1/nursery.proto new file mode 100644 index 00000000..0f8b3250 --- /dev/null +++ b/proto/where_child_bus/v1/nursery.proto @@ -0,0 +1,58 @@ +syntax = "proto3"; + +package where_child_bus.v1; + +import "where_child_bus/v1/resources.proto"; +import "google/protobuf/field_mask.proto"; + +service NurseryService { + rpc GetNurseryByGuardianId(GetNurseryByGuardianIdRequest) returns (GetNurseryByGuardianIdResponse); + rpc CreateNursery(CreateNurseryRequest) returns (CreateNurseryResponse); + rpc NurseryLogin(NurseryLoginRequest) returns (NurseryLoginResponse); + rpc UpdateNursery(UpdateNurseryRequest) returns (UpdateNurseryResponse); +} + +message GetNurseryByGuardianIdRequest { + string guardian_id = 1; +} + +message GetNurseryByGuardianIdResponse { + NurseryResponse nurseries = 1; +} + +message CreateNurseryRequest { + string email = 1; + string password = 2; + string name = 3; + string phone_number = 4; + string address = 5; +} + +message CreateNurseryResponse { + NurseryResponse nursery = 1; +} + +message NurseryLoginRequest {; + string email = 1; + string password = 2; +} + +message NurseryLoginResponse { + bool success = 1; + NurseryResponse nursery = 2; +} + +message UpdateNurseryRequest { + string id = 1; + string name = 2; + string address = 3; + string phone_number = 4; + string email = 5; + string password = 6; + google.protobuf.FieldMask update_mask = 7; +} + +message UpdateNurseryResponse { + NurseryResponse nursery = 1; +} + diff --git a/proto/where_child_bus/v1/resources.proto b/proto/where_child_bus/v1/resources.proto new file mode 100644 index 00000000..2d866330 --- /dev/null +++ b/proto/where_child_bus/v1/resources.proto @@ -0,0 +1,152 @@ +syntax = "proto3"; + +package where_child_bus.v1; + +import "google/protobuf/timestamp.proto"; + +message Nursery { + string id = 1; + string nursery_code = 2; + string name = 3; + string address = 4; + string phone_number = 5; + string email = 6; + string hashed_password = 7; + google.protobuf.Timestamp created_at = 8; + google.protobuf.Timestamp updated_at = 9; +} + +message NurseryResponse { + string id = 1; + string nursery_code = 2; + string name = 3; + string address = 4; + string phone_number = 5; + string email = 6; + // ハッシュ化されたパスワードは除外 + google.protobuf.Timestamp created_at = 7; + google.protobuf.Timestamp updated_at = 8; +} + +message Guardian { + string id = 1; + string nursery_id = 2; + string name = 3; + string email = 4; + string phone_number = 5; + string hashed_password = 6; + bool is_use_morning_bus = 7; + bool is_use_evening_bus = 8; + google.protobuf.Timestamp created_at = 9; + google.protobuf.Timestamp updated_at =10; +} + +message GuardianResponse { + string id = 1; + string nursery_id = 2; + string name = 3; + string email = 4; + string phone_number = 5; + // ハッシュ化されたパスワードは除外 + bool is_use_morning_bus = 6; + bool is_use_evening_bus = 7; + google.protobuf.Timestamp created_at = 8; + google.protobuf.Timestamp updated_at = 9; +} + +enum BusStatus { + BUS_STATUS_UNSPECIFIED = 0; + BUS_STATUS_STOPPED = 1; + BUS_STATUS_RUNNING = 2; + BUS_STATUS_MAINTENANCE = 3; +} + +enum VehicleEvent { + VEHICLE_EVENT_UNSPECIFIED = 0; + VEHICLE_EVENT_GET_ON = 1; + VEHICLE_EVENT_GET_OFF = 2; +} + +message Bus { + string id = 1; + string nursery_id = 2; + string name = 3; + string plate_number = 4; + BusStatus bus_status = 5; + //緯度経度 + double latitude = 6; + double longitude = 7; + bool enable_face_recognition = 8; + string next_station_id = 11; + string latest_morning_route_id = 14; + string latest_evening_route_id = 15; + google.protobuf.Timestamp created_at = 12; + google.protobuf.Timestamp updated_at = 13; +} + +enum Sex { + SEX_UNSPECIFIED = 0; + SEX_MAN = 1; + SEX_WOMAN = 2; + SEX_OTHER = 3; +} + +message Child { + string id = 1; + string nursery_id = 2; + string guardian_id = 3; + string name = 4; + int32 age = 5; + Sex sex = 6; + bool check_for_missing_items = 7; + bool has_bag = 8; + bool has_lunch_box = 9; + bool has_water_bottle = 10; + bool has_umbrella = 11; + bool has_other = 12; + google.protobuf.Timestamp created_at = 13; + google.protobuf.Timestamp updated_at = 14; +} + +message Station { + string id = 1; + string guardian_id = 2; + double latitude = 5; + double longitude = 6; + google.protobuf.Timestamp created_at = 7; + google.protobuf.Timestamp updated_at = 8; +} + +enum BusType { + BUS_TYPE_UNSPECIFIED = 0; + BUS_TYPE_MORNING = 1; + BUS_TYPE_EVENING = 2; +} + +message ChildBusAssociation { + string bus_route_id = 1; + string child_id = 2; +} + +message ChildPhoto { + string id = 1; + string child_id = 2; + bytes photo_data = 3; + google.protobuf.Timestamp created_at = 4; + google.protobuf.Timestamp updated_at = 5; +} + +message BoardingRecord { + string id = 1; + string child_id = 2; + string bus_id = 3; + bool is_boarding = 4; + google.protobuf.Timestamp timestamp = 5; +} + +message BusRoute { + string id = 1; + string bus_id = 2; + repeated Station ordered_stations = 3; + BusType bus_type = 4; +} diff --git a/proto/where_child_bus/v1/station.proto b/proto/where_child_bus/v1/station.proto new file mode 100644 index 00000000..109ece91 --- /dev/null +++ b/proto/where_child_bus/v1/station.proto @@ -0,0 +1,64 @@ +syntax = "proto3"; + +package where_child_bus.v1; + +import "where_child_bus/v1/resources.proto"; +import "google/protobuf/field_mask.proto"; + +service StationService { + rpc UpdateStationLocationByGuardianId(UpdateStationLocationByGuardianIdRequest) returns (UpdateStationLocationByGuardianIdResponse); + rpc GetStationListByBusId(GetStationListByBusIdRequest) returns (GetStationListByBusIdResponse); + rpc GetUnregisteredStationList(GetUnregisteredStationListRequest) returns (GetUnregisteredStationListResponse); + rpc UpdateStation(UpdateStationRequest) returns (UpdateStationResponse); +} + +message UpdateStationLocationByGuardianIdRequest { + string guardian_id = 1; + double longitude = 2; + double latitude = 3; +} + +message UpdateStationLocationByGuardianIdResponse { + Station station = 1; +} + +message GetStationListByBusIdRequest { + string bus_id = 1; +} + +message GetStationListByBusIdResponse { + repeated Station stations = 1; + repeated GuardianResponse guardians = 2; + repeated Child children = 3; + repeated ChildPhoto photos = 4; +} + +message GetUnregisteredStationListRequest { + string bus_id = 1; +} + +message GetUnregisteredStationListResponse { + repeated Station stations = 1; + repeated GuardianResponse guardians = 2; +} + +message GetCorrectOrderStationListByBusIdRequest { + string bus_id = 1; + BusType bus_type = 2; +} + +message GetCorrectOrderStationListByBusIdResponse { + BusRoute bus_route = 1; +} + +message UpdateStationRequest { + string id = 1; + string bus_id = 2; + double latitude = 3; + double longitude = 4; + google.protobuf.FieldMask update_mask = 5; +} + +message UpdateStationResponse { + Station station = 1; +}