From 2808b5ad2af05d2bd835ca30f5388af91ae89626 Mon Sep 17 00:00:00 2001 From: amoghathimamula Date: Thu, 5 Feb 2026 18:21:31 -0500 Subject: [PATCH 1/6] feat: added trip pitches table --- .../20260205120000_create_trip_pitches.sql | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 backend/internal/migrations/20260205120000_create_trip_pitches.sql diff --git a/backend/internal/migrations/20260205120000_create_trip_pitches.sql b/backend/internal/migrations/20260205120000_create_trip_pitches.sql new file mode 100644 index 0000000..c649801 --- /dev/null +++ b/backend/internal/migrations/20260205120000_create_trip_pitches.sql @@ -0,0 +1,43 @@ +-- +goose Up +-- +goose StatementBegin +CREATE TABLE trip_pitches ( + id UUID PRIMARY KEY, + trip_id UUID NOT NULL, + user_id UUID NOT NULL, + title TEXT NOT NULL, + description TEXT, + audio_s3_key TEXT NOT NULL, + duration INTEGER, + created_at TIMESTAMP WITH TIME ZONE DEFAULT now(), + updated_at TIMESTAMP WITH TIME ZONE DEFAULT now(), + FOREIGN KEY (trip_id) REFERENCES trips(id) ON DELETE CASCADE, + FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE +); + +CREATE INDEX idx_trip_pitches_trip_id ON trip_pitches(trip_id); +CREATE INDEX idx_trip_pitches_user_id ON trip_pitches(user_id); +CREATE INDEX idx_trip_pitches_trip_created_id ON trip_pitches(trip_id, created_at DESC, id DESC); + +-- Create function to auto-update updated_at +CREATE OR REPLACE FUNCTION update_updated_at_column() +RETURNS TRIGGER AS $$ +BEGIN + NEW.updated_at = now(); + RETURN NEW; +END; +$$ language 'plpgsql'; + +-- Create trigger for trip_pitches table +CREATE TRIGGER update_trip_pitches_updated_at BEFORE UPDATE ON trip_pitches + FOR EACH ROW EXECUTE FUNCTION update_updated_at_column(); +-- +goose StatementEnd + +-- +goose Down +-- +goose StatementBegin +DROP TRIGGER IF EXISTS update_trip_pitches_updated_at ON trip_pitches; +DROP FUNCTION IF EXISTS update_updated_at_column(); +DROP INDEX IF EXISTS idx_trip_pitches_trip_created_id; +DROP INDEX IF EXISTS idx_trip_pitches_user_id; +DROP INDEX IF EXISTS idx_trip_pitches_trip_id; +DROP TABLE IF EXISTS trip_pitches; +-- +goose StatementEnd From b32e3f21cc70c3c0cf493248757a09be54799bed Mon Sep 17 00:00:00 2001 From: amoghathimamula Date: Thu, 5 Feb 2026 18:26:42 -0500 Subject: [PATCH 2/6] added go model for pitches, along with basic crud functions --- backend/internal/models/pitches.go | 62 ++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 backend/internal/models/pitches.go diff --git a/backend/internal/models/pitches.go b/backend/internal/models/pitches.go new file mode 100644 index 0000000..f50b432 --- /dev/null +++ b/backend/internal/models/pitches.go @@ -0,0 +1,62 @@ +package models + +import ( + "time" + + "github.com/google/uuid" +) + +type TripPitch struct { + ID uuid.UUID `bun:"id,pk,type:uuid" json:"id"` + TripID uuid.UUID `bun:"trip_id,type:uuid,notnull" json:"trip_id"` + UserID uuid.UUID `bun:"user_id,type:uuid,notnull" json:"user_id"` + Title string `bun:"title,notnull" json:"title"` + Description string `bun:"description" json:"description"` + AudioS3Key string `bun:"audio_s3_key,notnull" json:"audio_s3_key"` + Duration *int `bun:"duration" json:"duration,omitempty"` + CreatedAt time.Time `bun:"created_at,nullzero" json:"created_at"` + UpdatedAt time.Time `bun:"updated_at,nullzero" json:"updated_at"` +} + +type CreatePitchRequest struct { + Title string `validate:"required,min=1" json:"title"` + Description string `validate:"omitempty" json:"description"` + ContentType string `validate:"required,min=1" json:"content_type"` +} + +type UpdatePitchRequest struct { + Title *string `validate:"omitempty,min=1" json:"title"` + Description *string `validate:"omitempty" json:"description"` + Duration *int `validate:"omitempty,gte=0" json:"duration"` +} + +type PitchAPIResponse struct { + ID uuid.UUID `json:"id"` + TripID uuid.UUID `json:"trip_id"` + UserID uuid.UUID `json:"user_id"` + Title string `json:"title"` + Description string `json:"description"` + AudioURL string `json:"audio_url"` + Duration *int `json:"duration,omitempty"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` +} + +type CreatePitchResponse struct { + Pitch PitchAPIResponse `json:"pitch"` + UploadURL string `json:"upload_url"` + ExpiresAt string `json:"expires_at"` +} + +// PitchCursor is the sort key for cursor-based pagination (created_at DESC, id DESC). +type PitchCursor = TimeUUIDCursor + +type GetPitchesQueryParams struct { + CursorPaginationParams +} + +type PitchCursorPageResult struct { + Items []*PitchAPIResponse `json:"items"` + NextCursor *string `json:"next_cursor,omitempty"` + Limit int `json:"limit"` +} From 79f39e2816c98ad607108a1e273ad86d30a1819f Mon Sep 17 00:00:00 2001 From: amoghathimamula Date: Wed, 11 Feb 2026 00:16:53 -0500 Subject: [PATCH 3/6] feat: add pitch repository for trip pitches CRUD --- backend/internal/models/pitches.go | 2 + backend/internal/repository/pitches.go | 125 ++++++++++++++++++++++ backend/internal/repository/repository.go | 11 ++ 3 files changed, 138 insertions(+) create mode 100644 backend/internal/repository/pitches.go diff --git a/backend/internal/models/pitches.go b/backend/internal/models/pitches.go index f50b432..e945973 100644 --- a/backend/internal/models/pitches.go +++ b/backend/internal/models/pitches.go @@ -4,9 +4,11 @@ import ( "time" "github.com/google/uuid" + "github.com/uptrace/bun" ) type TripPitch struct { + bun.BaseModel `bun:"table:trip_pitches"` // need to specify table name so bun doesn't mess up and use wrong default (looks for trip_pitch insetead) ID uuid.UUID `bun:"id,pk,type:uuid" json:"id"` TripID uuid.UUID `bun:"trip_id,type:uuid,notnull" json:"trip_id"` UserID uuid.UUID `bun:"user_id,type:uuid,notnull" json:"user_id"` diff --git a/backend/internal/repository/pitches.go b/backend/internal/repository/pitches.go new file mode 100644 index 0000000..1a4cadf --- /dev/null +++ b/backend/internal/repository/pitches.go @@ -0,0 +1,125 @@ +package repository + +import ( + "context" + "database/sql" + "errors" + "toggo/internal/errs" + "toggo/internal/models" + + "github.com/google/uuid" + "github.com/uptrace/bun" +) + +var _ PitchRepository = (*pitchRepository)(nil) + +type pitchRepository struct { + db *bun.DB +} + +// Create inserts a new trip pitch and returns it (with ID and timestamps set). +func (r *pitchRepository) Create(ctx context.Context, pitch *models.TripPitch) (*models.TripPitch, error) { + _, err := r.db.NewInsert(). + Model(pitch). + Returning("*"). + Exec(ctx) + if err != nil { + return nil, err + } + return pitch, nil +} + +// FindByIDAndTripID fetches a pitch by id and trip_id (ensures the pitch belongs to the trip). +func (r *pitchRepository) FindByIDAndTripID(ctx context.Context, id, tripID uuid.UUID) (*models.TripPitch, error) { + pitch := &models.TripPitch{} + err := r.db.NewSelect(). + Model(pitch). + Where("id = ? AND trip_id = ?", id, tripID). + Scan(ctx) + if err != nil { + if errors.Is(err, sql.ErrNoRows) { + return nil, errs.ErrNotFound + } + return nil, err + } + return pitch, nil +} + +// FindByTripIDWithCursor returns pitches for a trip with cursor-based pagination (created_at DESC, id DESC). +func (r *pitchRepository) FindByTripIDWithCursor(ctx context.Context, tripID uuid.UUID, limit int, cursor *models.PitchCursor) ([]*models.TripPitch, *models.PitchCursor, error) { + query := r.db.NewSelect(). + Model((*models.TripPitch)(nil)). + Where("trip_id = ?", tripID). + OrderExpr("created_at DESC, id DESC"). + Limit(limit + 1) + + if cursor != nil { + query = query.Where("(created_at, id) < (?, ?)", cursor.CreatedAt, cursor.ID) + } + + var pitches []*models.TripPitch + if err := query.Scan(ctx, &pitches); err != nil { + return nil, nil, err + } + + var nextCursor *models.PitchCursor + if len(pitches) > limit { + last := pitches[limit-1] + nextCursor = &models.PitchCursor{CreatedAt: last.CreatedAt, ID: last.ID} + pitches = pitches[:limit] + } + + return pitches, nextCursor, nil +} + +// Update applies partial updates to a pitch (only non-nil fields). Pitch must belong to the given trip. +func (r *pitchRepository) Update(ctx context.Context, id, tripID uuid.UUID, req *models.UpdatePitchRequest) (*models.TripPitch, error) { + upd := r.db.NewUpdate(). + Model((*models.TripPitch)(nil)). + Where("id = ? AND trip_id = ?", id, tripID) + + if req.Title != nil { + upd = upd.Set("title = ?", *req.Title) + } + if req.Description != nil { + upd = upd.Set("description = ?", *req.Description) + } + if req.Duration != nil { + upd = upd.Set("duration = ?", *req.Duration) + } + + result, err := upd.Exec(ctx) + if err != nil { + return nil, err + } + rowsAffected, _ := result.RowsAffected() + if rowsAffected == 0 { + return nil, errs.ErrNotFound + } + + pitch := &models.TripPitch{} + err = r.db.NewSelect(). + Model(pitch). + Where("id = ? AND trip_id = ?", id, tripID). + Scan(ctx) + if err != nil { + return nil, err + } + return pitch, nil +} + +// Delete removes a pitch by id and trip_id. Returns ErrNotFound if no row was deleted. +func (r *pitchRepository) Delete(ctx context.Context, id, tripID uuid.UUID) error { + result, err := r.db.NewDelete(). + Model((*models.TripPitch)(nil)). + Where("id = ? AND trip_id = ?", id, tripID). + Exec(ctx) + if err != nil { + return err + } + rows, _ := result.RowsAffected() + if rows == 0 { + return errs.ErrNotFound + } + return nil +} diff --git a/backend/internal/repository/repository.go b/backend/internal/repository/repository.go index 81ded4c..6a8282d 100644 --- a/backend/internal/repository/repository.go +++ b/backend/internal/repository/repository.go @@ -16,6 +16,7 @@ type Repository struct { Comment CommentRepository Membership MembershipRepository Trip TripRepository + Pitch PitchRepository db *bun.DB } @@ -27,6 +28,7 @@ func NewRepository(db *bun.DB) *Repository { Comment: &commentRepository{db: db}, Trip: &tripRepository{db: db}, Membership: &membershipRepository{db: db}, + Pitch: &pitchRepository{db: db}, db: db, } } @@ -90,3 +92,12 @@ type CommentRepository interface { Delete(ctx context.Context, id uuid.UUID, userID uuid.UUID) error FindPaginatedComments(ctx context.Context, tripID uuid.UUID, entityType models.EntityType, entityID uuid.UUID, limit int, cursor *models.CommentCursor) ([]*models.CommentDatabaseResponse, error) } + +// PitchRepository handles persistence for trip pitches (audio pitches per trip). +type PitchRepository interface { + Create(ctx context.Context, pitch *models.TripPitch) (*models.TripPitch, error) + FindByIDAndTripID(ctx context.Context, id, tripID uuid.UUID) (*models.TripPitch, error) + FindByTripIDWithCursor(ctx context.Context, tripID uuid.UUID, limit int, cursor *models.PitchCursor) ([]*models.TripPitch, *models.PitchCursor, error) + Update(ctx context.Context, id, tripID uuid.UUID, req *models.UpdatePitchRequest) (*models.TripPitch, error) + Delete(ctx context.Context, id, tripID uuid.UUID) error +} From 19dafc8746d755818b2ccc34e83a4cdbd3c22e68 Mon Sep 17 00:00:00 2001 From: amoghathimamula Date: Fri, 13 Feb 2026 17:29:06 -0500 Subject: [PATCH 4/6] feat: add trip_pitches table, models, and pitch repository --- backend/internal/controllers/pitches.go | 214 +++++++++++++++++++++ backend/internal/server/routers/trips.go | 16 ++ backend/internal/services/pitches.go | 230 +++++++++++++++++++++++ 3 files changed, 460 insertions(+) create mode 100644 backend/internal/controllers/pitches.go create mode 100644 backend/internal/services/pitches.go diff --git a/backend/internal/controllers/pitches.go b/backend/internal/controllers/pitches.go new file mode 100644 index 0000000..08cc1dc --- /dev/null +++ b/backend/internal/controllers/pitches.go @@ -0,0 +1,214 @@ +package controllers + +import ( + "errors" + "net/http" + "toggo/internal/errs" + "toggo/internal/models" + "toggo/internal/services" + "toggo/internal/utilities" + "toggo/internal/validators" + + "github.com/go-playground/validator/v10" + "github.com/gofiber/fiber/v2" +) + +type PitchController struct { + pitchService services.PitchServiceInterface + validator *validator.Validate +} + +func NewPitchController(pitchService services.PitchServiceInterface, validator *validator.Validate) *PitchController { + return &PitchController{ + pitchService: pitchService, + validator: validator, + } +} + +// @Summary Create a pitch +// @Description Creates a new pitch for the trip and returns a presigned URL to upload the audio file +// @Tags pitches +// @Accept json +// @Produce json +// @Param tripID path string true "Trip ID" +// @Param request body models.CreatePitchRequest true "Create pitch request" +// @Success 201 {object} models.CreatePitchResponse +// @Failure 400 {object} errs.APIError +// @Failure 403 {object} errs.APIError +// @Failure 422 {object} errs.APIError +// @Failure 500 {object} errs.APIError +// @Router /api/v1/trips/{tripID}/pitches [post] +// @ID createPitch +func (ctrl *PitchController) CreatePitch(c *fiber.Ctx) error { + userIDValue := c.Locals("userID") + if userIDValue == nil { + return errs.Unauthorized() + } + userIDStr, ok := userIDValue.(string) + if !ok { + return errs.Unauthorized() + } + userID, err := validators.ValidateID(userIDStr) + if err != nil { + return errs.Unauthorized() + } + + tripID, err := validators.ValidateID(c.Params("tripID")) + if err != nil { + return errs.InvalidUUID() + } + + var req models.CreatePitchRequest + if err := c.BodyParser(&req); err != nil { + return errs.InvalidJSON() + } + if err := validators.Validate(ctrl.validator, req); err != nil { + return err + } + + resp, err := ctrl.pitchService.Create(c.Context(), tripID, userID, req) + if err != nil { + return err + } + return c.Status(http.StatusCreated).JSON(resp) +} + +// @Summary Get all pitches for a trip +// @Description Returns pitches for the trip with cursor-based pagination +// @Tags pitches +// @Produce json +// @Param tripID path string true "Trip ID" +// @Param limit query int false "Max items per page (default 20, max 100)" +// @Param cursor query string false "Opaque cursor from previous response next_cursor" +// @Success 200 {object} models.PitchCursorPageResult +// @Failure 400 {object} errs.APIError +// @Failure 404 {object} errs.APIError +// @Failure 500 {object} errs.APIError +// @Router /api/v1/trips/{tripID}/pitches [get] +// @ID listPitches +func (ctrl *PitchController) ListPitches(c *fiber.Ctx) error { + tripID, err := validators.ValidateID(c.Params("tripID")) + if err != nil { + return errs.InvalidUUID() + } + + var params models.GetPitchesQueryParams + if err := utilities.ParseAndValidateQueryParams(c, ctrl.validator, ¶ms); err != nil { + return err + } + limit, cursorToken := utilities.ExtractLimitAndCursor(¶ms) + + result, err := ctrl.pitchService.List(c.Context(), tripID, limit, cursorToken) + if err != nil { + if errors.Is(err, errs.ErrInvalidCursor) { + return errs.BadRequest(err) + } + return err + } + return c.Status(http.StatusOK).JSON(result) +} + +// @Summary Get a pitch by ID +// @Description Returns a single pitch with a presigned URL for the audio file +// @Tags pitches +// @Produce json +// @Param tripID path string true "Trip ID" +// @Param pitchID path string true "Pitch ID" +// @Success 200 {object} models.PitchAPIResponse +// @Failure 400 {object} errs.APIError +// @Failure 404 {object} errs.APIError +// @Failure 500 {object} errs.APIError +// @Router /api/v1/trips/{tripID}/pitches/{pitchID} [get] +// @ID getPitch +func (ctrl *PitchController) GetPitch(c *fiber.Ctx) error { + tripID, err := validators.ValidateID(c.Params("tripID")) + if err != nil { + return errs.InvalidUUID() + } + pitchID, err := validators.ValidateID(c.Params("pitchID")) + if err != nil { + return errs.InvalidUUID() + } + + pitch, err := ctrl.pitchService.GetByID(c.Context(), tripID, pitchID) + if err != nil { + if errs.IsNotFound(err) { + return errs.NewAPIError(http.StatusNotFound, err) + } + return err + } + return c.Status(http.StatusOK).JSON(pitch) +} + +// @Summary Update a pitch +// @Description Updates pitch metadata (title, description, duration) +// @Tags pitches +// @Accept json +// @Produce json +// @Param tripID path string true "Trip ID" +// @Param pitchID path string true "Pitch ID" +// @Param request body models.UpdatePitchRequest true "Update pitch request" +// @Success 200 {object} models.PitchAPIResponse +// @Failure 400 {object} errs.APIError +// @Failure 404 {object} errs.APIError +// @Failure 422 {object} errs.APIError +// @Failure 500 {object} errs.APIError +// @Router /api/v1/trips/{tripID}/pitches/{pitchID} [patch] +// @ID updatePitch +func (ctrl *PitchController) UpdatePitch(c *fiber.Ctx) error { + tripID, err := validators.ValidateID(c.Params("tripID")) + if err != nil { + return errs.InvalidUUID() + } + pitchID, err := validators.ValidateID(c.Params("pitchID")) + if err != nil { + return errs.InvalidUUID() + } + + var req models.UpdatePitchRequest + if err := c.BodyParser(&req); err != nil { + return errs.InvalidJSON() + } + if err := validators.Validate(ctrl.validator, req); err != nil { + return err + } + + pitch, err := ctrl.pitchService.Update(c.Context(), tripID, pitchID, req) + if err != nil { + if errs.IsNotFound(err) { + return errs.NewAPIError(http.StatusNotFound, err) + } + return err + } + return c.Status(http.StatusOK).JSON(pitch) +} + +// @Summary Delete a pitch +// @Description Deletes a pitch by ID +// @Tags pitches +// @Param tripID path string true "Trip ID" +// @Param pitchID path string true "Pitch ID" +// @Success 204 "No Content" +// @Failure 400 {object} errs.APIError +// @Failure 404 {object} errs.APIError +// @Failure 500 {object} errs.APIError +// @Router /api/v1/trips/{tripID}/pitches/{pitchID} [delete] +// @ID deletePitch +func (ctrl *PitchController) DeletePitch(c *fiber.Ctx) error { + tripID, err := validators.ValidateID(c.Params("tripID")) + if err != nil { + return errs.InvalidUUID() + } + pitchID, err := validators.ValidateID(c.Params("pitchID")) + if err != nil { + return errs.InvalidUUID() + } + + if err := ctrl.pitchService.Delete(c.Context(), tripID, pitchID); err != nil { + if errs.IsNotFound(err) { + return errs.NewAPIError(http.StatusNotFound, err) + } + return err + } + return c.SendStatus(http.StatusNoContent) +} diff --git a/backend/internal/server/routers/trips.go b/backend/internal/server/routers/trips.go index 747cb00..8d15864 100644 --- a/backend/internal/server/routers/trips.go +++ b/backend/internal/server/routers/trips.go @@ -17,6 +17,15 @@ func TripRoutes(apiGroup fiber.Router, routeParams types.RouteParams) fiber.Rout ) tripController := controllers.NewTripController(tripService, routeParams.Validator) + awsCfg := routeParams.ServiceParams.Config.AWS + pitchService := services.NewPitchService(services.PitchServiceConfig{ + PresignClient: awsCfg.PresignClient, + PitchRepo: routeParams.ServiceParams.Repository.Pitch, + MembershipRepo: routeParams.ServiceParams.Repository.Membership, + BucketName: awsCfg.BucketName, + }) + pitchController := controllers.NewPitchController(pitchService, routeParams.Validator) + // /api/v1/trips tripGroup := apiGroup.Group("/trips") tripGroup.Post("", tripController.CreateTrip) @@ -29,5 +38,12 @@ func TripRoutes(apiGroup fiber.Router, routeParams types.RouteParams) fiber.Rout tripIDGroup.Patch("", tripController.UpdateTrip) tripIDGroup.Delete("", tripController.DeleteTrip) + // /api/v1/trips/:tripID/pitches + tripIDGroup.Post("/pitches", pitchController.CreatePitch) + tripIDGroup.Get("/pitches", pitchController.ListPitches) + tripIDGroup.Get("/pitches/:pitchID", pitchController.GetPitch) + tripIDGroup.Patch("/pitches/:pitchID", pitchController.UpdatePitch) + tripIDGroup.Delete("/pitches/:pitchID", pitchController.DeletePitch) + return tripGroup } diff --git a/backend/internal/services/pitches.go b/backend/internal/services/pitches.go new file mode 100644 index 0000000..3083518 --- /dev/null +++ b/backend/internal/services/pitches.go @@ -0,0 +1,230 @@ +package services + +import ( + "context" + "fmt" + "strings" + "time" + "toggo/internal/errs" + "toggo/internal/interfaces" + "toggo/internal/models" + "toggo/internal/repository" + "toggo/internal/utilities/pagination" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/s3" + "github.com/google/uuid" +) + +// PitchServiceInterface defines business logic for trip pitches (create, get, list, update, delete). +type PitchServiceInterface interface { + Create(ctx context.Context, tripID, userID uuid.UUID, req models.CreatePitchRequest) (*models.CreatePitchResponse, error) + GetByID(ctx context.Context, tripID, pitchID uuid.UUID) (*models.PitchAPIResponse, error) + List(ctx context.Context, tripID uuid.UUID, limit int, cursorToken string) (*models.PitchCursorPageResult, error) + Update(ctx context.Context, tripID, pitchID uuid.UUID, req models.UpdatePitchRequest) (*models.PitchAPIResponse, error) + Delete(ctx context.Context, tripID, pitchID uuid.UUID) error +} + +var _ PitchServiceInterface = (*PitchService)(nil) + +type PitchService struct { + presignClient interfaces.S3PresignClient + pitchRepo repository.PitchRepository + membershipRepo repository.MembershipRepository + bucketName string + urlExpiration time.Duration +} + +type PitchServiceConfig struct { + PresignClient interfaces.S3PresignClient + PitchRepo repository.PitchRepository + MembershipRepo repository.MembershipRepository + BucketName string + URLExpiration time.Duration +} + +func NewPitchService(cfg PitchServiceConfig) PitchServiceInterface { + expiration := cfg.URLExpiration + if expiration == 0 { + expiration = 15 * time.Minute + } + return &PitchService{ + presignClient: cfg.PresignClient, + pitchRepo: cfg.PitchRepo, + membershipRepo: cfg.MembershipRepo, + bucketName: cfg.BucketName, + urlExpiration: expiration, + } +} + +// Create creates a pitch record and returns metadata plus a presigned PUT URL for uploading the audio file. +func (s *PitchService) Create(ctx context.Context, tripID, userID uuid.UUID, req models.CreatePitchRequest) (*models.CreatePitchResponse, error) { + isMember, err := s.membershipRepo.IsMember(ctx, tripID, userID) + if err != nil { + return nil, err + } + if !isMember { + return nil, errs.Forbidden() + } + + pitchID := uuid.New() + ext := extensionFromContentType(req.ContentType) + // Single bucket, folder layout per ticket: trips/:tripId/pitches (e.g. profile_pictures/ elsewhere) + audioKey := fmt.Sprintf("trips/%s/pitches/%s.%s", tripID.String(), pitchID.String(), ext) + + pitch := &models.TripPitch{ + ID: pitchID, + TripID: tripID, + UserID: userID, + Title: req.Title, + Description: req.Description, + AudioS3Key: audioKey, + } + created, err := s.pitchRepo.Create(ctx, pitch) + if err != nil { + return nil, fmt.Errorf("create pitch: %w", err) + } + + presigned, err := s.presignClient.PresignPutObject(ctx, &s3.PutObjectInput{ + Bucket: aws.String(s.bucketName), + Key: aws.String(audioKey), + ContentType: aws.String(req.ContentType), + }, s3.WithPresignExpires(s.urlExpiration)) + if err != nil { + return nil, fmt.Errorf("presign upload URL: %w", err) + } + + expiresAt := time.Now().Add(s.urlExpiration).UTC().Format(time.RFC3339) + apiPitch := pitchToAPIResponse(created, "") // no download URL until audio is uploaded + return &models.CreatePitchResponse{ + Pitch: apiPitch, + UploadURL: presigned.URL, + ExpiresAt: expiresAt, + }, nil +} + +// GetByID returns a pitch by id and trip id with a presigned GET URL for the audio file. +func (s *PitchService) GetByID(ctx context.Context, tripID, pitchID uuid.UUID) (*models.PitchAPIResponse, error) { + pitch, err := s.pitchRepo.FindByIDAndTripID(ctx, pitchID, tripID) + if err != nil { + return nil, err + } + audioURL, err := s.presignGetURL(ctx, pitch.AudioS3Key) + if err != nil { + return nil, fmt.Errorf("presign download URL: %w", err) + } + resp := pitchToAPIResponse(pitch, audioURL) + return &resp, nil +} + +// List returns pitches for a trip with cursor-based pagination; each item includes a presigned audio URL. +func (s *PitchService) List(ctx context.Context, tripID uuid.UUID, limit int, cursorToken string) (*models.PitchCursorPageResult, error) { + if limit <= 0 { + limit = 20 + } + if limit > 100 { + limit = 100 + } + + var cursor *models.PitchCursor + if cursorToken != "" { + decoded, err := pagination.DecodeTimeUUIDCursor(cursorToken) + if err != nil { + return nil, err + } + cursor = decoded + } + + pitches, nextCursor, err := s.pitchRepo.FindByTripIDWithCursor(ctx, tripID, limit, cursor) + if err != nil { + return nil, err + } + + items := make([]*models.PitchAPIResponse, 0, len(pitches)) + for _, p := range pitches { + audioURL, err := s.presignGetURL(ctx, p.AudioS3Key) + if err != nil { + return nil, fmt.Errorf("presign download URL for pitch %s: %w", p.ID, err) + } + resp := pitchToAPIResponse(p, audioURL) + items = append(items, &resp) + } + + var nextCursorStr *string + if nextCursor != nil { + token, err := pagination.EncodeTimeUUIDCursorFromValues(nextCursor.CreatedAt, nextCursor.ID) + if err != nil { + return nil, err + } + nextCursorStr = &token + } + + return &models.PitchCursorPageResult{ + Items: items, + NextCursor: nextCursorStr, + Limit: limit, + }, nil +} + +// Update updates pitch metadata (title, description, duration) and returns the updated pitch with presigned audio URL. +func (s *PitchService) Update(ctx context.Context, tripID, pitchID uuid.UUID, req models.UpdatePitchRequest) (*models.PitchAPIResponse, error) { + updated, err := s.pitchRepo.Update(ctx, pitchID, tripID, &req) + if err != nil { + return nil, err + } + audioURL, err := s.presignGetURL(ctx, updated.AudioS3Key) + if err != nil { + return nil, fmt.Errorf("presign download URL: %w", err) + } + resp := pitchToAPIResponse(updated, audioURL) + return &resp, nil +} + +// Delete removes a pitch by id and trip id. +func (s *PitchService) Delete(ctx context.Context, tripID, pitchID uuid.UUID) error { + return s.pitchRepo.Delete(ctx, pitchID, tripID) +} + +func (s *PitchService) presignGetURL(ctx context.Context, key string) (string, error) { + presigned, err := s.presignClient.PresignGetObject(ctx, &s3.GetObjectInput{ + Bucket: aws.String(s.bucketName), + Key: aws.String(key), + }, s3.WithPresignExpires(s.urlExpiration)) + if err != nil { + return "", err + } + return presigned.URL, nil +} + +func pitchToAPIResponse(p *models.TripPitch, audioURL string) models.PitchAPIResponse { + return models.PitchAPIResponse{ + ID: p.ID, + TripID: p.TripID, + UserID: p.UserID, + Title: p.Title, + Description: p.Description, + AudioURL: audioURL, + Duration: p.Duration, + CreatedAt: p.CreatedAt, + UpdatedAt: p.UpdatedAt, + } +} + +// extensionFromContentType returns a file extension for common audio MIME types. +func extensionFromContentType(contentType string) string { + contentType = strings.TrimSpace(strings.ToLower(contentType)) + switch { + case strings.HasSuffix(contentType, "m4a"), contentType == "audio/mp4": + return "m4a" + case strings.HasSuffix(contentType, "mpeg"), strings.HasSuffix(contentType, "mp3"): + return "mp3" + case strings.HasSuffix(contentType, "wav"): + return "wav" + case strings.HasSuffix(contentType, "ogg"): + return "ogg" + case strings.HasSuffix(contentType, "webm"): + return "webm" + default: + return "m4a" + } +} From 66ce5c5e9f1eb9e9e7137198c1f10b2835db2ee1 Mon Sep 17 00:00:00 2001 From: amoghathimamula Date: Fri, 13 Feb 2026 18:04:41 -0500 Subject: [PATCH 5/6] feat: regenerated swagger api docs and frontend types --- backend/docs/docs.go | 396 +++ backend/docs/swagger.json | 396 +++ backend/docs/swagger.yaml | 267 ++ frontend/api/comments/index.ts | 2 +- frontend/api/comments/useCreateComment.ts | 171 +- frontend/api/comments/useDeleteComment.ts | 138 +- .../api/comments/useGetPaginatedComments.ts | 191 +- .../useGetPaginatedCommentsSuspense.ts | 195 +- frontend/api/comments/useUpdateComment.ts | 188 +- frontend/api/example/index.ts | 2 +- frontend/api/example/useHealthcheck.ts | 115 +- .../api/example/useHealthcheckSuspense.ts | 116 +- frontend/api/files/index.ts | 2 +- frontend/api/files/useCheckS3Health.ts | 116 +- .../api/files/useCheckS3HealthSuspense.ts | 116 +- frontend/api/files/useConfirmUpload.ts | 149 +- frontend/api/files/useCreateUploadURLs.ts | 146 +- frontend/api/files/useGetFile.ts | 139 +- frontend/api/files/useGetFileAllSizes.ts | 135 +- .../api/files/useGetFileAllSizesSuspense.ts | 134 +- frontend/api/files/useGetFileSuspense.ts | 140 +- frontend/api/index.ts | 37 +- frontend/api/memberships/index.ts | 2 +- frontend/api/memberships/useAddMember.ts | 142 +- .../api/memberships/useDemoteFromAdmin.ts | 170 +- frontend/api/memberships/useGetMembership.ts | 152 +- .../memberships/useGetMembershipSuspense.ts | 152 +- frontend/api/memberships/useGetTripMembers.ts | 161 +- .../memberships/useGetTripMembersSuspense.ts | 161 +- frontend/api/memberships/usePromoteToAdmin.ts | 170 +- frontend/api/memberships/useRemoveMember.ts | 149 +- .../api/memberships/useUpdateMembership.ts | 195 +- frontend/api/notifications/index.ts | 2 +- .../notifications/useSendBulkNotification.ts | 158 +- .../api/notifications/useSendNotification.ts | 146 +- frontend/api/pitches/index.ts | 35 + frontend/api/pitches/useCreatePitch.ts | 62 + frontend/api/pitches/useDeletePitch.ts | 60 + frontend/api/pitches/useGetPitch.ts | 64 + frontend/api/pitches/useGetPitchSuspense.ts | 64 + frontend/api/pitches/useListPitches.ts | 64 + .../api/pitches/useListPitchesSuspense.ts | 64 + frontend/api/pitches/useUpdatePitch.ts | 62 + frontend/api/trips/index.ts | 2 +- frontend/api/trips/useCreateTrip.ts | 141 +- frontend/api/trips/useDeleteTrip.ts | 127 +- frontend/api/trips/useGetAllTrips.ts | 123 +- frontend/api/trips/useGetAllTripsSuspense.ts | 125 +- frontend/api/trips/useGetTrip.ts | 124 +- frontend/api/trips/useGetTripSuspense.ts | 124 +- frontend/api/trips/useUpdateTrip.ts | 184 +- frontend/api/users/index.ts | 2 +- frontend/api/users/useCreateUser.ts | 128 +- frontend/api/users/useDeleteUser.ts | 114 +- frontend/api/users/useGetCurrentUser.ts | 127 +- .../api/users/useGetCurrentUserSuspense.ts | 127 +- frontend/api/users/useGetUser.ts | 124 +- frontend/api/users/useGetUserSuspense.ts | 124 +- frontend/api/users/useUpdateUser.ts | 159 +- frontend/index.ts | 37 +- frontend/schemas/errsAPIError.json | 6 +- frontend/schemas/modelsComment.json | 20 +- .../schemas/modelsCommentAPIResponse.json | 25 +- .../schemas/modelsConfirmUploadRequest.json | 24 +- .../schemas/modelsConfirmUploadResponse.json | 10 +- .../schemas/modelsCreateCommentRequest.json | 22 +- .../modelsCreateMembershipRequest.json | 13 +- .../schemas/modelsCreatePitchRequest.json | 1 + .../schemas/modelsCreatePitchResponse.json | 1 + frontend/schemas/modelsCreateTripRequest.json | 12 +- frontend/schemas/modelsCreateUserRequest.json | 11 +- frontend/schemas/modelsEntityType.json | 7 +- .../modelsGetFileAllSizesResponse.json | 30 +- frontend/schemas/modelsGetFileResponse.json | 20 +- frontend/schemas/modelsImageSize.json | 7 +- frontend/schemas/modelsMembership.json | 15 +- .../schemas/modelsMembershipAPIResponse.json | 17 +- .../modelsMembershipCursorPageResult.json | 28 +- frontend/schemas/modelsNotificationError.json | 10 +- .../schemas/modelsNotificationResponse.json | 21 +- .../modelsPaginatedCommentsResponse.json | 36 +- frontend/schemas/modelsPitchAPIResponse.json | 1 + .../schemas/modelsPitchCursorPageResult.json | 1 + .../schemas/modelsS3HealthCheckResponse.json | 14 +- .../modelsSendBulkNotificationRequest.json | 17 +- .../modelsSendNotificationRequest.json | 12 +- frontend/schemas/modelsSizedUploadURL.json | 18 +- frontend/schemas/modelsTrip.json | 14 +- frontend/schemas/modelsTripAPIResponse.json | 14 +- .../schemas/modelsTripCursorPageResult.json | 25 +- .../schemas/modelsUpdateCommentRequest.json | 7 +- .../modelsUpdateMembershipRequest.json | 10 +- .../schemas/modelsUpdatePitchRequest.json | 1 + frontend/schemas/modelsUpdateTripRequest.json | 11 +- frontend/schemas/modelsUpdateUserRequest.json | 13 +- frontend/schemas/modelsUploadURLRequest.json | 25 +- frontend/schemas/modelsUploadURLResponse.json | 30 +- frontend/schemas/modelsUser.json | 17 +- frontend/types/schema.gen.ts | 1705 +++++------- frontend/types/types.gen.ts | 2372 +++++++++-------- 100 files changed, 5103 insertions(+), 6958 deletions(-) create mode 100644 frontend/api/pitches/index.ts create mode 100644 frontend/api/pitches/useCreatePitch.ts create mode 100644 frontend/api/pitches/useDeletePitch.ts create mode 100644 frontend/api/pitches/useGetPitch.ts create mode 100644 frontend/api/pitches/useGetPitchSuspense.ts create mode 100644 frontend/api/pitches/useListPitches.ts create mode 100644 frontend/api/pitches/useListPitchesSuspense.ts create mode 100644 frontend/api/pitches/useUpdatePitch.ts create mode 100644 frontend/schemas/modelsCreatePitchRequest.json create mode 100644 frontend/schemas/modelsCreatePitchResponse.json create mode 100644 frontend/schemas/modelsPitchAPIResponse.json create mode 100644 frontend/schemas/modelsPitchCursorPageResult.json create mode 100644 frontend/schemas/modelsUpdatePitchRequest.json diff --git a/backend/docs/docs.go b/backend/docs/docs.go index 8eb132b..3586d9b 100644 --- a/backend/docs/docs.go +++ b/backend/docs/docs.go @@ -1255,6 +1255,303 @@ const docTemplate = `{ } } }, + "/api/v1/trips/{tripID}/pitches": { + "get": { + "description": "Returns pitches for the trip with cursor-based pagination", + "produces": [ + "application/json" + ], + "tags": [ + "pitches" + ], + "summary": "Get all pitches for a trip", + "operationId": "listPitches", + "parameters": [ + { + "type": "string", + "description": "Trip ID", + "name": "tripID", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "Max items per page (default 20, max 100)", + "name": "limit", + "in": "query" + }, + { + "type": "string", + "description": "Opaque cursor from previous response next_cursor", + "name": "cursor", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.PitchCursorPageResult" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + } + } + }, + "post": { + "description": "Creates a new pitch for the trip and returns a presigned URL to upload the audio file", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pitches" + ], + "summary": "Create a pitch", + "operationId": "createPitch", + "parameters": [ + { + "type": "string", + "description": "Trip ID", + "name": "tripID", + "in": "path", + "required": true + }, + { + "description": "Create pitch request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.CreatePitchRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/models.CreatePitchResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + } + } + } + }, + "/api/v1/trips/{tripID}/pitches/{pitchID}": { + "get": { + "description": "Returns a single pitch with a presigned URL for the audio file", + "produces": [ + "application/json" + ], + "tags": [ + "pitches" + ], + "summary": "Get a pitch by ID", + "operationId": "getPitch", + "parameters": [ + { + "type": "string", + "description": "Trip ID", + "name": "tripID", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Pitch ID", + "name": "pitchID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.PitchAPIResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + } + } + }, + "delete": { + "description": "Deletes a pitch by ID", + "tags": [ + "pitches" + ], + "summary": "Delete a pitch", + "operationId": "deletePitch", + "parameters": [ + { + "type": "string", + "description": "Trip ID", + "name": "tripID", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Pitch ID", + "name": "pitchID", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + } + } + }, + "patch": { + "description": "Updates pitch metadata (title, description, duration)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pitches" + ], + "summary": "Update a pitch", + "operationId": "updatePitch", + "parameters": [ + { + "type": "string", + "description": "Trip ID", + "name": "tripID", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Pitch ID", + "name": "pitchID", + "in": "path", + "required": true + }, + { + "description": "Update pitch request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.UpdatePitchRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.PitchAPIResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + } + } + } + }, "/api/v1/trips/{tripID}/{entityType}/{entityID}/comments": { "get": { "description": "Retrieves paginated comments for a trip entity", @@ -1783,6 +2080,40 @@ const docTemplate = `{ } } }, + "models.CreatePitchRequest": { + "type": "object", + "required": [ + "content_type", + "title" + ], + "properties": { + "content_type": { + "type": "string", + "minLength": 1 + }, + "description": { + "type": "string" + }, + "title": { + "type": "string", + "minLength": 1 + } + } + }, + "models.CreatePitchResponse": { + "type": "object", + "properties": { + "expires_at": { + "type": "string" + }, + "pitch": { + "$ref": "#/definitions/models.PitchAPIResponse" + }, + "upload_url": { + "type": "string" + } + } + }, "models.CreateTripRequest": { "type": "object", "required": [ @@ -2014,6 +2345,55 @@ const docTemplate = `{ } } }, + "models.PitchAPIResponse": { + "type": "object", + "properties": { + "audio_url": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "duration": { + "type": "integer" + }, + "id": { + "type": "string" + }, + "title": { + "type": "string" + }, + "trip_id": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user_id": { + "type": "string" + } + } + }, + "models.PitchCursorPageResult": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/models.PitchAPIResponse" + } + }, + "limit": { + "type": "integer" + }, + "next_cursor": { + "type": "string" + } + } + }, "models.S3HealthCheckResponse": { "type": "object", "properties": { @@ -2199,6 +2579,22 @@ const docTemplate = `{ } } }, + "models.UpdatePitchRequest": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "duration": { + "type": "integer", + "minimum": 0 + }, + "title": { + "type": "string", + "minLength": 1 + } + } + }, "models.UpdateTripRequest": { "type": "object", "properties": { diff --git a/backend/docs/swagger.json b/backend/docs/swagger.json index 8b641cd..74f5410 100644 --- a/backend/docs/swagger.json +++ b/backend/docs/swagger.json @@ -1249,6 +1249,303 @@ } } }, + "/api/v1/trips/{tripID}/pitches": { + "get": { + "description": "Returns pitches for the trip with cursor-based pagination", + "produces": [ + "application/json" + ], + "tags": [ + "pitches" + ], + "summary": "Get all pitches for a trip", + "operationId": "listPitches", + "parameters": [ + { + "type": "string", + "description": "Trip ID", + "name": "tripID", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "Max items per page (default 20, max 100)", + "name": "limit", + "in": "query" + }, + { + "type": "string", + "description": "Opaque cursor from previous response next_cursor", + "name": "cursor", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.PitchCursorPageResult" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + } + } + }, + "post": { + "description": "Creates a new pitch for the trip and returns a presigned URL to upload the audio file", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pitches" + ], + "summary": "Create a pitch", + "operationId": "createPitch", + "parameters": [ + { + "type": "string", + "description": "Trip ID", + "name": "tripID", + "in": "path", + "required": true + }, + { + "description": "Create pitch request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.CreatePitchRequest" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/models.CreatePitchResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + } + } + } + }, + "/api/v1/trips/{tripID}/pitches/{pitchID}": { + "get": { + "description": "Returns a single pitch with a presigned URL for the audio file", + "produces": [ + "application/json" + ], + "tags": [ + "pitches" + ], + "summary": "Get a pitch by ID", + "operationId": "getPitch", + "parameters": [ + { + "type": "string", + "description": "Trip ID", + "name": "tripID", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Pitch ID", + "name": "pitchID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.PitchAPIResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + } + } + }, + "delete": { + "description": "Deletes a pitch by ID", + "tags": [ + "pitches" + ], + "summary": "Delete a pitch", + "operationId": "deletePitch", + "parameters": [ + { + "type": "string", + "description": "Trip ID", + "name": "tripID", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Pitch ID", + "name": "pitchID", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + } + } + }, + "patch": { + "description": "Updates pitch metadata (title, description, duration)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pitches" + ], + "summary": "Update a pitch", + "operationId": "updatePitch", + "parameters": [ + { + "type": "string", + "description": "Trip ID", + "name": "tripID", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Pitch ID", + "name": "pitchID", + "in": "path", + "required": true + }, + { + "description": "Update pitch request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.UpdatePitchRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.PitchAPIResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errs.APIError" + } + } + } + } + }, "/api/v1/trips/{tripID}/{entityType}/{entityID}/comments": { "get": { "description": "Retrieves paginated comments for a trip entity", @@ -1777,6 +2074,40 @@ } } }, + "models.CreatePitchRequest": { + "type": "object", + "required": [ + "content_type", + "title" + ], + "properties": { + "content_type": { + "type": "string", + "minLength": 1 + }, + "description": { + "type": "string" + }, + "title": { + "type": "string", + "minLength": 1 + } + } + }, + "models.CreatePitchResponse": { + "type": "object", + "properties": { + "expires_at": { + "type": "string" + }, + "pitch": { + "$ref": "#/definitions/models.PitchAPIResponse" + }, + "upload_url": { + "type": "string" + } + } + }, "models.CreateTripRequest": { "type": "object", "required": [ @@ -2008,6 +2339,55 @@ } } }, + "models.PitchAPIResponse": { + "type": "object", + "properties": { + "audio_url": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "description": { + "type": "string" + }, + "duration": { + "type": "integer" + }, + "id": { + "type": "string" + }, + "title": { + "type": "string" + }, + "trip_id": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "user_id": { + "type": "string" + } + } + }, + "models.PitchCursorPageResult": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/models.PitchAPIResponse" + } + }, + "limit": { + "type": "integer" + }, + "next_cursor": { + "type": "string" + } + } + }, "models.S3HealthCheckResponse": { "type": "object", "properties": { @@ -2193,6 +2573,22 @@ } } }, + "models.UpdatePitchRequest": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "duration": { + "type": "integer", + "minimum": 0 + }, + "title": { + "type": "string", + "minLength": 1 + } + } + }, "models.UpdateTripRequest": { "type": "object", "properties": { diff --git a/backend/docs/swagger.yaml b/backend/docs/swagger.yaml index 6603038..0aa0b9c 100644 --- a/backend/docs/swagger.yaml +++ b/backend/docs/swagger.yaml @@ -110,6 +110,29 @@ definitions: - trip_id - user_id type: object + models.CreatePitchRequest: + properties: + content_type: + minLength: 1 + type: string + description: + type: string + title: + minLength: 1 + type: string + required: + - content_type + - title + type: object + models.CreatePitchResponse: + properties: + expires_at: + type: string + pitch: + $ref: '#/definitions/models.PitchAPIResponse' + upload_url: + type: string + type: object models.CreateTripRequest: properties: budget_max: @@ -266,6 +289,38 @@ definitions: next_cursor: type: string type: object + models.PitchAPIResponse: + properties: + audio_url: + type: string + created_at: + type: string + description: + type: string + duration: + type: integer + id: + type: string + title: + type: string + trip_id: + type: string + updated_at: + type: string + user_id: + type: string + type: object + models.PitchCursorPageResult: + properties: + items: + items: + $ref: '#/definitions/models.PitchAPIResponse' + type: array + limit: + type: integer + next_cursor: + type: string + type: object models.S3HealthCheckResponse: properties: bucketName: @@ -393,6 +448,17 @@ definitions: is_admin: type: boolean type: object + models.UpdatePitchRequest: + properties: + description: + type: string + duration: + minimum: 0 + type: integer + title: + minLength: 1 + type: string + type: object models.UpdateTripRequest: properties: budget_max: @@ -1375,6 +1441,207 @@ paths: summary: Promote member to admin tags: - memberships + /api/v1/trips/{tripID}/pitches: + get: + description: Returns pitches for the trip with cursor-based pagination + operationId: listPitches + parameters: + - description: Trip ID + in: path + name: tripID + required: true + type: string + - description: Max items per page (default 20, max 100) + in: query + name: limit + type: integer + - description: Opaque cursor from previous response next_cursor + in: query + name: cursor + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/models.PitchCursorPageResult' + "400": + description: Bad Request + schema: + $ref: '#/definitions/errs.APIError' + "404": + description: Not Found + schema: + $ref: '#/definitions/errs.APIError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/errs.APIError' + summary: Get all pitches for a trip + tags: + - pitches + post: + consumes: + - application/json + description: Creates a new pitch for the trip and returns a presigned URL to + upload the audio file + operationId: createPitch + parameters: + - description: Trip ID + in: path + name: tripID + required: true + type: string + - description: Create pitch request + in: body + name: request + required: true + schema: + $ref: '#/definitions/models.CreatePitchRequest' + produces: + - application/json + responses: + "201": + description: Created + schema: + $ref: '#/definitions/models.CreatePitchResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/errs.APIError' + "403": + description: Forbidden + schema: + $ref: '#/definitions/errs.APIError' + "422": + description: Unprocessable Entity + schema: + $ref: '#/definitions/errs.APIError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/errs.APIError' + summary: Create a pitch + tags: + - pitches + /api/v1/trips/{tripID}/pitches/{pitchID}: + delete: + description: Deletes a pitch by ID + operationId: deletePitch + parameters: + - description: Trip ID + in: path + name: tripID + required: true + type: string + - description: Pitch ID + in: path + name: pitchID + required: true + type: string + responses: + "204": + description: No Content + "400": + description: Bad Request + schema: + $ref: '#/definitions/errs.APIError' + "404": + description: Not Found + schema: + $ref: '#/definitions/errs.APIError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/errs.APIError' + summary: Delete a pitch + tags: + - pitches + get: + description: Returns a single pitch with a presigned URL for the audio file + operationId: getPitch + parameters: + - description: Trip ID + in: path + name: tripID + required: true + type: string + - description: Pitch ID + in: path + name: pitchID + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/models.PitchAPIResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/errs.APIError' + "404": + description: Not Found + schema: + $ref: '#/definitions/errs.APIError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/errs.APIError' + summary: Get a pitch by ID + tags: + - pitches + patch: + consumes: + - application/json + description: Updates pitch metadata (title, description, duration) + operationId: updatePitch + parameters: + - description: Trip ID + in: path + name: tripID + required: true + type: string + - description: Pitch ID + in: path + name: pitchID + required: true + type: string + - description: Update pitch request + in: body + name: request + required: true + schema: + $ref: '#/definitions/models.UpdatePitchRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/models.PitchAPIResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/errs.APIError' + "404": + description: Not Found + schema: + $ref: '#/definitions/errs.APIError' + "422": + description: Unprocessable Entity + schema: + $ref: '#/definitions/errs.APIError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/errs.APIError' + summary: Update a pitch + tags: + - pitches /api/v1/users: post: consumes: diff --git a/frontend/api/comments/index.ts b/frontend/api/comments/index.ts index e1d7e12..9167133 100644 --- a/frontend/api/comments/index.ts +++ b/frontend/api/comments/index.ts @@ -22,4 +22,4 @@ export { useGetPaginatedCommentsSuspense } from "./useGetPaginatedCommentsSuspen export { updateCommentMutationKey } from "./useUpdateComment.ts"; export { updateComment } from "./useUpdateComment.ts"; export { updateCommentMutationOptions } from "./useUpdateComment.ts"; -export { useUpdateComment } from "./useUpdateComment.ts"; +export { useUpdateComment } from "./useUpdateComment.ts"; \ No newline at end of file diff --git a/frontend/api/comments/useCreateComment.ts b/frontend/api/comments/useCreateComment.ts index 128340e..8ba8a38 100644 --- a/frontend/api/comments/useCreateComment.ts +++ b/frontend/api/comments/useCreateComment.ts @@ -1,90 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - CreateCommentMutationRequest, - CreateCommentMutationResponse, - CreateComment400, - CreateComment401, - CreateComment404, - CreateComment422, - CreateComment500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { CreateCommentMutationRequest, CreateCommentMutationResponse, CreateComment400, CreateComment401, CreateComment404, CreateComment422, CreateComment500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const createCommentMutationKey = () => - [{ url: "/api/v1/comments" }] as const; +export const createCommentMutationKey = () => [{ url: '/api/v1/comments' }] as const -export type CreateCommentMutationKey = ReturnType< - typeof createCommentMutationKey ->; +export type CreateCommentMutationKey = ReturnType /** * @description Creates a new comment * @summary Create a comment * {@link /api/v1/comments} */ -export async function createComment( - data: CreateCommentMutationRequest, - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const requestData = data; - - const res = await request< - CreateCommentMutationResponse, - ResponseErrorConfig< - | CreateComment400 - | CreateComment401 - | CreateComment404 - | CreateComment422 - | CreateComment500 - >, - CreateCommentMutationRequest - >({ - method: "POST", - url: `/api/v1/comments`, - data: requestData, - ...requestConfig, - }); - return res.data; +export async function createComment(data: CreateCommentMutationRequest, config: Partial> & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const requestData = data + + const res = await request, CreateCommentMutationRequest>({ method : "POST", url : `/api/v1/comments`, data : requestData, ... requestConfig }) + return res.data } -export function createCommentMutationOptions( - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const mutationKey = createCommentMutationKey(); - return mutationOptions< - CreateCommentMutationResponse, - ResponseErrorConfig< - | CreateComment400 - | CreateComment401 - | CreateComment404 - | CreateComment422 - | CreateComment500 - >, - { data: CreateCommentMutationRequest }, - TContext - >({ +export function createCommentMutationOptions(config: Partial> & { client?: typeof fetch } = {}) { + const mutationKey = createCommentMutationKey() + return mutationOptions, {data: CreateCommentMutationRequest}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ data }) => { - return createComment(data, config); + mutationFn: async({ data }) => { + return createComment(data, config) }, - }); + }) } /** @@ -92,72 +42,21 @@ export function createCommentMutationOptions( * @summary Create a comment * {@link /api/v1/comments} */ -export function useCreateComment( - options: { - mutation?: UseMutationOptions< - CreateCommentMutationResponse, - ResponseErrorConfig< - | CreateComment400 - | CreateComment401 - | CreateComment404 - | CreateComment422 - | CreateComment500 - >, - { data: CreateCommentMutationRequest }, - TContext - > & { client?: QueryClient }; - client?: Partial> & { - client?: typeof fetch; - }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useCreateComment(options: +{ + mutation?: UseMutationOptions, {data: CreateCommentMutationRequest}, TContext> & { client?: QueryClient }, + client?: Partial> & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = mutationOptions.mutationKey ?? createCommentMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? createCommentMutationKey() - const baseOptions = createCommentMutationOptions( - config, - ) as UseMutationOptions< - CreateCommentMutationResponse, - ResponseErrorConfig< - | CreateComment400 - | CreateComment401 - | CreateComment404 - | CreateComment422 - | CreateComment500 - >, - { data: CreateCommentMutationRequest }, - TContext - >; + const baseOptions = createCommentMutationOptions(config) as UseMutationOptions, {data: CreateCommentMutationRequest}, TContext> - return useMutation< - CreateCommentMutationResponse, - ResponseErrorConfig< - | CreateComment400 - | CreateComment401 - | CreateComment404 - | CreateComment422 - | CreateComment500 - >, - { data: CreateCommentMutationRequest }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - CreateCommentMutationResponse, - ResponseErrorConfig< - | CreateComment400 - | CreateComment401 - | CreateComment404 - | CreateComment422 - | CreateComment500 - >, - { data: CreateCommentMutationRequest }, - TContext - >; -} + return useMutation, {data: CreateCommentMutationRequest}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {data: CreateCommentMutationRequest}, TContext> +} \ No newline at end of file diff --git a/frontend/api/comments/useDeleteComment.ts b/frontend/api/comments/useDeleteComment.ts index e7f7f58..a8272fa 100644 --- a/frontend/api/comments/useDeleteComment.ts +++ b/frontend/api/comments/useDeleteComment.ts @@ -1,74 +1,38 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - DeleteCommentMutationResponse, - DeleteCommentPathParams, - DeleteComment400, - DeleteComment401, - DeleteComment404, - DeleteComment500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { DeleteCommentMutationResponse, DeleteCommentPathParams, DeleteComment400, DeleteComment401, DeleteComment404, DeleteComment500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const deleteCommentMutationKey = () => - [{ url: "/api/v1/comments/:commentID" }] as const; +export const deleteCommentMutationKey = () => [{ url: '/api/v1/comments/:commentID' }] as const -export type DeleteCommentMutationKey = ReturnType< - typeof deleteCommentMutationKey ->; +export type DeleteCommentMutationKey = ReturnType /** * @description Deletes a comment by ID * @summary Delete a comment * {@link /api/v1/comments/:commentID} */ -export async function deleteComment( - commentID: DeleteCommentPathParams["commentID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - DeleteCommentMutationResponse, - ResponseErrorConfig< - DeleteComment400 | DeleteComment401 | DeleteComment404 | DeleteComment500 - >, - unknown - >({ - method: "DELETE", - url: `/api/v1/comments/${commentID}`, - ...requestConfig, - }); - return res.data; +export async function deleteComment(commentID: DeleteCommentPathParams["commentID"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "DELETE", url : `/api/v1/comments/${commentID}`, ... requestConfig }) + return res.data } -export function deleteCommentMutationOptions( - config: Partial & { client?: typeof fetch } = {}, -) { - const mutationKey = deleteCommentMutationKey(); - return mutationOptions< - DeleteCommentMutationResponse, - ResponseErrorConfig< - DeleteComment400 | DeleteComment401 | DeleteComment404 | DeleteComment500 - >, - { commentID: DeleteCommentPathParams["commentID"] }, - TContext - >({ +export function deleteCommentMutationOptions(config: Partial & { client?: typeof fetch } = {}) { + const mutationKey = deleteCommentMutationKey() + return mutationOptions, {commentID: DeleteCommentPathParams["commentID"]}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ commentID }) => { - return deleteComment(commentID, config); + mutationFn: async({ commentID }) => { + return deleteComment(commentID, config) }, - }); + }) } /** @@ -76,57 +40,21 @@ export function deleteCommentMutationOptions( * @summary Delete a comment * {@link /api/v1/comments/:commentID} */ -export function useDeleteComment( - options: { - mutation?: UseMutationOptions< - DeleteCommentMutationResponse, - ResponseErrorConfig< - | DeleteComment400 - | DeleteComment401 - | DeleteComment404 - | DeleteComment500 - >, - { commentID: DeleteCommentPathParams["commentID"] }, - TContext - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useDeleteComment(options: +{ + mutation?: UseMutationOptions, {commentID: DeleteCommentPathParams["commentID"]}, TContext> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = mutationOptions.mutationKey ?? deleteCommentMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? deleteCommentMutationKey() - const baseOptions = deleteCommentMutationOptions( - config, - ) as UseMutationOptions< - DeleteCommentMutationResponse, - ResponseErrorConfig< - DeleteComment400 | DeleteComment401 | DeleteComment404 | DeleteComment500 - >, - { commentID: DeleteCommentPathParams["commentID"] }, - TContext - >; + const baseOptions = deleteCommentMutationOptions(config) as UseMutationOptions, {commentID: DeleteCommentPathParams["commentID"]}, TContext> - return useMutation< - DeleteCommentMutationResponse, - ResponseErrorConfig< - DeleteComment400 | DeleteComment401 | DeleteComment404 | DeleteComment500 - >, - { commentID: DeleteCommentPathParams["commentID"] }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - DeleteCommentMutationResponse, - ResponseErrorConfig< - DeleteComment400 | DeleteComment401 | DeleteComment404 | DeleteComment500 - >, - { commentID: DeleteCommentPathParams["commentID"] }, - TContext - >; -} + return useMutation, {commentID: DeleteCommentPathParams["commentID"]}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {commentID: DeleteCommentPathParams["commentID"]}, TContext> +} \ No newline at end of file diff --git a/frontend/api/comments/useGetPaginatedComments.ts b/frontend/api/comments/useGetPaginatedComments.ts index 3d36fdb..e26bf97 100644 --- a/frontend/api/comments/useGetPaginatedComments.ts +++ b/frontend/api/comments/useGetPaginatedComments.ts @@ -1,111 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetPaginatedCommentsQueryResponse, - GetPaginatedCommentsPathParams, - GetPaginatedCommentsQueryParams, - GetPaginatedComments400, - GetPaginatedComments401, - GetPaginatedComments404, - GetPaginatedComments422, - GetPaginatedComments500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - QueryObserverOptions, - UseQueryResult, -} from "@tanstack/react-query"; +import type { GetPaginatedCommentsQueryResponse, GetPaginatedCommentsPathParams, GetPaginatedCommentsQueryParams, GetPaginatedComments400, GetPaginatedComments401, GetPaginatedComments404, GetPaginatedComments422, GetPaginatedComments500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; -export const getPaginatedCommentsQueryKey = ( - tripID: GetPaginatedCommentsPathParams["tripID"], - entityType: GetPaginatedCommentsPathParams["entityType"], - entityID: GetPaginatedCommentsPathParams["entityID"], - params: GetPaginatedCommentsQueryParams = {}, -) => - [ - { - url: "/api/v1/trips/:tripID/:entityType/:entityID/comments", - params: { tripID: tripID, entityType: entityType, entityID: entityID }, - }, - ...(params ? [params] : []), - ] as const; +export const getPaginatedCommentsQueryKey = (tripID: GetPaginatedCommentsPathParams["tripID"], entityType: GetPaginatedCommentsPathParams["entityType"], entityID: GetPaginatedCommentsPathParams["entityID"], params?: GetPaginatedCommentsQueryParams) => [{ url: '/api/v1/trips/:tripID/:entityType/:entityID/comments', params: {tripID:tripID,entityType:entityType,entityID:entityID} }, ...(params ? [params] : [])] as const -export type GetPaginatedCommentsQueryKey = ReturnType< - typeof getPaginatedCommentsQueryKey ->; +export type GetPaginatedCommentsQueryKey = ReturnType /** * @description Retrieves paginated comments for a trip entity * @summary Get comments * {@link /api/v1/trips/:tripID/:entityType/:entityID/comments} */ -export async function getPaginatedComments( - tripID: GetPaginatedCommentsPathParams["tripID"], - entityType: GetPaginatedCommentsPathParams["entityType"], - entityID: GetPaginatedCommentsPathParams["entityID"], - params?: GetPaginatedCommentsQueryParams, - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetPaginatedCommentsQueryResponse, - ResponseErrorConfig< - | GetPaginatedComments400 - | GetPaginatedComments401 - | GetPaginatedComments404 - | GetPaginatedComments422 - | GetPaginatedComments500 - >, - unknown - >({ - method: "GET", - url: `/api/v1/trips/${tripID}/${entityType}/${entityID}/comments`, - params, - ...requestConfig, - }); - return res.data; +export async function getPaginatedComments(tripID: GetPaginatedCommentsPathParams["tripID"], entityType: GetPaginatedCommentsPathParams["entityType"], entityID: GetPaginatedCommentsPathParams["entityID"], params?: GetPaginatedCommentsQueryParams, config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/trips/${tripID}/${entityType}/${entityID}/comments`, params, ... requestConfig }) + return res.data } -export function getPaginatedCommentsQueryOptions( - tripID: GetPaginatedCommentsPathParams["tripID"], - entityType: GetPaginatedCommentsPathParams["entityType"], - entityID: GetPaginatedCommentsPathParams["entityID"], - params?: GetPaginatedCommentsQueryParams, - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getPaginatedCommentsQueryKey( - tripID, - entityType, - entityID, - params, - ); - return queryOptions< - GetPaginatedCommentsQueryResponse, - ResponseErrorConfig< - | GetPaginatedComments400 - | GetPaginatedComments401 - | GetPaginatedComments404 - | GetPaginatedComments422 - | GetPaginatedComments500 - >, - GetPaginatedCommentsQueryResponse, - typeof queryKey - >({ - enabled: !!(tripID && entityType && entityID), - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getPaginatedComments(tripID, entityType, entityID, params, config); - }, - }); +export function getPaginatedCommentsQueryOptions(tripID: GetPaginatedCommentsPathParams["tripID"], entityType: GetPaginatedCommentsPathParams["entityType"], entityID: GetPaginatedCommentsPathParams["entityID"], params?: GetPaginatedCommentsQueryParams, config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getPaginatedCommentsQueryKey(tripID, entityType, entityID, params) + return queryOptions, GetPaginatedCommentsQueryResponse, typeof queryKey>({ + enabled: !!(tripID&& entityType&& entityID), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getPaginatedComments(tripID, entityType, entityID, params, config) + }, + }) } /** @@ -113,65 +42,23 @@ export function getPaginatedCommentsQueryOptions( * @summary Get comments * {@link /api/v1/trips/:tripID/:entityType/:entityID/comments} */ -export function useGetPaginatedComments< - TData = GetPaginatedCommentsQueryResponse, - TQueryData = GetPaginatedCommentsQueryResponse, - TQueryKey extends QueryKey = GetPaginatedCommentsQueryKey, ->( - tripID: GetPaginatedCommentsPathParams["tripID"], - entityType: GetPaginatedCommentsPathParams["entityType"], - entityID: GetPaginatedCommentsPathParams["entityID"], - params?: GetPaginatedCommentsQueryParams, - options: { - query?: Partial< - QueryObserverOptions< - GetPaginatedCommentsQueryResponse, - ResponseErrorConfig< - | GetPaginatedComments400 - | GetPaginatedComments401 - | GetPaginatedComments404 - | GetPaginatedComments422 - | GetPaginatedComments500 - >, - TData, - TQueryData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = - queryOptions?.queryKey ?? - getPaginatedCommentsQueryKey(tripID, entityType, entityID, params); +export function useGetPaginatedComments(tripID: GetPaginatedCommentsPathParams["tripID"], entityType: GetPaginatedCommentsPathParams["entityType"], entityID: GetPaginatedCommentsPathParams["entityID"], params?: GetPaginatedCommentsQueryParams, options: +{ + query?: Partial, TData, TQueryData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getPaginatedCommentsQueryKey(tripID, entityType, entityID, params) - const query = useQuery( - { - ...getPaginatedCommentsQueryOptions( - tripID, - entityType, - entityID, - params, - config, - ), - queryKey, - ...queryOptions, - } as unknown as QueryObserverOptions, - queryClient, - ) as UseQueryResult< - TData, - ResponseErrorConfig< - | GetPaginatedComments400 - | GetPaginatedComments401 - | GetPaginatedComments404 - | GetPaginatedComments422 - | GetPaginatedComments500 - > - > & { queryKey: TQueryKey }; + const query = useQuery({ + ...getPaginatedCommentsQueryOptions(tripID, entityType, entityID, params, config), + queryKey, + ...queryOptions + } as unknown as QueryObserverOptions, queryClient) as UseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/comments/useGetPaginatedCommentsSuspense.ts b/frontend/api/comments/useGetPaginatedCommentsSuspense.ts index fe4c610..6ed48d1 100644 --- a/frontend/api/comments/useGetPaginatedCommentsSuspense.ts +++ b/frontend/api/comments/useGetPaginatedCommentsSuspense.ts @@ -1,117 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetPaginatedCommentsQueryResponse, - GetPaginatedCommentsPathParams, - GetPaginatedCommentsQueryParams, - GetPaginatedComments400, - GetPaginatedComments401, - GetPaginatedComments404, - GetPaginatedComments422, - GetPaginatedComments500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - UseSuspenseQueryOptions, - UseSuspenseQueryResult, -} from "@tanstack/react-query"; +import type { GetPaginatedCommentsQueryResponse, GetPaginatedCommentsPathParams, GetPaginatedCommentsQueryParams, GetPaginatedComments400, GetPaginatedComments401, GetPaginatedComments404, GetPaginatedComments422, GetPaginatedComments500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const getPaginatedCommentsSuspenseQueryKey = ( - tripID: GetPaginatedCommentsPathParams["tripID"], - entityType: GetPaginatedCommentsPathParams["entityType"], - entityID: GetPaginatedCommentsPathParams["entityID"], - params: GetPaginatedCommentsQueryParams = {}, -) => - [ - { - url: "/api/v1/trips/:tripID/:entityType/:entityID/comments", - params: { tripID: tripID, entityType: entityType, entityID: entityID }, - }, - ...(params ? [params] : []), - ] as const; +export const getPaginatedCommentsSuspenseQueryKey = (tripID: GetPaginatedCommentsPathParams["tripID"], entityType: GetPaginatedCommentsPathParams["entityType"], entityID: GetPaginatedCommentsPathParams["entityID"], params?: GetPaginatedCommentsQueryParams) => [{ url: '/api/v1/trips/:tripID/:entityType/:entityID/comments', params: {tripID:tripID,entityType:entityType,entityID:entityID} }, ...(params ? [params] : [])] as const -export type GetPaginatedCommentsSuspenseQueryKey = ReturnType< - typeof getPaginatedCommentsSuspenseQueryKey ->; +export type GetPaginatedCommentsSuspenseQueryKey = ReturnType /** * @description Retrieves paginated comments for a trip entity * @summary Get comments * {@link /api/v1/trips/:tripID/:entityType/:entityID/comments} */ -export async function getPaginatedCommentsSuspense( - tripID: GetPaginatedCommentsPathParams["tripID"], - entityType: GetPaginatedCommentsPathParams["entityType"], - entityID: GetPaginatedCommentsPathParams["entityID"], - params?: GetPaginatedCommentsQueryParams, - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetPaginatedCommentsQueryResponse, - ResponseErrorConfig< - | GetPaginatedComments400 - | GetPaginatedComments401 - | GetPaginatedComments404 - | GetPaginatedComments422 - | GetPaginatedComments500 - >, - unknown - >({ - method: "GET", - url: `/api/v1/trips/${tripID}/${entityType}/${entityID}/comments`, - params, - ...requestConfig, - }); - return res.data; +export async function getPaginatedCommentsSuspense(tripID: GetPaginatedCommentsPathParams["tripID"], entityType: GetPaginatedCommentsPathParams["entityType"], entityID: GetPaginatedCommentsPathParams["entityID"], params?: GetPaginatedCommentsQueryParams, config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/trips/${tripID}/${entityType}/${entityID}/comments`, params, ... requestConfig }) + return res.data } -export function getPaginatedCommentsSuspenseQueryOptions( - tripID: GetPaginatedCommentsPathParams["tripID"], - entityType: GetPaginatedCommentsPathParams["entityType"], - entityID: GetPaginatedCommentsPathParams["entityID"], - params?: GetPaginatedCommentsQueryParams, - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getPaginatedCommentsSuspenseQueryKey( - tripID, - entityType, - entityID, - params, - ); - return queryOptions< - GetPaginatedCommentsQueryResponse, - ResponseErrorConfig< - | GetPaginatedComments400 - | GetPaginatedComments401 - | GetPaginatedComments404 - | GetPaginatedComments422 - | GetPaginatedComments500 - >, - GetPaginatedCommentsQueryResponse, - typeof queryKey - >({ - enabled: !!(tripID && entityType && entityID), - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getPaginatedCommentsSuspense( - tripID, - entityType, - entityID, - params, - config, - ); - }, - }); +export function getPaginatedCommentsSuspenseQueryOptions(tripID: GetPaginatedCommentsPathParams["tripID"], entityType: GetPaginatedCommentsPathParams["entityType"], entityID: GetPaginatedCommentsPathParams["entityID"], params?: GetPaginatedCommentsQueryParams, config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getPaginatedCommentsSuspenseQueryKey(tripID, entityType, entityID, params) + return queryOptions, GetPaginatedCommentsQueryResponse, typeof queryKey>({ + enabled: !!(tripID&& entityType&& entityID), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getPaginatedCommentsSuspense(tripID, entityType, entityID, params, config) + }, + }) } /** @@ -119,63 +42,23 @@ export function getPaginatedCommentsSuspenseQueryOptions( * @summary Get comments * {@link /api/v1/trips/:tripID/:entityType/:entityID/comments} */ -export function useGetPaginatedCommentsSuspense< - TData = GetPaginatedCommentsQueryResponse, - TQueryKey extends QueryKey = GetPaginatedCommentsSuspenseQueryKey, ->( - tripID: GetPaginatedCommentsPathParams["tripID"], - entityType: GetPaginatedCommentsPathParams["entityType"], - entityID: GetPaginatedCommentsPathParams["entityID"], - params?: GetPaginatedCommentsQueryParams, - options: { - query?: Partial< - UseSuspenseQueryOptions< - GetPaginatedCommentsQueryResponse, - ResponseErrorConfig< - | GetPaginatedComments400 - | GetPaginatedComments401 - | GetPaginatedComments404 - | GetPaginatedComments422 - | GetPaginatedComments500 - >, - TData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = - queryOptions?.queryKey ?? - getPaginatedCommentsSuspenseQueryKey(tripID, entityType, entityID, params); +export function useGetPaginatedCommentsSuspense(tripID: GetPaginatedCommentsPathParams["tripID"], entityType: GetPaginatedCommentsPathParams["entityType"], entityID: GetPaginatedCommentsPathParams["entityID"], params?: GetPaginatedCommentsQueryParams, options: +{ + query?: Partial, TData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getPaginatedCommentsSuspenseQueryKey(tripID, entityType, entityID, params) - const query = useSuspenseQuery( - { - ...getPaginatedCommentsSuspenseQueryOptions( - tripID, - entityType, - entityID, - params, - config, - ), - queryKey, - ...queryOptions, - } as unknown as UseSuspenseQueryOptions, - queryClient, - ) as UseSuspenseQueryResult< - TData, - ResponseErrorConfig< - | GetPaginatedComments400 - | GetPaginatedComments401 - | GetPaginatedComments404 - | GetPaginatedComments422 - | GetPaginatedComments500 - > - > & { queryKey: TQueryKey }; + const query = useSuspenseQuery({ + ...getPaginatedCommentsSuspenseQueryOptions(tripID, entityType, entityID, params, config), + queryKey, + ...queryOptions + } as unknown as UseSuspenseQueryOptions, queryClient) as UseSuspenseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/comments/useUpdateComment.ts b/frontend/api/comments/useUpdateComment.ts index c1f5c46..9a3d009 100644 --- a/frontend/api/comments/useUpdateComment.ts +++ b/frontend/api/comments/useUpdateComment.ts @@ -1,95 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - UpdateCommentMutationRequest, - UpdateCommentMutationResponse, - UpdateCommentPathParams, - UpdateComment400, - UpdateComment401, - UpdateComment404, - UpdateComment422, - UpdateComment500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { UpdateCommentMutationRequest, UpdateCommentMutationResponse, UpdateCommentPathParams, UpdateComment400, UpdateComment401, UpdateComment404, UpdateComment422, UpdateComment500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const updateCommentMutationKey = () => - [{ url: "/api/v1/comments/:commentID" }] as const; +export const updateCommentMutationKey = () => [{ url: '/api/v1/comments/:commentID' }] as const -export type UpdateCommentMutationKey = ReturnType< - typeof updateCommentMutationKey ->; +export type UpdateCommentMutationKey = ReturnType /** * @description Updates an existing comment by ID * @summary Update a comment * {@link /api/v1/comments/:commentID} */ -export async function updateComment( - commentID: UpdateCommentPathParams["commentID"], - data: UpdateCommentMutationRequest, - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const requestData = data; - - const res = await request< - UpdateCommentMutationResponse, - ResponseErrorConfig< - | UpdateComment400 - | UpdateComment401 - | UpdateComment404 - | UpdateComment422 - | UpdateComment500 - >, - UpdateCommentMutationRequest - >({ - method: "PATCH", - url: `/api/v1/comments/${commentID}`, - data: requestData, - ...requestConfig, - }); - return res.data; +export async function updateComment(commentID: UpdateCommentPathParams["commentID"], data: UpdateCommentMutationRequest, config: Partial> & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const requestData = data + + const res = await request, UpdateCommentMutationRequest>({ method : "PATCH", url : `/api/v1/comments/${commentID}`, data : requestData, ... requestConfig }) + return res.data } -export function updateCommentMutationOptions( - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const mutationKey = updateCommentMutationKey(); - return mutationOptions< - UpdateCommentMutationResponse, - ResponseErrorConfig< - | UpdateComment400 - | UpdateComment401 - | UpdateComment404 - | UpdateComment422 - | UpdateComment500 - >, - { - commentID: UpdateCommentPathParams["commentID"]; - data: UpdateCommentMutationRequest; - }, - TContext - >({ +export function updateCommentMutationOptions(config: Partial> & { client?: typeof fetch } = {}) { + const mutationKey = updateCommentMutationKey() + return mutationOptions, {commentID: UpdateCommentPathParams["commentID"], data: UpdateCommentMutationRequest}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ commentID, data }) => { - return updateComment(commentID, data, config); + mutationFn: async({ commentID, data }) => { + return updateComment(commentID, data, config) }, - }); + }) } /** @@ -97,84 +42,21 @@ export function updateCommentMutationOptions( * @summary Update a comment * {@link /api/v1/comments/:commentID} */ -export function useUpdateComment( - options: { - mutation?: UseMutationOptions< - UpdateCommentMutationResponse, - ResponseErrorConfig< - | UpdateComment400 - | UpdateComment401 - | UpdateComment404 - | UpdateComment422 - | UpdateComment500 - >, - { - commentID: UpdateCommentPathParams["commentID"]; - data: UpdateCommentMutationRequest; - }, - TContext - > & { client?: QueryClient }; - client?: Partial> & { - client?: typeof fetch; - }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useUpdateComment(options: +{ + mutation?: UseMutationOptions, {commentID: UpdateCommentPathParams["commentID"], data: UpdateCommentMutationRequest}, TContext> & { client?: QueryClient }, + client?: Partial> & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = mutationOptions.mutationKey ?? updateCommentMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? updateCommentMutationKey() - const baseOptions = updateCommentMutationOptions( - config, - ) as UseMutationOptions< - UpdateCommentMutationResponse, - ResponseErrorConfig< - | UpdateComment400 - | UpdateComment401 - | UpdateComment404 - | UpdateComment422 - | UpdateComment500 - >, - { - commentID: UpdateCommentPathParams["commentID"]; - data: UpdateCommentMutationRequest; - }, - TContext - >; + const baseOptions = updateCommentMutationOptions(config) as UseMutationOptions, {commentID: UpdateCommentPathParams["commentID"], data: UpdateCommentMutationRequest}, TContext> - return useMutation< - UpdateCommentMutationResponse, - ResponseErrorConfig< - | UpdateComment400 - | UpdateComment401 - | UpdateComment404 - | UpdateComment422 - | UpdateComment500 - >, - { - commentID: UpdateCommentPathParams["commentID"]; - data: UpdateCommentMutationRequest; - }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - UpdateCommentMutationResponse, - ResponseErrorConfig< - | UpdateComment400 - | UpdateComment401 - | UpdateComment404 - | UpdateComment422 - | UpdateComment500 - >, - { - commentID: UpdateCommentPathParams["commentID"]; - data: UpdateCommentMutationRequest; - }, - TContext - >; -} + return useMutation, {commentID: UpdateCommentPathParams["commentID"], data: UpdateCommentMutationRequest}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {commentID: UpdateCommentPathParams["commentID"], data: UpdateCommentMutationRequest}, TContext> +} \ No newline at end of file diff --git a/frontend/api/example/index.ts b/frontend/api/example/index.ts index 155f7d8..d2852ef 100644 --- a/frontend/api/example/index.ts +++ b/frontend/api/example/index.ts @@ -7,4 +7,4 @@ export { useHealthcheck } from "./useHealthcheck.ts"; export { healthcheckSuspenseQueryKey } from "./useHealthcheckSuspense.ts"; export { healthcheckSuspense } from "./useHealthcheckSuspense.ts"; export { healthcheckSuspenseQueryOptions } from "./useHealthcheckSuspense.ts"; -export { useHealthcheckSuspense } from "./useHealthcheckSuspense.ts"; +export { useHealthcheckSuspense } from "./useHealthcheckSuspense.ts"; \ No newline at end of file diff --git a/frontend/api/example/useHealthcheck.ts b/frontend/api/example/useHealthcheck.ts index fafb66c..66c664f 100644 --- a/frontend/api/example/useHealthcheck.ts +++ b/frontend/api/example/useHealthcheck.ts @@ -1,60 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - HealthcheckQueryResponse, - Healthcheck500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - QueryObserverOptions, - UseQueryResult, -} from "@tanstack/react-query"; +import type { HealthcheckQueryResponse, Healthcheck500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; -export const healthcheckQueryKey = () => [{ url: "/healthcheck" }] as const; +export const healthcheckQueryKey = () => [{ url: '/healthcheck' }] as const -export type HealthcheckQueryKey = ReturnType; +export type HealthcheckQueryKey = ReturnType /** * @description Returns OK if the server is running and database is healthy * @summary Healthcheck endpoint * {@link /healthcheck} */ -export async function healthcheck( - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - HealthcheckQueryResponse, - ResponseErrorConfig, - unknown - >({ method: "GET", url: `/healthcheck`, ...requestConfig }); - return res.data; +export async function healthcheck(config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/healthcheck`, ... requestConfig }) + return res.data } -export function healthcheckQueryOptions( - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = healthcheckQueryKey(); - return queryOptions< - HealthcheckQueryResponse, - ResponseErrorConfig, - HealthcheckQueryResponse, - typeof queryKey - >({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return healthcheck(config); - }, - }); +export function healthcheckQueryOptions(config: Partial & { client?: typeof fetch } = {}) { + const queryKey = healthcheckQueryKey() + return queryOptions, HealthcheckQueryResponse, typeof queryKey>({ + + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return healthcheck(config) + }, + }) } /** @@ -62,40 +42,23 @@ export function healthcheckQueryOptions( * @summary Healthcheck endpoint * {@link /healthcheck} */ -export function useHealthcheck< - TData = HealthcheckQueryResponse, - TQueryData = HealthcheckQueryResponse, - TQueryKey extends QueryKey = HealthcheckQueryKey, ->( - options: { - query?: Partial< - QueryObserverOptions< - HealthcheckQueryResponse, - ResponseErrorConfig, - TData, - TQueryData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = queryOptions?.queryKey ?? healthcheckQueryKey(); +export function useHealthcheck(options: +{ + query?: Partial, TData, TQueryData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? healthcheckQueryKey() - const query = useQuery( - { - ...healthcheckQueryOptions(config), - queryKey, - ...queryOptions, - } as unknown as QueryObserverOptions, - queryClient, - ) as UseQueryResult> & { - queryKey: TQueryKey; - }; + const query = useQuery({ + ...healthcheckQueryOptions(config), + queryKey, + ...queryOptions + } as unknown as QueryObserverOptions, queryClient) as UseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/example/useHealthcheckSuspense.ts b/frontend/api/example/useHealthcheckSuspense.ts index 4a43754..29f27d4 100644 --- a/frontend/api/example/useHealthcheckSuspense.ts +++ b/frontend/api/example/useHealthcheckSuspense.ts @@ -1,63 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - HealthcheckQueryResponse, - Healthcheck500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - UseSuspenseQueryOptions, - UseSuspenseQueryResult, -} from "@tanstack/react-query"; +import type { HealthcheckQueryResponse, Healthcheck500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const healthcheckSuspenseQueryKey = () => - [{ url: "/healthcheck" }] as const; +export const healthcheckSuspenseQueryKey = () => [{ url: '/healthcheck' }] as const -export type HealthcheckSuspenseQueryKey = ReturnType< - typeof healthcheckSuspenseQueryKey ->; +export type HealthcheckSuspenseQueryKey = ReturnType /** * @description Returns OK if the server is running and database is healthy * @summary Healthcheck endpoint * {@link /healthcheck} */ -export async function healthcheckSuspense( - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - HealthcheckQueryResponse, - ResponseErrorConfig, - unknown - >({ method: "GET", url: `/healthcheck`, ...requestConfig }); - return res.data; +export async function healthcheckSuspense(config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/healthcheck`, ... requestConfig }) + return res.data } -export function healthcheckSuspenseQueryOptions( - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = healthcheckSuspenseQueryKey(); - return queryOptions< - HealthcheckQueryResponse, - ResponseErrorConfig, - HealthcheckQueryResponse, - typeof queryKey - >({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return healthcheckSuspense(config); - }, - }); +export function healthcheckSuspenseQueryOptions(config: Partial & { client?: typeof fetch } = {}) { + const queryKey = healthcheckSuspenseQueryKey() + return queryOptions, HealthcheckQueryResponse, typeof queryKey>({ + + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return healthcheckSuspense(config) + }, + }) } /** @@ -65,38 +42,23 @@ export function healthcheckSuspenseQueryOptions( * @summary Healthcheck endpoint * {@link /healthcheck} */ -export function useHealthcheckSuspense< - TData = HealthcheckQueryResponse, - TQueryKey extends QueryKey = HealthcheckSuspenseQueryKey, ->( - options: { - query?: Partial< - UseSuspenseQueryOptions< - HealthcheckQueryResponse, - ResponseErrorConfig, - TData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = queryOptions?.queryKey ?? healthcheckSuspenseQueryKey(); +export function useHealthcheckSuspense(options: +{ + query?: Partial, TData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? healthcheckSuspenseQueryKey() - const query = useSuspenseQuery( - { - ...healthcheckSuspenseQueryOptions(config), - queryKey, - ...queryOptions, - } as unknown as UseSuspenseQueryOptions, - queryClient, - ) as UseSuspenseQueryResult> & { - queryKey: TQueryKey; - }; + const query = useSuspenseQuery({ + ...healthcheckSuspenseQueryOptions(config), + queryKey, + ...queryOptions + } as unknown as UseSuspenseQueryOptions, queryClient) as UseSuspenseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/files/index.ts b/frontend/api/files/index.ts index 2ea1256..df5dbc0 100644 --- a/frontend/api/files/index.ts +++ b/frontend/api/files/index.ts @@ -37,4 +37,4 @@ export { useGetFileAllSizesSuspense } from "./useGetFileAllSizesSuspense.ts"; export { getFileSuspenseQueryKey } from "./useGetFileSuspense.ts"; export { getFileSuspense } from "./useGetFileSuspense.ts"; export { getFileSuspenseQueryOptions } from "./useGetFileSuspense.ts"; -export { useGetFileSuspense } from "./useGetFileSuspense.ts"; +export { useGetFileSuspense } from "./useGetFileSuspense.ts"; \ No newline at end of file diff --git a/frontend/api/files/useCheckS3Health.ts b/frontend/api/files/useCheckS3Health.ts index fac43c6..fff1999 100644 --- a/frontend/api/files/useCheckS3Health.ts +++ b/frontend/api/files/useCheckS3Health.ts @@ -1,61 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - CheckS3HealthQueryResponse, - CheckS3Health503, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - QueryObserverOptions, - UseQueryResult, -} from "@tanstack/react-query"; +import type { CheckS3HealthQueryResponse, CheckS3Health503 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; -export const checkS3HealthQueryKey = () => - [{ url: "/api/v1/files/health" }] as const; +export const checkS3HealthQueryKey = () => [{ url: '/api/v1/files/health' }] as const -export type CheckS3HealthQueryKey = ReturnType; +export type CheckS3HealthQueryKey = ReturnType /** * @description Verifies connectivity to the configured S3 bucket * @summary Check S3 connection * {@link /api/v1/files/health} */ -export async function checkS3Health( - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - CheckS3HealthQueryResponse, - ResponseErrorConfig, - unknown - >({ method: "GET", url: `/api/v1/files/health`, ...requestConfig }); - return res.data; +export async function checkS3Health(config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/files/health`, ... requestConfig }) + return res.data } -export function checkS3HealthQueryOptions( - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = checkS3HealthQueryKey(); - return queryOptions< - CheckS3HealthQueryResponse, - ResponseErrorConfig, - CheckS3HealthQueryResponse, - typeof queryKey - >({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return checkS3Health(config); - }, - }); +export function checkS3HealthQueryOptions(config: Partial & { client?: typeof fetch } = {}) { + const queryKey = checkS3HealthQueryKey() + return queryOptions, CheckS3HealthQueryResponse, typeof queryKey>({ + + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return checkS3Health(config) + }, + }) } /** @@ -63,40 +42,23 @@ export function checkS3HealthQueryOptions( * @summary Check S3 connection * {@link /api/v1/files/health} */ -export function useCheckS3Health< - TData = CheckS3HealthQueryResponse, - TQueryData = CheckS3HealthQueryResponse, - TQueryKey extends QueryKey = CheckS3HealthQueryKey, ->( - options: { - query?: Partial< - QueryObserverOptions< - CheckS3HealthQueryResponse, - ResponseErrorConfig, - TData, - TQueryData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = queryOptions?.queryKey ?? checkS3HealthQueryKey(); +export function useCheckS3Health(options: +{ + query?: Partial, TData, TQueryData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? checkS3HealthQueryKey() - const query = useQuery( - { - ...checkS3HealthQueryOptions(config), - queryKey, - ...queryOptions, - } as unknown as QueryObserverOptions, - queryClient, - ) as UseQueryResult> & { - queryKey: TQueryKey; - }; + const query = useQuery({ + ...checkS3HealthQueryOptions(config), + queryKey, + ...queryOptions + } as unknown as QueryObserverOptions, queryClient) as UseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/files/useCheckS3HealthSuspense.ts b/frontend/api/files/useCheckS3HealthSuspense.ts index 368614d..659d08b 100644 --- a/frontend/api/files/useCheckS3HealthSuspense.ts +++ b/frontend/api/files/useCheckS3HealthSuspense.ts @@ -1,63 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - CheckS3HealthQueryResponse, - CheckS3Health503, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - UseSuspenseQueryOptions, - UseSuspenseQueryResult, -} from "@tanstack/react-query"; +import type { CheckS3HealthQueryResponse, CheckS3Health503 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const checkS3HealthSuspenseQueryKey = () => - [{ url: "/api/v1/files/health" }] as const; +export const checkS3HealthSuspenseQueryKey = () => [{ url: '/api/v1/files/health' }] as const -export type CheckS3HealthSuspenseQueryKey = ReturnType< - typeof checkS3HealthSuspenseQueryKey ->; +export type CheckS3HealthSuspenseQueryKey = ReturnType /** * @description Verifies connectivity to the configured S3 bucket * @summary Check S3 connection * {@link /api/v1/files/health} */ -export async function checkS3HealthSuspense( - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - CheckS3HealthQueryResponse, - ResponseErrorConfig, - unknown - >({ method: "GET", url: `/api/v1/files/health`, ...requestConfig }); - return res.data; +export async function checkS3HealthSuspense(config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/files/health`, ... requestConfig }) + return res.data } -export function checkS3HealthSuspenseQueryOptions( - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = checkS3HealthSuspenseQueryKey(); - return queryOptions< - CheckS3HealthQueryResponse, - ResponseErrorConfig, - CheckS3HealthQueryResponse, - typeof queryKey - >({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return checkS3HealthSuspense(config); - }, - }); +export function checkS3HealthSuspenseQueryOptions(config: Partial & { client?: typeof fetch } = {}) { + const queryKey = checkS3HealthSuspenseQueryKey() + return queryOptions, CheckS3HealthQueryResponse, typeof queryKey>({ + + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return checkS3HealthSuspense(config) + }, + }) } /** @@ -65,38 +42,23 @@ export function checkS3HealthSuspenseQueryOptions( * @summary Check S3 connection * {@link /api/v1/files/health} */ -export function useCheckS3HealthSuspense< - TData = CheckS3HealthQueryResponse, - TQueryKey extends QueryKey = CheckS3HealthSuspenseQueryKey, ->( - options: { - query?: Partial< - UseSuspenseQueryOptions< - CheckS3HealthQueryResponse, - ResponseErrorConfig, - TData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = queryOptions?.queryKey ?? checkS3HealthSuspenseQueryKey(); +export function useCheckS3HealthSuspense(options: +{ + query?: Partial, TData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? checkS3HealthSuspenseQueryKey() - const query = useSuspenseQuery( - { - ...checkS3HealthSuspenseQueryOptions(config), - queryKey, - ...queryOptions, - } as unknown as UseSuspenseQueryOptions, - queryClient, - ) as UseSuspenseQueryResult> & { - queryKey: TQueryKey; - }; + const query = useSuspenseQuery({ + ...checkS3HealthSuspenseQueryOptions(config), + queryKey, + ...queryOptions + } as unknown as UseSuspenseQueryOptions, queryClient) as UseSuspenseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/files/useConfirmUpload.ts b/frontend/api/files/useConfirmUpload.ts index 0380768..1089b0a 100644 --- a/frontend/api/files/useConfirmUpload.ts +++ b/frontend/api/files/useConfirmUpload.ts @@ -1,81 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - ConfirmUploadMutationRequest, - ConfirmUploadMutationResponse, - ConfirmUpload400, - ConfirmUpload404, - ConfirmUpload422, - ConfirmUpload500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { ConfirmUploadMutationRequest, ConfirmUploadMutationResponse, ConfirmUpload400, ConfirmUpload404, ConfirmUpload422, ConfirmUpload500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const confirmUploadMutationKey = () => - [{ url: "/api/v1/files/confirm" }] as const; +export const confirmUploadMutationKey = () => [{ url: '/api/v1/files/confirm' }] as const -export type ConfirmUploadMutationKey = ReturnType< - typeof confirmUploadMutationKey ->; +export type ConfirmUploadMutationKey = ReturnType /** * @description Verifies the file exists in S3 and marks the upload as confirmed in DB * @summary Confirm upload * {@link /api/v1/files/confirm} */ -export async function confirmUpload( - data: ConfirmUploadMutationRequest, - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const requestData = data; - - const res = await request< - ConfirmUploadMutationResponse, - ResponseErrorConfig< - ConfirmUpload400 | ConfirmUpload404 | ConfirmUpload422 | ConfirmUpload500 - >, - ConfirmUploadMutationRequest - >({ - method: "POST", - url: `/api/v1/files/confirm`, - data: requestData, - ...requestConfig, - }); - return res.data; +export async function confirmUpload(data: ConfirmUploadMutationRequest, config: Partial> & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const requestData = data + + const res = await request, ConfirmUploadMutationRequest>({ method : "POST", url : `/api/v1/files/confirm`, data : requestData, ... requestConfig }) + return res.data } -export function confirmUploadMutationOptions( - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const mutationKey = confirmUploadMutationKey(); - return mutationOptions< - ConfirmUploadMutationResponse, - ResponseErrorConfig< - ConfirmUpload400 | ConfirmUpload404 | ConfirmUpload422 | ConfirmUpload500 - >, - { data: ConfirmUploadMutationRequest }, - TContext - >({ +export function confirmUploadMutationOptions(config: Partial> & { client?: typeof fetch } = {}) { + const mutationKey = confirmUploadMutationKey() + return mutationOptions, {data: ConfirmUploadMutationRequest}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ data }) => { - return confirmUpload(data, config); + mutationFn: async({ data }) => { + return confirmUpload(data, config) }, - }); + }) } /** @@ -83,59 +42,21 @@ export function confirmUploadMutationOptions( * @summary Confirm upload * {@link /api/v1/files/confirm} */ -export function useConfirmUpload( - options: { - mutation?: UseMutationOptions< - ConfirmUploadMutationResponse, - ResponseErrorConfig< - | ConfirmUpload400 - | ConfirmUpload404 - | ConfirmUpload422 - | ConfirmUpload500 - >, - { data: ConfirmUploadMutationRequest }, - TContext - > & { client?: QueryClient }; - client?: Partial> & { - client?: typeof fetch; - }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useConfirmUpload(options: +{ + mutation?: UseMutationOptions, {data: ConfirmUploadMutationRequest}, TContext> & { client?: QueryClient }, + client?: Partial> & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = mutationOptions.mutationKey ?? confirmUploadMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? confirmUploadMutationKey() - const baseOptions = confirmUploadMutationOptions( - config, - ) as UseMutationOptions< - ConfirmUploadMutationResponse, - ResponseErrorConfig< - ConfirmUpload400 | ConfirmUpload404 | ConfirmUpload422 | ConfirmUpload500 - >, - { data: ConfirmUploadMutationRequest }, - TContext - >; + const baseOptions = confirmUploadMutationOptions(config) as UseMutationOptions, {data: ConfirmUploadMutationRequest}, TContext> - return useMutation< - ConfirmUploadMutationResponse, - ResponseErrorConfig< - ConfirmUpload400 | ConfirmUpload404 | ConfirmUpload422 | ConfirmUpload500 - >, - { data: ConfirmUploadMutationRequest }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - ConfirmUploadMutationResponse, - ResponseErrorConfig< - ConfirmUpload400 | ConfirmUpload404 | ConfirmUpload422 | ConfirmUpload500 - >, - { data: ConfirmUploadMutationRequest }, - TContext - >; -} + return useMutation, {data: ConfirmUploadMutationRequest}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {data: ConfirmUploadMutationRequest}, TContext> +} \ No newline at end of file diff --git a/frontend/api/files/useCreateUploadURLs.ts b/frontend/api/files/useCreateUploadURLs.ts index 5bec9c8..ea65d11 100644 --- a/frontend/api/files/useCreateUploadURLs.ts +++ b/frontend/api/files/useCreateUploadURLs.ts @@ -1,80 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - CreateUploadURLsMutationRequest, - CreateUploadURLsMutationResponse, - CreateUploadURLs400, - CreateUploadURLs422, - CreateUploadURLs500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { CreateUploadURLsMutationRequest, CreateUploadURLsMutationResponse, CreateUploadURLs400, CreateUploadURLs422, CreateUploadURLs500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const createUploadURLsMutationKey = () => - [{ url: "/api/v1/files/upload" }] as const; +export const createUploadURLsMutationKey = () => [{ url: '/api/v1/files/upload' }] as const -export type CreateUploadURLsMutationKey = ReturnType< - typeof createUploadURLsMutationKey ->; +export type CreateUploadURLsMutationKey = ReturnType /** * @description Generates presigned PUT URLs for uploading files and creates pending records in DB * @summary Create upload URLs * {@link /api/v1/files/upload} */ -export async function createUploadURLs( - data: CreateUploadURLsMutationRequest, - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const requestData = data; - - const res = await request< - CreateUploadURLsMutationResponse, - ResponseErrorConfig< - CreateUploadURLs400 | CreateUploadURLs422 | CreateUploadURLs500 - >, - CreateUploadURLsMutationRequest - >({ - method: "POST", - url: `/api/v1/files/upload`, - data: requestData, - ...requestConfig, - }); - return res.data; +export async function createUploadURLs(data: CreateUploadURLsMutationRequest, config: Partial> & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const requestData = data + + const res = await request, CreateUploadURLsMutationRequest>({ method : "POST", url : `/api/v1/files/upload`, data : requestData, ... requestConfig }) + return res.data } -export function createUploadURLsMutationOptions( - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const mutationKey = createUploadURLsMutationKey(); - return mutationOptions< - CreateUploadURLsMutationResponse, - ResponseErrorConfig< - CreateUploadURLs400 | CreateUploadURLs422 | CreateUploadURLs500 - >, - { data: CreateUploadURLsMutationRequest }, - TContext - >({ +export function createUploadURLsMutationOptions(config: Partial> & { client?: typeof fetch } = {}) { + const mutationKey = createUploadURLsMutationKey() + return mutationOptions, {data: CreateUploadURLsMutationRequest}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ data }) => { - return createUploadURLs(data, config); + mutationFn: async({ data }) => { + return createUploadURLs(data, config) }, - }); + }) } /** @@ -82,57 +42,21 @@ export function createUploadURLsMutationOptions( * @summary Create upload URLs * {@link /api/v1/files/upload} */ -export function useCreateUploadURLs( - options: { - mutation?: UseMutationOptions< - CreateUploadURLsMutationResponse, - ResponseErrorConfig< - CreateUploadURLs400 | CreateUploadURLs422 | CreateUploadURLs500 - >, - { data: CreateUploadURLsMutationRequest }, - TContext - > & { client?: QueryClient }; - client?: Partial> & { - client?: typeof fetch; - }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useCreateUploadURLs(options: +{ + mutation?: UseMutationOptions, {data: CreateUploadURLsMutationRequest}, TContext> & { client?: QueryClient }, + client?: Partial> & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = - mutationOptions.mutationKey ?? createUploadURLsMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? createUploadURLsMutationKey() - const baseOptions = createUploadURLsMutationOptions( - config, - ) as UseMutationOptions< - CreateUploadURLsMutationResponse, - ResponseErrorConfig< - CreateUploadURLs400 | CreateUploadURLs422 | CreateUploadURLs500 - >, - { data: CreateUploadURLsMutationRequest }, - TContext - >; + const baseOptions = createUploadURLsMutationOptions(config) as UseMutationOptions, {data: CreateUploadURLsMutationRequest}, TContext> - return useMutation< - CreateUploadURLsMutationResponse, - ResponseErrorConfig< - CreateUploadURLs400 | CreateUploadURLs422 | CreateUploadURLs500 - >, - { data: CreateUploadURLsMutationRequest }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - CreateUploadURLsMutationResponse, - ResponseErrorConfig< - CreateUploadURLs400 | CreateUploadURLs422 | CreateUploadURLs500 - >, - { data: CreateUploadURLsMutationRequest }, - TContext - >; -} + return useMutation, {data: CreateUploadURLsMutationRequest}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {data: CreateUploadURLsMutationRequest}, TContext> +} \ No newline at end of file diff --git a/frontend/api/files/useGetFile.ts b/frontend/api/files/useGetFile.ts index 33b2ea3..2d72a98 100644 --- a/frontend/api/files/useGetFile.ts +++ b/frontend/api/files/useGetFile.ts @@ -1,81 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetFileQueryResponse, - GetFilePathParams, - GetFile400, - GetFile404, - GetFile500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - QueryObserverOptions, - UseQueryResult, -} from "@tanstack/react-query"; +import type { GetFileQueryResponse, GetFilePathParams, GetFile400, GetFile404, GetFile500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; -export const getFileQueryKey = ( - imageId: GetFilePathParams["imageId"], - size: GetFilePathParams["size"], -) => - [ - { - url: "/api/v1/files/:imageId/:size", - params: { imageId: imageId, size: size }, - }, - ] as const; +export const getFileQueryKey = (imageId: GetFilePathParams["imageId"], size: GetFilePathParams["size"]) => [{ url: '/api/v1/files/:imageId/:size', params: {imageId:imageId,size:size} }] as const -export type GetFileQueryKey = ReturnType; +export type GetFileQueryKey = ReturnType /** * @description Retrieves a presigned URL for downloading a specific file size * @summary Get file by ID and size * {@link /api/v1/files/:imageId/:size} */ -export async function getFile( - imageId: GetFilePathParams["imageId"], - size: GetFilePathParams["size"], - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetFileQueryResponse, - ResponseErrorConfig, - unknown - >({ - method: "GET", - url: `/api/v1/files/${imageId}/${size}`, - ...requestConfig, - }); - return res.data; +export async function getFile(imageId: GetFilePathParams["imageId"], size: GetFilePathParams["size"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/files/${imageId}/${size}`, ... requestConfig }) + return res.data } -export function getFileQueryOptions( - imageId: GetFilePathParams["imageId"], - size: GetFilePathParams["size"], - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getFileQueryKey(imageId, size); - return queryOptions< - GetFileQueryResponse, - ResponseErrorConfig, - GetFileQueryResponse, - typeof queryKey - >({ - enabled: !!(imageId && size), - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getFile(imageId, size, config); - }, - }); +export function getFileQueryOptions(imageId: GetFilePathParams["imageId"], size: GetFilePathParams["size"], config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getFileQueryKey(imageId, size) + return queryOptions, GetFileQueryResponse, typeof queryKey>({ + enabled: !!(imageId&& size), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getFile(imageId, size, config) + }, + }) } /** @@ -83,43 +42,23 @@ export function getFileQueryOptions( * @summary Get file by ID and size * {@link /api/v1/files/:imageId/:size} */ -export function useGetFile< - TData = GetFileQueryResponse, - TQueryData = GetFileQueryResponse, - TQueryKey extends QueryKey = GetFileQueryKey, ->( - imageId: GetFilePathParams["imageId"], - size: GetFilePathParams["size"], - options: { - query?: Partial< - QueryObserverOptions< - GetFileQueryResponse, - ResponseErrorConfig, - TData, - TQueryData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = queryOptions?.queryKey ?? getFileQueryKey(imageId, size); +export function useGetFile(imageId: GetFilePathParams["imageId"], size: GetFilePathParams["size"], options: +{ + query?: Partial, TData, TQueryData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getFileQueryKey(imageId, size) - const query = useQuery( - { - ...getFileQueryOptions(imageId, size, config), - queryKey, - ...queryOptions, - } as unknown as QueryObserverOptions, - queryClient, - ) as UseQueryResult< - TData, - ResponseErrorConfig - > & { queryKey: TQueryKey }; + const query = useQuery({ + ...getFileQueryOptions(imageId, size, config), + queryKey, + ...queryOptions + } as unknown as QueryObserverOptions, queryClient) as UseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/files/useGetFileAllSizes.ts b/frontend/api/files/useGetFileAllSizes.ts index 0b416a0..93887e2 100644 --- a/frontend/api/files/useGetFileAllSizes.ts +++ b/frontend/api/files/useGetFileAllSizes.ts @@ -1,74 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetFileAllSizesQueryResponse, - GetFileAllSizesPathParams, - GetFileAllSizes400, - GetFileAllSizes404, - GetFileAllSizes500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - QueryObserverOptions, - UseQueryResult, -} from "@tanstack/react-query"; +import type { GetFileAllSizesQueryResponse, GetFileAllSizesPathParams, GetFileAllSizes400, GetFileAllSizes404, GetFileAllSizes500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; -export const getFileAllSizesQueryKey = ( - imageId: GetFileAllSizesPathParams["imageId"], -) => [{ url: "/api/v1/files/:imageId", params: { imageId: imageId } }] as const; +export const getFileAllSizesQueryKey = (imageId: GetFileAllSizesPathParams["imageId"]) => [{ url: '/api/v1/files/:imageId', params: {imageId:imageId} }] as const -export type GetFileAllSizesQueryKey = ReturnType< - typeof getFileAllSizesQueryKey ->; +export type GetFileAllSizesQueryKey = ReturnType /** * @description Retrieves presigned URLs for all sizes of an image * @summary Get all sizes of a file * {@link /api/v1/files/:imageId} */ -export async function getFileAllSizes( - imageId: GetFileAllSizesPathParams["imageId"], - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetFileAllSizesQueryResponse, - ResponseErrorConfig< - GetFileAllSizes400 | GetFileAllSizes404 | GetFileAllSizes500 - >, - unknown - >({ method: "GET", url: `/api/v1/files/${imageId}`, ...requestConfig }); - return res.data; +export async function getFileAllSizes(imageId: GetFileAllSizesPathParams["imageId"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/files/${imageId}`, ... requestConfig }) + return res.data } -export function getFileAllSizesQueryOptions( - imageId: GetFileAllSizesPathParams["imageId"], - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getFileAllSizesQueryKey(imageId); - return queryOptions< - GetFileAllSizesQueryResponse, - ResponseErrorConfig< - GetFileAllSizes400 | GetFileAllSizes404 | GetFileAllSizes500 - >, - GetFileAllSizesQueryResponse, - typeof queryKey - >({ - enabled: !!imageId, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getFileAllSizes(imageId, config); - }, - }); +export function getFileAllSizesQueryOptions(imageId: GetFileAllSizesPathParams["imageId"], config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getFileAllSizesQueryKey(imageId) + return queryOptions, GetFileAllSizesQueryResponse, typeof queryKey>({ + enabled: !!(imageId), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getFileAllSizes(imageId, config) + }, + }) } /** @@ -76,46 +42,23 @@ export function getFileAllSizesQueryOptions( * @summary Get all sizes of a file * {@link /api/v1/files/:imageId} */ -export function useGetFileAllSizes< - TData = GetFileAllSizesQueryResponse, - TQueryData = GetFileAllSizesQueryResponse, - TQueryKey extends QueryKey = GetFileAllSizesQueryKey, ->( - imageId: GetFileAllSizesPathParams["imageId"], - options: { - query?: Partial< - QueryObserverOptions< - GetFileAllSizesQueryResponse, - ResponseErrorConfig< - GetFileAllSizes400 | GetFileAllSizes404 | GetFileAllSizes500 - >, - TData, - TQueryData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = queryOptions?.queryKey ?? getFileAllSizesQueryKey(imageId); +export function useGetFileAllSizes(imageId: GetFileAllSizesPathParams["imageId"], options: +{ + query?: Partial, TData, TQueryData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getFileAllSizesQueryKey(imageId) - const query = useQuery( - { - ...getFileAllSizesQueryOptions(imageId, config), - queryKey, - ...queryOptions, - } as unknown as QueryObserverOptions, - queryClient, - ) as UseQueryResult< - TData, - ResponseErrorConfig< - GetFileAllSizes400 | GetFileAllSizes404 | GetFileAllSizes500 - > - > & { queryKey: TQueryKey }; + const query = useQuery({ + ...getFileAllSizesQueryOptions(imageId, config), + queryKey, + ...queryOptions + } as unknown as QueryObserverOptions, queryClient) as UseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/files/useGetFileAllSizesSuspense.ts b/frontend/api/files/useGetFileAllSizesSuspense.ts index 8eacae0..198a416 100644 --- a/frontend/api/files/useGetFileAllSizesSuspense.ts +++ b/frontend/api/files/useGetFileAllSizesSuspense.ts @@ -1,74 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetFileAllSizesQueryResponse, - GetFileAllSizesPathParams, - GetFileAllSizes400, - GetFileAllSizes404, - GetFileAllSizes500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - UseSuspenseQueryOptions, - UseSuspenseQueryResult, -} from "@tanstack/react-query"; +import type { GetFileAllSizesQueryResponse, GetFileAllSizesPathParams, GetFileAllSizes400, GetFileAllSizes404, GetFileAllSizes500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const getFileAllSizesSuspenseQueryKey = ( - imageId: GetFileAllSizesPathParams["imageId"], -) => [{ url: "/api/v1/files/:imageId", params: { imageId: imageId } }] as const; +export const getFileAllSizesSuspenseQueryKey = (imageId: GetFileAllSizesPathParams["imageId"]) => [{ url: '/api/v1/files/:imageId', params: {imageId:imageId} }] as const -export type GetFileAllSizesSuspenseQueryKey = ReturnType< - typeof getFileAllSizesSuspenseQueryKey ->; +export type GetFileAllSizesSuspenseQueryKey = ReturnType /** * @description Retrieves presigned URLs for all sizes of an image * @summary Get all sizes of a file * {@link /api/v1/files/:imageId} */ -export async function getFileAllSizesSuspense( - imageId: GetFileAllSizesPathParams["imageId"], - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetFileAllSizesQueryResponse, - ResponseErrorConfig< - GetFileAllSizes400 | GetFileAllSizes404 | GetFileAllSizes500 - >, - unknown - >({ method: "GET", url: `/api/v1/files/${imageId}`, ...requestConfig }); - return res.data; +export async function getFileAllSizesSuspense(imageId: GetFileAllSizesPathParams["imageId"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/files/${imageId}`, ... requestConfig }) + return res.data } -export function getFileAllSizesSuspenseQueryOptions( - imageId: GetFileAllSizesPathParams["imageId"], - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getFileAllSizesSuspenseQueryKey(imageId); - return queryOptions< - GetFileAllSizesQueryResponse, - ResponseErrorConfig< - GetFileAllSizes400 | GetFileAllSizes404 | GetFileAllSizes500 - >, - GetFileAllSizesQueryResponse, - typeof queryKey - >({ - enabled: !!imageId, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getFileAllSizesSuspense(imageId, config); - }, - }); +export function getFileAllSizesSuspenseQueryOptions(imageId: GetFileAllSizesPathParams["imageId"], config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getFileAllSizesSuspenseQueryKey(imageId) + return queryOptions, GetFileAllSizesQueryResponse, typeof queryKey>({ + enabled: !!(imageId), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getFileAllSizesSuspense(imageId, config) + }, + }) } /** @@ -76,45 +42,23 @@ export function getFileAllSizesSuspenseQueryOptions( * @summary Get all sizes of a file * {@link /api/v1/files/:imageId} */ -export function useGetFileAllSizesSuspense< - TData = GetFileAllSizesQueryResponse, - TQueryKey extends QueryKey = GetFileAllSizesSuspenseQueryKey, ->( - imageId: GetFileAllSizesPathParams["imageId"], - options: { - query?: Partial< - UseSuspenseQueryOptions< - GetFileAllSizesQueryResponse, - ResponseErrorConfig< - GetFileAllSizes400 | GetFileAllSizes404 | GetFileAllSizes500 - >, - TData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = - queryOptions?.queryKey ?? getFileAllSizesSuspenseQueryKey(imageId); +export function useGetFileAllSizesSuspense(imageId: GetFileAllSizesPathParams["imageId"], options: +{ + query?: Partial, TData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getFileAllSizesSuspenseQueryKey(imageId) - const query = useSuspenseQuery( - { - ...getFileAllSizesSuspenseQueryOptions(imageId, config), - queryKey, - ...queryOptions, - } as unknown as UseSuspenseQueryOptions, - queryClient, - ) as UseSuspenseQueryResult< - TData, - ResponseErrorConfig< - GetFileAllSizes400 | GetFileAllSizes404 | GetFileAllSizes500 - > - > & { queryKey: TQueryKey }; + const query = useSuspenseQuery({ + ...getFileAllSizesSuspenseQueryOptions(imageId, config), + queryKey, + ...queryOptions + } as unknown as UseSuspenseQueryOptions, queryClient) as UseSuspenseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/files/useGetFileSuspense.ts b/frontend/api/files/useGetFileSuspense.ts index 957132c..12aa162 100644 --- a/frontend/api/files/useGetFileSuspense.ts +++ b/frontend/api/files/useGetFileSuspense.ts @@ -1,83 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetFileQueryResponse, - GetFilePathParams, - GetFile400, - GetFile404, - GetFile500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - UseSuspenseQueryOptions, - UseSuspenseQueryResult, -} from "@tanstack/react-query"; +import type { GetFileQueryResponse, GetFilePathParams, GetFile400, GetFile404, GetFile500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const getFileSuspenseQueryKey = ( - imageId: GetFilePathParams["imageId"], - size: GetFilePathParams["size"], -) => - [ - { - url: "/api/v1/files/:imageId/:size", - params: { imageId: imageId, size: size }, - }, - ] as const; +export const getFileSuspenseQueryKey = (imageId: GetFilePathParams["imageId"], size: GetFilePathParams["size"]) => [{ url: '/api/v1/files/:imageId/:size', params: {imageId:imageId,size:size} }] as const -export type GetFileSuspenseQueryKey = ReturnType< - typeof getFileSuspenseQueryKey ->; +export type GetFileSuspenseQueryKey = ReturnType /** * @description Retrieves a presigned URL for downloading a specific file size * @summary Get file by ID and size * {@link /api/v1/files/:imageId/:size} */ -export async function getFileSuspense( - imageId: GetFilePathParams["imageId"], - size: GetFilePathParams["size"], - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetFileQueryResponse, - ResponseErrorConfig, - unknown - >({ - method: "GET", - url: `/api/v1/files/${imageId}/${size}`, - ...requestConfig, - }); - return res.data; +export async function getFileSuspense(imageId: GetFilePathParams["imageId"], size: GetFilePathParams["size"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/files/${imageId}/${size}`, ... requestConfig }) + return res.data } -export function getFileSuspenseQueryOptions( - imageId: GetFilePathParams["imageId"], - size: GetFilePathParams["size"], - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getFileSuspenseQueryKey(imageId, size); - return queryOptions< - GetFileQueryResponse, - ResponseErrorConfig, - GetFileQueryResponse, - typeof queryKey - >({ - enabled: !!(imageId && size), - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getFileSuspense(imageId, size, config); - }, - }); +export function getFileSuspenseQueryOptions(imageId: GetFilePathParams["imageId"], size: GetFilePathParams["size"], config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getFileSuspenseQueryKey(imageId, size) + return queryOptions, GetFileQueryResponse, typeof queryKey>({ + enabled: !!(imageId&& size), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getFileSuspense(imageId, size, config) + }, + }) } /** @@ -85,42 +42,23 @@ export function getFileSuspenseQueryOptions( * @summary Get file by ID and size * {@link /api/v1/files/:imageId/:size} */ -export function useGetFileSuspense< - TData = GetFileQueryResponse, - TQueryKey extends QueryKey = GetFileSuspenseQueryKey, ->( - imageId: GetFilePathParams["imageId"], - size: GetFilePathParams["size"], - options: { - query?: Partial< - UseSuspenseQueryOptions< - GetFileQueryResponse, - ResponseErrorConfig, - TData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = - queryOptions?.queryKey ?? getFileSuspenseQueryKey(imageId, size); +export function useGetFileSuspense(imageId: GetFilePathParams["imageId"], size: GetFilePathParams["size"], options: +{ + query?: Partial, TData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getFileSuspenseQueryKey(imageId, size) - const query = useSuspenseQuery( - { - ...getFileSuspenseQueryOptions(imageId, size, config), - queryKey, - ...queryOptions, - } as unknown as UseSuspenseQueryOptions, - queryClient, - ) as UseSuspenseQueryResult< - TData, - ResponseErrorConfig - > & { queryKey: TQueryKey }; + const query = useSuspenseQuery({ + ...getFileSuspenseQueryOptions(imageId, size, config), + queryKey, + ...queryOptions + } as unknown as UseSuspenseQueryOptions, queryClient) as UseSuspenseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/index.ts b/frontend/api/index.ts index 6ec3cb4..45dd481 100644 --- a/frontend/api/index.ts +++ b/frontend/api/index.ts @@ -24,6 +24,13 @@ export type { RemoveMemberMutationKey } from "./memberships/useRemoveMember.ts"; export type { UpdateMembershipMutationKey } from "./memberships/useUpdateMembership.ts"; export type { SendBulkNotificationMutationKey } from "./notifications/useSendBulkNotification.ts"; export type { SendNotificationMutationKey } from "./notifications/useSendNotification.ts"; +export type { CreatePitchMutationKey } from "./pitches/useCreatePitch.ts"; +export type { DeletePitchMutationKey } from "./pitches/useDeletePitch.ts"; +export type { GetPitchQueryKey } from "./pitches/useGetPitch.ts"; +export type { GetPitchSuspenseQueryKey } from "./pitches/useGetPitchSuspense.ts"; +export type { ListPitchesQueryKey } from "./pitches/useListPitches.ts"; +export type { ListPitchesSuspenseQueryKey } from "./pitches/useListPitchesSuspense.ts"; +export type { UpdatePitchMutationKey } from "./pitches/useUpdatePitch.ts"; export type { CreateTripMutationKey } from "./trips/useCreateTrip.ts"; export type { DeleteTripMutationKey } from "./trips/useDeleteTrip.ts"; export type { GetAllTripsQueryKey } from "./trips/useGetAllTrips.ts"; @@ -142,6 +149,34 @@ export { sendNotificationMutationKey } from "./notifications/useSendNotification export { sendNotification } from "./notifications/useSendNotification.ts"; export { sendNotificationMutationOptions } from "./notifications/useSendNotification.ts"; export { useSendNotification } from "./notifications/useSendNotification.ts"; +export { createPitchMutationKey } from "./pitches/useCreatePitch.ts"; +export { createPitch } from "./pitches/useCreatePitch.ts"; +export { createPitchMutationOptions } from "./pitches/useCreatePitch.ts"; +export { useCreatePitch } from "./pitches/useCreatePitch.ts"; +export { deletePitchMutationKey } from "./pitches/useDeletePitch.ts"; +export { deletePitch } from "./pitches/useDeletePitch.ts"; +export { deletePitchMutationOptions } from "./pitches/useDeletePitch.ts"; +export { useDeletePitch } from "./pitches/useDeletePitch.ts"; +export { getPitchQueryKey } from "./pitches/useGetPitch.ts"; +export { getPitch } from "./pitches/useGetPitch.ts"; +export { getPitchQueryOptions } from "./pitches/useGetPitch.ts"; +export { useGetPitch } from "./pitches/useGetPitch.ts"; +export { getPitchSuspenseQueryKey } from "./pitches/useGetPitchSuspense.ts"; +export { getPitchSuspense } from "./pitches/useGetPitchSuspense.ts"; +export { getPitchSuspenseQueryOptions } from "./pitches/useGetPitchSuspense.ts"; +export { useGetPitchSuspense } from "./pitches/useGetPitchSuspense.ts"; +export { listPitchesQueryKey } from "./pitches/useListPitches.ts"; +export { listPitches } from "./pitches/useListPitches.ts"; +export { listPitchesQueryOptions } from "./pitches/useListPitches.ts"; +export { useListPitches } from "./pitches/useListPitches.ts"; +export { listPitchesSuspenseQueryKey } from "./pitches/useListPitchesSuspense.ts"; +export { listPitchesSuspense } from "./pitches/useListPitchesSuspense.ts"; +export { listPitchesSuspenseQueryOptions } from "./pitches/useListPitchesSuspense.ts"; +export { useListPitchesSuspense } from "./pitches/useListPitchesSuspense.ts"; +export { updatePitchMutationKey } from "./pitches/useUpdatePitch.ts"; +export { updatePitch } from "./pitches/useUpdatePitch.ts"; +export { updatePitchMutationOptions } from "./pitches/useUpdatePitch.ts"; +export { useUpdatePitch } from "./pitches/useUpdatePitch.ts"; export { createTripMutationKey } from "./trips/useCreateTrip.ts"; export { createTrip } from "./trips/useCreateTrip.ts"; export { createTripMutationOptions } from "./trips/useCreateTrip.ts"; @@ -197,4 +232,4 @@ export { useGetUserSuspense } from "./users/useGetUserSuspense.ts"; export { updateUserMutationKey } from "./users/useUpdateUser.ts"; export { updateUser } from "./users/useUpdateUser.ts"; export { updateUserMutationOptions } from "./users/useUpdateUser.ts"; -export { useUpdateUser } from "./users/useUpdateUser.ts"; +export { useUpdateUser } from "./users/useUpdateUser.ts"; \ No newline at end of file diff --git a/frontend/api/memberships/index.ts b/frontend/api/memberships/index.ts index e7822a3..b344788 100644 --- a/frontend/api/memberships/index.ts +++ b/frontend/api/memberships/index.ts @@ -42,4 +42,4 @@ export { useRemoveMember } from "./useRemoveMember.ts"; export { updateMembershipMutationKey } from "./useUpdateMembership.ts"; export { updateMembership } from "./useUpdateMembership.ts"; export { updateMembershipMutationOptions } from "./useUpdateMembership.ts"; -export { useUpdateMembership } from "./useUpdateMembership.ts"; +export { useUpdateMembership } from "./useUpdateMembership.ts"; \ No newline at end of file diff --git a/frontend/api/memberships/useAddMember.ts b/frontend/api/memberships/useAddMember.ts index acb18e5..c87a1fc 100644 --- a/frontend/api/memberships/useAddMember.ts +++ b/frontend/api/memberships/useAddMember.ts @@ -1,79 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - AddMemberMutationRequest, - AddMemberMutationResponse, - AddMember400, - AddMember401, - AddMember422, - AddMember500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { AddMemberMutationRequest, AddMemberMutationResponse, AddMember400, AddMember401, AddMember422, AddMember500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const addMemberMutationKey = () => - [{ url: "/api/v1/memberships" }] as const; +export const addMemberMutationKey = () => [{ url: '/api/v1/memberships' }] as const -export type AddMemberMutationKey = ReturnType; +export type AddMemberMutationKey = ReturnType /** * @description Adds a user as a member of a trip * @summary Add member to trip * {@link /api/v1/memberships} */ -export async function addMember( - data: AddMemberMutationRequest, - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const requestData = data; - - const res = await request< - AddMemberMutationResponse, - ResponseErrorConfig< - AddMember400 | AddMember401 | AddMember422 | AddMember500 - >, - AddMemberMutationRequest - >({ - method: "POST", - url: `/api/v1/memberships`, - data: requestData, - ...requestConfig, - }); - return res.data; +export async function addMember(data: AddMemberMutationRequest, config: Partial> & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const requestData = data + + const res = await request, AddMemberMutationRequest>({ method : "POST", url : `/api/v1/memberships`, data : requestData, ... requestConfig }) + return res.data } -export function addMemberMutationOptions( - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const mutationKey = addMemberMutationKey(); - return mutationOptions< - AddMemberMutationResponse, - ResponseErrorConfig< - AddMember400 | AddMember401 | AddMember422 | AddMember500 - >, - { data: AddMemberMutationRequest }, - TContext - >({ +export function addMemberMutationOptions(config: Partial> & { client?: typeof fetch } = {}) { + const mutationKey = addMemberMutationKey() + return mutationOptions, {data: AddMemberMutationRequest}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ data }) => { - return addMember(data, config); + mutationFn: async({ data }) => { + return addMember(data, config) }, - }); + }) } /** @@ -81,54 +42,21 @@ export function addMemberMutationOptions( * @summary Add member to trip * {@link /api/v1/memberships} */ -export function useAddMember( - options: { - mutation?: UseMutationOptions< - AddMemberMutationResponse, - ResponseErrorConfig< - AddMember400 | AddMember401 | AddMember422 | AddMember500 - >, - { data: AddMemberMutationRequest }, - TContext - > & { client?: QueryClient }; - client?: Partial> & { - client?: typeof fetch; - }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useAddMember(options: +{ + mutation?: UseMutationOptions, {data: AddMemberMutationRequest}, TContext> & { client?: QueryClient }, + client?: Partial> & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = mutationOptions.mutationKey ?? addMemberMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? addMemberMutationKey() - const baseOptions = addMemberMutationOptions(config) as UseMutationOptions< - AddMemberMutationResponse, - ResponseErrorConfig< - AddMember400 | AddMember401 | AddMember422 | AddMember500 - >, - { data: AddMemberMutationRequest }, - TContext - >; + const baseOptions = addMemberMutationOptions(config) as UseMutationOptions, {data: AddMemberMutationRequest}, TContext> - return useMutation< - AddMemberMutationResponse, - ResponseErrorConfig< - AddMember400 | AddMember401 | AddMember422 | AddMember500 - >, - { data: AddMemberMutationRequest }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - AddMemberMutationResponse, - ResponseErrorConfig< - AddMember400 | AddMember401 | AddMember422 | AddMember500 - >, - { data: AddMemberMutationRequest }, - TContext - >; -} + return useMutation, {data: AddMemberMutationRequest}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {data: AddMemberMutationRequest}, TContext> +} \ No newline at end of file diff --git a/frontend/api/memberships/useDemoteFromAdmin.ts b/frontend/api/memberships/useDemoteFromAdmin.ts index 213abc8..f539cb3 100644 --- a/frontend/api/memberships/useDemoteFromAdmin.ts +++ b/frontend/api/memberships/useDemoteFromAdmin.ts @@ -1,84 +1,38 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - DemoteFromAdminMutationResponse, - DemoteFromAdminPathParams, - DemoteFromAdmin400, - DemoteFromAdmin401, - DemoteFromAdmin404, - DemoteFromAdmin500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { DemoteFromAdminMutationResponse, DemoteFromAdminPathParams, DemoteFromAdmin400, DemoteFromAdmin401, DemoteFromAdmin404, DemoteFromAdmin500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const demoteFromAdminMutationKey = () => - [{ url: "/api/v1/trips/:tripID/memberships/:userID/demote" }] as const; +export const demoteFromAdminMutationKey = () => [{ url: '/api/v1/trips/:tripID/memberships/:userID/demote' }] as const -export type DemoteFromAdminMutationKey = ReturnType< - typeof demoteFromAdminMutationKey ->; +export type DemoteFromAdminMutationKey = ReturnType /** * @description Demotes an admin to regular member role * @summary Demote admin to member * {@link /api/v1/trips/:tripID/memberships/:userID/demote} */ -export async function demoteFromAdmin( - tripID: DemoteFromAdminPathParams["tripID"], - userID: DemoteFromAdminPathParams["userID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - DemoteFromAdminMutationResponse, - ResponseErrorConfig< - | DemoteFromAdmin400 - | DemoteFromAdmin401 - | DemoteFromAdmin404 - | DemoteFromAdmin500 - >, - unknown - >({ - method: "POST", - url: `/api/v1/trips/${tripID}/memberships/${userID}/demote`, - ...requestConfig, - }); - return res.data; +export async function demoteFromAdmin(tripID: DemoteFromAdminPathParams["tripID"], userID: DemoteFromAdminPathParams["userID"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "POST", url : `/api/v1/trips/${tripID}/memberships/${userID}/demote`, ... requestConfig }) + return res.data } -export function demoteFromAdminMutationOptions( - config: Partial & { client?: typeof fetch } = {}, -) { - const mutationKey = demoteFromAdminMutationKey(); - return mutationOptions< - DemoteFromAdminMutationResponse, - ResponseErrorConfig< - | DemoteFromAdmin400 - | DemoteFromAdmin401 - | DemoteFromAdmin404 - | DemoteFromAdmin500 - >, - { - tripID: DemoteFromAdminPathParams["tripID"]; - userID: DemoteFromAdminPathParams["userID"]; - }, - TContext - >({ +export function demoteFromAdminMutationOptions(config: Partial & { client?: typeof fetch } = {}) { + const mutationKey = demoteFromAdminMutationKey() + return mutationOptions, {tripID: DemoteFromAdminPathParams["tripID"], userID: DemoteFromAdminPathParams["userID"]}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ tripID, userID }) => { - return demoteFromAdmin(tripID, userID, config); + mutationFn: async({ tripID, userID }) => { + return demoteFromAdmin(tripID, userID, config) }, - }); + }) } /** @@ -86,79 +40,21 @@ export function demoteFromAdminMutationOptions( * @summary Demote admin to member * {@link /api/v1/trips/:tripID/memberships/:userID/demote} */ -export function useDemoteFromAdmin( - options: { - mutation?: UseMutationOptions< - DemoteFromAdminMutationResponse, - ResponseErrorConfig< - | DemoteFromAdmin400 - | DemoteFromAdmin401 - | DemoteFromAdmin404 - | DemoteFromAdmin500 - >, - { - tripID: DemoteFromAdminPathParams["tripID"]; - userID: DemoteFromAdminPathParams["userID"]; - }, - TContext - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useDemoteFromAdmin(options: +{ + mutation?: UseMutationOptions, {tripID: DemoteFromAdminPathParams["tripID"], userID: DemoteFromAdminPathParams["userID"]}, TContext> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = - mutationOptions.mutationKey ?? demoteFromAdminMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? demoteFromAdminMutationKey() - const baseOptions = demoteFromAdminMutationOptions( - config, - ) as UseMutationOptions< - DemoteFromAdminMutationResponse, - ResponseErrorConfig< - | DemoteFromAdmin400 - | DemoteFromAdmin401 - | DemoteFromAdmin404 - | DemoteFromAdmin500 - >, - { - tripID: DemoteFromAdminPathParams["tripID"]; - userID: DemoteFromAdminPathParams["userID"]; - }, - TContext - >; + const baseOptions = demoteFromAdminMutationOptions(config) as UseMutationOptions, {tripID: DemoteFromAdminPathParams["tripID"], userID: DemoteFromAdminPathParams["userID"]}, TContext> - return useMutation< - DemoteFromAdminMutationResponse, - ResponseErrorConfig< - | DemoteFromAdmin400 - | DemoteFromAdmin401 - | DemoteFromAdmin404 - | DemoteFromAdmin500 - >, - { - tripID: DemoteFromAdminPathParams["tripID"]; - userID: DemoteFromAdminPathParams["userID"]; - }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - DemoteFromAdminMutationResponse, - ResponseErrorConfig< - | DemoteFromAdmin400 - | DemoteFromAdmin401 - | DemoteFromAdmin404 - | DemoteFromAdmin500 - >, - { - tripID: DemoteFromAdminPathParams["tripID"]; - userID: DemoteFromAdminPathParams["userID"]; - }, - TContext - >; -} + return useMutation, {tripID: DemoteFromAdminPathParams["tripID"], userID: DemoteFromAdminPathParams["userID"]}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {tripID: DemoteFromAdminPathParams["tripID"], userID: DemoteFromAdminPathParams["userID"]}, TContext> +} \ No newline at end of file diff --git a/frontend/api/memberships/useGetMembership.ts b/frontend/api/memberships/useGetMembership.ts index 03af567..6c90370 100644 --- a/frontend/api/memberships/useGetMembership.ts +++ b/frontend/api/memberships/useGetMembership.ts @@ -1,86 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetMembershipQueryResponse, - GetMembershipPathParams, - GetMembership400, - GetMembership401, - GetMembership404, - GetMembership500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - QueryObserverOptions, - UseQueryResult, -} from "@tanstack/react-query"; +import type { GetMembershipQueryResponse, GetMembershipPathParams, GetMembership400, GetMembership401, GetMembership404, GetMembership500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; -export const getMembershipQueryKey = ( - tripID: GetMembershipPathParams["tripID"], - userID: GetMembershipPathParams["userID"], -) => - [ - { - url: "/api/v1/trips/:tripID/memberships/:userID", - params: { tripID: tripID, userID: userID }, - }, - ] as const; +export const getMembershipQueryKey = (tripID: GetMembershipPathParams["tripID"], userID: GetMembershipPathParams["userID"]) => [{ url: '/api/v1/trips/:tripID/memberships/:userID', params: {tripID:tripID,userID:userID} }] as const -export type GetMembershipQueryKey = ReturnType; +export type GetMembershipQueryKey = ReturnType /** * @description Retrieves the membership for a user in a trip * @summary Get membership * {@link /api/v1/trips/:tripID/memberships/:userID} */ -export async function getMembership( - tripID: GetMembershipPathParams["tripID"], - userID: GetMembershipPathParams["userID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetMembershipQueryResponse, - ResponseErrorConfig< - GetMembership400 | GetMembership401 | GetMembership404 | GetMembership500 - >, - unknown - >({ - method: "GET", - url: `/api/v1/trips/${tripID}/memberships/${userID}`, - ...requestConfig, - }); - return res.data; +export async function getMembership(tripID: GetMembershipPathParams["tripID"], userID: GetMembershipPathParams["userID"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/trips/${tripID}/memberships/${userID}`, ... requestConfig }) + return res.data } -export function getMembershipQueryOptions( - tripID: GetMembershipPathParams["tripID"], - userID: GetMembershipPathParams["userID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getMembershipQueryKey(tripID, userID); - return queryOptions< - GetMembershipQueryResponse, - ResponseErrorConfig< - GetMembership400 | GetMembership401 | GetMembership404 | GetMembership500 - >, - GetMembershipQueryResponse, - typeof queryKey - >({ - enabled: !!(tripID && userID), - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getMembership(tripID, userID, config); - }, - }); +export function getMembershipQueryOptions(tripID: GetMembershipPathParams["tripID"], userID: GetMembershipPathParams["userID"], config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getMembershipQueryKey(tripID, userID) + return queryOptions, GetMembershipQueryResponse, typeof queryKey>({ + enabled: !!(tripID&& userID), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getMembership(tripID, userID, config) + }, + }) } /** @@ -88,51 +42,23 @@ export function getMembershipQueryOptions( * @summary Get membership * {@link /api/v1/trips/:tripID/memberships/:userID} */ -export function useGetMembership< - TData = GetMembershipQueryResponse, - TQueryData = GetMembershipQueryResponse, - TQueryKey extends QueryKey = GetMembershipQueryKey, ->( - tripID: GetMembershipPathParams["tripID"], - userID: GetMembershipPathParams["userID"], - options: { - query?: Partial< - QueryObserverOptions< - GetMembershipQueryResponse, - ResponseErrorConfig< - | GetMembership400 - | GetMembership401 - | GetMembership404 - | GetMembership500 - >, - TData, - TQueryData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = - queryOptions?.queryKey ?? getMembershipQueryKey(tripID, userID); +export function useGetMembership(tripID: GetMembershipPathParams["tripID"], userID: GetMembershipPathParams["userID"], options: +{ + query?: Partial, TData, TQueryData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getMembershipQueryKey(tripID, userID) - const query = useQuery( - { - ...getMembershipQueryOptions(tripID, userID, config), - queryKey, - ...queryOptions, - } as unknown as QueryObserverOptions, - queryClient, - ) as UseQueryResult< - TData, - ResponseErrorConfig< - GetMembership400 | GetMembership401 | GetMembership404 | GetMembership500 - > - > & { queryKey: TQueryKey }; + const query = useQuery({ + ...getMembershipQueryOptions(tripID, userID, config), + queryKey, + ...queryOptions + } as unknown as QueryObserverOptions, queryClient) as UseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/memberships/useGetMembershipSuspense.ts b/frontend/api/memberships/useGetMembershipSuspense.ts index 2ffd267..13fe7fc 100644 --- a/frontend/api/memberships/useGetMembershipSuspense.ts +++ b/frontend/api/memberships/useGetMembershipSuspense.ts @@ -1,88 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetMembershipQueryResponse, - GetMembershipPathParams, - GetMembership400, - GetMembership401, - GetMembership404, - GetMembership500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - UseSuspenseQueryOptions, - UseSuspenseQueryResult, -} from "@tanstack/react-query"; +import type { GetMembershipQueryResponse, GetMembershipPathParams, GetMembership400, GetMembership401, GetMembership404, GetMembership500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const getMembershipSuspenseQueryKey = ( - tripID: GetMembershipPathParams["tripID"], - userID: GetMembershipPathParams["userID"], -) => - [ - { - url: "/api/v1/trips/:tripID/memberships/:userID", - params: { tripID: tripID, userID: userID }, - }, - ] as const; +export const getMembershipSuspenseQueryKey = (tripID: GetMembershipPathParams["tripID"], userID: GetMembershipPathParams["userID"]) => [{ url: '/api/v1/trips/:tripID/memberships/:userID', params: {tripID:tripID,userID:userID} }] as const -export type GetMembershipSuspenseQueryKey = ReturnType< - typeof getMembershipSuspenseQueryKey ->; +export type GetMembershipSuspenseQueryKey = ReturnType /** * @description Retrieves the membership for a user in a trip * @summary Get membership * {@link /api/v1/trips/:tripID/memberships/:userID} */ -export async function getMembershipSuspense( - tripID: GetMembershipPathParams["tripID"], - userID: GetMembershipPathParams["userID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetMembershipQueryResponse, - ResponseErrorConfig< - GetMembership400 | GetMembership401 | GetMembership404 | GetMembership500 - >, - unknown - >({ - method: "GET", - url: `/api/v1/trips/${tripID}/memberships/${userID}`, - ...requestConfig, - }); - return res.data; +export async function getMembershipSuspense(tripID: GetMembershipPathParams["tripID"], userID: GetMembershipPathParams["userID"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/trips/${tripID}/memberships/${userID}`, ... requestConfig }) + return res.data } -export function getMembershipSuspenseQueryOptions( - tripID: GetMembershipPathParams["tripID"], - userID: GetMembershipPathParams["userID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getMembershipSuspenseQueryKey(tripID, userID); - return queryOptions< - GetMembershipQueryResponse, - ResponseErrorConfig< - GetMembership400 | GetMembership401 | GetMembership404 | GetMembership500 - >, - GetMembershipQueryResponse, - typeof queryKey - >({ - enabled: !!(tripID && userID), - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getMembershipSuspense(tripID, userID, config); - }, - }); +export function getMembershipSuspenseQueryOptions(tripID: GetMembershipPathParams["tripID"], userID: GetMembershipPathParams["userID"], config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getMembershipSuspenseQueryKey(tripID, userID) + return queryOptions, GetMembershipQueryResponse, typeof queryKey>({ + enabled: !!(tripID&& userID), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getMembershipSuspense(tripID, userID, config) + }, + }) } /** @@ -90,49 +42,23 @@ export function getMembershipSuspenseQueryOptions( * @summary Get membership * {@link /api/v1/trips/:tripID/memberships/:userID} */ -export function useGetMembershipSuspense< - TData = GetMembershipQueryResponse, - TQueryKey extends QueryKey = GetMembershipSuspenseQueryKey, ->( - tripID: GetMembershipPathParams["tripID"], - userID: GetMembershipPathParams["userID"], - options: { - query?: Partial< - UseSuspenseQueryOptions< - GetMembershipQueryResponse, - ResponseErrorConfig< - | GetMembership400 - | GetMembership401 - | GetMembership404 - | GetMembership500 - >, - TData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = - queryOptions?.queryKey ?? getMembershipSuspenseQueryKey(tripID, userID); +export function useGetMembershipSuspense(tripID: GetMembershipPathParams["tripID"], userID: GetMembershipPathParams["userID"], options: +{ + query?: Partial, TData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getMembershipSuspenseQueryKey(tripID, userID) - const query = useSuspenseQuery( - { - ...getMembershipSuspenseQueryOptions(tripID, userID, config), - queryKey, - ...queryOptions, - } as unknown as UseSuspenseQueryOptions, - queryClient, - ) as UseSuspenseQueryResult< - TData, - ResponseErrorConfig< - GetMembership400 | GetMembership401 | GetMembership404 | GetMembership500 - > - > & { queryKey: TQueryKey }; + const query = useSuspenseQuery({ + ...getMembershipSuspenseQueryOptions(tripID, userID, config), + queryKey, + ...queryOptions + } as unknown as UseSuspenseQueryOptions, queryClient) as UseSuspenseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/memberships/useGetTripMembers.ts b/frontend/api/memberships/useGetTripMembers.ts index e779411..17dcc14 100644 --- a/frontend/api/memberships/useGetTripMembers.ts +++ b/frontend/api/memberships/useGetTripMembers.ts @@ -1,92 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetTripMembersQueryResponse, - GetTripMembersPathParams, - GetTripMembersQueryParams, - GetTripMembers400, - GetTripMembers401, - GetTripMembers404, - GetTripMembers500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - QueryObserverOptions, - UseQueryResult, -} from "@tanstack/react-query"; +import type { GetTripMembersQueryResponse, GetTripMembersPathParams, GetTripMembersQueryParams, GetTripMembers400, GetTripMembers401, GetTripMembers404, GetTripMembers500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; -export const getTripMembersQueryKey = ( - tripID: GetTripMembersPathParams["tripID"], - params: GetTripMembersQueryParams = {}, -) => - [ - { url: "/api/v1/trips/:tripID/memberships", params: { tripID: tripID } }, - ...(params ? [params] : []), - ] as const; +export const getTripMembersQueryKey = (tripID: GetTripMembersPathParams["tripID"], params?: GetTripMembersQueryParams) => [{ url: '/api/v1/trips/:tripID/memberships', params: {tripID:tripID} }, ...(params ? [params] : [])] as const -export type GetTripMembersQueryKey = ReturnType; +export type GetTripMembersQueryKey = ReturnType /** * @description Retrieves all members of a trip * @summary Get trip members * {@link /api/v1/trips/:tripID/memberships} */ -export async function getTripMembers( - tripID: GetTripMembersPathParams["tripID"], - params?: GetTripMembersQueryParams, - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetTripMembersQueryResponse, - ResponseErrorConfig< - | GetTripMembers400 - | GetTripMembers401 - | GetTripMembers404 - | GetTripMembers500 - >, - unknown - >({ - method: "GET", - url: `/api/v1/trips/${tripID}/memberships`, - params, - ...requestConfig, - }); - return res.data; +export async function getTripMembers(tripID: GetTripMembersPathParams["tripID"], params?: GetTripMembersQueryParams, config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/trips/${tripID}/memberships`, params, ... requestConfig }) + return res.data } -export function getTripMembersQueryOptions( - tripID: GetTripMembersPathParams["tripID"], - params?: GetTripMembersQueryParams, - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getTripMembersQueryKey(tripID, params); - return queryOptions< - GetTripMembersQueryResponse, - ResponseErrorConfig< - | GetTripMembers400 - | GetTripMembers401 - | GetTripMembers404 - | GetTripMembers500 - >, - GetTripMembersQueryResponse, - typeof queryKey - >({ - enabled: !!tripID, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getTripMembers(tripID, params, config); - }, - }); +export function getTripMembersQueryOptions(tripID: GetTripMembersPathParams["tripID"], params?: GetTripMembersQueryParams, config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getTripMembersQueryKey(tripID, params) + return queryOptions, GetTripMembersQueryResponse, typeof queryKey>({ + enabled: !!(tripID), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getTripMembers(tripID, params, config) + }, + }) } /** @@ -94,54 +42,23 @@ export function getTripMembersQueryOptions( * @summary Get trip members * {@link /api/v1/trips/:tripID/memberships} */ -export function useGetTripMembers< - TData = GetTripMembersQueryResponse, - TQueryData = GetTripMembersQueryResponse, - TQueryKey extends QueryKey = GetTripMembersQueryKey, ->( - tripID: GetTripMembersPathParams["tripID"], - params?: GetTripMembersQueryParams, - options: { - query?: Partial< - QueryObserverOptions< - GetTripMembersQueryResponse, - ResponseErrorConfig< - | GetTripMembers400 - | GetTripMembers401 - | GetTripMembers404 - | GetTripMembers500 - >, - TData, - TQueryData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = - queryOptions?.queryKey ?? getTripMembersQueryKey(tripID, params); +export function useGetTripMembers(tripID: GetTripMembersPathParams["tripID"], params?: GetTripMembersQueryParams, options: +{ + query?: Partial, TData, TQueryData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getTripMembersQueryKey(tripID, params) - const query = useQuery( - { - ...getTripMembersQueryOptions(tripID, params, config), - queryKey, - ...queryOptions, - } as unknown as QueryObserverOptions, - queryClient, - ) as UseQueryResult< - TData, - ResponseErrorConfig< - | GetTripMembers400 - | GetTripMembers401 - | GetTripMembers404 - | GetTripMembers500 - > - > & { queryKey: TQueryKey }; + const query = useQuery({ + ...getTripMembersQueryOptions(tripID, params, config), + queryKey, + ...queryOptions + } as unknown as QueryObserverOptions, queryClient) as UseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/memberships/useGetTripMembersSuspense.ts b/frontend/api/memberships/useGetTripMembersSuspense.ts index 72893f0..4436409 100644 --- a/frontend/api/memberships/useGetTripMembersSuspense.ts +++ b/frontend/api/memberships/useGetTripMembersSuspense.ts @@ -1,94 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetTripMembersQueryResponse, - GetTripMembersPathParams, - GetTripMembersQueryParams, - GetTripMembers400, - GetTripMembers401, - GetTripMembers404, - GetTripMembers500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - UseSuspenseQueryOptions, - UseSuspenseQueryResult, -} from "@tanstack/react-query"; +import type { GetTripMembersQueryResponse, GetTripMembersPathParams, GetTripMembersQueryParams, GetTripMembers400, GetTripMembers401, GetTripMembers404, GetTripMembers500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const getTripMembersSuspenseQueryKey = ( - tripID: GetTripMembersPathParams["tripID"], - params: GetTripMembersQueryParams = {}, -) => - [ - { url: "/api/v1/trips/:tripID/memberships", params: { tripID: tripID } }, - ...(params ? [params] : []), - ] as const; +export const getTripMembersSuspenseQueryKey = (tripID: GetTripMembersPathParams["tripID"], params?: GetTripMembersQueryParams) => [{ url: '/api/v1/trips/:tripID/memberships', params: {tripID:tripID} }, ...(params ? [params] : [])] as const -export type GetTripMembersSuspenseQueryKey = ReturnType< - typeof getTripMembersSuspenseQueryKey ->; +export type GetTripMembersSuspenseQueryKey = ReturnType /** * @description Retrieves all members of a trip * @summary Get trip members * {@link /api/v1/trips/:tripID/memberships} */ -export async function getTripMembersSuspense( - tripID: GetTripMembersPathParams["tripID"], - params?: GetTripMembersQueryParams, - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetTripMembersQueryResponse, - ResponseErrorConfig< - | GetTripMembers400 - | GetTripMembers401 - | GetTripMembers404 - | GetTripMembers500 - >, - unknown - >({ - method: "GET", - url: `/api/v1/trips/${tripID}/memberships`, - params, - ...requestConfig, - }); - return res.data; +export async function getTripMembersSuspense(tripID: GetTripMembersPathParams["tripID"], params?: GetTripMembersQueryParams, config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/trips/${tripID}/memberships`, params, ... requestConfig }) + return res.data } -export function getTripMembersSuspenseQueryOptions( - tripID: GetTripMembersPathParams["tripID"], - params?: GetTripMembersQueryParams, - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getTripMembersSuspenseQueryKey(tripID, params); - return queryOptions< - GetTripMembersQueryResponse, - ResponseErrorConfig< - | GetTripMembers400 - | GetTripMembers401 - | GetTripMembers404 - | GetTripMembers500 - >, - GetTripMembersQueryResponse, - typeof queryKey - >({ - enabled: !!tripID, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getTripMembersSuspense(tripID, params, config); - }, - }); +export function getTripMembersSuspenseQueryOptions(tripID: GetTripMembersPathParams["tripID"], params?: GetTripMembersQueryParams, config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getTripMembersSuspenseQueryKey(tripID, params) + return queryOptions, GetTripMembersQueryResponse, typeof queryKey>({ + enabled: !!(tripID), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getTripMembersSuspense(tripID, params, config) + }, + }) } /** @@ -96,52 +42,23 @@ export function getTripMembersSuspenseQueryOptions( * @summary Get trip members * {@link /api/v1/trips/:tripID/memberships} */ -export function useGetTripMembersSuspense< - TData = GetTripMembersQueryResponse, - TQueryKey extends QueryKey = GetTripMembersSuspenseQueryKey, ->( - tripID: GetTripMembersPathParams["tripID"], - params?: GetTripMembersQueryParams, - options: { - query?: Partial< - UseSuspenseQueryOptions< - GetTripMembersQueryResponse, - ResponseErrorConfig< - | GetTripMembers400 - | GetTripMembers401 - | GetTripMembers404 - | GetTripMembers500 - >, - TData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = - queryOptions?.queryKey ?? getTripMembersSuspenseQueryKey(tripID, params); +export function useGetTripMembersSuspense(tripID: GetTripMembersPathParams["tripID"], params?: GetTripMembersQueryParams, options: +{ + query?: Partial, TData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getTripMembersSuspenseQueryKey(tripID, params) - const query = useSuspenseQuery( - { - ...getTripMembersSuspenseQueryOptions(tripID, params, config), - queryKey, - ...queryOptions, - } as unknown as UseSuspenseQueryOptions, - queryClient, - ) as UseSuspenseQueryResult< - TData, - ResponseErrorConfig< - | GetTripMembers400 - | GetTripMembers401 - | GetTripMembers404 - | GetTripMembers500 - > - > & { queryKey: TQueryKey }; + const query = useSuspenseQuery({ + ...getTripMembersSuspenseQueryOptions(tripID, params, config), + queryKey, + ...queryOptions + } as unknown as UseSuspenseQueryOptions, queryClient) as UseSuspenseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/memberships/usePromoteToAdmin.ts b/frontend/api/memberships/usePromoteToAdmin.ts index a3221d0..76f2fa8 100644 --- a/frontend/api/memberships/usePromoteToAdmin.ts +++ b/frontend/api/memberships/usePromoteToAdmin.ts @@ -1,84 +1,38 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - PromoteToAdminMutationResponse, - PromoteToAdminPathParams, - PromoteToAdmin400, - PromoteToAdmin401, - PromoteToAdmin404, - PromoteToAdmin500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { PromoteToAdminMutationResponse, PromoteToAdminPathParams, PromoteToAdmin400, PromoteToAdmin401, PromoteToAdmin404, PromoteToAdmin500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const promoteToAdminMutationKey = () => - [{ url: "/api/v1/trips/:tripID/memberships/:userID/promote" }] as const; +export const promoteToAdminMutationKey = () => [{ url: '/api/v1/trips/:tripID/memberships/:userID/promote' }] as const -export type PromoteToAdminMutationKey = ReturnType< - typeof promoteToAdminMutationKey ->; +export type PromoteToAdminMutationKey = ReturnType /** * @description Promotes a member to admin role * @summary Promote member to admin * {@link /api/v1/trips/:tripID/memberships/:userID/promote} */ -export async function promoteToAdmin( - tripID: PromoteToAdminPathParams["tripID"], - userID: PromoteToAdminPathParams["userID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - PromoteToAdminMutationResponse, - ResponseErrorConfig< - | PromoteToAdmin400 - | PromoteToAdmin401 - | PromoteToAdmin404 - | PromoteToAdmin500 - >, - unknown - >({ - method: "POST", - url: `/api/v1/trips/${tripID}/memberships/${userID}/promote`, - ...requestConfig, - }); - return res.data; +export async function promoteToAdmin(tripID: PromoteToAdminPathParams["tripID"], userID: PromoteToAdminPathParams["userID"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "POST", url : `/api/v1/trips/${tripID}/memberships/${userID}/promote`, ... requestConfig }) + return res.data } -export function promoteToAdminMutationOptions( - config: Partial & { client?: typeof fetch } = {}, -) { - const mutationKey = promoteToAdminMutationKey(); - return mutationOptions< - PromoteToAdminMutationResponse, - ResponseErrorConfig< - | PromoteToAdmin400 - | PromoteToAdmin401 - | PromoteToAdmin404 - | PromoteToAdmin500 - >, - { - tripID: PromoteToAdminPathParams["tripID"]; - userID: PromoteToAdminPathParams["userID"]; - }, - TContext - >({ +export function promoteToAdminMutationOptions(config: Partial & { client?: typeof fetch } = {}) { + const mutationKey = promoteToAdminMutationKey() + return mutationOptions, {tripID: PromoteToAdminPathParams["tripID"], userID: PromoteToAdminPathParams["userID"]}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ tripID, userID }) => { - return promoteToAdmin(tripID, userID, config); + mutationFn: async({ tripID, userID }) => { + return promoteToAdmin(tripID, userID, config) }, - }); + }) } /** @@ -86,79 +40,21 @@ export function promoteToAdminMutationOptions( * @summary Promote member to admin * {@link /api/v1/trips/:tripID/memberships/:userID/promote} */ -export function usePromoteToAdmin( - options: { - mutation?: UseMutationOptions< - PromoteToAdminMutationResponse, - ResponseErrorConfig< - | PromoteToAdmin400 - | PromoteToAdmin401 - | PromoteToAdmin404 - | PromoteToAdmin500 - >, - { - tripID: PromoteToAdminPathParams["tripID"]; - userID: PromoteToAdminPathParams["userID"]; - }, - TContext - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function usePromoteToAdmin(options: +{ + mutation?: UseMutationOptions, {tripID: PromoteToAdminPathParams["tripID"], userID: PromoteToAdminPathParams["userID"]}, TContext> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = - mutationOptions.mutationKey ?? promoteToAdminMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? promoteToAdminMutationKey() - const baseOptions = promoteToAdminMutationOptions( - config, - ) as UseMutationOptions< - PromoteToAdminMutationResponse, - ResponseErrorConfig< - | PromoteToAdmin400 - | PromoteToAdmin401 - | PromoteToAdmin404 - | PromoteToAdmin500 - >, - { - tripID: PromoteToAdminPathParams["tripID"]; - userID: PromoteToAdminPathParams["userID"]; - }, - TContext - >; + const baseOptions = promoteToAdminMutationOptions(config) as UseMutationOptions, {tripID: PromoteToAdminPathParams["tripID"], userID: PromoteToAdminPathParams["userID"]}, TContext> - return useMutation< - PromoteToAdminMutationResponse, - ResponseErrorConfig< - | PromoteToAdmin400 - | PromoteToAdmin401 - | PromoteToAdmin404 - | PromoteToAdmin500 - >, - { - tripID: PromoteToAdminPathParams["tripID"]; - userID: PromoteToAdminPathParams["userID"]; - }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - PromoteToAdminMutationResponse, - ResponseErrorConfig< - | PromoteToAdmin400 - | PromoteToAdmin401 - | PromoteToAdmin404 - | PromoteToAdmin500 - >, - { - tripID: PromoteToAdminPathParams["tripID"]; - userID: PromoteToAdminPathParams["userID"]; - }, - TContext - >; -} + return useMutation, {tripID: PromoteToAdminPathParams["tripID"], userID: PromoteToAdminPathParams["userID"]}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {tripID: PromoteToAdminPathParams["tripID"], userID: PromoteToAdminPathParams["userID"]}, TContext> +} \ No newline at end of file diff --git a/frontend/api/memberships/useRemoveMember.ts b/frontend/api/memberships/useRemoveMember.ts index 1d084a5..aa45eae 100644 --- a/frontend/api/memberships/useRemoveMember.ts +++ b/frontend/api/memberships/useRemoveMember.ts @@ -1,78 +1,38 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - RemoveMemberMutationResponse, - RemoveMemberPathParams, - RemoveMember400, - RemoveMember401, - RemoveMember404, - RemoveMember500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { RemoveMemberMutationResponse, RemoveMemberPathParams, RemoveMember400, RemoveMember401, RemoveMember404, RemoveMember500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const removeMemberMutationKey = () => - [{ url: "/api/v1/trips/:tripID/memberships/:userID" }] as const; +export const removeMemberMutationKey = () => [{ url: '/api/v1/trips/:tripID/memberships/:userID' }] as const -export type RemoveMemberMutationKey = ReturnType< - typeof removeMemberMutationKey ->; +export type RemoveMemberMutationKey = ReturnType /** * @description Removes a user from a trip * @summary Remove member from trip * {@link /api/v1/trips/:tripID/memberships/:userID} */ -export async function removeMember( - tripID: RemoveMemberPathParams["tripID"], - userID: RemoveMemberPathParams["userID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - RemoveMemberMutationResponse, - ResponseErrorConfig< - RemoveMember400 | RemoveMember401 | RemoveMember404 | RemoveMember500 - >, - unknown - >({ - method: "DELETE", - url: `/api/v1/trips/${tripID}/memberships/${userID}`, - ...requestConfig, - }); - return res.data; +export async function removeMember(tripID: RemoveMemberPathParams["tripID"], userID: RemoveMemberPathParams["userID"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "DELETE", url : `/api/v1/trips/${tripID}/memberships/${userID}`, ... requestConfig }) + return res.data } -export function removeMemberMutationOptions( - config: Partial & { client?: typeof fetch } = {}, -) { - const mutationKey = removeMemberMutationKey(); - return mutationOptions< - RemoveMemberMutationResponse, - ResponseErrorConfig< - RemoveMember400 | RemoveMember401 | RemoveMember404 | RemoveMember500 - >, - { - tripID: RemoveMemberPathParams["tripID"]; - userID: RemoveMemberPathParams["userID"]; - }, - TContext - >({ +export function removeMemberMutationOptions(config: Partial & { client?: typeof fetch } = {}) { + const mutationKey = removeMemberMutationKey() + return mutationOptions, {tripID: RemoveMemberPathParams["tripID"], userID: RemoveMemberPathParams["userID"]}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ tripID, userID }) => { - return removeMember(tripID, userID, config); + mutationFn: async({ tripID, userID }) => { + return removeMember(tripID, userID, config) }, - }); + }) } /** @@ -80,64 +40,21 @@ export function removeMemberMutationOptions( * @summary Remove member from trip * {@link /api/v1/trips/:tripID/memberships/:userID} */ -export function useRemoveMember( - options: { - mutation?: UseMutationOptions< - RemoveMemberMutationResponse, - ResponseErrorConfig< - RemoveMember400 | RemoveMember401 | RemoveMember404 | RemoveMember500 - >, - { - tripID: RemoveMemberPathParams["tripID"]; - userID: RemoveMemberPathParams["userID"]; - }, - TContext - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useRemoveMember(options: +{ + mutation?: UseMutationOptions, {tripID: RemoveMemberPathParams["tripID"], userID: RemoveMemberPathParams["userID"]}, TContext> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = mutationOptions.mutationKey ?? removeMemberMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? removeMemberMutationKey() - const baseOptions = removeMemberMutationOptions(config) as UseMutationOptions< - RemoveMemberMutationResponse, - ResponseErrorConfig< - RemoveMember400 | RemoveMember401 | RemoveMember404 | RemoveMember500 - >, - { - tripID: RemoveMemberPathParams["tripID"]; - userID: RemoveMemberPathParams["userID"]; - }, - TContext - >; + const baseOptions = removeMemberMutationOptions(config) as UseMutationOptions, {tripID: RemoveMemberPathParams["tripID"], userID: RemoveMemberPathParams["userID"]}, TContext> - return useMutation< - RemoveMemberMutationResponse, - ResponseErrorConfig< - RemoveMember400 | RemoveMember401 | RemoveMember404 | RemoveMember500 - >, - { - tripID: RemoveMemberPathParams["tripID"]; - userID: RemoveMemberPathParams["userID"]; - }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - RemoveMemberMutationResponse, - ResponseErrorConfig< - RemoveMember400 | RemoveMember401 | RemoveMember404 | RemoveMember500 - >, - { - tripID: RemoveMemberPathParams["tripID"]; - userID: RemoveMemberPathParams["userID"]; - }, - TContext - >; -} + return useMutation, {tripID: RemoveMemberPathParams["tripID"], userID: RemoveMemberPathParams["userID"]}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {tripID: RemoveMemberPathParams["tripID"], userID: RemoveMemberPathParams["userID"]}, TContext> +} \ No newline at end of file diff --git a/frontend/api/memberships/useUpdateMembership.ts b/frontend/api/memberships/useUpdateMembership.ts index a3b1d9f..e635f75 100644 --- a/frontend/api/memberships/useUpdateMembership.ts +++ b/frontend/api/memberships/useUpdateMembership.ts @@ -1,97 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - UpdateMembershipMutationRequest, - UpdateMembershipMutationResponse, - UpdateMembershipPathParams, - UpdateMembership400, - UpdateMembership401, - UpdateMembership404, - UpdateMembership422, - UpdateMembership500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { UpdateMembershipMutationRequest, UpdateMembershipMutationResponse, UpdateMembershipPathParams, UpdateMembership400, UpdateMembership401, UpdateMembership404, UpdateMembership422, UpdateMembership500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const updateMembershipMutationKey = () => - [{ url: "/api/v1/trips/:tripID/memberships/:userID" }] as const; +export const updateMembershipMutationKey = () => [{ url: '/api/v1/trips/:tripID/memberships/:userID' }] as const -export type UpdateMembershipMutationKey = ReturnType< - typeof updateMembershipMutationKey ->; +export type UpdateMembershipMutationKey = ReturnType /** * @description Updates a membership * @summary Update membership * {@link /api/v1/trips/:tripID/memberships/:userID} */ -export async function updateMembership( - tripID: UpdateMembershipPathParams["tripID"], - userID: UpdateMembershipPathParams["userID"], - data?: UpdateMembershipMutationRequest, - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const requestData = data; - - const res = await request< - UpdateMembershipMutationResponse, - ResponseErrorConfig< - | UpdateMembership400 - | UpdateMembership401 - | UpdateMembership404 - | UpdateMembership422 - | UpdateMembership500 - >, - UpdateMembershipMutationRequest - >({ - method: "PATCH", - url: `/api/v1/trips/${tripID}/memberships/${userID}`, - data: requestData, - ...requestConfig, - }); - return res.data; +export async function updateMembership(tripID: UpdateMembershipPathParams["tripID"], userID: UpdateMembershipPathParams["userID"], data?: UpdateMembershipMutationRequest, config: Partial> & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const requestData = data + + const res = await request, UpdateMembershipMutationRequest>({ method : "PATCH", url : `/api/v1/trips/${tripID}/memberships/${userID}`, data : requestData, ... requestConfig }) + return res.data } -export function updateMembershipMutationOptions( - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const mutationKey = updateMembershipMutationKey(); - return mutationOptions< - UpdateMembershipMutationResponse, - ResponseErrorConfig< - | UpdateMembership400 - | UpdateMembership401 - | UpdateMembership404 - | UpdateMembership422 - | UpdateMembership500 - >, - { - tripID: UpdateMembershipPathParams["tripID"]; - userID: UpdateMembershipPathParams["userID"]; - data?: UpdateMembershipMutationRequest; - }, - TContext - >({ +export function updateMembershipMutationOptions(config: Partial> & { client?: typeof fetch } = {}) { + const mutationKey = updateMembershipMutationKey() + return mutationOptions, {tripID: UpdateMembershipPathParams["tripID"], userID: UpdateMembershipPathParams["userID"], data?: UpdateMembershipMutationRequest}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ tripID, userID, data }) => { - return updateMembership(tripID, userID, data, config); + mutationFn: async({ tripID, userID, data }) => { + return updateMembership(tripID, userID, data, config) }, - }); + }) } /** @@ -99,89 +42,21 @@ export function updateMembershipMutationOptions( * @summary Update membership * {@link /api/v1/trips/:tripID/memberships/:userID} */ -export function useUpdateMembership( - options: { - mutation?: UseMutationOptions< - UpdateMembershipMutationResponse, - ResponseErrorConfig< - | UpdateMembership400 - | UpdateMembership401 - | UpdateMembership404 - | UpdateMembership422 - | UpdateMembership500 - >, - { - tripID: UpdateMembershipPathParams["tripID"]; - userID: UpdateMembershipPathParams["userID"]; - data?: UpdateMembershipMutationRequest; - }, - TContext - > & { client?: QueryClient }; - client?: Partial> & { - client?: typeof fetch; - }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useUpdateMembership(options: +{ + mutation?: UseMutationOptions, {tripID: UpdateMembershipPathParams["tripID"], userID: UpdateMembershipPathParams["userID"], data?: UpdateMembershipMutationRequest}, TContext> & { client?: QueryClient }, + client?: Partial> & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = - mutationOptions.mutationKey ?? updateMembershipMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? updateMembershipMutationKey() - const baseOptions = updateMembershipMutationOptions( - config, - ) as UseMutationOptions< - UpdateMembershipMutationResponse, - ResponseErrorConfig< - | UpdateMembership400 - | UpdateMembership401 - | UpdateMembership404 - | UpdateMembership422 - | UpdateMembership500 - >, - { - tripID: UpdateMembershipPathParams["tripID"]; - userID: UpdateMembershipPathParams["userID"]; - data?: UpdateMembershipMutationRequest; - }, - TContext - >; + const baseOptions = updateMembershipMutationOptions(config) as UseMutationOptions, {tripID: UpdateMembershipPathParams["tripID"], userID: UpdateMembershipPathParams["userID"], data?: UpdateMembershipMutationRequest}, TContext> - return useMutation< - UpdateMembershipMutationResponse, - ResponseErrorConfig< - | UpdateMembership400 - | UpdateMembership401 - | UpdateMembership404 - | UpdateMembership422 - | UpdateMembership500 - >, - { - tripID: UpdateMembershipPathParams["tripID"]; - userID: UpdateMembershipPathParams["userID"]; - data?: UpdateMembershipMutationRequest; - }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - UpdateMembershipMutationResponse, - ResponseErrorConfig< - | UpdateMembership400 - | UpdateMembership401 - | UpdateMembership404 - | UpdateMembership422 - | UpdateMembership500 - >, - { - tripID: UpdateMembershipPathParams["tripID"]; - userID: UpdateMembershipPathParams["userID"]; - data?: UpdateMembershipMutationRequest; - }, - TContext - >; -} + return useMutation, {tripID: UpdateMembershipPathParams["tripID"], userID: UpdateMembershipPathParams["userID"], data?: UpdateMembershipMutationRequest}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {tripID: UpdateMembershipPathParams["tripID"], userID: UpdateMembershipPathParams["userID"], data?: UpdateMembershipMutationRequest}, TContext> +} \ No newline at end of file diff --git a/frontend/api/notifications/index.ts b/frontend/api/notifications/index.ts index fd77dfb..7fa587f 100644 --- a/frontend/api/notifications/index.ts +++ b/frontend/api/notifications/index.ts @@ -7,4 +7,4 @@ export { useSendBulkNotification } from "./useSendBulkNotification.ts"; export { sendNotificationMutationKey } from "./useSendNotification.ts"; export { sendNotification } from "./useSendNotification.ts"; export { sendNotificationMutationOptions } from "./useSendNotification.ts"; -export { useSendNotification } from "./useSendNotification.ts"; +export { useSendNotification } from "./useSendNotification.ts"; \ No newline at end of file diff --git a/frontend/api/notifications/useSendBulkNotification.ts b/frontend/api/notifications/useSendBulkNotification.ts index 64b49df..afb3e32 100644 --- a/frontend/api/notifications/useSendBulkNotification.ts +++ b/frontend/api/notifications/useSendBulkNotification.ts @@ -1,84 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - SendBulkNotificationMutationRequest, - SendBulkNotificationMutationResponse, - SendBulkNotification400, - SendBulkNotification422, - SendBulkNotification500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { SendBulkNotificationMutationRequest, SendBulkNotificationMutationResponse, SendBulkNotification400, SendBulkNotification422, SendBulkNotification500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const sendBulkNotificationMutationKey = () => - [{ url: "/api/v1/notifications/send-bulk" }] as const; +export const sendBulkNotificationMutationKey = () => [{ url: '/api/v1/notifications/send-bulk' }] as const -export type SendBulkNotificationMutationKey = ReturnType< - typeof sendBulkNotificationMutationKey ->; +export type SendBulkNotificationMutationKey = ReturnType /** * @description Sends push notifications to multiple users * @summary Send bulk notifications * {@link /api/v1/notifications/send-bulk} */ -export async function sendBulkNotification( - data: SendBulkNotificationMutationRequest, - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const requestData = data; - - const res = await request< - SendBulkNotificationMutationResponse, - ResponseErrorConfig< - | SendBulkNotification400 - | SendBulkNotification422 - | SendBulkNotification500 - >, - SendBulkNotificationMutationRequest - >({ - method: "POST", - url: `/api/v1/notifications/send-bulk`, - data: requestData, - ...requestConfig, - }); - return res.data; +export async function sendBulkNotification(data: SendBulkNotificationMutationRequest, config: Partial> & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const requestData = data + + const res = await request, SendBulkNotificationMutationRequest>({ method : "POST", url : `/api/v1/notifications/send-bulk`, data : requestData, ... requestConfig }) + return res.data } -export function sendBulkNotificationMutationOptions( - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const mutationKey = sendBulkNotificationMutationKey(); - return mutationOptions< - SendBulkNotificationMutationResponse, - ResponseErrorConfig< - | SendBulkNotification400 - | SendBulkNotification422 - | SendBulkNotification500 - >, - { data: SendBulkNotificationMutationRequest }, - TContext - >({ +export function sendBulkNotificationMutationOptions(config: Partial> & { client?: typeof fetch } = {}) { + const mutationKey = sendBulkNotificationMutationKey() + return mutationOptions, {data: SendBulkNotificationMutationRequest}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ data }) => { - return sendBulkNotification(data, config); + mutationFn: async({ data }) => { + return sendBulkNotification(data, config) }, - }); + }) } /** @@ -86,65 +42,21 @@ export function sendBulkNotificationMutationOptions( * @summary Send bulk notifications * {@link /api/v1/notifications/send-bulk} */ -export function useSendBulkNotification( - options: { - mutation?: UseMutationOptions< - SendBulkNotificationMutationResponse, - ResponseErrorConfig< - | SendBulkNotification400 - | SendBulkNotification422 - | SendBulkNotification500 - >, - { data: SendBulkNotificationMutationRequest }, - TContext - > & { client?: QueryClient }; - client?: Partial> & { - client?: typeof fetch; - }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useSendBulkNotification(options: +{ + mutation?: UseMutationOptions, {data: SendBulkNotificationMutationRequest}, TContext> & { client?: QueryClient }, + client?: Partial> & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = - mutationOptions.mutationKey ?? sendBulkNotificationMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? sendBulkNotificationMutationKey() - const baseOptions = sendBulkNotificationMutationOptions( - config, - ) as UseMutationOptions< - SendBulkNotificationMutationResponse, - ResponseErrorConfig< - | SendBulkNotification400 - | SendBulkNotification422 - | SendBulkNotification500 - >, - { data: SendBulkNotificationMutationRequest }, - TContext - >; + const baseOptions = sendBulkNotificationMutationOptions(config) as UseMutationOptions, {data: SendBulkNotificationMutationRequest}, TContext> - return useMutation< - SendBulkNotificationMutationResponse, - ResponseErrorConfig< - | SendBulkNotification400 - | SendBulkNotification422 - | SendBulkNotification500 - >, - { data: SendBulkNotificationMutationRequest }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - SendBulkNotificationMutationResponse, - ResponseErrorConfig< - | SendBulkNotification400 - | SendBulkNotification422 - | SendBulkNotification500 - >, - { data: SendBulkNotificationMutationRequest }, - TContext - >; -} + return useMutation, {data: SendBulkNotificationMutationRequest}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {data: SendBulkNotificationMutationRequest}, TContext> +} \ No newline at end of file diff --git a/frontend/api/notifications/useSendNotification.ts b/frontend/api/notifications/useSendNotification.ts index 7e42048..505ffd7 100644 --- a/frontend/api/notifications/useSendNotification.ts +++ b/frontend/api/notifications/useSendNotification.ts @@ -1,80 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - SendNotificationMutationRequest, - SendNotificationMutationResponse, - SendNotification400, - SendNotification422, - SendNotification500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { SendNotificationMutationRequest, SendNotificationMutationResponse, SendNotification400, SendNotification422, SendNotification500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const sendNotificationMutationKey = () => - [{ url: "/api/v1/notifications/send" }] as const; +export const sendNotificationMutationKey = () => [{ url: '/api/v1/notifications/send' }] as const -export type SendNotificationMutationKey = ReturnType< - typeof sendNotificationMutationKey ->; +export type SendNotificationMutationKey = ReturnType /** * @description Sends a push notification to a single user * @summary Send notification to user * {@link /api/v1/notifications/send} */ -export async function sendNotification( - data: SendNotificationMutationRequest, - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const requestData = data; - - const res = await request< - SendNotificationMutationResponse, - ResponseErrorConfig< - SendNotification400 | SendNotification422 | SendNotification500 - >, - SendNotificationMutationRequest - >({ - method: "POST", - url: `/api/v1/notifications/send`, - data: requestData, - ...requestConfig, - }); - return res.data; +export async function sendNotification(data: SendNotificationMutationRequest, config: Partial> & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const requestData = data + + const res = await request, SendNotificationMutationRequest>({ method : "POST", url : `/api/v1/notifications/send`, data : requestData, ... requestConfig }) + return res.data } -export function sendNotificationMutationOptions( - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const mutationKey = sendNotificationMutationKey(); - return mutationOptions< - SendNotificationMutationResponse, - ResponseErrorConfig< - SendNotification400 | SendNotification422 | SendNotification500 - >, - { data: SendNotificationMutationRequest }, - TContext - >({ +export function sendNotificationMutationOptions(config: Partial> & { client?: typeof fetch } = {}) { + const mutationKey = sendNotificationMutationKey() + return mutationOptions, {data: SendNotificationMutationRequest}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ data }) => { - return sendNotification(data, config); + mutationFn: async({ data }) => { + return sendNotification(data, config) }, - }); + }) } /** @@ -82,57 +42,21 @@ export function sendNotificationMutationOptions( * @summary Send notification to user * {@link /api/v1/notifications/send} */ -export function useSendNotification( - options: { - mutation?: UseMutationOptions< - SendNotificationMutationResponse, - ResponseErrorConfig< - SendNotification400 | SendNotification422 | SendNotification500 - >, - { data: SendNotificationMutationRequest }, - TContext - > & { client?: QueryClient }; - client?: Partial> & { - client?: typeof fetch; - }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useSendNotification(options: +{ + mutation?: UseMutationOptions, {data: SendNotificationMutationRequest}, TContext> & { client?: QueryClient }, + client?: Partial> & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = - mutationOptions.mutationKey ?? sendNotificationMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? sendNotificationMutationKey() - const baseOptions = sendNotificationMutationOptions( - config, - ) as UseMutationOptions< - SendNotificationMutationResponse, - ResponseErrorConfig< - SendNotification400 | SendNotification422 | SendNotification500 - >, - { data: SendNotificationMutationRequest }, - TContext - >; + const baseOptions = sendNotificationMutationOptions(config) as UseMutationOptions, {data: SendNotificationMutationRequest}, TContext> - return useMutation< - SendNotificationMutationResponse, - ResponseErrorConfig< - SendNotification400 | SendNotification422 | SendNotification500 - >, - { data: SendNotificationMutationRequest }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - SendNotificationMutationResponse, - ResponseErrorConfig< - SendNotification400 | SendNotification422 | SendNotification500 - >, - { data: SendNotificationMutationRequest }, - TContext - >; -} + return useMutation, {data: SendNotificationMutationRequest}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {data: SendNotificationMutationRequest}, TContext> +} \ No newline at end of file diff --git a/frontend/api/pitches/index.ts b/frontend/api/pitches/index.ts new file mode 100644 index 0000000..3c58625 --- /dev/null +++ b/frontend/api/pitches/index.ts @@ -0,0 +1,35 @@ +export type { CreatePitchMutationKey } from "./useCreatePitch.ts"; +export type { DeletePitchMutationKey } from "./useDeletePitch.ts"; +export type { GetPitchQueryKey } from "./useGetPitch.ts"; +export type { GetPitchSuspenseQueryKey } from "./useGetPitchSuspense.ts"; +export type { ListPitchesQueryKey } from "./useListPitches.ts"; +export type { ListPitchesSuspenseQueryKey } from "./useListPitchesSuspense.ts"; +export type { UpdatePitchMutationKey } from "./useUpdatePitch.ts"; +export { createPitchMutationKey } from "./useCreatePitch.ts"; +export { createPitch } from "./useCreatePitch.ts"; +export { createPitchMutationOptions } from "./useCreatePitch.ts"; +export { useCreatePitch } from "./useCreatePitch.ts"; +export { deletePitchMutationKey } from "./useDeletePitch.ts"; +export { deletePitch } from "./useDeletePitch.ts"; +export { deletePitchMutationOptions } from "./useDeletePitch.ts"; +export { useDeletePitch } from "./useDeletePitch.ts"; +export { getPitchQueryKey } from "./useGetPitch.ts"; +export { getPitch } from "./useGetPitch.ts"; +export { getPitchQueryOptions } from "./useGetPitch.ts"; +export { useGetPitch } from "./useGetPitch.ts"; +export { getPitchSuspenseQueryKey } from "./useGetPitchSuspense.ts"; +export { getPitchSuspense } from "./useGetPitchSuspense.ts"; +export { getPitchSuspenseQueryOptions } from "./useGetPitchSuspense.ts"; +export { useGetPitchSuspense } from "./useGetPitchSuspense.ts"; +export { listPitchesQueryKey } from "./useListPitches.ts"; +export { listPitches } from "./useListPitches.ts"; +export { listPitchesQueryOptions } from "./useListPitches.ts"; +export { useListPitches } from "./useListPitches.ts"; +export { listPitchesSuspenseQueryKey } from "./useListPitchesSuspense.ts"; +export { listPitchesSuspense } from "./useListPitchesSuspense.ts"; +export { listPitchesSuspenseQueryOptions } from "./useListPitchesSuspense.ts"; +export { useListPitchesSuspense } from "./useListPitchesSuspense.ts"; +export { updatePitchMutationKey } from "./useUpdatePitch.ts"; +export { updatePitch } from "./useUpdatePitch.ts"; +export { updatePitchMutationOptions } from "./useUpdatePitch.ts"; +export { useUpdatePitch } from "./useUpdatePitch.ts"; \ No newline at end of file diff --git a/frontend/api/pitches/useCreatePitch.ts b/frontend/api/pitches/useCreatePitch.ts new file mode 100644 index 0000000..38ea166 --- /dev/null +++ b/frontend/api/pitches/useCreatePitch.ts @@ -0,0 +1,62 @@ +/** +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ + +import fetch from "../client"; +import type { RequestConfig, ResponseErrorConfig } from "../client"; +import type { CreatePitchMutationRequest, CreatePitchMutationResponse, CreatePitchPathParams, CreatePitch400, CreatePitch403, CreatePitch422, CreatePitch500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; +import { mutationOptions, useMutation } from "@tanstack/react-query"; + +export const createPitchMutationKey = () => [{ url: '/api/v1/trips/:tripID/pitches' }] as const + +export type CreatePitchMutationKey = ReturnType + +/** + * @description Creates a new pitch for the trip and returns a presigned URL to upload the audio file + * @summary Create a pitch + * {@link /api/v1/trips/:tripID/pitches} + */ +export async function createPitch(tripID: CreatePitchPathParams["tripID"], data: CreatePitchMutationRequest, config: Partial> & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const requestData = data + + const res = await request, CreatePitchMutationRequest>({ method : "POST", url : `/api/v1/trips/${tripID}/pitches`, data : requestData, ... requestConfig }) + return res.data +} + +export function createPitchMutationOptions(config: Partial> & { client?: typeof fetch } = {}) { + const mutationKey = createPitchMutationKey() + return mutationOptions, {tripID: CreatePitchPathParams["tripID"], data: CreatePitchMutationRequest}, typeof mutationKey>({ + mutationKey, + mutationFn: async({ tripID, data }) => { + return createPitch(tripID, data, config) + }, + }) +} + +/** + * @description Creates a new pitch for the trip and returns a presigned URL to upload the audio file + * @summary Create a pitch + * {@link /api/v1/trips/:tripID/pitches} + */ +export function useCreatePitch(options: +{ + mutation?: UseMutationOptions, {tripID: CreatePitchPathParams["tripID"], data: CreatePitchMutationRequest}, TContext> & { client?: QueryClient }, + client?: Partial> & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...mutationOptions } = mutation; + const mutationKey = mutationOptions.mutationKey ?? createPitchMutationKey() + + const baseOptions = createPitchMutationOptions(config) as UseMutationOptions, {tripID: CreatePitchPathParams["tripID"], data: CreatePitchMutationRequest}, TContext> + + return useMutation, {tripID: CreatePitchPathParams["tripID"], data: CreatePitchMutationRequest}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {tripID: CreatePitchPathParams["tripID"], data: CreatePitchMutationRequest}, TContext> +} \ No newline at end of file diff --git a/frontend/api/pitches/useDeletePitch.ts b/frontend/api/pitches/useDeletePitch.ts new file mode 100644 index 0000000..5f5ce64 --- /dev/null +++ b/frontend/api/pitches/useDeletePitch.ts @@ -0,0 +1,60 @@ +/** +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ + +import fetch from "../client"; +import type { RequestConfig, ResponseErrorConfig } from "../client"; +import type { DeletePitchMutationResponse, DeletePitchPathParams, DeletePitch400, DeletePitch404, DeletePitch500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; +import { mutationOptions, useMutation } from "@tanstack/react-query"; + +export const deletePitchMutationKey = () => [{ url: '/api/v1/trips/:tripID/pitches/:pitchID' }] as const + +export type DeletePitchMutationKey = ReturnType + +/** + * @description Deletes a pitch by ID + * @summary Delete a pitch + * {@link /api/v1/trips/:tripID/pitches/:pitchID} + */ +export async function deletePitch(tripID: DeletePitchPathParams["tripID"], pitchID: DeletePitchPathParams["pitchID"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "DELETE", url : `/api/v1/trips/${tripID}/pitches/${pitchID}`, ... requestConfig }) + return res.data +} + +export function deletePitchMutationOptions(config: Partial & { client?: typeof fetch } = {}) { + const mutationKey = deletePitchMutationKey() + return mutationOptions, {tripID: DeletePitchPathParams["tripID"], pitchID: DeletePitchPathParams["pitchID"]}, typeof mutationKey>({ + mutationKey, + mutationFn: async({ tripID, pitchID }) => { + return deletePitch(tripID, pitchID, config) + }, + }) +} + +/** + * @description Deletes a pitch by ID + * @summary Delete a pitch + * {@link /api/v1/trips/:tripID/pitches/:pitchID} + */ +export function useDeletePitch(options: +{ + mutation?: UseMutationOptions, {tripID: DeletePitchPathParams["tripID"], pitchID: DeletePitchPathParams["pitchID"]}, TContext> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...mutationOptions } = mutation; + const mutationKey = mutationOptions.mutationKey ?? deletePitchMutationKey() + + const baseOptions = deletePitchMutationOptions(config) as UseMutationOptions, {tripID: DeletePitchPathParams["tripID"], pitchID: DeletePitchPathParams["pitchID"]}, TContext> + + return useMutation, {tripID: DeletePitchPathParams["tripID"], pitchID: DeletePitchPathParams["pitchID"]}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {tripID: DeletePitchPathParams["tripID"], pitchID: DeletePitchPathParams["pitchID"]}, TContext> +} \ No newline at end of file diff --git a/frontend/api/pitches/useGetPitch.ts b/frontend/api/pitches/useGetPitch.ts new file mode 100644 index 0000000..02dda54 --- /dev/null +++ b/frontend/api/pitches/useGetPitch.ts @@ -0,0 +1,64 @@ +/** +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ + +import fetch from "../client"; +import type { RequestConfig, ResponseErrorConfig } from "../client"; +import type { GetPitchQueryResponse, GetPitchPathParams, GetPitch400, GetPitch404, GetPitch500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useQuery } from "@tanstack/react-query"; + +export const getPitchQueryKey = (tripID: GetPitchPathParams["tripID"], pitchID: GetPitchPathParams["pitchID"]) => [{ url: '/api/v1/trips/:tripID/pitches/:pitchID', params: {tripID:tripID,pitchID:pitchID} }] as const + +export type GetPitchQueryKey = ReturnType + +/** + * @description Returns a single pitch with a presigned URL for the audio file + * @summary Get a pitch by ID + * {@link /api/v1/trips/:tripID/pitches/:pitchID} + */ +export async function getPitch(tripID: GetPitchPathParams["tripID"], pitchID: GetPitchPathParams["pitchID"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/trips/${tripID}/pitches/${pitchID}`, ... requestConfig }) + return res.data +} + +export function getPitchQueryOptions(tripID: GetPitchPathParams["tripID"], pitchID: GetPitchPathParams["pitchID"], config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getPitchQueryKey(tripID, pitchID) + return queryOptions, GetPitchQueryResponse, typeof queryKey>({ + enabled: !!(tripID&& pitchID), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getPitch(tripID, pitchID, config) + }, + }) +} + +/** + * @description Returns a single pitch with a presigned URL for the audio file + * @summary Get a pitch by ID + * {@link /api/v1/trips/:tripID/pitches/:pitchID} + */ +export function useGetPitch(tripID: GetPitchPathParams["tripID"], pitchID: GetPitchPathParams["pitchID"], options: +{ + query?: Partial, TData, TQueryData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getPitchQueryKey(tripID, pitchID) + + const query = useQuery({ + ...getPitchQueryOptions(tripID, pitchID, config), + queryKey, + ...queryOptions + } as unknown as QueryObserverOptions, queryClient) as UseQueryResult> & { queryKey: TQueryKey } + + query.queryKey = queryKey as TQueryKey + + return query +} \ No newline at end of file diff --git a/frontend/api/pitches/useGetPitchSuspense.ts b/frontend/api/pitches/useGetPitchSuspense.ts new file mode 100644 index 0000000..2cea16c --- /dev/null +++ b/frontend/api/pitches/useGetPitchSuspense.ts @@ -0,0 +1,64 @@ +/** +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ + +import fetch from "../client"; +import type { RequestConfig, ResponseErrorConfig } from "../client"; +import type { GetPitchQueryResponse, GetPitchPathParams, GetPitch400, GetPitch404, GetPitch500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; + +export const getPitchSuspenseQueryKey = (tripID: GetPitchPathParams["tripID"], pitchID: GetPitchPathParams["pitchID"]) => [{ url: '/api/v1/trips/:tripID/pitches/:pitchID', params: {tripID:tripID,pitchID:pitchID} }] as const + +export type GetPitchSuspenseQueryKey = ReturnType + +/** + * @description Returns a single pitch with a presigned URL for the audio file + * @summary Get a pitch by ID + * {@link /api/v1/trips/:tripID/pitches/:pitchID} + */ +export async function getPitchSuspense(tripID: GetPitchPathParams["tripID"], pitchID: GetPitchPathParams["pitchID"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/trips/${tripID}/pitches/${pitchID}`, ... requestConfig }) + return res.data +} + +export function getPitchSuspenseQueryOptions(tripID: GetPitchPathParams["tripID"], pitchID: GetPitchPathParams["pitchID"], config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getPitchSuspenseQueryKey(tripID, pitchID) + return queryOptions, GetPitchQueryResponse, typeof queryKey>({ + enabled: !!(tripID&& pitchID), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getPitchSuspense(tripID, pitchID, config) + }, + }) +} + +/** + * @description Returns a single pitch with a presigned URL for the audio file + * @summary Get a pitch by ID + * {@link /api/v1/trips/:tripID/pitches/:pitchID} + */ +export function useGetPitchSuspense(tripID: GetPitchPathParams["tripID"], pitchID: GetPitchPathParams["pitchID"], options: +{ + query?: Partial, TData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getPitchSuspenseQueryKey(tripID, pitchID) + + const query = useSuspenseQuery({ + ...getPitchSuspenseQueryOptions(tripID, pitchID, config), + queryKey, + ...queryOptions + } as unknown as UseSuspenseQueryOptions, queryClient) as UseSuspenseQueryResult> & { queryKey: TQueryKey } + + query.queryKey = queryKey as TQueryKey + + return query +} \ No newline at end of file diff --git a/frontend/api/pitches/useListPitches.ts b/frontend/api/pitches/useListPitches.ts new file mode 100644 index 0000000..57ac581 --- /dev/null +++ b/frontend/api/pitches/useListPitches.ts @@ -0,0 +1,64 @@ +/** +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ + +import fetch from "../client"; +import type { RequestConfig, ResponseErrorConfig } from "../client"; +import type { ListPitchesQueryResponse, ListPitchesPathParams, ListPitchesQueryParams, ListPitches400, ListPitches404, ListPitches500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useQuery } from "@tanstack/react-query"; + +export const listPitchesQueryKey = (tripID: ListPitchesPathParams["tripID"], params?: ListPitchesQueryParams) => [{ url: '/api/v1/trips/:tripID/pitches', params: {tripID:tripID} }, ...(params ? [params] : [])] as const + +export type ListPitchesQueryKey = ReturnType + +/** + * @description Returns pitches for the trip with cursor-based pagination + * @summary Get all pitches for a trip + * {@link /api/v1/trips/:tripID/pitches} + */ +export async function listPitches(tripID: ListPitchesPathParams["tripID"], params?: ListPitchesQueryParams, config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/trips/${tripID}/pitches`, params, ... requestConfig }) + return res.data +} + +export function listPitchesQueryOptions(tripID: ListPitchesPathParams["tripID"], params?: ListPitchesQueryParams, config: Partial & { client?: typeof fetch } = {}) { + const queryKey = listPitchesQueryKey(tripID, params) + return queryOptions, ListPitchesQueryResponse, typeof queryKey>({ + enabled: !!(tripID), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return listPitches(tripID, params, config) + }, + }) +} + +/** + * @description Returns pitches for the trip with cursor-based pagination + * @summary Get all pitches for a trip + * {@link /api/v1/trips/:tripID/pitches} + */ +export function useListPitches(tripID: ListPitchesPathParams["tripID"], params?: ListPitchesQueryParams, options: +{ + query?: Partial, TData, TQueryData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? listPitchesQueryKey(tripID, params) + + const query = useQuery({ + ...listPitchesQueryOptions(tripID, params, config), + queryKey, + ...queryOptions + } as unknown as QueryObserverOptions, queryClient) as UseQueryResult> & { queryKey: TQueryKey } + + query.queryKey = queryKey as TQueryKey + + return query +} \ No newline at end of file diff --git a/frontend/api/pitches/useListPitchesSuspense.ts b/frontend/api/pitches/useListPitchesSuspense.ts new file mode 100644 index 0000000..91fe0bc --- /dev/null +++ b/frontend/api/pitches/useListPitchesSuspense.ts @@ -0,0 +1,64 @@ +/** +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ + +import fetch from "../client"; +import type { RequestConfig, ResponseErrorConfig } from "../client"; +import type { ListPitchesQueryResponse, ListPitchesPathParams, ListPitchesQueryParams, ListPitches400, ListPitches404, ListPitches500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; + +export const listPitchesSuspenseQueryKey = (tripID: ListPitchesPathParams["tripID"], params?: ListPitchesQueryParams) => [{ url: '/api/v1/trips/:tripID/pitches', params: {tripID:tripID} }, ...(params ? [params] : [])] as const + +export type ListPitchesSuspenseQueryKey = ReturnType + +/** + * @description Returns pitches for the trip with cursor-based pagination + * @summary Get all pitches for a trip + * {@link /api/v1/trips/:tripID/pitches} + */ +export async function listPitchesSuspense(tripID: ListPitchesPathParams["tripID"], params?: ListPitchesQueryParams, config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/trips/${tripID}/pitches`, params, ... requestConfig }) + return res.data +} + +export function listPitchesSuspenseQueryOptions(tripID: ListPitchesPathParams["tripID"], params?: ListPitchesQueryParams, config: Partial & { client?: typeof fetch } = {}) { + const queryKey = listPitchesSuspenseQueryKey(tripID, params) + return queryOptions, ListPitchesQueryResponse, typeof queryKey>({ + enabled: !!(tripID), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return listPitchesSuspense(tripID, params, config) + }, + }) +} + +/** + * @description Returns pitches for the trip with cursor-based pagination + * @summary Get all pitches for a trip + * {@link /api/v1/trips/:tripID/pitches} + */ +export function useListPitchesSuspense(tripID: ListPitchesPathParams["tripID"], params?: ListPitchesQueryParams, options: +{ + query?: Partial, TData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? listPitchesSuspenseQueryKey(tripID, params) + + const query = useSuspenseQuery({ + ...listPitchesSuspenseQueryOptions(tripID, params, config), + queryKey, + ...queryOptions + } as unknown as UseSuspenseQueryOptions, queryClient) as UseSuspenseQueryResult> & { queryKey: TQueryKey } + + query.queryKey = queryKey as TQueryKey + + return query +} \ No newline at end of file diff --git a/frontend/api/pitches/useUpdatePitch.ts b/frontend/api/pitches/useUpdatePitch.ts new file mode 100644 index 0000000..c26ac28 --- /dev/null +++ b/frontend/api/pitches/useUpdatePitch.ts @@ -0,0 +1,62 @@ +/** +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ + +import fetch from "../client"; +import type { RequestConfig, ResponseErrorConfig } from "../client"; +import type { UpdatePitchMutationRequest, UpdatePitchMutationResponse, UpdatePitchPathParams, UpdatePitch400, UpdatePitch404, UpdatePitch422, UpdatePitch500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; +import { mutationOptions, useMutation } from "@tanstack/react-query"; + +export const updatePitchMutationKey = () => [{ url: '/api/v1/trips/:tripID/pitches/:pitchID' }] as const + +export type UpdatePitchMutationKey = ReturnType + +/** + * @description Updates pitch metadata (title, description, duration) + * @summary Update a pitch + * {@link /api/v1/trips/:tripID/pitches/:pitchID} + */ +export async function updatePitch(tripID: UpdatePitchPathParams["tripID"], pitchID: UpdatePitchPathParams["pitchID"], data?: UpdatePitchMutationRequest, config: Partial> & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const requestData = data + + const res = await request, UpdatePitchMutationRequest>({ method : "PATCH", url : `/api/v1/trips/${tripID}/pitches/${pitchID}`, data : requestData, ... requestConfig }) + return res.data +} + +export function updatePitchMutationOptions(config: Partial> & { client?: typeof fetch } = {}) { + const mutationKey = updatePitchMutationKey() + return mutationOptions, {tripID: UpdatePitchPathParams["tripID"], pitchID: UpdatePitchPathParams["pitchID"], data?: UpdatePitchMutationRequest}, typeof mutationKey>({ + mutationKey, + mutationFn: async({ tripID, pitchID, data }) => { + return updatePitch(tripID, pitchID, data, config) + }, + }) +} + +/** + * @description Updates pitch metadata (title, description, duration) + * @summary Update a pitch + * {@link /api/v1/trips/:tripID/pitches/:pitchID} + */ +export function useUpdatePitch(options: +{ + mutation?: UseMutationOptions, {tripID: UpdatePitchPathParams["tripID"], pitchID: UpdatePitchPathParams["pitchID"], data?: UpdatePitchMutationRequest}, TContext> & { client?: QueryClient }, + client?: Partial> & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...mutationOptions } = mutation; + const mutationKey = mutationOptions.mutationKey ?? updatePitchMutationKey() + + const baseOptions = updatePitchMutationOptions(config) as UseMutationOptions, {tripID: UpdatePitchPathParams["tripID"], pitchID: UpdatePitchPathParams["pitchID"], data?: UpdatePitchMutationRequest}, TContext> + + return useMutation, {tripID: UpdatePitchPathParams["tripID"], pitchID: UpdatePitchPathParams["pitchID"], data?: UpdatePitchMutationRequest}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {tripID: UpdatePitchPathParams["tripID"], pitchID: UpdatePitchPathParams["pitchID"], data?: UpdatePitchMutationRequest}, TContext> +} \ No newline at end of file diff --git a/frontend/api/trips/index.ts b/frontend/api/trips/index.ts index 96d7321..c8ac72e 100644 --- a/frontend/api/trips/index.ts +++ b/frontend/api/trips/index.ts @@ -32,4 +32,4 @@ export { useGetTripSuspense } from "./useGetTripSuspense.ts"; export { updateTripMutationKey } from "./useUpdateTrip.ts"; export { updateTrip } from "./useUpdateTrip.ts"; export { updateTripMutationOptions } from "./useUpdateTrip.ts"; -export { useUpdateTrip } from "./useUpdateTrip.ts"; +export { useUpdateTrip } from "./useUpdateTrip.ts"; \ No newline at end of file diff --git a/frontend/api/trips/useCreateTrip.ts b/frontend/api/trips/useCreateTrip.ts index 2f05cbc..2813835 100644 --- a/frontend/api/trips/useCreateTrip.ts +++ b/frontend/api/trips/useCreateTrip.ts @@ -1,78 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - CreateTripMutationRequest, - CreateTripMutationResponse, - CreateTrip400, - CreateTrip401, - CreateTrip422, - CreateTrip500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { CreateTripMutationRequest, CreateTripMutationResponse, CreateTrip400, CreateTrip401, CreateTrip422, CreateTrip500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const createTripMutationKey = () => [{ url: "/api/v1/trips" }] as const; +export const createTripMutationKey = () => [{ url: '/api/v1/trips' }] as const -export type CreateTripMutationKey = ReturnType; +export type CreateTripMutationKey = ReturnType /** * @description Creates a new trip for the authenticated user * @summary Create a trip * {@link /api/v1/trips} */ -export async function createTrip( - data: CreateTripMutationRequest, - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const requestData = data; - - const res = await request< - CreateTripMutationResponse, - ResponseErrorConfig< - CreateTrip400 | CreateTrip401 | CreateTrip422 | CreateTrip500 - >, - CreateTripMutationRequest - >({ - method: "POST", - url: `/api/v1/trips`, - data: requestData, - ...requestConfig, - }); - return res.data; +export async function createTrip(data: CreateTripMutationRequest, config: Partial> & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const requestData = data + + const res = await request, CreateTripMutationRequest>({ method : "POST", url : `/api/v1/trips`, data : requestData, ... requestConfig }) + return res.data } -export function createTripMutationOptions( - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const mutationKey = createTripMutationKey(); - return mutationOptions< - CreateTripMutationResponse, - ResponseErrorConfig< - CreateTrip400 | CreateTrip401 | CreateTrip422 | CreateTrip500 - >, - { data: CreateTripMutationRequest }, - TContext - >({ +export function createTripMutationOptions(config: Partial> & { client?: typeof fetch } = {}) { + const mutationKey = createTripMutationKey() + return mutationOptions, {data: CreateTripMutationRequest}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ data }) => { - return createTrip(data, config); + mutationFn: async({ data }) => { + return createTrip(data, config) }, - }); + }) } /** @@ -80,54 +42,21 @@ export function createTripMutationOptions( * @summary Create a trip * {@link /api/v1/trips} */ -export function useCreateTrip( - options: { - mutation?: UseMutationOptions< - CreateTripMutationResponse, - ResponseErrorConfig< - CreateTrip400 | CreateTrip401 | CreateTrip422 | CreateTrip500 - >, - { data: CreateTripMutationRequest }, - TContext - > & { client?: QueryClient }; - client?: Partial> & { - client?: typeof fetch; - }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useCreateTrip(options: +{ + mutation?: UseMutationOptions, {data: CreateTripMutationRequest}, TContext> & { client?: QueryClient }, + client?: Partial> & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = mutationOptions.mutationKey ?? createTripMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? createTripMutationKey() - const baseOptions = createTripMutationOptions(config) as UseMutationOptions< - CreateTripMutationResponse, - ResponseErrorConfig< - CreateTrip400 | CreateTrip401 | CreateTrip422 | CreateTrip500 - >, - { data: CreateTripMutationRequest }, - TContext - >; + const baseOptions = createTripMutationOptions(config) as UseMutationOptions, {data: CreateTripMutationRequest}, TContext> - return useMutation< - CreateTripMutationResponse, - ResponseErrorConfig< - CreateTrip400 | CreateTrip401 | CreateTrip422 | CreateTrip500 - >, - { data: CreateTripMutationRequest }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - CreateTripMutationResponse, - ResponseErrorConfig< - CreateTrip400 | CreateTrip401 | CreateTrip422 | CreateTrip500 - >, - { data: CreateTripMutationRequest }, - TContext - >; -} + return useMutation, {data: CreateTripMutationRequest}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {data: CreateTripMutationRequest}, TContext> +} \ No newline at end of file diff --git a/frontend/api/trips/useDeleteTrip.ts b/frontend/api/trips/useDeleteTrip.ts index 730a231..35ac784 100644 --- a/frontend/api/trips/useDeleteTrip.ts +++ b/frontend/api/trips/useDeleteTrip.ts @@ -1,68 +1,38 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - DeleteTripMutationResponse, - DeleteTripPathParams, - DeleteTrip400, - DeleteTrip401, - DeleteTrip404, - DeleteTrip500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { DeleteTripMutationResponse, DeleteTripPathParams, DeleteTrip400, DeleteTrip401, DeleteTrip404, DeleteTrip500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const deleteTripMutationKey = () => - [{ url: "/api/v1/trips/:tripID" }] as const; +export const deleteTripMutationKey = () => [{ url: '/api/v1/trips/:tripID' }] as const -export type DeleteTripMutationKey = ReturnType; +export type DeleteTripMutationKey = ReturnType /** * @description Deletes a trip by ID * @summary Delete a trip * {@link /api/v1/trips/:tripID} */ -export async function deleteTrip( - tripID: DeleteTripPathParams["tripID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - DeleteTripMutationResponse, - ResponseErrorConfig< - DeleteTrip400 | DeleteTrip401 | DeleteTrip404 | DeleteTrip500 - >, - unknown - >({ method: "DELETE", url: `/api/v1/trips/${tripID}`, ...requestConfig }); - return res.data; +export async function deleteTrip(tripID: DeleteTripPathParams["tripID"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "DELETE", url : `/api/v1/trips/${tripID}`, ... requestConfig }) + return res.data } -export function deleteTripMutationOptions( - config: Partial & { client?: typeof fetch } = {}, -) { - const mutationKey = deleteTripMutationKey(); - return mutationOptions< - DeleteTripMutationResponse, - ResponseErrorConfig< - DeleteTrip400 | DeleteTrip401 | DeleteTrip404 | DeleteTrip500 - >, - { tripID: DeleteTripPathParams["tripID"] }, - TContext - >({ +export function deleteTripMutationOptions(config: Partial & { client?: typeof fetch } = {}) { + const mutationKey = deleteTripMutationKey() + return mutationOptions, {tripID: DeleteTripPathParams["tripID"]}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ tripID }) => { - return deleteTrip(tripID, config); + mutationFn: async({ tripID }) => { + return deleteTrip(tripID, config) }, - }); + }) } /** @@ -70,52 +40,21 @@ export function deleteTripMutationOptions( * @summary Delete a trip * {@link /api/v1/trips/:tripID} */ -export function useDeleteTrip( - options: { - mutation?: UseMutationOptions< - DeleteTripMutationResponse, - ResponseErrorConfig< - DeleteTrip400 | DeleteTrip401 | DeleteTrip404 | DeleteTrip500 - >, - { tripID: DeleteTripPathParams["tripID"] }, - TContext - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useDeleteTrip(options: +{ + mutation?: UseMutationOptions, {tripID: DeleteTripPathParams["tripID"]}, TContext> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = mutationOptions.mutationKey ?? deleteTripMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? deleteTripMutationKey() - const baseOptions = deleteTripMutationOptions(config) as UseMutationOptions< - DeleteTripMutationResponse, - ResponseErrorConfig< - DeleteTrip400 | DeleteTrip401 | DeleteTrip404 | DeleteTrip500 - >, - { tripID: DeleteTripPathParams["tripID"] }, - TContext - >; + const baseOptions = deleteTripMutationOptions(config) as UseMutationOptions, {tripID: DeleteTripPathParams["tripID"]}, TContext> - return useMutation< - DeleteTripMutationResponse, - ResponseErrorConfig< - DeleteTrip400 | DeleteTrip401 | DeleteTrip404 | DeleteTrip500 - >, - { tripID: DeleteTripPathParams["tripID"] }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - DeleteTripMutationResponse, - ResponseErrorConfig< - DeleteTrip400 | DeleteTrip401 | DeleteTrip404 | DeleteTrip500 - >, - { tripID: DeleteTripPathParams["tripID"] }, - TContext - >; -} + return useMutation, {tripID: DeleteTripPathParams["tripID"]}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {tripID: DeleteTripPathParams["tripID"]}, TContext> +} \ No newline at end of file diff --git a/frontend/api/trips/useGetAllTrips.ts b/frontend/api/trips/useGetAllTrips.ts index 5a90ec4..41bac85 100644 --- a/frontend/api/trips/useGetAllTrips.ts +++ b/frontend/api/trips/useGetAllTrips.ts @@ -1,66 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetAllTripsQueryResponse, - GetAllTripsQueryParams, - GetAllTrips400, - GetAllTrips401, - GetAllTrips500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - QueryObserverOptions, - UseQueryResult, -} from "@tanstack/react-query"; +import type { GetAllTripsQueryResponse, GetAllTripsQueryParams, GetAllTrips400, GetAllTrips401, GetAllTrips500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; -export const getAllTripsQueryKey = (params: GetAllTripsQueryParams = {}) => - [{ url: "/api/v1/trips" }, ...(params ? [params] : [])] as const; +export const getAllTripsQueryKey = (params?: GetAllTripsQueryParams) => [{ url: '/api/v1/trips' }, ...(params ? [params] : [])] as const -export type GetAllTripsQueryKey = ReturnType; +export type GetAllTripsQueryKey = ReturnType /** * @description Retrieves trips with cursor-based pagination. Use limit and cursor query params. * @summary Get all trips * {@link /api/v1/trips} */ -export async function getAllTrips( - params?: GetAllTripsQueryParams, - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetAllTripsQueryResponse, - ResponseErrorConfig, - unknown - >({ method: "GET", url: `/api/v1/trips`, params, ...requestConfig }); - return res.data; +export async function getAllTrips(params?: GetAllTripsQueryParams, config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/trips`, params, ... requestConfig }) + return res.data } -export function getAllTripsQueryOptions( - params?: GetAllTripsQueryParams, - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getAllTripsQueryKey(params); - return queryOptions< - GetAllTripsQueryResponse, - ResponseErrorConfig, - GetAllTripsQueryResponse, - typeof queryKey - >({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getAllTrips(params, config); - }, - }); +export function getAllTripsQueryOptions(params?: GetAllTripsQueryParams, config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getAllTripsQueryKey(params) + return queryOptions, GetAllTripsQueryResponse, typeof queryKey>({ + + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getAllTrips(params, config) + }, + }) } /** @@ -68,42 +42,23 @@ export function getAllTripsQueryOptions( * @summary Get all trips * {@link /api/v1/trips} */ -export function useGetAllTrips< - TData = GetAllTripsQueryResponse, - TQueryData = GetAllTripsQueryResponse, - TQueryKey extends QueryKey = GetAllTripsQueryKey, ->( - params?: GetAllTripsQueryParams, - options: { - query?: Partial< - QueryObserverOptions< - GetAllTripsQueryResponse, - ResponseErrorConfig, - TData, - TQueryData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = queryOptions?.queryKey ?? getAllTripsQueryKey(params); +export function useGetAllTrips(params?: GetAllTripsQueryParams, options: +{ + query?: Partial, TData, TQueryData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getAllTripsQueryKey(params) - const query = useQuery( - { - ...getAllTripsQueryOptions(params, config), - queryKey, - ...queryOptions, - } as unknown as QueryObserverOptions, - queryClient, - ) as UseQueryResult< - TData, - ResponseErrorConfig - > & { queryKey: TQueryKey }; + const query = useQuery({ + ...getAllTripsQueryOptions(params, config), + queryKey, + ...queryOptions + } as unknown as QueryObserverOptions, queryClient) as UseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/trips/useGetAllTripsSuspense.ts b/frontend/api/trips/useGetAllTripsSuspense.ts index a480155..a72d77c 100644 --- a/frontend/api/trips/useGetAllTripsSuspense.ts +++ b/frontend/api/trips/useGetAllTripsSuspense.ts @@ -1,69 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetAllTripsQueryResponse, - GetAllTripsQueryParams, - GetAllTrips400, - GetAllTrips401, - GetAllTrips500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - UseSuspenseQueryOptions, - UseSuspenseQueryResult, -} from "@tanstack/react-query"; +import type { GetAllTripsQueryResponse, GetAllTripsQueryParams, GetAllTrips400, GetAllTrips401, GetAllTrips500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const getAllTripsSuspenseQueryKey = ( - params: GetAllTripsQueryParams = {}, -) => [{ url: "/api/v1/trips" }, ...(params ? [params] : [])] as const; +export const getAllTripsSuspenseQueryKey = (params?: GetAllTripsQueryParams) => [{ url: '/api/v1/trips' }, ...(params ? [params] : [])] as const -export type GetAllTripsSuspenseQueryKey = ReturnType< - typeof getAllTripsSuspenseQueryKey ->; +export type GetAllTripsSuspenseQueryKey = ReturnType /** * @description Retrieves trips with cursor-based pagination. Use limit and cursor query params. * @summary Get all trips * {@link /api/v1/trips} */ -export async function getAllTripsSuspense( - params?: GetAllTripsQueryParams, - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetAllTripsQueryResponse, - ResponseErrorConfig, - unknown - >({ method: "GET", url: `/api/v1/trips`, params, ...requestConfig }); - return res.data; +export async function getAllTripsSuspense(params?: GetAllTripsQueryParams, config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/trips`, params, ... requestConfig }) + return res.data } -export function getAllTripsSuspenseQueryOptions( - params?: GetAllTripsQueryParams, - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getAllTripsSuspenseQueryKey(params); - return queryOptions< - GetAllTripsQueryResponse, - ResponseErrorConfig, - GetAllTripsQueryResponse, - typeof queryKey - >({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getAllTripsSuspense(params, config); - }, - }); +export function getAllTripsSuspenseQueryOptions(params?: GetAllTripsQueryParams, config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getAllTripsSuspenseQueryKey(params) + return queryOptions, GetAllTripsQueryResponse, typeof queryKey>({ + + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getAllTripsSuspense(params, config) + }, + }) } /** @@ -71,41 +42,23 @@ export function getAllTripsSuspenseQueryOptions( * @summary Get all trips * {@link /api/v1/trips} */ -export function useGetAllTripsSuspense< - TData = GetAllTripsQueryResponse, - TQueryKey extends QueryKey = GetAllTripsSuspenseQueryKey, ->( - params?: GetAllTripsQueryParams, - options: { - query?: Partial< - UseSuspenseQueryOptions< - GetAllTripsQueryResponse, - ResponseErrorConfig, - TData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = - queryOptions?.queryKey ?? getAllTripsSuspenseQueryKey(params); +export function useGetAllTripsSuspense(params?: GetAllTripsQueryParams, options: +{ + query?: Partial, TData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getAllTripsSuspenseQueryKey(params) - const query = useSuspenseQuery( - { - ...getAllTripsSuspenseQueryOptions(params, config), - queryKey, - ...queryOptions, - } as unknown as UseSuspenseQueryOptions, - queryClient, - ) as UseSuspenseQueryResult< - TData, - ResponseErrorConfig - > & { queryKey: TQueryKey }; + const query = useSuspenseQuery({ + ...getAllTripsSuspenseQueryOptions(params, config), + queryKey, + ...queryOptions + } as unknown as UseSuspenseQueryOptions, queryClient) as UseSuspenseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/trips/useGetTrip.ts b/frontend/api/trips/useGetTrip.ts index 860a264..268da53 100644 --- a/frontend/api/trips/useGetTrip.ts +++ b/frontend/api/trips/useGetTrip.ts @@ -1,67 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetTripQueryResponse, - GetTripPathParams, - GetTrip400, - GetTrip404, - GetTrip500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - QueryObserverOptions, - UseQueryResult, -} from "@tanstack/react-query"; +import type { GetTripQueryResponse, GetTripPathParams, GetTrip400, GetTrip404, GetTrip500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; -export const getTripQueryKey = (tripID: GetTripPathParams["tripID"]) => - [{ url: "/api/v1/trips/:tripID", params: { tripID: tripID } }] as const; +export const getTripQueryKey = (tripID: GetTripPathParams["tripID"]) => [{ url: '/api/v1/trips/:tripID', params: {tripID:tripID} }] as const -export type GetTripQueryKey = ReturnType; +export type GetTripQueryKey = ReturnType /** * @description Retrieves a trip by ID * @summary Get a trip * {@link /api/v1/trips/:tripID} */ -export async function getTrip( - tripID: GetTripPathParams["tripID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetTripQueryResponse, - ResponseErrorConfig, - unknown - >({ method: "GET", url: `/api/v1/trips/${tripID}`, ...requestConfig }); - return res.data; +export async function getTrip(tripID: GetTripPathParams["tripID"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/trips/${tripID}`, ... requestConfig }) + return res.data } -export function getTripQueryOptions( - tripID: GetTripPathParams["tripID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getTripQueryKey(tripID); - return queryOptions< - GetTripQueryResponse, - ResponseErrorConfig, - GetTripQueryResponse, - typeof queryKey - >({ - enabled: !!tripID, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getTrip(tripID, config); - }, - }); +export function getTripQueryOptions(tripID: GetTripPathParams["tripID"], config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getTripQueryKey(tripID) + return queryOptions, GetTripQueryResponse, typeof queryKey>({ + enabled: !!(tripID), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getTrip(tripID, config) + }, + }) } /** @@ -69,42 +42,23 @@ export function getTripQueryOptions( * @summary Get a trip * {@link /api/v1/trips/:tripID} */ -export function useGetTrip< - TData = GetTripQueryResponse, - TQueryData = GetTripQueryResponse, - TQueryKey extends QueryKey = GetTripQueryKey, ->( - tripID: GetTripPathParams["tripID"], - options: { - query?: Partial< - QueryObserverOptions< - GetTripQueryResponse, - ResponseErrorConfig, - TData, - TQueryData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = queryOptions?.queryKey ?? getTripQueryKey(tripID); +export function useGetTrip(tripID: GetTripPathParams["tripID"], options: +{ + query?: Partial, TData, TQueryData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getTripQueryKey(tripID) - const query = useQuery( - { - ...getTripQueryOptions(tripID, config), - queryKey, - ...queryOptions, - } as unknown as QueryObserverOptions, - queryClient, - ) as UseQueryResult< - TData, - ResponseErrorConfig - > & { queryKey: TQueryKey }; + const query = useQuery({ + ...getTripQueryOptions(tripID, config), + queryKey, + ...queryOptions + } as unknown as QueryObserverOptions, queryClient) as UseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/trips/useGetTripSuspense.ts b/frontend/api/trips/useGetTripSuspense.ts index 76fbf00..b9679fa 100644 --- a/frontend/api/trips/useGetTripSuspense.ts +++ b/frontend/api/trips/useGetTripSuspense.ts @@ -1,69 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetTripQueryResponse, - GetTripPathParams, - GetTrip400, - GetTrip404, - GetTrip500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - UseSuspenseQueryOptions, - UseSuspenseQueryResult, -} from "@tanstack/react-query"; +import type { GetTripQueryResponse, GetTripPathParams, GetTrip400, GetTrip404, GetTrip500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const getTripSuspenseQueryKey = (tripID: GetTripPathParams["tripID"]) => - [{ url: "/api/v1/trips/:tripID", params: { tripID: tripID } }] as const; +export const getTripSuspenseQueryKey = (tripID: GetTripPathParams["tripID"]) => [{ url: '/api/v1/trips/:tripID', params: {tripID:tripID} }] as const -export type GetTripSuspenseQueryKey = ReturnType< - typeof getTripSuspenseQueryKey ->; +export type GetTripSuspenseQueryKey = ReturnType /** * @description Retrieves a trip by ID * @summary Get a trip * {@link /api/v1/trips/:tripID} */ -export async function getTripSuspense( - tripID: GetTripPathParams["tripID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetTripQueryResponse, - ResponseErrorConfig, - unknown - >({ method: "GET", url: `/api/v1/trips/${tripID}`, ...requestConfig }); - return res.data; +export async function getTripSuspense(tripID: GetTripPathParams["tripID"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/trips/${tripID}`, ... requestConfig }) + return res.data } -export function getTripSuspenseQueryOptions( - tripID: GetTripPathParams["tripID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getTripSuspenseQueryKey(tripID); - return queryOptions< - GetTripQueryResponse, - ResponseErrorConfig, - GetTripQueryResponse, - typeof queryKey - >({ - enabled: !!tripID, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getTripSuspense(tripID, config); - }, - }); +export function getTripSuspenseQueryOptions(tripID: GetTripPathParams["tripID"], config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getTripSuspenseQueryKey(tripID) + return queryOptions, GetTripQueryResponse, typeof queryKey>({ + enabled: !!(tripID), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getTripSuspense(tripID, config) + }, + }) } /** @@ -71,40 +42,23 @@ export function getTripSuspenseQueryOptions( * @summary Get a trip * {@link /api/v1/trips/:tripID} */ -export function useGetTripSuspense< - TData = GetTripQueryResponse, - TQueryKey extends QueryKey = GetTripSuspenseQueryKey, ->( - tripID: GetTripPathParams["tripID"], - options: { - query?: Partial< - UseSuspenseQueryOptions< - GetTripQueryResponse, - ResponseErrorConfig, - TData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = queryOptions?.queryKey ?? getTripSuspenseQueryKey(tripID); +export function useGetTripSuspense(tripID: GetTripPathParams["tripID"], options: +{ + query?: Partial, TData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getTripSuspenseQueryKey(tripID) - const query = useSuspenseQuery( - { - ...getTripSuspenseQueryOptions(tripID, config), - queryKey, - ...queryOptions, - } as unknown as UseSuspenseQueryOptions, - queryClient, - ) as UseSuspenseQueryResult< - TData, - ResponseErrorConfig - > & { queryKey: TQueryKey }; + const query = useSuspenseQuery({ + ...getTripSuspenseQueryOptions(tripID, config), + queryKey, + ...queryOptions + } as unknown as UseSuspenseQueryOptions, queryClient) as UseSuspenseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/trips/useUpdateTrip.ts b/frontend/api/trips/useUpdateTrip.ts index 8c7721a..f4d714f 100644 --- a/frontend/api/trips/useUpdateTrip.ts +++ b/frontend/api/trips/useUpdateTrip.ts @@ -1,93 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - UpdateTripMutationRequest, - UpdateTripMutationResponse, - UpdateTripPathParams, - UpdateTrip400, - UpdateTrip401, - UpdateTrip404, - UpdateTrip422, - UpdateTrip500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { UpdateTripMutationRequest, UpdateTripMutationResponse, UpdateTripPathParams, UpdateTrip400, UpdateTrip401, UpdateTrip404, UpdateTrip422, UpdateTrip500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const updateTripMutationKey = () => - [{ url: "/api/v1/trips/:tripID" }] as const; +export const updateTripMutationKey = () => [{ url: '/api/v1/trips/:tripID' }] as const -export type UpdateTripMutationKey = ReturnType; +export type UpdateTripMutationKey = ReturnType /** * @description Updates an existing trip by ID * @summary Update a trip * {@link /api/v1/trips/:tripID} */ -export async function updateTrip( - tripID: UpdateTripPathParams["tripID"], - data?: UpdateTripMutationRequest, - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const requestData = data; - - const res = await request< - UpdateTripMutationResponse, - ResponseErrorConfig< - | UpdateTrip400 - | UpdateTrip401 - | UpdateTrip404 - | UpdateTrip422 - | UpdateTrip500 - >, - UpdateTripMutationRequest - >({ - method: "PATCH", - url: `/api/v1/trips/${tripID}`, - data: requestData, - ...requestConfig, - }); - return res.data; +export async function updateTrip(tripID: UpdateTripPathParams["tripID"], data?: UpdateTripMutationRequest, config: Partial> & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const requestData = data + + const res = await request, UpdateTripMutationRequest>({ method : "PATCH", url : `/api/v1/trips/${tripID}`, data : requestData, ... requestConfig }) + return res.data } -export function updateTripMutationOptions( - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const mutationKey = updateTripMutationKey(); - return mutationOptions< - UpdateTripMutationResponse, - ResponseErrorConfig< - | UpdateTrip400 - | UpdateTrip401 - | UpdateTrip404 - | UpdateTrip422 - | UpdateTrip500 - >, - { - tripID: UpdateTripPathParams["tripID"]; - data?: UpdateTripMutationRequest; - }, - TContext - >({ +export function updateTripMutationOptions(config: Partial> & { client?: typeof fetch } = {}) { + const mutationKey = updateTripMutationKey() + return mutationOptions, {tripID: UpdateTripPathParams["tripID"], data?: UpdateTripMutationRequest}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ tripID, data }) => { - return updateTrip(tripID, data, config); + mutationFn: async({ tripID, data }) => { + return updateTrip(tripID, data, config) }, - }); + }) } /** @@ -95,82 +42,21 @@ export function updateTripMutationOptions( * @summary Update a trip * {@link /api/v1/trips/:tripID} */ -export function useUpdateTrip( - options: { - mutation?: UseMutationOptions< - UpdateTripMutationResponse, - ResponseErrorConfig< - | UpdateTrip400 - | UpdateTrip401 - | UpdateTrip404 - | UpdateTrip422 - | UpdateTrip500 - >, - { - tripID: UpdateTripPathParams["tripID"]; - data?: UpdateTripMutationRequest; - }, - TContext - > & { client?: QueryClient }; - client?: Partial> & { - client?: typeof fetch; - }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useUpdateTrip(options: +{ + mutation?: UseMutationOptions, {tripID: UpdateTripPathParams["tripID"], data?: UpdateTripMutationRequest}, TContext> & { client?: QueryClient }, + client?: Partial> & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = mutationOptions.mutationKey ?? updateTripMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? updateTripMutationKey() - const baseOptions = updateTripMutationOptions(config) as UseMutationOptions< - UpdateTripMutationResponse, - ResponseErrorConfig< - | UpdateTrip400 - | UpdateTrip401 - | UpdateTrip404 - | UpdateTrip422 - | UpdateTrip500 - >, - { - tripID: UpdateTripPathParams["tripID"]; - data?: UpdateTripMutationRequest; - }, - TContext - >; + const baseOptions = updateTripMutationOptions(config) as UseMutationOptions, {tripID: UpdateTripPathParams["tripID"], data?: UpdateTripMutationRequest}, TContext> - return useMutation< - UpdateTripMutationResponse, - ResponseErrorConfig< - | UpdateTrip400 - | UpdateTrip401 - | UpdateTrip404 - | UpdateTrip422 - | UpdateTrip500 - >, - { - tripID: UpdateTripPathParams["tripID"]; - data?: UpdateTripMutationRequest; - }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - UpdateTripMutationResponse, - ResponseErrorConfig< - | UpdateTrip400 - | UpdateTrip401 - | UpdateTrip404 - | UpdateTrip422 - | UpdateTrip500 - >, - { - tripID: UpdateTripPathParams["tripID"]; - data?: UpdateTripMutationRequest; - }, - TContext - >; -} + return useMutation, {tripID: UpdateTripPathParams["tripID"], data?: UpdateTripMutationRequest}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {tripID: UpdateTripPathParams["tripID"], data?: UpdateTripMutationRequest}, TContext> +} \ No newline at end of file diff --git a/frontend/api/users/index.ts b/frontend/api/users/index.ts index e6693ea..f85721c 100644 --- a/frontend/api/users/index.ts +++ b/frontend/api/users/index.ts @@ -32,4 +32,4 @@ export { useGetUserSuspense } from "./useGetUserSuspense.ts"; export { updateUserMutationKey } from "./useUpdateUser.ts"; export { updateUser } from "./useUpdateUser.ts"; export { updateUserMutationOptions } from "./useUpdateUser.ts"; -export { useUpdateUser } from "./useUpdateUser.ts"; +export { useUpdateUser } from "./useUpdateUser.ts"; \ No newline at end of file diff --git a/frontend/api/users/useCreateUser.ts b/frontend/api/users/useCreateUser.ts index 1893897..768f311 100644 --- a/frontend/api/users/useCreateUser.ts +++ b/frontend/api/users/useCreateUser.ts @@ -1,73 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - CreateUserMutationRequest, - CreateUserMutationResponse, - CreateUser400, - CreateUser422, - CreateUser500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { CreateUserMutationRequest, CreateUserMutationResponse, CreateUser400, CreateUser422, CreateUser500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const createUserMutationKey = () => [{ url: "/api/v1/users" }] as const; +export const createUserMutationKey = () => [{ url: '/api/v1/users' }] as const -export type CreateUserMutationKey = ReturnType; +export type CreateUserMutationKey = ReturnType /** * @description Creates a new user with the provided payload * @summary Create a new user * {@link /api/v1/users} */ -export async function createUser( - data: CreateUserMutationRequest, - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const requestData = data; - - const res = await request< - CreateUserMutationResponse, - ResponseErrorConfig, - CreateUserMutationRequest - >({ - method: "POST", - url: `/api/v1/users`, - data: requestData, - ...requestConfig, - }); - return res.data; +export async function createUser(data: CreateUserMutationRequest, config: Partial> & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const requestData = data + + const res = await request, CreateUserMutationRequest>({ method : "POST", url : `/api/v1/users`, data : requestData, ... requestConfig }) + return res.data } -export function createUserMutationOptions( - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const mutationKey = createUserMutationKey(); - return mutationOptions< - CreateUserMutationResponse, - ResponseErrorConfig, - { data: CreateUserMutationRequest }, - TContext - >({ +export function createUserMutationOptions(config: Partial> & { client?: typeof fetch } = {}) { + const mutationKey = createUserMutationKey() + return mutationOptions, {data: CreateUserMutationRequest}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ data }) => { - return createUser(data, config); + mutationFn: async({ data }) => { + return createUser(data, config) }, - }); + }) } /** @@ -75,46 +42,21 @@ export function createUserMutationOptions( * @summary Create a new user * {@link /api/v1/users} */ -export function useCreateUser( - options: { - mutation?: UseMutationOptions< - CreateUserMutationResponse, - ResponseErrorConfig, - { data: CreateUserMutationRequest }, - TContext - > & { client?: QueryClient }; - client?: Partial> & { - client?: typeof fetch; - }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useCreateUser(options: +{ + mutation?: UseMutationOptions, {data: CreateUserMutationRequest}, TContext> & { client?: QueryClient }, + client?: Partial> & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = mutationOptions.mutationKey ?? createUserMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? createUserMutationKey() - const baseOptions = createUserMutationOptions(config) as UseMutationOptions< - CreateUserMutationResponse, - ResponseErrorConfig, - { data: CreateUserMutationRequest }, - TContext - >; + const baseOptions = createUserMutationOptions(config) as UseMutationOptions, {data: CreateUserMutationRequest}, TContext> - return useMutation< - CreateUserMutationResponse, - ResponseErrorConfig, - { data: CreateUserMutationRequest }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - CreateUserMutationResponse, - ResponseErrorConfig, - { data: CreateUserMutationRequest }, - TContext - >; -} + return useMutation, {data: CreateUserMutationRequest}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {data: CreateUserMutationRequest}, TContext> +} \ No newline at end of file diff --git a/frontend/api/users/useDeleteUser.ts b/frontend/api/users/useDeleteUser.ts index f08f9c8..2eab5f1 100644 --- a/frontend/api/users/useDeleteUser.ts +++ b/frontend/api/users/useDeleteUser.ts @@ -1,63 +1,38 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - DeleteUserMutationResponse, - DeleteUserPathParams, - DeleteUser400, - DeleteUser404, - DeleteUser500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404, DeleteUser500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const deleteUserMutationKey = () => - [{ url: "/api/v1/users/:userID" }] as const; +export const deleteUserMutationKey = () => [{ url: '/api/v1/users/:userID' }] as const -export type DeleteUserMutationKey = ReturnType; +export type DeleteUserMutationKey = ReturnType /** * @description Deletes a user by ID * @summary Delete a user * {@link /api/v1/users/:userID} */ -export async function deleteUser( - userID: DeleteUserPathParams["userID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - DeleteUserMutationResponse, - ResponseErrorConfig, - unknown - >({ method: "DELETE", url: `/api/v1/users/${userID}`, ...requestConfig }); - return res.data; +export async function deleteUser(userID: DeleteUserPathParams["userID"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "DELETE", url : `/api/v1/users/${userID}`, ... requestConfig }) + return res.data } -export function deleteUserMutationOptions( - config: Partial & { client?: typeof fetch } = {}, -) { - const mutationKey = deleteUserMutationKey(); - return mutationOptions< - DeleteUserMutationResponse, - ResponseErrorConfig, - { userID: DeleteUserPathParams["userID"] }, - TContext - >({ +export function deleteUserMutationOptions(config: Partial & { client?: typeof fetch } = {}) { + const mutationKey = deleteUserMutationKey() + return mutationOptions, {userID: DeleteUserPathParams["userID"]}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ userID }) => { - return deleteUser(userID, config); + mutationFn: async({ userID }) => { + return deleteUser(userID, config) }, - }); + }) } /** @@ -65,44 +40,21 @@ export function deleteUserMutationOptions( * @summary Delete a user * {@link /api/v1/users/:userID} */ -export function useDeleteUser( - options: { - mutation?: UseMutationOptions< - DeleteUserMutationResponse, - ResponseErrorConfig, - { userID: DeleteUserPathParams["userID"] }, - TContext - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useDeleteUser(options: +{ + mutation?: UseMutationOptions, {userID: DeleteUserPathParams["userID"]}, TContext> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = mutationOptions.mutationKey ?? deleteUserMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? deleteUserMutationKey() - const baseOptions = deleteUserMutationOptions(config) as UseMutationOptions< - DeleteUserMutationResponse, - ResponseErrorConfig, - { userID: DeleteUserPathParams["userID"] }, - TContext - >; + const baseOptions = deleteUserMutationOptions(config) as UseMutationOptions, {userID: DeleteUserPathParams["userID"]}, TContext> - return useMutation< - DeleteUserMutationResponse, - ResponseErrorConfig, - { userID: DeleteUserPathParams["userID"] }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - DeleteUserMutationResponse, - ResponseErrorConfig, - { userID: DeleteUserPathParams["userID"] }, - TContext - >; -} + return useMutation, {userID: DeleteUserPathParams["userID"]}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {userID: DeleteUserPathParams["userID"]}, TContext> +} \ No newline at end of file diff --git a/frontend/api/users/useGetCurrentUser.ts b/frontend/api/users/useGetCurrentUser.ts index d2472ab..88a8634 100644 --- a/frontend/api/users/useGetCurrentUser.ts +++ b/frontend/api/users/useGetCurrentUser.ts @@ -1,67 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetCurrentUserQueryResponse, - GetCurrentUser401, - GetCurrentUser404, - GetCurrentUser500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - QueryObserverOptions, - UseQueryResult, -} from "@tanstack/react-query"; +import type { GetCurrentUserQueryResponse, GetCurrentUser401, GetCurrentUser404, GetCurrentUser500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; -export const getCurrentUserQueryKey = () => - [{ url: "/api/v1/users/me" }] as const; +export const getCurrentUserQueryKey = () => [{ url: '/api/v1/users/me' }] as const -export type GetCurrentUserQueryKey = ReturnType; +export type GetCurrentUserQueryKey = ReturnType /** * @description Retrieves the authenticated user (from JWT claims) * @summary Get current user * {@link /api/v1/users/me} */ -export async function getCurrentUser( - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetCurrentUserQueryResponse, - ResponseErrorConfig< - GetCurrentUser401 | GetCurrentUser404 | GetCurrentUser500 - >, - unknown - >({ method: "GET", url: `/api/v1/users/me`, ...requestConfig }); - return res.data; +export async function getCurrentUser(config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/users/me`, ... requestConfig }) + return res.data } -export function getCurrentUserQueryOptions( - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getCurrentUserQueryKey(); - return queryOptions< - GetCurrentUserQueryResponse, - ResponseErrorConfig< - GetCurrentUser401 | GetCurrentUser404 | GetCurrentUser500 - >, - GetCurrentUserQueryResponse, - typeof queryKey - >({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getCurrentUser(config); - }, - }); +export function getCurrentUserQueryOptions(config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getCurrentUserQueryKey() + return queryOptions, GetCurrentUserQueryResponse, typeof queryKey>({ + + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getCurrentUser(config) + }, + }) } /** @@ -69,45 +42,23 @@ export function getCurrentUserQueryOptions( * @summary Get current user * {@link /api/v1/users/me} */ -export function useGetCurrentUser< - TData = GetCurrentUserQueryResponse, - TQueryData = GetCurrentUserQueryResponse, - TQueryKey extends QueryKey = GetCurrentUserQueryKey, ->( - options: { - query?: Partial< - QueryObserverOptions< - GetCurrentUserQueryResponse, - ResponseErrorConfig< - GetCurrentUser401 | GetCurrentUser404 | GetCurrentUser500 - >, - TData, - TQueryData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = queryOptions?.queryKey ?? getCurrentUserQueryKey(); +export function useGetCurrentUser(options: +{ + query?: Partial, TData, TQueryData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getCurrentUserQueryKey() - const query = useQuery( - { - ...getCurrentUserQueryOptions(config), - queryKey, - ...queryOptions, - } as unknown as QueryObserverOptions, - queryClient, - ) as UseQueryResult< - TData, - ResponseErrorConfig< - GetCurrentUser401 | GetCurrentUser404 | GetCurrentUser500 - > - > & { queryKey: TQueryKey }; + const query = useQuery({ + ...getCurrentUserQueryOptions(config), + queryKey, + ...queryOptions + } as unknown as QueryObserverOptions, queryClient) as UseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/users/useGetCurrentUserSuspense.ts b/frontend/api/users/useGetCurrentUserSuspense.ts index da9c0fe..0bab092 100644 --- a/frontend/api/users/useGetCurrentUserSuspense.ts +++ b/frontend/api/users/useGetCurrentUserSuspense.ts @@ -1,69 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetCurrentUserQueryResponse, - GetCurrentUser401, - GetCurrentUser404, - GetCurrentUser500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - UseSuspenseQueryOptions, - UseSuspenseQueryResult, -} from "@tanstack/react-query"; +import type { GetCurrentUserQueryResponse, GetCurrentUser401, GetCurrentUser404, GetCurrentUser500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const getCurrentUserSuspenseQueryKey = () => - [{ url: "/api/v1/users/me" }] as const; +export const getCurrentUserSuspenseQueryKey = () => [{ url: '/api/v1/users/me' }] as const -export type GetCurrentUserSuspenseQueryKey = ReturnType< - typeof getCurrentUserSuspenseQueryKey ->; +export type GetCurrentUserSuspenseQueryKey = ReturnType /** * @description Retrieves the authenticated user (from JWT claims) * @summary Get current user * {@link /api/v1/users/me} */ -export async function getCurrentUserSuspense( - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetCurrentUserQueryResponse, - ResponseErrorConfig< - GetCurrentUser401 | GetCurrentUser404 | GetCurrentUser500 - >, - unknown - >({ method: "GET", url: `/api/v1/users/me`, ...requestConfig }); - return res.data; +export async function getCurrentUserSuspense(config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/users/me`, ... requestConfig }) + return res.data } -export function getCurrentUserSuspenseQueryOptions( - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getCurrentUserSuspenseQueryKey(); - return queryOptions< - GetCurrentUserQueryResponse, - ResponseErrorConfig< - GetCurrentUser401 | GetCurrentUser404 | GetCurrentUser500 - >, - GetCurrentUserQueryResponse, - typeof queryKey - >({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getCurrentUserSuspense(config); - }, - }); +export function getCurrentUserSuspenseQueryOptions(config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getCurrentUserSuspenseQueryKey() + return queryOptions, GetCurrentUserQueryResponse, typeof queryKey>({ + + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getCurrentUserSuspense(config) + }, + }) } /** @@ -71,43 +42,23 @@ export function getCurrentUserSuspenseQueryOptions( * @summary Get current user * {@link /api/v1/users/me} */ -export function useGetCurrentUserSuspense< - TData = GetCurrentUserQueryResponse, - TQueryKey extends QueryKey = GetCurrentUserSuspenseQueryKey, ->( - options: { - query?: Partial< - UseSuspenseQueryOptions< - GetCurrentUserQueryResponse, - ResponseErrorConfig< - GetCurrentUser401 | GetCurrentUser404 | GetCurrentUser500 - >, - TData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = queryOptions?.queryKey ?? getCurrentUserSuspenseQueryKey(); +export function useGetCurrentUserSuspense(options: +{ + query?: Partial, TData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getCurrentUserSuspenseQueryKey() - const query = useSuspenseQuery( - { - ...getCurrentUserSuspenseQueryOptions(config), - queryKey, - ...queryOptions, - } as unknown as UseSuspenseQueryOptions, - queryClient, - ) as UseSuspenseQueryResult< - TData, - ResponseErrorConfig< - GetCurrentUser401 | GetCurrentUser404 | GetCurrentUser500 - > - > & { queryKey: TQueryKey }; + const query = useSuspenseQuery({ + ...getCurrentUserSuspenseQueryOptions(config), + queryKey, + ...queryOptions + } as unknown as UseSuspenseQueryOptions, queryClient) as UseSuspenseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/users/useGetUser.ts b/frontend/api/users/useGetUser.ts index 542c323..989d3be 100644 --- a/frontend/api/users/useGetUser.ts +++ b/frontend/api/users/useGetUser.ts @@ -1,67 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetUserQueryResponse, - GetUserPathParams, - GetUser400, - GetUser404, - GetUser500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - QueryObserverOptions, - UseQueryResult, -} from "@tanstack/react-query"; +import type { GetUserQueryResponse, GetUserPathParams, GetUser400, GetUser404, GetUser500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; -export const getUserQueryKey = (userID: GetUserPathParams["userID"]) => - [{ url: "/api/v1/users/:userID", params: { userID: userID } }] as const; +export const getUserQueryKey = (userID: GetUserPathParams["userID"]) => [{ url: '/api/v1/users/:userID', params: {userID:userID} }] as const -export type GetUserQueryKey = ReturnType; +export type GetUserQueryKey = ReturnType /** * @description Retrieves a user by ID * @summary Get a user * {@link /api/v1/users/:userID} */ -export async function getUser( - userID: GetUserPathParams["userID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetUserQueryResponse, - ResponseErrorConfig, - unknown - >({ method: "GET", url: `/api/v1/users/${userID}`, ...requestConfig }); - return res.data; +export async function getUser(userID: GetUserPathParams["userID"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/users/${userID}`, ... requestConfig }) + return res.data } -export function getUserQueryOptions( - userID: GetUserPathParams["userID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getUserQueryKey(userID); - return queryOptions< - GetUserQueryResponse, - ResponseErrorConfig, - GetUserQueryResponse, - typeof queryKey - >({ - enabled: !!userID, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getUser(userID, config); - }, - }); +export function getUserQueryOptions(userID: GetUserPathParams["userID"], config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getUserQueryKey(userID) + return queryOptions, GetUserQueryResponse, typeof queryKey>({ + enabled: !!(userID), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getUser(userID, config) + }, + }) } /** @@ -69,42 +42,23 @@ export function getUserQueryOptions( * @summary Get a user * {@link /api/v1/users/:userID} */ -export function useGetUser< - TData = GetUserQueryResponse, - TQueryData = GetUserQueryResponse, - TQueryKey extends QueryKey = GetUserQueryKey, ->( - userID: GetUserPathParams["userID"], - options: { - query?: Partial< - QueryObserverOptions< - GetUserQueryResponse, - ResponseErrorConfig, - TData, - TQueryData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = queryOptions?.queryKey ?? getUserQueryKey(userID); +export function useGetUser(userID: GetUserPathParams["userID"], options: +{ + query?: Partial, TData, TQueryData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getUserQueryKey(userID) - const query = useQuery( - { - ...getUserQueryOptions(userID, config), - queryKey, - ...queryOptions, - } as unknown as QueryObserverOptions, - queryClient, - ) as UseQueryResult< - TData, - ResponseErrorConfig - > & { queryKey: TQueryKey }; + const query = useQuery({ + ...getUserQueryOptions(userID, config), + queryKey, + ...queryOptions + } as unknown as QueryObserverOptions, queryClient) as UseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/users/useGetUserSuspense.ts b/frontend/api/users/useGetUserSuspense.ts index bba03d5..b22fbe9 100644 --- a/frontend/api/users/useGetUserSuspense.ts +++ b/frontend/api/users/useGetUserSuspense.ts @@ -1,69 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - GetUserQueryResponse, - GetUserPathParams, - GetUser400, - GetUser404, - GetUser500, -} from "../../types/types.gen.ts"; -import type { - QueryKey, - QueryClient, - UseSuspenseQueryOptions, - UseSuspenseQueryResult, -} from "@tanstack/react-query"; +import type { GetUserQueryResponse, GetUserPathParams, GetUser400, GetUser404, GetUser500 } from "../../types/types.gen.ts"; +import type { QueryKey, QueryClient, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const getUserSuspenseQueryKey = (userID: GetUserPathParams["userID"]) => - [{ url: "/api/v1/users/:userID", params: { userID: userID } }] as const; +export const getUserSuspenseQueryKey = (userID: GetUserPathParams["userID"]) => [{ url: '/api/v1/users/:userID', params: {userID:userID} }] as const -export type GetUserSuspenseQueryKey = ReturnType< - typeof getUserSuspenseQueryKey ->; +export type GetUserSuspenseQueryKey = ReturnType /** * @description Retrieves a user by ID * @summary Get a user * {@link /api/v1/users/:userID} */ -export async function getUserSuspense( - userID: GetUserPathParams["userID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const res = await request< - GetUserQueryResponse, - ResponseErrorConfig, - unknown - >({ method: "GET", url: `/api/v1/users/${userID}`, ...requestConfig }); - return res.data; +export async function getUserSuspense(userID: GetUserPathParams["userID"], config: Partial & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const res = await request, unknown>({ method : "GET", url : `/api/v1/users/${userID}`, ... requestConfig }) + return res.data } -export function getUserSuspenseQueryOptions( - userID: GetUserPathParams["userID"], - config: Partial & { client?: typeof fetch } = {}, -) { - const queryKey = getUserSuspenseQueryKey(userID); - return queryOptions< - GetUserQueryResponse, - ResponseErrorConfig, - GetUserQueryResponse, - typeof queryKey - >({ - enabled: !!userID, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal; - return getUserSuspense(userID, config); - }, - }); +export function getUserSuspenseQueryOptions(userID: GetUserPathParams["userID"], config: Partial & { client?: typeof fetch } = {}) { + const queryKey = getUserSuspenseQueryKey(userID) + return queryOptions, GetUserQueryResponse, typeof queryKey>({ + enabled: !!(userID), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getUserSuspense(userID, config) + }, + }) } /** @@ -71,40 +42,23 @@ export function getUserSuspenseQueryOptions( * @summary Get a user * {@link /api/v1/users/:userID} */ -export function useGetUserSuspense< - TData = GetUserQueryResponse, - TQueryKey extends QueryKey = GetUserSuspenseQueryKey, ->( - userID: GetUserPathParams["userID"], - options: { - query?: Partial< - UseSuspenseQueryOptions< - GetUserQueryResponse, - ResponseErrorConfig, - TData, - TQueryKey - > - > & { client?: QueryClient }; - client?: Partial & { client?: typeof fetch }; - } = {}, -) { - const { query: queryConfig = {}, client: config = {} } = options ?? {}; - const { client: queryClient, ...queryOptions } = queryConfig; - const queryKey = queryOptions?.queryKey ?? getUserSuspenseQueryKey(userID); +export function useGetUserSuspense(userID: GetUserPathParams["userID"], options: +{ + query?: Partial, TData, TQueryKey>> & { client?: QueryClient }, + client?: Partial & { client?: typeof fetch } +} + = {}) { + const { query: queryConfig = {}, client: config = {} } = options ?? {} + const { client: queryClient, ...queryOptions } = queryConfig + const queryKey = queryOptions?.queryKey ?? getUserSuspenseQueryKey(userID) - const query = useSuspenseQuery( - { - ...getUserSuspenseQueryOptions(userID, config), - queryKey, - ...queryOptions, - } as unknown as UseSuspenseQueryOptions, - queryClient, - ) as UseSuspenseQueryResult< - TData, - ResponseErrorConfig - > & { queryKey: TQueryKey }; + const query = useSuspenseQuery({ + ...getUserSuspenseQueryOptions(userID, config), + queryKey, + ...queryOptions + } as unknown as UseSuspenseQueryOptions, queryClient) as UseSuspenseQueryResult> & { queryKey: TQueryKey } - query.queryKey = queryKey as TQueryKey; + query.queryKey = queryKey as TQueryKey - return query; -} + return query +} \ No newline at end of file diff --git a/frontend/api/users/useUpdateUser.ts b/frontend/api/users/useUpdateUser.ts index e71c3a6..7a8d4b1 100644 --- a/frontend/api/users/useUpdateUser.ts +++ b/frontend/api/users/useUpdateUser.ts @@ -1,84 +1,40 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ import fetch from "../client"; import type { RequestConfig, ResponseErrorConfig } from "../client"; -import type { - UpdateUserMutationRequest, - UpdateUserMutationResponse, - UpdateUserPathParams, - UpdateUser400, - UpdateUser404, - UpdateUser422, - UpdateUser500, -} from "../../types/types.gen.ts"; -import type { - UseMutationOptions, - UseMutationResult, - QueryClient, -} from "@tanstack/react-query"; +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams, UpdateUser400, UpdateUser404, UpdateUser422, UpdateUser500 } from "../../types/types.gen.ts"; +import type { UseMutationOptions, UseMutationResult, QueryClient } from "@tanstack/react-query"; import { mutationOptions, useMutation } from "@tanstack/react-query"; -export const updateUserMutationKey = () => - [{ url: "/api/v1/users/:userID" }] as const; +export const updateUserMutationKey = () => [{ url: '/api/v1/users/:userID' }] as const -export type UpdateUserMutationKey = ReturnType; +export type UpdateUserMutationKey = ReturnType /** * @description Updates an existing user by ID * @summary Update a user * {@link /api/v1/users/:userID} */ -export async function updateUser( - userID: UpdateUserPathParams["userID"], - data?: UpdateUserMutationRequest, - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const { client: request = fetch, ...requestConfig } = config; - - const requestData = data; - - const res = await request< - UpdateUserMutationResponse, - ResponseErrorConfig< - UpdateUser400 | UpdateUser404 | UpdateUser422 | UpdateUser500 - >, - UpdateUserMutationRequest - >({ - method: "PATCH", - url: `/api/v1/users/${userID}`, - data: requestData, - ...requestConfig, - }); - return res.data; +export async function updateUser(userID: UpdateUserPathParams["userID"], data?: UpdateUserMutationRequest, config: Partial> & { client?: typeof fetch } = {}) { + const { client: request = fetch, ...requestConfig } = config + + const requestData = data + + const res = await request, UpdateUserMutationRequest>({ method : "PATCH", url : `/api/v1/users/${userID}`, data : requestData, ... requestConfig }) + return res.data } -export function updateUserMutationOptions( - config: Partial> & { - client?: typeof fetch; - } = {}, -) { - const mutationKey = updateUserMutationKey(); - return mutationOptions< - UpdateUserMutationResponse, - ResponseErrorConfig< - UpdateUser400 | UpdateUser404 | UpdateUser422 | UpdateUser500 - >, - { - userID: UpdateUserPathParams["userID"]; - data?: UpdateUserMutationRequest; - }, - TContext - >({ +export function updateUserMutationOptions(config: Partial> & { client?: typeof fetch } = {}) { + const mutationKey = updateUserMutationKey() + return mutationOptions, {userID: UpdateUserPathParams["userID"], data?: UpdateUserMutationRequest}, typeof mutationKey>({ mutationKey, - mutationFn: async ({ userID, data }) => { - return updateUser(userID, data, config); + mutationFn: async({ userID, data }) => { + return updateUser(userID, data, config) }, - }); + }) } /** @@ -86,66 +42,21 @@ export function updateUserMutationOptions( * @summary Update a user * {@link /api/v1/users/:userID} */ -export function useUpdateUser( - options: { - mutation?: UseMutationOptions< - UpdateUserMutationResponse, - ResponseErrorConfig< - UpdateUser400 | UpdateUser404 | UpdateUser422 | UpdateUser500 - >, - { - userID: UpdateUserPathParams["userID"]; - data?: UpdateUserMutationRequest; - }, - TContext - > & { client?: QueryClient }; - client?: Partial> & { - client?: typeof fetch; - }; - } = {}, -) { - const { mutation = {}, client: config = {} } = options ?? {}; +export function useUpdateUser(options: +{ + mutation?: UseMutationOptions, {userID: UpdateUserPathParams["userID"], data?: UpdateUserMutationRequest}, TContext> & { client?: QueryClient }, + client?: Partial> & { client?: typeof fetch }, +} + = {}) { + const { mutation = {}, client: config = {} } = options ?? {} const { client: queryClient, ...mutationOptions } = mutation; - const mutationKey = mutationOptions.mutationKey ?? updateUserMutationKey(); + const mutationKey = mutationOptions.mutationKey ?? updateUserMutationKey() - const baseOptions = updateUserMutationOptions(config) as UseMutationOptions< - UpdateUserMutationResponse, - ResponseErrorConfig< - UpdateUser400 | UpdateUser404 | UpdateUser422 | UpdateUser500 - >, - { - userID: UpdateUserPathParams["userID"]; - data?: UpdateUserMutationRequest; - }, - TContext - >; + const baseOptions = updateUserMutationOptions(config) as UseMutationOptions, {userID: UpdateUserPathParams["userID"], data?: UpdateUserMutationRequest}, TContext> - return useMutation< - UpdateUserMutationResponse, - ResponseErrorConfig< - UpdateUser400 | UpdateUser404 | UpdateUser422 | UpdateUser500 - >, - { - userID: UpdateUserPathParams["userID"]; - data?: UpdateUserMutationRequest; - }, - TContext - >( - { - ...baseOptions, - mutationKey, - ...mutationOptions, - }, - queryClient, - ) as UseMutationResult< - UpdateUserMutationResponse, - ResponseErrorConfig< - UpdateUser400 | UpdateUser404 | UpdateUser422 | UpdateUser500 - >, - { - userID: UpdateUserPathParams["userID"]; - data?: UpdateUserMutationRequest; - }, - TContext - >; -} + return useMutation, {userID: UpdateUserPathParams["userID"], data?: UpdateUserMutationRequest}, TContext>({ + ...baseOptions, + mutationKey, + ...mutationOptions, + }, queryClient) as UseMutationResult, {userID: UpdateUserPathParams["userID"], data?: UpdateUserMutationRequest}, TContext> +} \ No newline at end of file diff --git a/frontend/index.ts b/frontend/index.ts index f355aee..9b139ef 100644 --- a/frontend/index.ts +++ b/frontend/index.ts @@ -24,6 +24,13 @@ export type { RemoveMemberMutationKey } from "./api/memberships/useRemoveMember. export type { UpdateMembershipMutationKey } from "./api/memberships/useUpdateMembership.ts"; export type { SendBulkNotificationMutationKey } from "./api/notifications/useSendBulkNotification.ts"; export type { SendNotificationMutationKey } from "./api/notifications/useSendNotification.ts"; +export type { CreatePitchMutationKey } from "./api/pitches/useCreatePitch.ts"; +export type { DeletePitchMutationKey } from "./api/pitches/useDeletePitch.ts"; +export type { GetPitchQueryKey } from "./api/pitches/useGetPitch.ts"; +export type { GetPitchSuspenseQueryKey } from "./api/pitches/useGetPitchSuspense.ts"; +export type { ListPitchesQueryKey } from "./api/pitches/useListPitches.ts"; +export type { ListPitchesSuspenseQueryKey } from "./api/pitches/useListPitchesSuspense.ts"; +export type { UpdatePitchMutationKey } from "./api/pitches/useUpdatePitch.ts"; export type { CreateTripMutationKey } from "./api/trips/useCreateTrip.ts"; export type { DeleteTripMutationKey } from "./api/trips/useDeleteTrip.ts"; export type { GetAllTripsQueryKey } from "./api/trips/useGetAllTrips.ts"; @@ -142,6 +149,34 @@ export { sendNotificationMutationKey } from "./api/notifications/useSendNotifica export { sendNotification } from "./api/notifications/useSendNotification.ts"; export { sendNotificationMutationOptions } from "./api/notifications/useSendNotification.ts"; export { useSendNotification } from "./api/notifications/useSendNotification.ts"; +export { createPitchMutationKey } from "./api/pitches/useCreatePitch.ts"; +export { createPitch } from "./api/pitches/useCreatePitch.ts"; +export { createPitchMutationOptions } from "./api/pitches/useCreatePitch.ts"; +export { useCreatePitch } from "./api/pitches/useCreatePitch.ts"; +export { deletePitchMutationKey } from "./api/pitches/useDeletePitch.ts"; +export { deletePitch } from "./api/pitches/useDeletePitch.ts"; +export { deletePitchMutationOptions } from "./api/pitches/useDeletePitch.ts"; +export { useDeletePitch } from "./api/pitches/useDeletePitch.ts"; +export { getPitchQueryKey } from "./api/pitches/useGetPitch.ts"; +export { getPitch } from "./api/pitches/useGetPitch.ts"; +export { getPitchQueryOptions } from "./api/pitches/useGetPitch.ts"; +export { useGetPitch } from "./api/pitches/useGetPitch.ts"; +export { getPitchSuspenseQueryKey } from "./api/pitches/useGetPitchSuspense.ts"; +export { getPitchSuspense } from "./api/pitches/useGetPitchSuspense.ts"; +export { getPitchSuspenseQueryOptions } from "./api/pitches/useGetPitchSuspense.ts"; +export { useGetPitchSuspense } from "./api/pitches/useGetPitchSuspense.ts"; +export { listPitchesQueryKey } from "./api/pitches/useListPitches.ts"; +export { listPitches } from "./api/pitches/useListPitches.ts"; +export { listPitchesQueryOptions } from "./api/pitches/useListPitches.ts"; +export { useListPitches } from "./api/pitches/useListPitches.ts"; +export { listPitchesSuspenseQueryKey } from "./api/pitches/useListPitchesSuspense.ts"; +export { listPitchesSuspense } from "./api/pitches/useListPitchesSuspense.ts"; +export { listPitchesSuspenseQueryOptions } from "./api/pitches/useListPitchesSuspense.ts"; +export { useListPitchesSuspense } from "./api/pitches/useListPitchesSuspense.ts"; +export { updatePitchMutationKey } from "./api/pitches/useUpdatePitch.ts"; +export { updatePitch } from "./api/pitches/useUpdatePitch.ts"; +export { updatePitchMutationOptions } from "./api/pitches/useUpdatePitch.ts"; +export { useUpdatePitch } from "./api/pitches/useUpdatePitch.ts"; export { createTripMutationKey } from "./api/trips/useCreateTrip.ts"; export { createTrip } from "./api/trips/useCreateTrip.ts"; export { createTripMutationOptions } from "./api/trips/useCreateTrip.ts"; @@ -197,4 +232,4 @@ export { useGetUserSuspense } from "./api/users/useGetUserSuspense.ts"; export { updateUserMutationKey } from "./api/users/useUpdateUser.ts"; export { updateUser } from "./api/users/useUpdateUser.ts"; export { updateUserMutationOptions } from "./api/users/useUpdateUser.ts"; -export { useUpdateUser } from "./api/users/useUpdateUser.ts"; +export { useUpdateUser } from "./api/users/useUpdateUser.ts"; \ No newline at end of file diff --git a/frontend/schemas/errsAPIError.json b/frontend/schemas/errsAPIError.json index 3ae2290..874f8c5 100644 --- a/frontend/schemas/errsAPIError.json +++ b/frontend/schemas/errsAPIError.json @@ -1,5 +1 @@ -{ - "type": "object", - "properties": { "message": {}, "statusCode": { "type": "integer" } }, - "x-readme-ref-name": "errs.APIError" -} +{"type":"object","properties":{"message":{},"statusCode":{"type":"integer"}},"x-readme-ref-name":"errs.APIError"} \ No newline at end of file diff --git a/frontend/schemas/modelsComment.json b/frontend/schemas/modelsComment.json index 973d258..873cf32 100644 --- a/frontend/schemas/modelsComment.json +++ b/frontend/schemas/modelsComment.json @@ -1,19 +1 @@ -{ - "type": "object", - "properties": { - "content": { "type": "string" }, - "created_at": { "type": "string" }, - "entity_id": { "type": "string" }, - "entity_type": { - "type": "string", - "enum": ["activity", "pitch"], - "x-enum-varnames": ["Activity", "Pitch"], - "x-readme-ref-name": "models.EntityType" - }, - "id": { "type": "string" }, - "trip_id": { "type": "string" }, - "updated_at": { "type": "string" }, - "user_id": { "type": "string" } - }, - "x-readme-ref-name": "models.Comment" -} +{"type":"object","properties":{"content":{"type":"string"},"created_at":{"type":"string"},"entity_id":{"type":"string"},"entity_type":{"type":"string","enum":["activity","pitch"],"x-enum-varnames":["Activity","Pitch"],"x-readme-ref-name":"models.EntityType"},"id":{"type":"string"},"trip_id":{"type":"string"},"updated_at":{"type":"string"},"user_id":{"type":"string"}},"x-readme-ref-name":"models.Comment"} \ No newline at end of file diff --git a/frontend/schemas/modelsCommentAPIResponse.json b/frontend/schemas/modelsCommentAPIResponse.json index b8697e4..e55e7eb 100644 --- a/frontend/schemas/modelsCommentAPIResponse.json +++ b/frontend/schemas/modelsCommentAPIResponse.json @@ -1,24 +1 @@ -{ - "type": "object", - "properties": { - "content": { "type": "string" }, - "created_at": { "type": "string" }, - "entity_id": { "type": "string" }, - "entity_type": { - "type": "string", - "enum": ["activity", "pitch"], - "x-enum-varnames": ["Activity", "Pitch"], - "x-readme-ref-name": "models.EntityType" - }, - "id": { "type": "string" }, - "profile_picture_url": { - "description": "pointer since some users don't have their avatar set", - "type": "string" - }, - "trip_id": { "type": "string" }, - "updated_at": { "type": "string" }, - "user_id": { "type": "string" }, - "username": { "type": "string" } - }, - "x-readme-ref-name": "models.CommentAPIResponse" -} +{"type":"object","properties":{"content":{"type":"string"},"created_at":{"type":"string"},"entity_id":{"type":"string"},"entity_type":{"type":"string","enum":["activity","pitch"],"x-enum-varnames":["Activity","Pitch"],"x-readme-ref-name":"models.EntityType"},"id":{"type":"string"},"profile_picture_url":{"description":"pointer since some users don't have their avatar set","type":"string"},"trip_id":{"type":"string"},"updated_at":{"type":"string"},"user_id":{"type":"string"},"username":{"type":"string"}},"x-readme-ref-name":"models.CommentAPIResponse"} \ No newline at end of file diff --git a/frontend/schemas/modelsConfirmUploadRequest.json b/frontend/schemas/modelsConfirmUploadRequest.json index 017f320..b79a019 100644 --- a/frontend/schemas/modelsConfirmUploadRequest.json +++ b/frontend/schemas/modelsConfirmUploadRequest.json @@ -1,23 +1 @@ -{ - "type": "object", - "required": ["imageId"], - "properties": { - "imageId": { "type": "string" }, - "size": { - "description": "Optional: if nil, confirm all sizes", - "allOf": [ - { - "type": "string", - "enum": ["large", "medium", "small"], - "x-enum-varnames": [ - "ImageSizeLarge", - "ImageSizeMedium", - "ImageSizeSmall" - ], - "x-readme-ref-name": "models.ImageSize" - } - ] - } - }, - "x-readme-ref-name": "models.ConfirmUploadRequest" -} +{"type":"object","required":["imageId"],"properties":{"imageId":{"type":"string"},"size":{"description":"Optional: if nil, confirm all sizes","allOf":[{"type":"string","enum":["large","medium","small"],"x-enum-varnames":["ImageSizeLarge","ImageSizeMedium","ImageSizeSmall"],"x-readme-ref-name":"models.ImageSize"}]}},"x-readme-ref-name":"models.ConfirmUploadRequest"} \ No newline at end of file diff --git a/frontend/schemas/modelsConfirmUploadResponse.json b/frontend/schemas/modelsConfirmUploadResponse.json index 67f0b88..b3252d9 100644 --- a/frontend/schemas/modelsConfirmUploadResponse.json +++ b/frontend/schemas/modelsConfirmUploadResponse.json @@ -1,9 +1 @@ -{ - "type": "object", - "properties": { - "confirmed": { "type": "integer" }, - "imageId": { "type": "string" }, - "status": { "type": "string" } - }, - "x-readme-ref-name": "models.ConfirmUploadResponse" -} +{"type":"object","properties":{"confirmed":{"type":"integer"},"imageId":{"type":"string"},"status":{"type":"string"}},"x-readme-ref-name":"models.ConfirmUploadResponse"} \ No newline at end of file diff --git a/frontend/schemas/modelsCreateCommentRequest.json b/frontend/schemas/modelsCreateCommentRequest.json index 5230ee2..c056168 100644 --- a/frontend/schemas/modelsCreateCommentRequest.json +++ b/frontend/schemas/modelsCreateCommentRequest.json @@ -1,21 +1 @@ -{ - "type": "object", - "required": ["content", "entity_id", "entity_type", "trip_id"], - "properties": { - "content": { "type": "string", "minLength": 1 }, - "entity_id": { "type": "string" }, - "entity_type": { - "enum": ["activity", "pitch"], - "allOf": [ - { - "type": "string", - "enum": ["activity", "pitch"], - "x-enum-varnames": ["Activity", "Pitch"], - "x-readme-ref-name": "models.EntityType" - } - ] - }, - "trip_id": { "type": "string" } - }, - "x-readme-ref-name": "models.CreateCommentRequest" -} +{"type":"object","required":["content","entity_id","entity_type","trip_id"],"properties":{"content":{"type":"string","minLength":1},"entity_id":{"type":"string"},"entity_type":{"enum":["activity","pitch"],"allOf":[{"type":"string","enum":["activity","pitch"],"x-enum-varnames":["Activity","Pitch"],"x-readme-ref-name":"models.EntityType"}]},"trip_id":{"type":"string"}},"x-readme-ref-name":"models.CreateCommentRequest"} \ No newline at end of file diff --git a/frontend/schemas/modelsCreateMembershipRequest.json b/frontend/schemas/modelsCreateMembershipRequest.json index 6d1be31..4a33eef 100644 --- a/frontend/schemas/modelsCreateMembershipRequest.json +++ b/frontend/schemas/modelsCreateMembershipRequest.json @@ -1,12 +1 @@ -{ - "type": "object", - "required": ["budget_max", "budget_min", "trip_id", "user_id"], - "properties": { - "budget_max": { "type": "integer", "minimum": 0 }, - "budget_min": { "type": "integer", "minimum": 0 }, - "is_admin": { "type": "boolean" }, - "trip_id": { "type": "string" }, - "user_id": { "type": "string" } - }, - "x-readme-ref-name": "models.CreateMembershipRequest" -} +{"type":"object","required":["budget_max","budget_min","trip_id","user_id"],"properties":{"budget_max":{"type":"integer","minimum":0},"budget_min":{"type":"integer","minimum":0},"is_admin":{"type":"boolean"},"trip_id":{"type":"string"},"user_id":{"type":"string"}},"x-readme-ref-name":"models.CreateMembershipRequest"} \ No newline at end of file diff --git a/frontend/schemas/modelsCreatePitchRequest.json b/frontend/schemas/modelsCreatePitchRequest.json new file mode 100644 index 0000000..bd83182 --- /dev/null +++ b/frontend/schemas/modelsCreatePitchRequest.json @@ -0,0 +1 @@ +{"type":"object","required":["content_type","title"],"properties":{"content_type":{"type":"string","minLength":1},"description":{"type":"string"},"title":{"type":"string","minLength":1}},"x-readme-ref-name":"models.CreatePitchRequest"} \ No newline at end of file diff --git a/frontend/schemas/modelsCreatePitchResponse.json b/frontend/schemas/modelsCreatePitchResponse.json new file mode 100644 index 0000000..09be580 --- /dev/null +++ b/frontend/schemas/modelsCreatePitchResponse.json @@ -0,0 +1 @@ +{"type":"object","properties":{"expires_at":{"type":"string"},"pitch":{"type":"object","properties":{"audio_url":{"type":"string"},"created_at":{"type":"string"},"description":{"type":"string"},"duration":{"type":"integer"},"id":{"type":"string"},"title":{"type":"string"},"trip_id":{"type":"string"},"updated_at":{"type":"string"},"user_id":{"type":"string"}},"x-readme-ref-name":"models.PitchAPIResponse"},"upload_url":{"type":"string"}},"x-readme-ref-name":"models.CreatePitchResponse"} \ No newline at end of file diff --git a/frontend/schemas/modelsCreateTripRequest.json b/frontend/schemas/modelsCreateTripRequest.json index a32ecd9..e06e8dc 100644 --- a/frontend/schemas/modelsCreateTripRequest.json +++ b/frontend/schemas/modelsCreateTripRequest.json @@ -1,11 +1 @@ -{ - "type": "object", - "required": ["budget_max", "budget_min", "name"], - "properties": { - "budget_max": { "type": "integer", "minimum": 0 }, - "budget_min": { "type": "integer", "minimum": 0 }, - "cover_image_id": { "type": "string" }, - "name": { "type": "string", "minLength": 1 } - }, - "x-readme-ref-name": "models.CreateTripRequest" -} +{"type":"object","required":["budget_max","budget_min","name"],"properties":{"budget_max":{"type":"integer","minimum":0},"budget_min":{"type":"integer","minimum":0},"cover_image_id":{"type":"string"},"name":{"type":"string","minLength":1}},"x-readme-ref-name":"models.CreateTripRequest"} \ No newline at end of file diff --git a/frontend/schemas/modelsCreateUserRequest.json b/frontend/schemas/modelsCreateUserRequest.json index acb4e08..d93b417 100644 --- a/frontend/schemas/modelsCreateUserRequest.json +++ b/frontend/schemas/modelsCreateUserRequest.json @@ -1,10 +1 @@ -{ - "type": "object", - "required": ["name", "phone_number", "username"], - "properties": { - "name": { "type": "string", "minLength": 1 }, - "phone_number": { "type": "string" }, - "username": { "type": "string" } - }, - "x-readme-ref-name": "models.CreateUserRequest" -} +{"type":"object","required":["name","phone_number","username"],"properties":{"name":{"type":"string","minLength":1},"phone_number":{"type":"string"},"username":{"type":"string"}},"x-readme-ref-name":"models.CreateUserRequest"} \ No newline at end of file diff --git a/frontend/schemas/modelsEntityType.json b/frontend/schemas/modelsEntityType.json index d41ba70..18d0303 100644 --- a/frontend/schemas/modelsEntityType.json +++ b/frontend/schemas/modelsEntityType.json @@ -1,6 +1 @@ -{ - "type": "string", - "enum": ["activity", "pitch"], - "x-enum-varnames": ["Activity", "Pitch"], - "x-readme-ref-name": "models.EntityType" -} +{"type":"string","enum":["activity","pitch"],"x-enum-varnames":["Activity","Pitch"],"x-readme-ref-name":"models.EntityType"} \ No newline at end of file diff --git a/frontend/schemas/modelsGetFileAllSizesResponse.json b/frontend/schemas/modelsGetFileAllSizesResponse.json index 89baca7..433bd8f 100644 --- a/frontend/schemas/modelsGetFileAllSizesResponse.json +++ b/frontend/schemas/modelsGetFileAllSizesResponse.json @@ -1,29 +1 @@ -{ - "type": "object", - "properties": { - "files": { - "type": "array", - "items": { - "type": "object", - "properties": { - "contentType": { "type": "string" }, - "imageId": { "type": "string" }, - "size": { - "type": "string", - "enum": ["large", "medium", "small"], - "x-enum-varnames": [ - "ImageSizeLarge", - "ImageSizeMedium", - "ImageSizeSmall" - ], - "x-readme-ref-name": "models.ImageSize" - }, - "url": { "type": "string" } - }, - "x-readme-ref-name": "models.GetFileResponse" - } - }, - "imageId": { "type": "string" } - }, - "x-readme-ref-name": "models.GetFileAllSizesResponse" -} +{"type":"object","properties":{"files":{"type":"array","items":{"type":"object","properties":{"contentType":{"type":"string"},"imageId":{"type":"string"},"size":{"type":"string","enum":["large","medium","small"],"x-enum-varnames":["ImageSizeLarge","ImageSizeMedium","ImageSizeSmall"],"x-readme-ref-name":"models.ImageSize"},"url":{"type":"string"}},"x-readme-ref-name":"models.GetFileResponse"}},"imageId":{"type":"string"}},"x-readme-ref-name":"models.GetFileAllSizesResponse"} \ No newline at end of file diff --git a/frontend/schemas/modelsGetFileResponse.json b/frontend/schemas/modelsGetFileResponse.json index d9fdfb3..fee166e 100644 --- a/frontend/schemas/modelsGetFileResponse.json +++ b/frontend/schemas/modelsGetFileResponse.json @@ -1,19 +1 @@ -{ - "type": "object", - "properties": { - "contentType": { "type": "string" }, - "imageId": { "type": "string" }, - "size": { - "type": "string", - "enum": ["large", "medium", "small"], - "x-enum-varnames": [ - "ImageSizeLarge", - "ImageSizeMedium", - "ImageSizeSmall" - ], - "x-readme-ref-name": "models.ImageSize" - }, - "url": { "type": "string" } - }, - "x-readme-ref-name": "models.GetFileResponse" -} +{"type":"object","properties":{"contentType":{"type":"string"},"imageId":{"type":"string"},"size":{"type":"string","enum":["large","medium","small"],"x-enum-varnames":["ImageSizeLarge","ImageSizeMedium","ImageSizeSmall"],"x-readme-ref-name":"models.ImageSize"},"url":{"type":"string"}},"x-readme-ref-name":"models.GetFileResponse"} \ No newline at end of file diff --git a/frontend/schemas/modelsImageSize.json b/frontend/schemas/modelsImageSize.json index 4ffbdad..3b4c472 100644 --- a/frontend/schemas/modelsImageSize.json +++ b/frontend/schemas/modelsImageSize.json @@ -1,6 +1 @@ -{ - "type": "string", - "enum": ["large", "medium", "small"], - "x-enum-varnames": ["ImageSizeLarge", "ImageSizeMedium", "ImageSizeSmall"], - "x-readme-ref-name": "models.ImageSize" -} +{"type":"string","enum":["large","medium","small"],"x-enum-varnames":["ImageSizeLarge","ImageSizeMedium","ImageSizeSmall"],"x-readme-ref-name":"models.ImageSize"} \ No newline at end of file diff --git a/frontend/schemas/modelsMembership.json b/frontend/schemas/modelsMembership.json index b1dc397..9c4fbfc 100644 --- a/frontend/schemas/modelsMembership.json +++ b/frontend/schemas/modelsMembership.json @@ -1,14 +1 @@ -{ - "type": "object", - "properties": { - "availability": { "type": "object", "additionalProperties": true }, - "budget_max": { "type": "integer" }, - "budget_min": { "type": "integer" }, - "created_at": { "type": "string" }, - "is_admin": { "type": "boolean" }, - "trip_id": { "type": "string" }, - "updated_at": { "type": "string" }, - "user_id": { "type": "string" } - }, - "x-readme-ref-name": "models.Membership" -} +{"type":"object","properties":{"availability":{"type":"object","additionalProperties":true},"budget_max":{"type":"integer"},"budget_min":{"type":"integer"},"created_at":{"type":"string"},"is_admin":{"type":"boolean"},"trip_id":{"type":"string"},"updated_at":{"type":"string"},"user_id":{"type":"string"}},"x-readme-ref-name":"models.Membership"} \ No newline at end of file diff --git a/frontend/schemas/modelsMembershipAPIResponse.json b/frontend/schemas/modelsMembershipAPIResponse.json index ef8c43a..c13ea78 100644 --- a/frontend/schemas/modelsMembershipAPIResponse.json +++ b/frontend/schemas/modelsMembershipAPIResponse.json @@ -1,16 +1 @@ -{ - "type": "object", - "properties": { - "availability": { "type": "object", "additionalProperties": true }, - "budget_max": { "type": "integer" }, - "budget_min": { "type": "integer" }, - "created_at": { "type": "string" }, - "is_admin": { "type": "boolean" }, - "profile_picture_url": { "type": "string" }, - "trip_id": { "type": "string" }, - "updated_at": { "type": "string" }, - "user_id": { "type": "string" }, - "username": { "type": "string" } - }, - "x-readme-ref-name": "models.MembershipAPIResponse" -} +{"type":"object","properties":{"availability":{"type":"object","additionalProperties":true},"budget_max":{"type":"integer"},"budget_min":{"type":"integer"},"created_at":{"type":"string"},"is_admin":{"type":"boolean"},"profile_picture_url":{"type":"string"},"trip_id":{"type":"string"},"updated_at":{"type":"string"},"user_id":{"type":"string"},"username":{"type":"string"}},"x-readme-ref-name":"models.MembershipAPIResponse"} \ No newline at end of file diff --git a/frontend/schemas/modelsMembershipCursorPageResult.json b/frontend/schemas/modelsMembershipCursorPageResult.json index 7219e31..360ce42 100644 --- a/frontend/schemas/modelsMembershipCursorPageResult.json +++ b/frontend/schemas/modelsMembershipCursorPageResult.json @@ -1,27 +1 @@ -{ - "type": "object", - "properties": { - "items": { - "type": "array", - "items": { - "type": "object", - "properties": { - "availability": { "type": "object", "additionalProperties": true }, - "budget_max": { "type": "integer" }, - "budget_min": { "type": "integer" }, - "created_at": { "type": "string" }, - "is_admin": { "type": "boolean" }, - "profile_picture_url": { "type": "string" }, - "trip_id": { "type": "string" }, - "updated_at": { "type": "string" }, - "user_id": { "type": "string" }, - "username": { "type": "string" } - }, - "x-readme-ref-name": "models.MembershipAPIResponse" - } - }, - "limit": { "type": "integer" }, - "next_cursor": { "type": "string" } - }, - "x-readme-ref-name": "models.MembershipCursorPageResult" -} +{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"availability":{"type":"object","additionalProperties":true},"budget_max":{"type":"integer"},"budget_min":{"type":"integer"},"created_at":{"type":"string"},"is_admin":{"type":"boolean"},"profile_picture_url":{"type":"string"},"trip_id":{"type":"string"},"updated_at":{"type":"string"},"user_id":{"type":"string"},"username":{"type":"string"}},"x-readme-ref-name":"models.MembershipAPIResponse"}},"limit":{"type":"integer"},"next_cursor":{"type":"string"}},"x-readme-ref-name":"models.MembershipCursorPageResult"} \ No newline at end of file diff --git a/frontend/schemas/modelsNotificationError.json b/frontend/schemas/modelsNotificationError.json index fcf39c6..41f3153 100644 --- a/frontend/schemas/modelsNotificationError.json +++ b/frontend/schemas/modelsNotificationError.json @@ -1,9 +1 @@ -{ - "type": "object", - "properties": { - "message": { "type": "string" }, - "token": { "type": "string" }, - "user_id": { "type": "string" } - }, - "x-readme-ref-name": "models.NotificationError" -} +{"type":"object","properties":{"message":{"type":"string"},"token":{"type":"string"},"user_id":{"type":"string"}},"x-readme-ref-name":"models.NotificationError"} \ No newline at end of file diff --git a/frontend/schemas/modelsNotificationResponse.json b/frontend/schemas/modelsNotificationResponse.json index 5bf54a5..81f44ea 100644 --- a/frontend/schemas/modelsNotificationResponse.json +++ b/frontend/schemas/modelsNotificationResponse.json @@ -1,20 +1 @@ -{ - "type": "object", - "properties": { - "errors": { - "type": "array", - "items": { - "type": "object", - "properties": { - "message": { "type": "string" }, - "token": { "type": "string" }, - "user_id": { "type": "string" } - }, - "x-readme-ref-name": "models.NotificationError" - } - }, - "failure_count": { "type": "integer" }, - "success_count": { "type": "integer" } - }, - "x-readme-ref-name": "models.NotificationResponse" -} +{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"token":{"type":"string"},"user_id":{"type":"string"}},"x-readme-ref-name":"models.NotificationError"}},"failure_count":{"type":"integer"},"success_count":{"type":"integer"}},"x-readme-ref-name":"models.NotificationResponse"} \ No newline at end of file diff --git a/frontend/schemas/modelsPaginatedCommentsResponse.json b/frontend/schemas/modelsPaginatedCommentsResponse.json index 1ba6dd3..202a7c4 100644 --- a/frontend/schemas/modelsPaginatedCommentsResponse.json +++ b/frontend/schemas/modelsPaginatedCommentsResponse.json @@ -1,35 +1 @@ -{ - "type": "object", - "properties": { - "items": { - "type": "array", - "items": { - "type": "object", - "properties": { - "content": { "type": "string" }, - "created_at": { "type": "string" }, - "entity_id": { "type": "string" }, - "entity_type": { - "type": "string", - "enum": ["activity", "pitch"], - "x-enum-varnames": ["Activity", "Pitch"], - "x-readme-ref-name": "models.EntityType" - }, - "id": { "type": "string" }, - "profile_picture_url": { - "description": "pointer since some users don't have their avatar set", - "type": "string" - }, - "trip_id": { "type": "string" }, - "updated_at": { "type": "string" }, - "user_id": { "type": "string" }, - "username": { "type": "string" } - }, - "x-readme-ref-name": "models.CommentAPIResponse" - } - }, - "limit": { "type": "integer" }, - "next_cursor": { "type": "string" } - }, - "x-readme-ref-name": "models.PaginatedCommentsResponse" -} +{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"content":{"type":"string"},"created_at":{"type":"string"},"entity_id":{"type":"string"},"entity_type":{"type":"string","enum":["activity","pitch"],"x-enum-varnames":["Activity","Pitch"],"x-readme-ref-name":"models.EntityType"},"id":{"type":"string"},"profile_picture_url":{"description":"pointer since some users don't have their avatar set","type":"string"},"trip_id":{"type":"string"},"updated_at":{"type":"string"},"user_id":{"type":"string"},"username":{"type":"string"}},"x-readme-ref-name":"models.CommentAPIResponse"}},"limit":{"type":"integer"},"next_cursor":{"type":"string"}},"x-readme-ref-name":"models.PaginatedCommentsResponse"} \ No newline at end of file diff --git a/frontend/schemas/modelsPitchAPIResponse.json b/frontend/schemas/modelsPitchAPIResponse.json new file mode 100644 index 0000000..dcc8985 --- /dev/null +++ b/frontend/schemas/modelsPitchAPIResponse.json @@ -0,0 +1 @@ +{"type":"object","properties":{"audio_url":{"type":"string"},"created_at":{"type":"string"},"description":{"type":"string"},"duration":{"type":"integer"},"id":{"type":"string"},"title":{"type":"string"},"trip_id":{"type":"string"},"updated_at":{"type":"string"},"user_id":{"type":"string"}},"x-readme-ref-name":"models.PitchAPIResponse"} \ No newline at end of file diff --git a/frontend/schemas/modelsPitchCursorPageResult.json b/frontend/schemas/modelsPitchCursorPageResult.json new file mode 100644 index 0000000..306c090 --- /dev/null +++ b/frontend/schemas/modelsPitchCursorPageResult.json @@ -0,0 +1 @@ +{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"audio_url":{"type":"string"},"created_at":{"type":"string"},"description":{"type":"string"},"duration":{"type":"integer"},"id":{"type":"string"},"title":{"type":"string"},"trip_id":{"type":"string"},"updated_at":{"type":"string"},"user_id":{"type":"string"}},"x-readme-ref-name":"models.PitchAPIResponse"}},"limit":{"type":"integer"},"next_cursor":{"type":"string"}},"x-readme-ref-name":"models.PitchCursorPageResult"} \ No newline at end of file diff --git a/frontend/schemas/modelsS3HealthCheckResponse.json b/frontend/schemas/modelsS3HealthCheckResponse.json index b663bdd..86f74d2 100644 --- a/frontend/schemas/modelsS3HealthCheckResponse.json +++ b/frontend/schemas/modelsS3HealthCheckResponse.json @@ -1,13 +1 @@ -{ - "type": "object", - "properties": { - "bucketName": { "type": "string" }, - "error": { - "description": "Error contains the underlying error message when status is \"unhealthy\"", - "type": "string" - }, - "region": { "type": "string" }, - "status": { "type": "string" } - }, - "x-readme-ref-name": "models.S3HealthCheckResponse" -} +{"type":"object","properties":{"bucketName":{"type":"string"},"error":{"description":"Error contains the underlying error message when status is \"unhealthy\"","type":"string"},"region":{"type":"string"},"status":{"type":"string"}},"x-readme-ref-name":"models.S3HealthCheckResponse"} \ No newline at end of file diff --git a/frontend/schemas/modelsSendBulkNotificationRequest.json b/frontend/schemas/modelsSendBulkNotificationRequest.json index 4d0ccc1..aee469e 100644 --- a/frontend/schemas/modelsSendBulkNotificationRequest.json +++ b/frontend/schemas/modelsSendBulkNotificationRequest.json @@ -1,16 +1 @@ -{ - "type": "object", - "required": ["body", "title", "user_ids"], - "properties": { - "body": { "type": "string", "maxLength": 500, "minLength": 1 }, - "data": { "type": "object", "additionalProperties": true }, - "title": { "type": "string", "maxLength": 100, "minLength": 1 }, - "user_ids": { - "type": "array", - "maxItems": 1000, - "minItems": 1, - "items": { "type": "string" } - } - }, - "x-readme-ref-name": "models.SendBulkNotificationRequest" -} +{"type":"object","required":["body","title","user_ids"],"properties":{"body":{"type":"string","maxLength":500,"minLength":1},"data":{"type":"object","additionalProperties":true},"title":{"type":"string","maxLength":100,"minLength":1},"user_ids":{"type":"array","maxItems":1000,"minItems":1,"items":{"type":"string"}}},"x-readme-ref-name":"models.SendBulkNotificationRequest"} \ No newline at end of file diff --git a/frontend/schemas/modelsSendNotificationRequest.json b/frontend/schemas/modelsSendNotificationRequest.json index e0c685a..f8acae4 100644 --- a/frontend/schemas/modelsSendNotificationRequest.json +++ b/frontend/schemas/modelsSendNotificationRequest.json @@ -1,11 +1 @@ -{ - "type": "object", - "required": ["body", "title", "user_id"], - "properties": { - "body": { "type": "string", "maxLength": 500, "minLength": 1 }, - "data": { "type": "object", "additionalProperties": true }, - "title": { "type": "string", "maxLength": 100, "minLength": 1 }, - "user_id": { "type": "string" } - }, - "x-readme-ref-name": "models.SendNotificationRequest" -} +{"type":"object","required":["body","title","user_id"],"properties":{"body":{"type":"string","maxLength":500,"minLength":1},"data":{"type":"object","additionalProperties":true},"title":{"type":"string","maxLength":100,"minLength":1},"user_id":{"type":"string"}},"x-readme-ref-name":"models.SendNotificationRequest"} \ No newline at end of file diff --git a/frontend/schemas/modelsSizedUploadURL.json b/frontend/schemas/modelsSizedUploadURL.json index 105c881..9f952cd 100644 --- a/frontend/schemas/modelsSizedUploadURL.json +++ b/frontend/schemas/modelsSizedUploadURL.json @@ -1,17 +1 @@ -{ - "type": "object", - "properties": { - "size": { - "type": "string", - "enum": ["large", "medium", "small"], - "x-enum-varnames": [ - "ImageSizeLarge", - "ImageSizeMedium", - "ImageSizeSmall" - ], - "x-readme-ref-name": "models.ImageSize" - }, - "url": { "type": "string" } - }, - "x-readme-ref-name": "models.SizedUploadURL" -} +{"type":"object","properties":{"size":{"type":"string","enum":["large","medium","small"],"x-enum-varnames":["ImageSizeLarge","ImageSizeMedium","ImageSizeSmall"],"x-readme-ref-name":"models.ImageSize"},"url":{"type":"string"}},"x-readme-ref-name":"models.SizedUploadURL"} \ No newline at end of file diff --git a/frontend/schemas/modelsTrip.json b/frontend/schemas/modelsTrip.json index 0c71fb7..36c23d2 100644 --- a/frontend/schemas/modelsTrip.json +++ b/frontend/schemas/modelsTrip.json @@ -1,13 +1 @@ -{ - "type": "object", - "properties": { - "budget_max": { "type": "integer" }, - "budget_min": { "type": "integer" }, - "cover_image_id": { "type": "string" }, - "created_at": { "type": "string" }, - "id": { "type": "string" }, - "name": { "type": "string" }, - "updated_at": { "type": "string" } - }, - "x-readme-ref-name": "models.Trip" -} +{"type":"object","properties":{"budget_max":{"type":"integer"},"budget_min":{"type":"integer"},"cover_image_id":{"type":"string"},"created_at":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"updated_at":{"type":"string"}},"x-readme-ref-name":"models.Trip"} \ No newline at end of file diff --git a/frontend/schemas/modelsTripAPIResponse.json b/frontend/schemas/modelsTripAPIResponse.json index 30408b6..98b3fdb 100644 --- a/frontend/schemas/modelsTripAPIResponse.json +++ b/frontend/schemas/modelsTripAPIResponse.json @@ -1,13 +1 @@ -{ - "type": "object", - "properties": { - "budget_max": { "type": "integer" }, - "budget_min": { "type": "integer" }, - "cover_image_url": { "type": "string" }, - "created_at": { "type": "string" }, - "id": { "type": "string" }, - "name": { "type": "string" }, - "updated_at": { "type": "string" } - }, - "x-readme-ref-name": "models.TripAPIResponse" -} +{"type":"object","properties":{"budget_max":{"type":"integer"},"budget_min":{"type":"integer"},"cover_image_url":{"type":"string"},"created_at":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"updated_at":{"type":"string"}},"x-readme-ref-name":"models.TripAPIResponse"} \ No newline at end of file diff --git a/frontend/schemas/modelsTripCursorPageResult.json b/frontend/schemas/modelsTripCursorPageResult.json index 8bc2ff9..3193489 100644 --- a/frontend/schemas/modelsTripCursorPageResult.json +++ b/frontend/schemas/modelsTripCursorPageResult.json @@ -1,24 +1 @@ -{ - "type": "object", - "properties": { - "items": { - "type": "array", - "items": { - "type": "object", - "properties": { - "budget_max": { "type": "integer" }, - "budget_min": { "type": "integer" }, - "cover_image_url": { "type": "string" }, - "created_at": { "type": "string" }, - "id": { "type": "string" }, - "name": { "type": "string" }, - "updated_at": { "type": "string" } - }, - "x-readme-ref-name": "models.TripAPIResponse" - } - }, - "limit": { "type": "integer" }, - "next_cursor": { "type": "string" } - }, - "x-readme-ref-name": "models.TripCursorPageResult" -} +{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"budget_max":{"type":"integer"},"budget_min":{"type":"integer"},"cover_image_url":{"type":"string"},"created_at":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"updated_at":{"type":"string"}},"x-readme-ref-name":"models.TripAPIResponse"}},"limit":{"type":"integer"},"next_cursor":{"type":"string"}},"x-readme-ref-name":"models.TripCursorPageResult"} \ No newline at end of file diff --git a/frontend/schemas/modelsUpdateCommentRequest.json b/frontend/schemas/modelsUpdateCommentRequest.json index 9269e04..9106bcb 100644 --- a/frontend/schemas/modelsUpdateCommentRequest.json +++ b/frontend/schemas/modelsUpdateCommentRequest.json @@ -1,6 +1 @@ -{ - "type": "object", - "required": ["content"], - "properties": { "content": { "type": "string", "minLength": 1 } }, - "x-readme-ref-name": "models.UpdateCommentRequest" -} +{"type":"object","required":["content"],"properties":{"content":{"type":"string","minLength":1}},"x-readme-ref-name":"models.UpdateCommentRequest"} \ No newline at end of file diff --git a/frontend/schemas/modelsUpdateMembershipRequest.json b/frontend/schemas/modelsUpdateMembershipRequest.json index ff562ca..f42b004 100644 --- a/frontend/schemas/modelsUpdateMembershipRequest.json +++ b/frontend/schemas/modelsUpdateMembershipRequest.json @@ -1,9 +1 @@ -{ - "type": "object", - "properties": { - "budget_max": { "type": "integer", "minimum": 0 }, - "budget_min": { "type": "integer", "minimum": 0 }, - "is_admin": { "type": "boolean" } - }, - "x-readme-ref-name": "models.UpdateMembershipRequest" -} +{"type":"object","properties":{"budget_max":{"type":"integer","minimum":0},"budget_min":{"type":"integer","minimum":0},"is_admin":{"type":"boolean"}},"x-readme-ref-name":"models.UpdateMembershipRequest"} \ No newline at end of file diff --git a/frontend/schemas/modelsUpdatePitchRequest.json b/frontend/schemas/modelsUpdatePitchRequest.json new file mode 100644 index 0000000..e689cf5 --- /dev/null +++ b/frontend/schemas/modelsUpdatePitchRequest.json @@ -0,0 +1 @@ +{"type":"object","properties":{"description":{"type":"string"},"duration":{"type":"integer","minimum":0},"title":{"type":"string","minLength":1}},"x-readme-ref-name":"models.UpdatePitchRequest"} \ No newline at end of file diff --git a/frontend/schemas/modelsUpdateTripRequest.json b/frontend/schemas/modelsUpdateTripRequest.json index 6ccbf28..9255e26 100644 --- a/frontend/schemas/modelsUpdateTripRequest.json +++ b/frontend/schemas/modelsUpdateTripRequest.json @@ -1,10 +1 @@ -{ - "type": "object", - "properties": { - "budget_max": { "type": "integer", "minimum": 0 }, - "budget_min": { "type": "integer", "minimum": 0 }, - "cover_image_id": { "type": "string" }, - "name": { "type": "string", "minLength": 1 } - }, - "x-readme-ref-name": "models.UpdateTripRequest" -} +{"type":"object","properties":{"budget_max":{"type":"integer","minimum":0},"budget_min":{"type":"integer","minimum":0},"cover_image_id":{"type":"string"},"name":{"type":"string","minLength":1}},"x-readme-ref-name":"models.UpdateTripRequest"} \ No newline at end of file diff --git a/frontend/schemas/modelsUpdateUserRequest.json b/frontend/schemas/modelsUpdateUserRequest.json index cfbce45..f7670ed 100644 --- a/frontend/schemas/modelsUpdateUserRequest.json +++ b/frontend/schemas/modelsUpdateUserRequest.json @@ -1,12 +1 @@ -{ - "type": "object", - "properties": { - "device_token": { "type": "string", "maxLength": 200 }, - "name": { "type": "string", "minLength": 1 }, - "phone_number": { "type": "string" }, - "profile_picture": { "type": "string" }, - "timezone": { "type": "string" }, - "username": { "type": "string" } - }, - "x-readme-ref-name": "models.UpdateUserRequest" -} +{"type":"object","properties":{"device_token":{"type":"string","maxLength":200},"name":{"type":"string","minLength":1},"phone_number":{"type":"string"},"profile_picture":{"type":"string"},"timezone":{"type":"string"},"username":{"type":"string"}},"x-readme-ref-name":"models.UpdateUserRequest"} \ No newline at end of file diff --git a/frontend/schemas/modelsUploadURLRequest.json b/frontend/schemas/modelsUploadURLRequest.json index 60d96f9..57ccb33 100644 --- a/frontend/schemas/modelsUploadURLRequest.json +++ b/frontend/schemas/modelsUploadURLRequest.json @@ -1,24 +1 @@ -{ - "type": "object", - "required": ["contentType", "fileKey", "sizes"], - "properties": { - "contentType": { "type": "string", "minLength": 1 }, - "fileKey": { "type": "string", "minLength": 1 }, - "sizes": { - "type": "array", - "maxItems": 3, - "minItems": 1, - "items": { - "type": "string", - "enum": ["large", "medium", "small"], - "x-enum-varnames": [ - "ImageSizeLarge", - "ImageSizeMedium", - "ImageSizeSmall" - ], - "x-readme-ref-name": "models.ImageSize" - } - } - }, - "x-readme-ref-name": "models.UploadURLRequest" -} +{"type":"object","required":["contentType","fileKey","sizes"],"properties":{"contentType":{"type":"string","minLength":1},"fileKey":{"type":"string","minLength":1},"sizes":{"type":"array","maxItems":3,"minItems":1,"items":{"type":"string","enum":["large","medium","small"],"x-enum-varnames":["ImageSizeLarge","ImageSizeMedium","ImageSizeSmall"],"x-readme-ref-name":"models.ImageSize"}}},"x-readme-ref-name":"models.UploadURLRequest"} \ No newline at end of file diff --git a/frontend/schemas/modelsUploadURLResponse.json b/frontend/schemas/modelsUploadURLResponse.json index d807450..785f7b0 100644 --- a/frontend/schemas/modelsUploadURLResponse.json +++ b/frontend/schemas/modelsUploadURLResponse.json @@ -1,29 +1 @@ -{ - "type": "object", - "properties": { - "expiresAt": { "type": "string" }, - "fileKey": { "type": "string" }, - "imageId": { "type": "string" }, - "uploadUrls": { - "type": "array", - "items": { - "type": "object", - "properties": { - "size": { - "type": "string", - "enum": ["large", "medium", "small"], - "x-enum-varnames": [ - "ImageSizeLarge", - "ImageSizeMedium", - "ImageSizeSmall" - ], - "x-readme-ref-name": "models.ImageSize" - }, - "url": { "type": "string" } - }, - "x-readme-ref-name": "models.SizedUploadURL" - } - } - }, - "x-readme-ref-name": "models.UploadURLResponse" -} +{"type":"object","properties":{"expiresAt":{"type":"string"},"fileKey":{"type":"string"},"imageId":{"type":"string"},"uploadUrls":{"type":"array","items":{"type":"object","properties":{"size":{"type":"string","enum":["large","medium","small"],"x-enum-varnames":["ImageSizeLarge","ImageSizeMedium","ImageSizeSmall"],"x-readme-ref-name":"models.ImageSize"},"url":{"type":"string"}},"x-readme-ref-name":"models.SizedUploadURL"}}},"x-readme-ref-name":"models.UploadURLResponse"} \ No newline at end of file diff --git a/frontend/schemas/modelsUser.json b/frontend/schemas/modelsUser.json index ab2addd..6659825 100644 --- a/frontend/schemas/modelsUser.json +++ b/frontend/schemas/modelsUser.json @@ -1,16 +1 @@ -{ - "type": "object", - "properties": { - "created_at": { "type": "string" }, - "device_token": { "type": "string" }, - "device_token_updated_at": { "type": "string" }, - "id": { "type": "string" }, - "name": { "type": "string" }, - "phone_number": { "type": "string" }, - "profile_picture": { "type": "string" }, - "timezone": { "type": "string" }, - "updated_at": { "type": "string" }, - "username": { "type": "string" } - }, - "x-readme-ref-name": "models.User" -} +{"type":"object","properties":{"created_at":{"type":"string"},"device_token":{"type":"string"},"device_token_updated_at":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"phone_number":{"type":"string"},"profile_picture":{"type":"string"},"timezone":{"type":"string"},"updated_at":{"type":"string"},"username":{"type":"string"}},"x-readme-ref-name":"models.User"} \ No newline at end of file diff --git a/frontend/types/schema.gen.ts b/frontend/types/schema.gen.ts index d757684..96eb9dd 100644 --- a/frontend/types/schema.gen.ts +++ b/frontend/types/schema.gen.ts @@ -1,1762 +1,1357 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ - -import type { - ErrsAPIError, - ModelsEntityType, - ModelsComment, - ModelsCommentAPIResponse, - ModelsImageSize, - ModelsConfirmUploadRequest, - ModelsConfirmUploadResponse, - ModelsCreateCommentRequest, - ModelsCreateMembershipRequest, - ModelsCreateTripRequest, - ModelsCreateUserRequest, - ModelsGetFileResponse, - ModelsGetFileAllSizesResponse, - ModelsMembership, - ModelsMembershipAPIResponse, - ModelsMembershipCursorPageResult, - ModelsNotificationError, - ModelsNotificationResponse, - ModelsPaginatedCommentsResponse, - ModelsS3HealthCheckResponse, - ModelsSendBulkNotificationRequest, - ModelsSendNotificationRequest, - ModelsSizedUploadURL, - ModelsTrip, - ModelsTripAPIResponse, - ModelsTripCursorPageResult, - ModelsUpdateCommentRequest, - ModelsUpdateMembershipRequest, - ModelsUpdateTripRequest, - ModelsUpdateUserRequest, - ModelsUploadURLRequest, - ModelsUploadURLResponse, - ModelsUser, - CreateComment201, - CreateComment400, - CreateComment401, - CreateComment404, - CreateComment422, - CreateComment500, - CreateCommentMutationRequest, - CreateCommentMutationResponse, - DeleteCommentPathParams, - DeleteComment204, - DeleteComment400, - DeleteComment401, - DeleteComment404, - DeleteComment500, - DeleteCommentMutationResponse, - UpdateCommentPathParams, - UpdateComment200, - UpdateComment400, - UpdateComment401, - UpdateComment404, - UpdateComment422, - UpdateComment500, - UpdateCommentMutationRequest, - UpdateCommentMutationResponse, - ConfirmUpload200, - ConfirmUpload400, - ConfirmUpload404, - ConfirmUpload422, - ConfirmUpload500, - ConfirmUploadMutationRequest, - ConfirmUploadMutationResponse, - CheckS3Health200, - CheckS3Health503, - CheckS3HealthQueryResponse, - CreateUploadURLs201, - CreateUploadURLs400, - CreateUploadURLs422, - CreateUploadURLs500, - CreateUploadURLsMutationRequest, - CreateUploadURLsMutationResponse, - GetFileAllSizesPathParams, - GetFileAllSizes200, - GetFileAllSizes400, - GetFileAllSizes404, - GetFileAllSizes500, - GetFileAllSizesQueryResponse, - GetFilePathParams, - GetFile200, - GetFile400, - GetFile404, - GetFile500, - GetFileQueryResponse, - AddMember201, - AddMember400, - AddMember401, - AddMember422, - AddMember500, - AddMemberMutationRequest, - AddMemberMutationResponse, - SendNotification200, - SendNotification400, - SendNotification422, - SendNotification500, - SendNotificationMutationRequest, - SendNotificationMutationResponse, - SendBulkNotification200, - SendBulkNotification400, - SendBulkNotification422, - SendBulkNotification500, - SendBulkNotificationMutationRequest, - SendBulkNotificationMutationResponse, - GetAllTripsQueryParams, - GetAllTrips200, - GetAllTrips400, - GetAllTrips401, - GetAllTrips500, - GetAllTripsQueryResponse, - CreateTrip201, - CreateTrip400, - CreateTrip401, - CreateTrip422, - CreateTrip500, - CreateTripMutationRequest, - CreateTripMutationResponse, - GetTripPathParams, - GetTrip200, - GetTrip400, - GetTrip404, - GetTrip500, - GetTripQueryResponse, - DeleteTripPathParams, - DeleteTrip204, - DeleteTrip400, - DeleteTrip401, - DeleteTrip404, - DeleteTrip500, - DeleteTripMutationResponse, - UpdateTripPathParams, - UpdateTrip200, - UpdateTrip400, - UpdateTrip401, - UpdateTrip404, - UpdateTrip422, - UpdateTrip500, - UpdateTripMutationRequest, - UpdateTripMutationResponse, - GetTripMembersPathParams, - GetTripMembersQueryParams, - GetTripMembers200, - GetTripMembers400, - GetTripMembers401, - GetTripMembers404, - GetTripMembers500, - GetTripMembersQueryResponse, - GetMembershipPathParams, - GetMembership200, - GetMembership400, - GetMembership401, - GetMembership404, - GetMembership500, - GetMembershipQueryResponse, - RemoveMemberPathParams, - RemoveMember204, - RemoveMember400, - RemoveMember401, - RemoveMember404, - RemoveMember500, - RemoveMemberMutationResponse, - UpdateMembershipPathParams, - UpdateMembership200, - UpdateMembership400, - UpdateMembership401, - UpdateMembership404, - UpdateMembership422, - UpdateMembership500, - UpdateMembershipMutationRequest, - UpdateMembershipMutationResponse, - DemoteFromAdminPathParams, - DemoteFromAdmin200, - DemoteFromAdmin400, - DemoteFromAdmin401, - DemoteFromAdmin404, - DemoteFromAdmin500, - DemoteFromAdminMutationResponse, - PromoteToAdminPathParams, - PromoteToAdmin200, - PromoteToAdmin400, - PromoteToAdmin401, - PromoteToAdmin404, - PromoteToAdmin500, - PromoteToAdminMutationResponse, - GetPaginatedCommentsPathParams, - GetPaginatedCommentsQueryParams, - GetPaginatedComments200, - GetPaginatedComments400, - GetPaginatedComments401, - GetPaginatedComments404, - GetPaginatedComments422, - GetPaginatedComments500, - GetPaginatedCommentsQueryResponse, - CreateUser201, - CreateUser400, - CreateUser422, - CreateUser500, - CreateUserMutationRequest, - CreateUserMutationResponse, - GetCurrentUser200, - GetCurrentUser401, - GetCurrentUser404, - GetCurrentUser500, - GetCurrentUserQueryResponse, - GetUserPathParams, - GetUser200, - GetUser400, - GetUser404, - GetUser500, - GetUserQueryResponse, - DeleteUserPathParams, - DeleteUser204, - DeleteUser400, - DeleteUser404, - DeleteUser500, - DeleteUserMutationResponse, - UpdateUserPathParams, - UpdateUser200, - UpdateUser400, - UpdateUser404, - UpdateUser422, - UpdateUser500, - UpdateUserMutationRequest, - UpdateUserMutationResponse, - Healthcheck200, - Healthcheck500, - HealthcheckQueryResponse, -} from "./types.gen.ts"; +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ + +import type { ErrsAPIError, ModelsEntityType, ModelsComment, ModelsCommentAPIResponse, ModelsImageSize, ModelsConfirmUploadRequest, ModelsConfirmUploadResponse, ModelsCreateCommentRequest, ModelsCreateMembershipRequest, ModelsCreatePitchRequest, ModelsPitchAPIResponse, ModelsCreatePitchResponse, ModelsCreateTripRequest, ModelsCreateUserRequest, ModelsGetFileResponse, ModelsGetFileAllSizesResponse, ModelsMembership, ModelsMembershipAPIResponse, ModelsMembershipCursorPageResult, ModelsNotificationError, ModelsNotificationResponse, ModelsPaginatedCommentsResponse, ModelsPitchCursorPageResult, ModelsS3HealthCheckResponse, ModelsSendBulkNotificationRequest, ModelsSendNotificationRequest, ModelsSizedUploadURL, ModelsTrip, ModelsTripAPIResponse, ModelsTripCursorPageResult, ModelsUpdateCommentRequest, ModelsUpdateMembershipRequest, ModelsUpdatePitchRequest, ModelsUpdateTripRequest, ModelsUpdateUserRequest, ModelsUploadURLRequest, ModelsUploadURLResponse, ModelsUser, CreateComment201, CreateComment400, CreateComment401, CreateComment404, CreateComment422, CreateComment500, CreateCommentMutationRequest, CreateCommentMutationResponse, DeleteCommentPathParams, DeleteComment204, DeleteComment400, DeleteComment401, DeleteComment404, DeleteComment500, DeleteCommentMutationResponse, UpdateCommentPathParams, UpdateComment200, UpdateComment400, UpdateComment401, UpdateComment404, UpdateComment422, UpdateComment500, UpdateCommentMutationRequest, UpdateCommentMutationResponse, ConfirmUpload200, ConfirmUpload400, ConfirmUpload404, ConfirmUpload422, ConfirmUpload500, ConfirmUploadMutationRequest, ConfirmUploadMutationResponse, CheckS3Health200, CheckS3Health503, CheckS3HealthQueryResponse, CreateUploadURLs201, CreateUploadURLs400, CreateUploadURLs422, CreateUploadURLs500, CreateUploadURLsMutationRequest, CreateUploadURLsMutationResponse, GetFileAllSizesPathParams, GetFileAllSizes200, GetFileAllSizes400, GetFileAllSizes404, GetFileAllSizes500, GetFileAllSizesQueryResponse, GetFilePathParams, GetFile200, GetFile400, GetFile404, GetFile500, GetFileQueryResponse, AddMember201, AddMember400, AddMember401, AddMember422, AddMember500, AddMemberMutationRequest, AddMemberMutationResponse, SendNotification200, SendNotification400, SendNotification422, SendNotification500, SendNotificationMutationRequest, SendNotificationMutationResponse, SendBulkNotification200, SendBulkNotification400, SendBulkNotification422, SendBulkNotification500, SendBulkNotificationMutationRequest, SendBulkNotificationMutationResponse, GetAllTripsQueryParams, GetAllTrips200, GetAllTrips400, GetAllTrips401, GetAllTrips500, GetAllTripsQueryResponse, CreateTrip201, CreateTrip400, CreateTrip401, CreateTrip422, CreateTrip500, CreateTripMutationRequest, CreateTripMutationResponse, GetTripPathParams, GetTrip200, GetTrip400, GetTrip404, GetTrip500, GetTripQueryResponse, DeleteTripPathParams, DeleteTrip204, DeleteTrip400, DeleteTrip401, DeleteTrip404, DeleteTrip500, DeleteTripMutationResponse, UpdateTripPathParams, UpdateTrip200, UpdateTrip400, UpdateTrip401, UpdateTrip404, UpdateTrip422, UpdateTrip500, UpdateTripMutationRequest, UpdateTripMutationResponse, GetTripMembersPathParams, GetTripMembersQueryParams, GetTripMembers200, GetTripMembers400, GetTripMembers401, GetTripMembers404, GetTripMembers500, GetTripMembersQueryResponse, GetMembershipPathParams, GetMembership200, GetMembership400, GetMembership401, GetMembership404, GetMembership500, GetMembershipQueryResponse, RemoveMemberPathParams, RemoveMember204, RemoveMember400, RemoveMember401, RemoveMember404, RemoveMember500, RemoveMemberMutationResponse, UpdateMembershipPathParams, UpdateMembership200, UpdateMembership400, UpdateMembership401, UpdateMembership404, UpdateMembership422, UpdateMembership500, UpdateMembershipMutationRequest, UpdateMembershipMutationResponse, DemoteFromAdminPathParams, DemoteFromAdmin200, DemoteFromAdmin400, DemoteFromAdmin401, DemoteFromAdmin404, DemoteFromAdmin500, DemoteFromAdminMutationResponse, PromoteToAdminPathParams, PromoteToAdmin200, PromoteToAdmin400, PromoteToAdmin401, PromoteToAdmin404, PromoteToAdmin500, PromoteToAdminMutationResponse, ListPitchesPathParams, ListPitchesQueryParams, ListPitches200, ListPitches400, ListPitches404, ListPitches500, ListPitchesQueryResponse, CreatePitchPathParams, CreatePitch201, CreatePitch400, CreatePitch403, CreatePitch422, CreatePitch500, CreatePitchMutationRequest, CreatePitchMutationResponse, GetPitchPathParams, GetPitch200, GetPitch400, GetPitch404, GetPitch500, GetPitchQueryResponse, DeletePitchPathParams, DeletePitch204, DeletePitch400, DeletePitch404, DeletePitch500, DeletePitchMutationResponse, UpdatePitchPathParams, UpdatePitch200, UpdatePitch400, UpdatePitch404, UpdatePitch422, UpdatePitch500, UpdatePitchMutationRequest, UpdatePitchMutationResponse, GetPaginatedCommentsPathParams, GetPaginatedCommentsQueryParams, GetPaginatedComments200, GetPaginatedComments400, GetPaginatedComments401, GetPaginatedComments404, GetPaginatedComments422, GetPaginatedComments500, GetPaginatedCommentsQueryResponse, CreateUser201, CreateUser400, CreateUser422, CreateUser500, CreateUserMutationRequest, CreateUserMutationResponse, GetCurrentUser200, GetCurrentUser401, GetCurrentUser404, GetCurrentUser500, GetCurrentUserQueryResponse, GetUserPathParams, GetUser200, GetUser400, GetUser404, GetUser500, GetUserQueryResponse, DeleteUserPathParams, DeleteUser204, DeleteUser400, DeleteUser404, DeleteUser500, DeleteUserMutationResponse, UpdateUserPathParams, UpdateUser200, UpdateUser400, UpdateUser404, UpdateUser422, UpdateUser500, UpdateUserMutationRequest, UpdateUserMutationResponse, Healthcheck200, Healthcheck500, HealthcheckQueryResponse } from "./types.gen.ts"; import { z } from "zod/v4"; export const errsAPIErrorSchema = z.object({ - message: z.optional(z.any()), - statusCode: z.optional(z.int()), -}) as unknown as z.ZodType; + "message": z.optional(z.any()), +"statusCode": z.optional(z.int()) + }) as unknown as z.ZodType -export const modelsEntityTypeSchema = z.enum([ - "activity", - "pitch", -]) as unknown as z.ZodType; +export const modelsEntityTypeSchema = z.enum(["activity", "pitch"]) as unknown as z.ZodType export const modelsCommentSchema = z.object({ - content: z.optional(z.string()), - created_at: z.optional(z.string()), - entity_id: z.optional(z.string()), - get entity_type() { - return modelsEntityTypeSchema.optional(); - }, - id: z.optional(z.string()), - trip_id: z.optional(z.string()), - updated_at: z.optional(z.string()), - user_id: z.optional(z.string()), -}) as unknown as z.ZodType; + "content": z.optional(z.string()), +"created_at": z.optional(z.string()), +"entity_id": z.optional(z.string()), +get "entity_type"(){ + return modelsEntityTypeSchema.optional() + }, +"id": z.optional(z.string()), +"trip_id": z.optional(z.string()), +"updated_at": z.optional(z.string()), +"user_id": z.optional(z.string()) + }) as unknown as z.ZodType export const modelsCommentAPIResponseSchema = z.object({ - content: z.optional(z.string()), - created_at: z.optional(z.string()), - entity_id: z.optional(z.string()), - get entity_type() { - return modelsEntityTypeSchema.optional(); - }, - id: z.optional(z.string()), - profile_picture_url: z.optional( - z.string().describe("pointer since some users don't have their avatar set"), - ), - trip_id: z.optional(z.string()), - updated_at: z.optional(z.string()), - user_id: z.optional(z.string()), - username: z.optional(z.string()), -}) as unknown as z.ZodType; - -export const modelsImageSizeSchema = z.enum([ - "large", - "medium", - "small", -]) as unknown as z.ZodType; + "content": z.optional(z.string()), +"created_at": z.optional(z.string()), +"entity_id": z.optional(z.string()), +get "entity_type"(){ + return modelsEntityTypeSchema.optional() + }, +"id": z.optional(z.string()), +"profile_picture_url": z.optional(z.string().describe("pointer since some users don't have their avatar set")), +"trip_id": z.optional(z.string()), +"updated_at": z.optional(z.string()), +"user_id": z.optional(z.string()), +"username": z.optional(z.string()) + }) as unknown as z.ZodType + +export const modelsImageSizeSchema = z.enum(["large", "medium", "small"]) as unknown as z.ZodType export const modelsConfirmUploadRequestSchema = z.object({ - imageId: z.string(), - get size() { - return modelsImageSizeSchema - .describe("Optional: if nil, confirm all sizes") - .optional(); - }, -}) as unknown as z.ZodType; + "imageId": z.string(), +get "size"(){ + return modelsImageSizeSchema.describe("Optional: if nil, confirm all sizes").optional() + } + }) as unknown as z.ZodType export const modelsConfirmUploadResponseSchema = z.object({ - confirmed: z.optional(z.int()), - imageId: z.optional(z.string()), - status: z.optional(z.string()), -}) as unknown as z.ZodType; + "confirmed": z.optional(z.int()), +"imageId": z.optional(z.string()), +"status": z.optional(z.string()) + }) as unknown as z.ZodType export const modelsCreateCommentRequestSchema = z.object({ - content: z.string().min(1), - entity_id: z.string(), - get entity_type() { - return modelsEntityTypeSchema; - }, - trip_id: z.string(), -}) as unknown as z.ZodType; + "content": z.string().min(1), +"entity_id": z.string(), +get "entity_type"(){ + return modelsEntityTypeSchema + }, +"trip_id": z.string() + }) as unknown as z.ZodType export const modelsCreateMembershipRequestSchema = z.object({ - budget_max: z.int().min(0), - budget_min: z.int().min(0), - is_admin: z.optional(z.boolean()), - trip_id: z.string(), - user_id: z.string(), -}) as unknown as z.ZodType; + "budget_max": z.int().min(0), +"budget_min": z.int().min(0), +"is_admin": z.optional(z.boolean()), +"trip_id": z.string(), +"user_id": z.string() + }) as unknown as z.ZodType + +export const modelsCreatePitchRequestSchema = z.object({ + "content_type": z.string().min(1), +"description": z.optional(z.string()), +"title": z.string().min(1) + }) as unknown as z.ZodType + +export const modelsPitchAPIResponseSchema = z.object({ + "audio_url": z.optional(z.string()), +"created_at": z.optional(z.string()), +"description": z.optional(z.string()), +"duration": z.optional(z.int()), +"id": z.optional(z.string()), +"title": z.optional(z.string()), +"trip_id": z.optional(z.string()), +"updated_at": z.optional(z.string()), +"user_id": z.optional(z.string()) + }) as unknown as z.ZodType + +export const modelsCreatePitchResponseSchema = z.object({ + "expires_at": z.optional(z.string()), +get "pitch"(){ + return modelsPitchAPIResponseSchema.optional() + }, +"upload_url": z.optional(z.string()) + }) as unknown as z.ZodType export const modelsCreateTripRequestSchema = z.object({ - budget_max: z.int().min(0), - budget_min: z.int().min(0), - cover_image_id: z.optional(z.string()), - name: z.string().min(1), -}) as unknown as z.ZodType; + "budget_max": z.int().min(0), +"budget_min": z.int().min(0), +"cover_image_id": z.optional(z.string()), +"name": z.string().min(1) + }) as unknown as z.ZodType export const modelsCreateUserRequestSchema = z.object({ - name: z.string().min(1), - phone_number: z.string(), - username: z.string(), -}) as unknown as z.ZodType; + "name": z.string().min(1), +"phone_number": z.string(), +"username": z.string() + }) as unknown as z.ZodType export const modelsGetFileResponseSchema = z.object({ - contentType: z.optional(z.string()), - imageId: z.optional(z.string()), - get size() { - return modelsImageSizeSchema.optional(); - }, - url: z.optional(z.string()), -}) as unknown as z.ZodType; + "contentType": z.optional(z.string()), +"imageId": z.optional(z.string()), +get "size"(){ + return modelsImageSizeSchema.optional() + }, +"url": z.optional(z.string()) + }) as unknown as z.ZodType export const modelsGetFileAllSizesResponseSchema = z.object({ - get files() { - return z.array(modelsGetFileResponseSchema).optional(); - }, - imageId: z.optional(z.string()), -}) as unknown as z.ZodType; + get "files"(){ + return z.array(modelsGetFileResponseSchema).optional() + }, +"imageId": z.optional(z.string()) + }) as unknown as z.ZodType export const modelsMembershipSchema = z.object({ - availability: z.optional(z.object({}).catchall(z.any())), - budget_max: z.optional(z.int()), - budget_min: z.optional(z.int()), - created_at: z.optional(z.string()), - is_admin: z.optional(z.boolean()), - trip_id: z.optional(z.string()), - updated_at: z.optional(z.string()), - user_id: z.optional(z.string()), -}) as unknown as z.ZodType; + "availability": z.optional(z.object({ + + }).catchall(z.any())), +"budget_max": z.optional(z.int()), +"budget_min": z.optional(z.int()), +"created_at": z.optional(z.string()), +"is_admin": z.optional(z.boolean()), +"trip_id": z.optional(z.string()), +"updated_at": z.optional(z.string()), +"user_id": z.optional(z.string()) + }) as unknown as z.ZodType export const modelsMembershipAPIResponseSchema = z.object({ - availability: z.optional(z.object({}).catchall(z.any())), - budget_max: z.optional(z.int()), - budget_min: z.optional(z.int()), - created_at: z.optional(z.string()), - is_admin: z.optional(z.boolean()), - profile_picture_url: z.optional(z.string()), - trip_id: z.optional(z.string()), - updated_at: z.optional(z.string()), - user_id: z.optional(z.string()), - username: z.optional(z.string()), -}) as unknown as z.ZodType; + "availability": z.optional(z.object({ + + }).catchall(z.any())), +"budget_max": z.optional(z.int()), +"budget_min": z.optional(z.int()), +"created_at": z.optional(z.string()), +"is_admin": z.optional(z.boolean()), +"profile_picture_url": z.optional(z.string()), +"trip_id": z.optional(z.string()), +"updated_at": z.optional(z.string()), +"user_id": z.optional(z.string()), +"username": z.optional(z.string()) + }) as unknown as z.ZodType export const modelsMembershipCursorPageResultSchema = z.object({ - get items() { - return z.array(modelsMembershipAPIResponseSchema).optional(); - }, - limit: z.optional(z.int()), - next_cursor: z.optional(z.string()), -}) as unknown as z.ZodType; + get "items"(){ + return z.array(modelsMembershipAPIResponseSchema).optional() + }, +"limit": z.optional(z.int()), +"next_cursor": z.optional(z.string()) + }) as unknown as z.ZodType export const modelsNotificationErrorSchema = z.object({ - message: z.optional(z.string()), - token: z.optional(z.string()), - user_id: z.optional(z.string()), -}) as unknown as z.ZodType; + "message": z.optional(z.string()), +"token": z.optional(z.string()), +"user_id": z.optional(z.string()) + }) as unknown as z.ZodType export const modelsNotificationResponseSchema = z.object({ - get errors() { - return z.array(modelsNotificationErrorSchema).optional(); - }, - failure_count: z.optional(z.int()), - success_count: z.optional(z.int()), -}) as unknown as z.ZodType; + get "errors"(){ + return z.array(modelsNotificationErrorSchema).optional() + }, +"failure_count": z.optional(z.int()), +"success_count": z.optional(z.int()) + }) as unknown as z.ZodType export const modelsPaginatedCommentsResponseSchema = z.object({ - get items() { - return z.array(modelsCommentAPIResponseSchema).optional(); - }, - limit: z.optional(z.int()), - next_cursor: z.optional(z.string()), -}) as unknown as z.ZodType; + get "items"(){ + return z.array(modelsCommentAPIResponseSchema).optional() + }, +"limit": z.optional(z.int()), +"next_cursor": z.optional(z.string()) + }) as unknown as z.ZodType + +export const modelsPitchCursorPageResultSchema = z.object({ + get "items"(){ + return z.array(modelsPitchAPIResponseSchema).optional() + }, +"limit": z.optional(z.int()), +"next_cursor": z.optional(z.string()) + }) as unknown as z.ZodType export const modelsS3HealthCheckResponseSchema = z.object({ - bucketName: z.optional(z.string()), - error: z.optional( - z - .string() - .describe( - 'Error contains the underlying error message when status is "unhealthy"', - ), - ), - region: z.optional(z.string()), - status: z.optional(z.string()), -}) as unknown as z.ZodType; + "bucketName": z.optional(z.string()), +"error": z.optional(z.string().describe("Error contains the underlying error message when status is \"unhealthy\"")), +"region": z.optional(z.string()), +"status": z.optional(z.string()) + }) as unknown as z.ZodType export const modelsSendBulkNotificationRequestSchema = z.object({ - body: z.string().min(1).max(500), - data: z.optional(z.object({}).catchall(z.any())), - title: z.string().min(1).max(100), - user_ids: z.array(z.string()).min(1).max(1000), -}) as unknown as z.ZodType; + "body": z.string().min(1).max(500), +"data": z.optional(z.object({ + + }).catchall(z.any())), +"title": z.string().min(1).max(100), +"user_ids": z.array(z.string()).min(1).max(1000) + }) as unknown as z.ZodType export const modelsSendNotificationRequestSchema = z.object({ - body: z.string().min(1).max(500), - data: z.optional(z.object({}).catchall(z.any())), - title: z.string().min(1).max(100), - user_id: z.string(), -}) as unknown as z.ZodType; + "body": z.string().min(1).max(500), +"data": z.optional(z.object({ + + }).catchall(z.any())), +"title": z.string().min(1).max(100), +"user_id": z.string() + }) as unknown as z.ZodType export const modelsSizedUploadURLSchema = z.object({ - get size() { - return modelsImageSizeSchema.optional(); - }, - url: z.optional(z.string()), -}) as unknown as z.ZodType; + get "size"(){ + return modelsImageSizeSchema.optional() + }, +"url": z.optional(z.string()) + }) as unknown as z.ZodType export const modelsTripSchema = z.object({ - budget_max: z.optional(z.int()), - budget_min: z.optional(z.int()), - cover_image_id: z.optional(z.string()), - created_at: z.optional(z.string()), - id: z.optional(z.string()), - name: z.optional(z.string()), - updated_at: z.optional(z.string()), -}) as unknown as z.ZodType; + "budget_max": z.optional(z.int()), +"budget_min": z.optional(z.int()), +"cover_image_id": z.optional(z.string()), +"created_at": z.optional(z.string()), +"id": z.optional(z.string()), +"name": z.optional(z.string()), +"updated_at": z.optional(z.string()) + }) as unknown as z.ZodType export const modelsTripAPIResponseSchema = z.object({ - budget_max: z.optional(z.int()), - budget_min: z.optional(z.int()), - cover_image_url: z.optional(z.string()), - created_at: z.optional(z.string()), - id: z.optional(z.string()), - name: z.optional(z.string()), - updated_at: z.optional(z.string()), -}) as unknown as z.ZodType; + "budget_max": z.optional(z.int()), +"budget_min": z.optional(z.int()), +"cover_image_url": z.optional(z.string()), +"created_at": z.optional(z.string()), +"id": z.optional(z.string()), +"name": z.optional(z.string()), +"updated_at": z.optional(z.string()) + }) as unknown as z.ZodType export const modelsTripCursorPageResultSchema = z.object({ - get items() { - return z.array(modelsTripAPIResponseSchema).optional(); - }, - limit: z.optional(z.int()), - next_cursor: z.optional(z.string()), -}) as unknown as z.ZodType; + get "items"(){ + return z.array(modelsTripAPIResponseSchema).optional() + }, +"limit": z.optional(z.int()), +"next_cursor": z.optional(z.string()) + }) as unknown as z.ZodType export const modelsUpdateCommentRequestSchema = z.object({ - content: z.string().min(1), -}) as unknown as z.ZodType; + "content": z.string().min(1) + }) as unknown as z.ZodType export const modelsUpdateMembershipRequestSchema = z.object({ - budget_max: z.optional(z.int().min(0)), - budget_min: z.optional(z.int().min(0)), - is_admin: z.optional(z.boolean()), -}) as unknown as z.ZodType; + "budget_max": z.optional(z.int().min(0)), +"budget_min": z.optional(z.int().min(0)), +"is_admin": z.optional(z.boolean()) + }) as unknown as z.ZodType + +export const modelsUpdatePitchRequestSchema = z.object({ + "description": z.optional(z.string()), +"duration": z.optional(z.int().min(0)), +"title": z.optional(z.string().min(1)) + }) as unknown as z.ZodType export const modelsUpdateTripRequestSchema = z.object({ - budget_max: z.optional(z.int().min(0)), - budget_min: z.optional(z.int().min(0)), - cover_image_id: z.optional(z.string()), - name: z.optional(z.string().min(1)), -}) as unknown as z.ZodType; + "budget_max": z.optional(z.int().min(0)), +"budget_min": z.optional(z.int().min(0)), +"cover_image_id": z.optional(z.string()), +"name": z.optional(z.string().min(1)) + }) as unknown as z.ZodType export const modelsUpdateUserRequestSchema = z.object({ - device_token: z.optional(z.string().max(200)), - name: z.optional(z.string().min(1)), - phone_number: z.optional(z.string()), - profile_picture: z.optional(z.string()), - timezone: z.optional(z.string()), - username: z.optional(z.string()), -}) as unknown as z.ZodType; + "device_token": z.optional(z.string().max(200)), +"name": z.optional(z.string().min(1)), +"phone_number": z.optional(z.string()), +"profile_picture": z.optional(z.string()), +"timezone": z.optional(z.string()), +"username": z.optional(z.string()) + }) as unknown as z.ZodType export const modelsUploadURLRequestSchema = z.object({ - contentType: z.string().min(1), - fileKey: z.string().min(1), - get sizes() { - return z.array(modelsImageSizeSchema).min(1).max(3); - }, -}) as unknown as z.ZodType; + "contentType": z.string().min(1), +"fileKey": z.string().min(1), +get "sizes"(){ + return z.array(modelsImageSizeSchema).min(1).max(3) + } + }) as unknown as z.ZodType export const modelsUploadURLResponseSchema = z.object({ - expiresAt: z.optional(z.string()), - fileKey: z.optional(z.string()), - imageId: z.optional(z.string()), - get uploadUrls() { - return z.array(modelsSizedUploadURLSchema).optional(); - }, -}) as unknown as z.ZodType; + "expiresAt": z.optional(z.string()), +"fileKey": z.optional(z.string()), +"imageId": z.optional(z.string()), +get "uploadUrls"(){ + return z.array(modelsSizedUploadURLSchema).optional() + } + }) as unknown as z.ZodType export const modelsUserSchema = z.object({ - created_at: z.optional(z.string()), - device_token: z.optional(z.string()), - device_token_updated_at: z.optional(z.string()), - id: z.optional(z.string()), - name: z.optional(z.string()), - phone_number: z.optional(z.string()), - profile_picture: z.optional(z.string()), - timezone: z.optional(z.string()), - updated_at: z.optional(z.string()), - username: z.optional(z.string()), -}) as unknown as z.ZodType; + "created_at": z.optional(z.string()), +"device_token": z.optional(z.string()), +"device_token_updated_at": z.optional(z.string()), +"id": z.optional(z.string()), +"name": z.optional(z.string()), +"phone_number": z.optional(z.string()), +"profile_picture": z.optional(z.string()), +"timezone": z.optional(z.string()), +"updated_at": z.optional(z.string()), +"username": z.optional(z.string()) + }) as unknown as z.ZodType /** * @description Created */ -export const createComment201Schema = z.lazy( - () => modelsCommentSchema, -) as unknown as z.ZodType; +export const createComment201Schema = z.lazy(() => modelsCommentSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const createComment400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const createComment400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unauthorized */ -export const createComment401Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const createComment401Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const createComment404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const createComment404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unprocessable Entity */ -export const createComment422Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const createComment422Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const createComment500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const createComment500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Create comment request */ -export const createCommentMutationRequestSchema = z.lazy( - () => modelsCreateCommentRequestSchema, -) as unknown as z.ZodType; +export const createCommentMutationRequestSchema = z.lazy(() => modelsCreateCommentRequestSchema) as unknown as z.ZodType -export const createCommentMutationResponseSchema = z.lazy( - () => createComment201Schema, -) as unknown as z.ZodType; +export const createCommentMutationResponseSchema = z.lazy(() => createComment201Schema) as unknown as z.ZodType export const deleteCommentPathParamsSchema = z.object({ - commentID: z.string().describe("Comment ID"), -}) as unknown as z.ZodType; + "commentID": z.string().describe("Comment ID") + }) as unknown as z.ZodType /** * @description No Content */ -export const deleteComment204Schema = - z.any() as unknown as z.ZodType; +export const deleteComment204Schema = z.any() as unknown as z.ZodType /** * @description Bad Request */ -export const deleteComment400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const deleteComment400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unauthorized */ -export const deleteComment401Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const deleteComment401Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const deleteComment404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const deleteComment404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const deleteComment500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const deleteComment500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType -export const deleteCommentMutationResponseSchema = z.lazy( - () => deleteComment204Schema, -) as unknown as z.ZodType; +export const deleteCommentMutationResponseSchema = z.lazy(() => deleteComment204Schema) as unknown as z.ZodType export const updateCommentPathParamsSchema = z.object({ - commentID: z.string().describe("Comment ID"), -}) as unknown as z.ZodType; + "commentID": z.string().describe("Comment ID") + }) as unknown as z.ZodType /** * @description OK */ -export const updateComment200Schema = z.lazy( - () => modelsCommentSchema, -) as unknown as z.ZodType; +export const updateComment200Schema = z.lazy(() => modelsCommentSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const updateComment400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateComment400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unauthorized */ -export const updateComment401Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateComment401Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const updateComment404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateComment404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unprocessable Entity */ -export const updateComment422Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateComment422Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const updateComment500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateComment500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Update comment request */ -export const updateCommentMutationRequestSchema = z.lazy( - () => modelsUpdateCommentRequestSchema, -) as unknown as z.ZodType; +export const updateCommentMutationRequestSchema = z.lazy(() => modelsUpdateCommentRequestSchema) as unknown as z.ZodType -export const updateCommentMutationResponseSchema = z.lazy( - () => updateComment200Schema, -) as unknown as z.ZodType; +export const updateCommentMutationResponseSchema = z.lazy(() => updateComment200Schema) as unknown as z.ZodType /** * @description OK */ -export const confirmUpload200Schema = z.lazy( - () => modelsConfirmUploadResponseSchema, -) as unknown as z.ZodType; +export const confirmUpload200Schema = z.lazy(() => modelsConfirmUploadResponseSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const confirmUpload400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const confirmUpload400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const confirmUpload404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const confirmUpload404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unprocessable Entity */ -export const confirmUpload422Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const confirmUpload422Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const confirmUpload500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const confirmUpload500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Confirm upload request */ -export const confirmUploadMutationRequestSchema = z.lazy( - () => modelsConfirmUploadRequestSchema, -) as unknown as z.ZodType; +export const confirmUploadMutationRequestSchema = z.lazy(() => modelsConfirmUploadRequestSchema) as unknown as z.ZodType -export const confirmUploadMutationResponseSchema = z.lazy( - () => confirmUpload200Schema, -) as unknown as z.ZodType; +export const confirmUploadMutationResponseSchema = z.lazy(() => confirmUpload200Schema) as unknown as z.ZodType /** * @description OK */ -export const checkS3Health200Schema = z.lazy( - () => modelsS3HealthCheckResponseSchema, -) as unknown as z.ZodType; +export const checkS3Health200Schema = z.lazy(() => modelsS3HealthCheckResponseSchema) as unknown as z.ZodType /** * @description Service Unavailable */ -export const checkS3Health503Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const checkS3Health503Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType -export const checkS3HealthQueryResponseSchema = z.lazy( - () => checkS3Health200Schema, -) as unknown as z.ZodType; +export const checkS3HealthQueryResponseSchema = z.lazy(() => checkS3Health200Schema) as unknown as z.ZodType /** * @description Created */ -export const createUploadURLs201Schema = z.lazy( - () => modelsUploadURLResponseSchema, -) as unknown as z.ZodType; +export const createUploadURLs201Schema = z.lazy(() => modelsUploadURLResponseSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const createUploadURLs400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const createUploadURLs400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unprocessable Entity */ -export const createUploadURLs422Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const createUploadURLs422Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const createUploadURLs500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const createUploadURLs500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Upload URL request */ -export const createUploadURLsMutationRequestSchema = z.lazy( - () => modelsUploadURLRequestSchema, -) as unknown as z.ZodType; +export const createUploadURLsMutationRequestSchema = z.lazy(() => modelsUploadURLRequestSchema) as unknown as z.ZodType -export const createUploadURLsMutationResponseSchema = z.lazy( - () => createUploadURLs201Schema, -) as unknown as z.ZodType; +export const createUploadURLsMutationResponseSchema = z.lazy(() => createUploadURLs201Schema) as unknown as z.ZodType export const getFileAllSizesPathParamsSchema = z.object({ - imageId: z.string().describe("Image ID (UUID)"), -}) as unknown as z.ZodType; + "imageId": z.string().describe("Image ID (UUID)") + }) as unknown as z.ZodType /** * @description OK */ -export const getFileAllSizes200Schema = z.lazy( - () => modelsGetFileAllSizesResponseSchema, -) as unknown as z.ZodType; +export const getFileAllSizes200Schema = z.lazy(() => modelsGetFileAllSizesResponseSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const getFileAllSizes400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getFileAllSizes400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const getFileAllSizes404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getFileAllSizes404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const getFileAllSizes500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getFileAllSizes500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType -export const getFileAllSizesQueryResponseSchema = z.lazy( - () => getFileAllSizes200Schema, -) as unknown as z.ZodType; +export const getFileAllSizesQueryResponseSchema = z.lazy(() => getFileAllSizes200Schema) as unknown as z.ZodType export const getFilePathParamsSchema = z.object({ - imageId: z.string().describe("Image ID (UUID)"), - size: z.string().describe("Image size (large, medium, small)"), -}) as unknown as z.ZodType; + "imageId": z.string().describe("Image ID (UUID)"), +"size": z.string().describe("Image size (large, medium, small)") + }) as unknown as z.ZodType /** * @description OK */ -export const getFile200Schema = z.lazy( - () => modelsGetFileResponseSchema, -) as unknown as z.ZodType; +export const getFile200Schema = z.lazy(() => modelsGetFileResponseSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const getFile400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getFile400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const getFile404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getFile404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const getFile500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getFile500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType -export const getFileQueryResponseSchema = z.lazy( - () => getFile200Schema, -) as unknown as z.ZodType; +export const getFileQueryResponseSchema = z.lazy(() => getFile200Schema) as unknown as z.ZodType /** * @description Created */ -export const addMember201Schema = z.lazy( - () => modelsMembershipSchema, -) as unknown as z.ZodType; +export const addMember201Schema = z.lazy(() => modelsMembershipSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const addMember400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const addMember400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unauthorized */ -export const addMember401Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const addMember401Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unprocessable Entity */ -export const addMember422Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const addMember422Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const addMember500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const addMember500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Create membership request */ -export const addMemberMutationRequestSchema = z.lazy( - () => modelsCreateMembershipRequestSchema, -) as unknown as z.ZodType; +export const addMemberMutationRequestSchema = z.lazy(() => modelsCreateMembershipRequestSchema) as unknown as z.ZodType -export const addMemberMutationResponseSchema = z.lazy( - () => addMember201Schema, -) as unknown as z.ZodType; +export const addMemberMutationResponseSchema = z.lazy(() => addMember201Schema) as unknown as z.ZodType /** * @description OK */ -export const sendNotification200Schema = - z.any() as unknown as z.ZodType; +export const sendNotification200Schema = z.any() as unknown as z.ZodType /** * @description Bad Request */ -export const sendNotification400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const sendNotification400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unprocessable Entity */ -export const sendNotification422Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const sendNotification422Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const sendNotification500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const sendNotification500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Notification request */ -export const sendNotificationMutationRequestSchema = z.lazy( - () => modelsSendNotificationRequestSchema, -) as unknown as z.ZodType; +export const sendNotificationMutationRequestSchema = z.lazy(() => modelsSendNotificationRequestSchema) as unknown as z.ZodType -export const sendNotificationMutationResponseSchema = z.lazy( - () => sendNotification200Schema, -) as unknown as z.ZodType; +export const sendNotificationMutationResponseSchema = z.lazy(() => sendNotification200Schema) as unknown as z.ZodType /** * @description OK */ -export const sendBulkNotification200Schema = z.lazy( - () => modelsNotificationResponseSchema, -) as unknown as z.ZodType; +export const sendBulkNotification200Schema = z.lazy(() => modelsNotificationResponseSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const sendBulkNotification400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const sendBulkNotification400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unprocessable Entity */ -export const sendBulkNotification422Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const sendBulkNotification422Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const sendBulkNotification500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const sendBulkNotification500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Bulk notification request */ -export const sendBulkNotificationMutationRequestSchema = z.lazy( - () => modelsSendBulkNotificationRequestSchema, -) as unknown as z.ZodType; - -export const sendBulkNotificationMutationResponseSchema = z.lazy( - () => sendBulkNotification200Schema, -) as unknown as z.ZodType; - -export const getAllTripsQueryParamsSchema = z - .object({ - limit: z.optional( - z.coerce - .number() - .int() - .describe("Max items per page (default 20, max 100)"), - ), - cursor: z.optional( - z - .string() - .describe( - "Opaque cursor from previous response next_cursor for next page", - ), - ), - }) - .optional() as unknown as z.ZodType; +export const sendBulkNotificationMutationRequestSchema = z.lazy(() => modelsSendBulkNotificationRequestSchema) as unknown as z.ZodType + +export const sendBulkNotificationMutationResponseSchema = z.lazy(() => sendBulkNotification200Schema) as unknown as z.ZodType + +export const getAllTripsQueryParamsSchema = z.object({ + "limit": z.optional(z.coerce.number().int().describe("Max items per page (default 20, max 100)")), +"cursor": z.optional(z.string().describe("Opaque cursor from previous response next_cursor for next page")) + }).optional() as unknown as z.ZodType /** * @description OK */ -export const getAllTrips200Schema = z.lazy( - () => modelsTripCursorPageResultSchema, -) as unknown as z.ZodType; +export const getAllTrips200Schema = z.lazy(() => modelsTripCursorPageResultSchema) as unknown as z.ZodType /** * @description Invalid cursor */ -export const getAllTrips400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getAllTrips400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unauthorized */ -export const getAllTrips401Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getAllTrips401Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const getAllTrips500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getAllTrips500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType -export const getAllTripsQueryResponseSchema = z.lazy( - () => getAllTrips200Schema, -) as unknown as z.ZodType; +export const getAllTripsQueryResponseSchema = z.lazy(() => getAllTrips200Schema) as unknown as z.ZodType /** * @description Created */ -export const createTrip201Schema = z.lazy( - () => modelsTripSchema, -) as unknown as z.ZodType; +export const createTrip201Schema = z.lazy(() => modelsTripSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const createTrip400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const createTrip400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unauthorized */ -export const createTrip401Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const createTrip401Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unprocessable Entity */ -export const createTrip422Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const createTrip422Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const createTrip500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const createTrip500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Create trip request */ -export const createTripMutationRequestSchema = z.lazy( - () => modelsCreateTripRequestSchema, -) as unknown as z.ZodType; +export const createTripMutationRequestSchema = z.lazy(() => modelsCreateTripRequestSchema) as unknown as z.ZodType -export const createTripMutationResponseSchema = z.lazy( - () => createTrip201Schema, -) as unknown as z.ZodType; +export const createTripMutationResponseSchema = z.lazy(() => createTrip201Schema) as unknown as z.ZodType export const getTripPathParamsSchema = z.object({ - tripID: z.string().describe("Trip ID"), -}) as unknown as z.ZodType; + "tripID": z.string().describe("Trip ID") + }) as unknown as z.ZodType /** * @description OK */ -export const getTrip200Schema = z.lazy( - () => modelsTripAPIResponseSchema, -) as unknown as z.ZodType; +export const getTrip200Schema = z.lazy(() => modelsTripAPIResponseSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const getTrip400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getTrip400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const getTrip404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getTrip404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const getTrip500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getTrip500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType -export const getTripQueryResponseSchema = z.lazy( - () => getTrip200Schema, -) as unknown as z.ZodType; +export const getTripQueryResponseSchema = z.lazy(() => getTrip200Schema) as unknown as z.ZodType export const deleteTripPathParamsSchema = z.object({ - tripID: z.string().describe("Trip ID"), -}) as unknown as z.ZodType; + "tripID": z.string().describe("Trip ID") + }) as unknown as z.ZodType /** * @description No Content */ -export const deleteTrip204Schema = - z.any() as unknown as z.ZodType; +export const deleteTrip204Schema = z.any() as unknown as z.ZodType /** * @description Bad Request */ -export const deleteTrip400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const deleteTrip400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unauthorized */ -export const deleteTrip401Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const deleteTrip401Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const deleteTrip404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const deleteTrip404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const deleteTrip500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const deleteTrip500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType -export const deleteTripMutationResponseSchema = z.lazy( - () => deleteTrip204Schema, -) as unknown as z.ZodType; +export const deleteTripMutationResponseSchema = z.lazy(() => deleteTrip204Schema) as unknown as z.ZodType export const updateTripPathParamsSchema = z.object({ - tripID: z.string().describe("Trip ID"), -}) as unknown as z.ZodType; + "tripID": z.string().describe("Trip ID") + }) as unknown as z.ZodType /** * @description OK */ -export const updateTrip200Schema = z.lazy( - () => modelsTripSchema, -) as unknown as z.ZodType; +export const updateTrip200Schema = z.lazy(() => modelsTripSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const updateTrip400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateTrip400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unauthorized */ -export const updateTrip401Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateTrip401Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const updateTrip404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateTrip404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unprocessable Entity */ -export const updateTrip422Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateTrip422Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const updateTrip500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateTrip500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Update trip request */ -export const updateTripMutationRequestSchema = z.lazy( - () => modelsUpdateTripRequestSchema, -) as unknown as z.ZodType; +export const updateTripMutationRequestSchema = z.lazy(() => modelsUpdateTripRequestSchema) as unknown as z.ZodType -export const updateTripMutationResponseSchema = z.lazy( - () => updateTrip200Schema, -) as unknown as z.ZodType; +export const updateTripMutationResponseSchema = z.lazy(() => updateTrip200Schema) as unknown as z.ZodType export const getTripMembersPathParamsSchema = z.object({ - tripID: z.string().describe("Trip ID"), -}) as unknown as z.ZodType; - -export const getTripMembersQueryParamsSchema = z - .object({ - limit: z.optional( - z.coerce - .number() - .int() - .describe("Max items per page (default 20, max 100)"), - ), - cursor: z.optional( - z.string().describe("Opaque cursor returned in next_cursor"), - ), - }) - .optional() as unknown as z.ZodType; + "tripID": z.string().describe("Trip ID") + }) as unknown as z.ZodType + +export const getTripMembersQueryParamsSchema = z.object({ + "limit": z.optional(z.coerce.number().int().describe("Max items per page (default 20, max 100)")), +"cursor": z.optional(z.string().describe("Opaque cursor returned in next_cursor")) + }).optional() as unknown as z.ZodType /** * @description OK */ -export const getTripMembers200Schema = z.lazy( - () => modelsMembershipCursorPageResultSchema, -) as unknown as z.ZodType; +export const getTripMembers200Schema = z.lazy(() => modelsMembershipCursorPageResultSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const getTripMembers400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getTripMembers400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unauthorized */ -export const getTripMembers401Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getTripMembers401Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const getTripMembers404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getTripMembers404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const getTripMembers500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getTripMembers500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType -export const getTripMembersQueryResponseSchema = z.lazy( - () => getTripMembers200Schema, -) as unknown as z.ZodType; +export const getTripMembersQueryResponseSchema = z.lazy(() => getTripMembers200Schema) as unknown as z.ZodType export const getMembershipPathParamsSchema = z.object({ - tripID: z.string().describe("Trip ID"), - userID: z.string().describe("User ID"), -}) as unknown as z.ZodType; + "tripID": z.string().describe("Trip ID"), +"userID": z.string().describe("User ID") + }) as unknown as z.ZodType /** * @description OK */ -export const getMembership200Schema = z.lazy( - () => modelsMembershipAPIResponseSchema, -) as unknown as z.ZodType; +export const getMembership200Schema = z.lazy(() => modelsMembershipAPIResponseSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const getMembership400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getMembership400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unauthorized */ -export const getMembership401Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getMembership401Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const getMembership404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getMembership404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const getMembership500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getMembership500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType -export const getMembershipQueryResponseSchema = z.lazy( - () => getMembership200Schema, -) as unknown as z.ZodType; +export const getMembershipQueryResponseSchema = z.lazy(() => getMembership200Schema) as unknown as z.ZodType export const removeMemberPathParamsSchema = z.object({ - tripID: z.string().describe("Trip ID"), - userID: z.string().describe("User ID"), -}) as unknown as z.ZodType; + "tripID": z.string().describe("Trip ID"), +"userID": z.string().describe("User ID") + }) as unknown as z.ZodType /** * @description No Content */ -export const removeMember204Schema = - z.any() as unknown as z.ZodType; +export const removeMember204Schema = z.any() as unknown as z.ZodType /** * @description Bad Request */ -export const removeMember400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const removeMember400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unauthorized */ -export const removeMember401Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const removeMember401Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const removeMember404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const removeMember404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const removeMember500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const removeMember500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType -export const removeMemberMutationResponseSchema = z.lazy( - () => removeMember204Schema, -) as unknown as z.ZodType; +export const removeMemberMutationResponseSchema = z.lazy(() => removeMember204Schema) as unknown as z.ZodType export const updateMembershipPathParamsSchema = z.object({ - tripID: z.string().describe("Trip ID"), - userID: z.string().describe("User ID"), -}) as unknown as z.ZodType; + "tripID": z.string().describe("Trip ID"), +"userID": z.string().describe("User ID") + }) as unknown as z.ZodType /** * @description OK */ -export const updateMembership200Schema = z.lazy( - () => modelsMembershipSchema, -) as unknown as z.ZodType; +export const updateMembership200Schema = z.lazy(() => modelsMembershipSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const updateMembership400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateMembership400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unauthorized */ -export const updateMembership401Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateMembership401Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const updateMembership404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateMembership404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unprocessable Entity */ -export const updateMembership422Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateMembership422Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const updateMembership500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateMembership500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Update membership request */ -export const updateMembershipMutationRequestSchema = z.lazy( - () => modelsUpdateMembershipRequestSchema, -) as unknown as z.ZodType; +export const updateMembershipMutationRequestSchema = z.lazy(() => modelsUpdateMembershipRequestSchema) as unknown as z.ZodType -export const updateMembershipMutationResponseSchema = z.lazy( - () => updateMembership200Schema, -) as unknown as z.ZodType; +export const updateMembershipMutationResponseSchema = z.lazy(() => updateMembership200Schema) as unknown as z.ZodType export const demoteFromAdminPathParamsSchema = z.object({ - tripID: z.string().describe("Trip ID"), - userID: z.string().describe("User ID"), -}) as unknown as z.ZodType; + "tripID": z.string().describe("Trip ID"), +"userID": z.string().describe("User ID") + }) as unknown as z.ZodType /** * @description OK */ -export const demoteFromAdmin200Schema = z - .object({}) - .catchall(z.string()) as unknown as z.ZodType; +export const demoteFromAdmin200Schema = z.object({ + + }).catchall(z.string()) as unknown as z.ZodType /** * @description Bad Request */ -export const demoteFromAdmin400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const demoteFromAdmin400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unauthorized */ -export const demoteFromAdmin401Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const demoteFromAdmin401Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const demoteFromAdmin404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const demoteFromAdmin404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const demoteFromAdmin500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const demoteFromAdmin500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType -export const demoteFromAdminMutationResponseSchema = z.lazy( - () => demoteFromAdmin200Schema, -) as unknown as z.ZodType; +export const demoteFromAdminMutationResponseSchema = z.lazy(() => demoteFromAdmin200Schema) as unknown as z.ZodType export const promoteToAdminPathParamsSchema = z.object({ - tripID: z.string().describe("Trip ID"), - userID: z.string().describe("User ID"), -}) as unknown as z.ZodType; + "tripID": z.string().describe("Trip ID"), +"userID": z.string().describe("User ID") + }) as unknown as z.ZodType /** * @description OK */ -export const promoteToAdmin200Schema = z - .object({}) - .catchall(z.string()) as unknown as z.ZodType; +export const promoteToAdmin200Schema = z.object({ + + }).catchall(z.string()) as unknown as z.ZodType /** * @description Bad Request */ -export const promoteToAdmin400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const promoteToAdmin400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unauthorized */ -export const promoteToAdmin401Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const promoteToAdmin401Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +/** + * @description Not Found + */ +export const promoteToAdmin404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +/** + * @description Internal Server Error + */ +export const promoteToAdmin500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +export const promoteToAdminMutationResponseSchema = z.lazy(() => promoteToAdmin200Schema) as unknown as z.ZodType + +export const listPitchesPathParamsSchema = z.object({ + "tripID": z.string().describe("Trip ID") + }) as unknown as z.ZodType + +export const listPitchesQueryParamsSchema = z.object({ + "limit": z.optional(z.coerce.number().int().describe("Max items per page (default 20, max 100)")), +"cursor": z.optional(z.string().describe("Opaque cursor from previous response next_cursor")) + }).optional() as unknown as z.ZodType + +/** + * @description OK + */ +export const listPitches200Schema = z.lazy(() => modelsPitchCursorPageResultSchema) as unknown as z.ZodType + +/** + * @description Bad Request + */ +export const listPitches400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +/** + * @description Not Found + */ +export const listPitches404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +/** + * @description Internal Server Error + */ +export const listPitches500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +export const listPitchesQueryResponseSchema = z.lazy(() => listPitches200Schema) as unknown as z.ZodType + +export const createPitchPathParamsSchema = z.object({ + "tripID": z.string().describe("Trip ID") + }) as unknown as z.ZodType + +/** + * @description Created + */ +export const createPitch201Schema = z.lazy(() => modelsCreatePitchResponseSchema) as unknown as z.ZodType + +/** + * @description Bad Request + */ +export const createPitch400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +/** + * @description Forbidden + */ +export const createPitch403Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +/** + * @description Unprocessable Entity + */ +export const createPitch422Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +/** + * @description Internal Server Error + */ +export const createPitch500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +/** + * @description Create pitch request + */ +export const createPitchMutationRequestSchema = z.lazy(() => modelsCreatePitchRequestSchema) as unknown as z.ZodType + +export const createPitchMutationResponseSchema = z.lazy(() => createPitch201Schema) as unknown as z.ZodType + +export const getPitchPathParamsSchema = z.object({ + "tripID": z.string().describe("Trip ID"), +"pitchID": z.string().describe("Pitch ID") + }) as unknown as z.ZodType + +/** + * @description OK + */ +export const getPitch200Schema = z.lazy(() => modelsPitchAPIResponseSchema) as unknown as z.ZodType + +/** + * @description Bad Request + */ +export const getPitch400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const promoteToAdmin404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getPitch404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const promoteToAdmin500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getPitch500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +export const getPitchQueryResponseSchema = z.lazy(() => getPitch200Schema) as unknown as z.ZodType + +export const deletePitchPathParamsSchema = z.object({ + "tripID": z.string().describe("Trip ID"), +"pitchID": z.string().describe("Pitch ID") + }) as unknown as z.ZodType + +/** + * @description No Content + */ +export const deletePitch204Schema = z.any() as unknown as z.ZodType + +/** + * @description Bad Request + */ +export const deletePitch400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType -export const promoteToAdminMutationResponseSchema = z.lazy( - () => promoteToAdmin200Schema, -) as unknown as z.ZodType; +/** + * @description Not Found + */ +export const deletePitch404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +/** + * @description Internal Server Error + */ +export const deletePitch500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +export const deletePitchMutationResponseSchema = z.lazy(() => deletePitch204Schema) as unknown as z.ZodType + +export const updatePitchPathParamsSchema = z.object({ + "tripID": z.string().describe("Trip ID"), +"pitchID": z.string().describe("Pitch ID") + }) as unknown as z.ZodType + +/** + * @description OK + */ +export const updatePitch200Schema = z.lazy(() => modelsPitchAPIResponseSchema) as unknown as z.ZodType + +/** + * @description Bad Request + */ +export const updatePitch400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +/** + * @description Not Found + */ +export const updatePitch404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +/** + * @description Unprocessable Entity + */ +export const updatePitch422Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +/** + * @description Internal Server Error + */ +export const updatePitch500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType + +/** + * @description Update pitch request + */ +export const updatePitchMutationRequestSchema = z.lazy(() => modelsUpdatePitchRequestSchema) as unknown as z.ZodType + +export const updatePitchMutationResponseSchema = z.lazy(() => updatePitch200Schema) as unknown as z.ZodType export const getPaginatedCommentsPathParamsSchema = z.object({ - tripID: z.string().describe("Trip ID"), - entityType: z.string().describe("Entity type (activity, pitch)"), - entityID: z.string().describe("Entity ID"), -}) as unknown as z.ZodType; - -export const getPaginatedCommentsQueryParamsSchema = z - .object({ - limit: z.optional( - z.coerce - .number() - .int() - .describe("Max items per page (default 20, max 100)"), - ), - cursor: z.optional( - z.string().describe("Opaque cursor returned in next_cursor"), - ), - }) - .optional() as unknown as z.ZodType; + "tripID": z.string().describe("Trip ID"), +"entityType": z.string().describe("Entity type (activity, pitch)"), +"entityID": z.string().describe("Entity ID") + }) as unknown as z.ZodType + +export const getPaginatedCommentsQueryParamsSchema = z.object({ + "limit": z.optional(z.coerce.number().int().describe("Max items per page (default 20, max 100)")), +"cursor": z.optional(z.string().describe("Opaque cursor returned in next_cursor")) + }).optional() as unknown as z.ZodType /** * @description OK */ -export const getPaginatedComments200Schema = z.lazy( - () => modelsPaginatedCommentsResponseSchema, -) as unknown as z.ZodType; +export const getPaginatedComments200Schema = z.lazy(() => modelsPaginatedCommentsResponseSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const getPaginatedComments400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getPaginatedComments400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unauthorized */ -export const getPaginatedComments401Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getPaginatedComments401Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const getPaginatedComments404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getPaginatedComments404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unprocessable Entity */ -export const getPaginatedComments422Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getPaginatedComments422Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const getPaginatedComments500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getPaginatedComments500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType -export const getPaginatedCommentsQueryResponseSchema = z.lazy( - () => getPaginatedComments200Schema, -) as unknown as z.ZodType; +export const getPaginatedCommentsQueryResponseSchema = z.lazy(() => getPaginatedComments200Schema) as unknown as z.ZodType /** * @description Created */ -export const createUser201Schema = z.lazy( - () => modelsUserSchema, -) as unknown as z.ZodType; +export const createUser201Schema = z.lazy(() => modelsUserSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const createUser400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const createUser400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unprocessable Entity */ -export const createUser422Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const createUser422Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const createUser500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const createUser500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Create user request */ -export const createUserMutationRequestSchema = z.lazy( - () => modelsCreateUserRequestSchema, -) as unknown as z.ZodType; +export const createUserMutationRequestSchema = z.lazy(() => modelsCreateUserRequestSchema) as unknown as z.ZodType -export const createUserMutationResponseSchema = z.lazy( - () => createUser201Schema, -) as unknown as z.ZodType; +export const createUserMutationResponseSchema = z.lazy(() => createUser201Schema) as unknown as z.ZodType /** * @description OK */ -export const getCurrentUser200Schema = z.lazy( - () => modelsUserSchema, -) as unknown as z.ZodType; +export const getCurrentUser200Schema = z.lazy(() => modelsUserSchema) as unknown as z.ZodType /** * @description Unauthorized */ -export const getCurrentUser401Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getCurrentUser401Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const getCurrentUser404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getCurrentUser404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const getCurrentUser500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getCurrentUser500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType -export const getCurrentUserQueryResponseSchema = z.lazy( - () => getCurrentUser200Schema, -) as unknown as z.ZodType; +export const getCurrentUserQueryResponseSchema = z.lazy(() => getCurrentUser200Schema) as unknown as z.ZodType export const getUserPathParamsSchema = z.object({ - userID: z.string().describe("User ID"), -}) as unknown as z.ZodType; + "userID": z.string().describe("User ID") + }) as unknown as z.ZodType /** * @description OK */ -export const getUser200Schema = z.lazy( - () => modelsUserSchema, -) as unknown as z.ZodType; +export const getUser200Schema = z.lazy(() => modelsUserSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const getUser400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getUser400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const getUser404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getUser404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const getUser500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const getUser500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType -export const getUserQueryResponseSchema = z.lazy( - () => getUser200Schema, -) as unknown as z.ZodType; +export const getUserQueryResponseSchema = z.lazy(() => getUser200Schema) as unknown as z.ZodType export const deleteUserPathParamsSchema = z.object({ - userID: z.string().describe("User ID"), -}) as unknown as z.ZodType; + "userID": z.string().describe("User ID") + }) as unknown as z.ZodType /** * @description No Content */ -export const deleteUser204Schema = - z.any() as unknown as z.ZodType; +export const deleteUser204Schema = z.any() as unknown as z.ZodType /** * @description Bad Request */ -export const deleteUser400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const deleteUser400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const deleteUser404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const deleteUser404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const deleteUser500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const deleteUser500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType -export const deleteUserMutationResponseSchema = z.lazy( - () => deleteUser204Schema, -) as unknown as z.ZodType; +export const deleteUserMutationResponseSchema = z.lazy(() => deleteUser204Schema) as unknown as z.ZodType export const updateUserPathParamsSchema = z.object({ - userID: z.string().describe("User ID"), -}) as unknown as z.ZodType; + "userID": z.string().describe("User ID") + }) as unknown as z.ZodType /** * @description OK */ -export const updateUser200Schema = z.lazy( - () => modelsUserSchema, -) as unknown as z.ZodType; +export const updateUser200Schema = z.lazy(() => modelsUserSchema) as unknown as z.ZodType /** * @description Bad Request */ -export const updateUser400Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateUser400Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Not Found */ -export const updateUser404Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateUser404Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Unprocessable Entity */ -export const updateUser422Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateUser422Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Internal Server Error */ -export const updateUser500Schema = z.lazy( - () => errsAPIErrorSchema, -) as unknown as z.ZodType; +export const updateUser500Schema = z.lazy(() => errsAPIErrorSchema) as unknown as z.ZodType /** * @description Update user request */ -export const updateUserMutationRequestSchema = z.lazy( - () => modelsUpdateUserRequestSchema, -) as unknown as z.ZodType; +export const updateUserMutationRequestSchema = z.lazy(() => modelsUpdateUserRequestSchema) as unknown as z.ZodType -export const updateUserMutationResponseSchema = z.lazy( - () => updateUser200Schema, -) as unknown as z.ZodType; +export const updateUserMutationResponseSchema = z.lazy(() => updateUser200Schema) as unknown as z.ZodType /** * @description OK */ -export const healthcheck200Schema = z - .object({}) - .catchall(z.any()) as unknown as z.ZodType; +export const healthcheck200Schema = z.object({ + + }).catchall(z.any()) as unknown as z.ZodType /** * @description Internal Server Error */ -export const healthcheck500Schema = z - .object({}) - .catchall(z.any()) as unknown as z.ZodType; +export const healthcheck500Schema = z.object({ + + }).catchall(z.any()) as unknown as z.ZodType -export const healthcheckQueryResponseSchema = z.lazy( - () => healthcheck200Schema, -) as unknown as z.ZodType; +export const healthcheckQueryResponseSchema = z.lazy(() => healthcheck200Schema) as unknown as z.ZodType \ No newline at end of file diff --git a/frontend/types/types.gen.ts b/frontend/types/types.gen.ts index 72fbfd1..070c114 100644 --- a/frontend/types/types.gen.ts +++ b/frontend/types/types.gen.ts @@ -1,1939 +1,2219 @@ /** - * Generated by Kubb (https://kubb.dev/). - * Do not edit manually. - */ +* Generated by Kubb (https://kubb.dev/). +* Do not edit manually. +*/ + export type ErrsAPIError = { - message?: any; - /** - * @type integer | undefined - */ - statusCode?: number; + message?: any; + /** + * @type integer | undefined + */ + statusCode?: number; }; export const modelsEntityType = { - Activity: "activity", - Pitch: "pitch", + "Activity": "activity", + "Pitch": "pitch" } as const; -export type ModelsEntityTypeEnumKey = - (typeof modelsEntityType)[keyof typeof modelsEntityType]; +export type ModelsEntityTypeEnumKey = (typeof modelsEntityType)[keyof typeof modelsEntityType]; export type ModelsEntityType = ModelsEntityTypeEnumKey; export type ModelsComment = { - /** - * @type string | undefined - */ - content?: string; - /** - * @type string | undefined - */ - created_at?: string; - /** - * @type string | undefined - */ - entity_id?: string; - /** - * @type string | undefined - */ - entity_type?: ModelsEntityType; - /** - * @type string | undefined - */ - id?: string; - /** - * @type string | undefined - */ - trip_id?: string; - /** - * @type string | undefined - */ - updated_at?: string; - /** - * @type string | undefined - */ - user_id?: string; + /** + * @type string | undefined + */ + content?: string; + /** + * @type string | undefined + */ + created_at?: string; + /** + * @type string | undefined + */ + entity_id?: string; + /** + * @type string | undefined + */ + entity_type?: ModelsEntityType; + /** + * @type string | undefined + */ + id?: string; + /** + * @type string | undefined + */ + trip_id?: string; + /** + * @type string | undefined + */ + updated_at?: string; + /** + * @type string | undefined + */ + user_id?: string; }; export type ModelsCommentAPIResponse = { - /** - * @type string | undefined - */ - content?: string; - /** - * @type string | undefined - */ - created_at?: string; - /** - * @type string | undefined - */ - entity_id?: string; - /** - * @type string | undefined - */ - entity_type?: ModelsEntityType; - /** - * @type string | undefined - */ - id?: string; - /** - * @description pointer since some users don\'t have their avatar set - * @type string | undefined - */ - profile_picture_url?: string; - /** - * @type string | undefined - */ - trip_id?: string; - /** - * @type string | undefined - */ - updated_at?: string; - /** - * @type string | undefined - */ - user_id?: string; - /** - * @type string | undefined - */ - username?: string; + /** + * @type string | undefined + */ + content?: string; + /** + * @type string | undefined + */ + created_at?: string; + /** + * @type string | undefined + */ + entity_id?: string; + /** + * @type string | undefined + */ + entity_type?: ModelsEntityType; + /** + * @type string | undefined + */ + id?: string; + /** + * @description pointer since some users don\'t have their avatar set + * @type string | undefined + */ + profile_picture_url?: string; + /** + * @type string | undefined + */ + trip_id?: string; + /** + * @type string | undefined + */ + updated_at?: string; + /** + * @type string | undefined + */ + user_id?: string; + /** + * @type string | undefined + */ + username?: string; }; export const modelsImageSize = { - ImageSizeLarge: "large", - ImageSizeMedium: "medium", - ImageSizeSmall: "small", + "ImageSizeLarge": "large", + "ImageSizeMedium": "medium", + "ImageSizeSmall": "small" } as const; -export type ModelsImageSizeEnumKey = - (typeof modelsImageSize)[keyof typeof modelsImageSize]; +export type ModelsImageSizeEnumKey = (typeof modelsImageSize)[keyof typeof modelsImageSize]; export type ModelsImageSize = ModelsImageSizeEnumKey; export type ModelsConfirmUploadRequest = { - /** - * @type string - */ - imageId: string; - /** - * @description Optional: if nil, confirm all sizes - */ - size?: ModelsImageSize; + /** + * @type string + */ + imageId: string; + /** + * @description Optional: if nil, confirm all sizes + */ + size?: ModelsImageSize; }; export type ModelsConfirmUploadResponse = { - /** - * @type integer | undefined - */ - confirmed?: number; - /** - * @type string | undefined - */ - imageId?: string; - /** - * @type string | undefined - */ - status?: string; + /** + * @type integer | undefined + */ + confirmed?: number; + /** + * @type string | undefined + */ + imageId?: string; + /** + * @type string | undefined + */ + status?: string; }; export type ModelsCreateCommentRequest = { - /** - * @minLength 1 - * @type string - */ - content: string; - /** - * @type string - */ - entity_id: string; - entity_type: ModelsEntityType; - /** - * @type string - */ - trip_id: string; + /** + * @minLength 1 + * @type string + */ + content: string; + /** + * @type string + */ + entity_id: string; + entity_type: ModelsEntityType; + /** + * @type string + */ + trip_id: string; }; export type ModelsCreateMembershipRequest = { - /** - * @minLength 0 - * @type integer - */ - budget_max: number; - /** - * @minLength 0 - * @type integer - */ - budget_min: number; - /** - * @type boolean | undefined - */ - is_admin?: boolean; - /** - * @type string - */ - trip_id: string; - /** - * @type string - */ - user_id: string; + /** + * @minLength 0 + * @type integer + */ + budget_max: number; + /** + * @minLength 0 + * @type integer + */ + budget_min: number; + /** + * @type boolean | undefined + */ + is_admin?: boolean; + /** + * @type string + */ + trip_id: string; + /** + * @type string + */ + user_id: string; +}; + +export type ModelsCreatePitchRequest = { + /** + * @minLength 1 + * @type string + */ + content_type: string; + /** + * @type string | undefined + */ + description?: string; + /** + * @minLength 1 + * @type string + */ + title: string; +}; + +export type ModelsPitchAPIResponse = { + /** + * @type string | undefined + */ + audio_url?: string; + /** + * @type string | undefined + */ + created_at?: string; + /** + * @type string | undefined + */ + description?: string; + /** + * @type integer | undefined + */ + duration?: number; + /** + * @type string | undefined + */ + id?: string; + /** + * @type string | undefined + */ + title?: string; + /** + * @type string | undefined + */ + trip_id?: string; + /** + * @type string | undefined + */ + updated_at?: string; + /** + * @type string | undefined + */ + user_id?: string; +}; + +export type ModelsCreatePitchResponse = { + /** + * @type string | undefined + */ + expires_at?: string; + /** + * @type object | undefined + */ + pitch?: ModelsPitchAPIResponse; + /** + * @type string | undefined + */ + upload_url?: string; }; export type ModelsCreateTripRequest = { - /** - * @minLength 0 - * @type integer - */ - budget_max: number; - /** - * @minLength 0 - * @type integer - */ - budget_min: number; - /** - * @type string | undefined - */ - cover_image_id?: string; - /** - * @minLength 1 - * @type string - */ - name: string; + /** + * @minLength 0 + * @type integer + */ + budget_max: number; + /** + * @minLength 0 + * @type integer + */ + budget_min: number; + /** + * @type string | undefined + */ + cover_image_id?: string; + /** + * @minLength 1 + * @type string + */ + name: string; }; export type ModelsCreateUserRequest = { - /** - * @minLength 1 - * @type string - */ - name: string; - /** - * @type string - */ - phone_number: string; - /** - * @type string - */ - username: string; + /** + * @minLength 1 + * @type string + */ + name: string; + /** + * @type string + */ + phone_number: string; + /** + * @type string + */ + username: string; }; export type ModelsGetFileResponse = { - /** - * @type string | undefined - */ - contentType?: string; - /** - * @type string | undefined - */ - imageId?: string; - /** - * @type string | undefined - */ - size?: ModelsImageSize; - /** - * @type string | undefined - */ - url?: string; + /** + * @type string | undefined + */ + contentType?: string; + /** + * @type string | undefined + */ + imageId?: string; + /** + * @type string | undefined + */ + size?: ModelsImageSize; + /** + * @type string | undefined + */ + url?: string; }; export type ModelsGetFileAllSizesResponse = { - /** - * @type array | undefined - */ - files?: ModelsGetFileResponse[]; - /** - * @type string | undefined - */ - imageId?: string; + /** + * @type array | undefined + */ + files?: ModelsGetFileResponse[]; + /** + * @type string | undefined + */ + imageId?: string; }; export type ModelsMembership = { - /** - * @type object | undefined - */ - availability?: { - [key: string]: any; - }; - /** - * @type integer | undefined - */ - budget_max?: number; - /** - * @type integer | undefined - */ - budget_min?: number; - /** - * @type string | undefined - */ - created_at?: string; - /** - * @type boolean | undefined - */ - is_admin?: boolean; - /** - * @type string | undefined - */ - trip_id?: string; - /** - * @type string | undefined - */ - updated_at?: string; - /** - * @type string | undefined - */ - user_id?: string; + /** + * @type object | undefined + */ + availability?: { + [key: string]: any; + }; + /** + * @type integer | undefined + */ + budget_max?: number; + /** + * @type integer | undefined + */ + budget_min?: number; + /** + * @type string | undefined + */ + created_at?: string; + /** + * @type boolean | undefined + */ + is_admin?: boolean; + /** + * @type string | undefined + */ + trip_id?: string; + /** + * @type string | undefined + */ + updated_at?: string; + /** + * @type string | undefined + */ + user_id?: string; }; export type ModelsMembershipAPIResponse = { - /** - * @type object | undefined - */ - availability?: { - [key: string]: any; - }; - /** - * @type integer | undefined - */ - budget_max?: number; - /** - * @type integer | undefined - */ - budget_min?: number; - /** - * @type string | undefined - */ - created_at?: string; - /** - * @type boolean | undefined - */ - is_admin?: boolean; - /** - * @type string | undefined - */ - profile_picture_url?: string; - /** - * @type string | undefined - */ - trip_id?: string; - /** - * @type string | undefined - */ - updated_at?: string; - /** - * @type string | undefined - */ - user_id?: string; - /** - * @type string | undefined - */ - username?: string; + /** + * @type object | undefined + */ + availability?: { + [key: string]: any; + }; + /** + * @type integer | undefined + */ + budget_max?: number; + /** + * @type integer | undefined + */ + budget_min?: number; + /** + * @type string | undefined + */ + created_at?: string; + /** + * @type boolean | undefined + */ + is_admin?: boolean; + /** + * @type string | undefined + */ + profile_picture_url?: string; + /** + * @type string | undefined + */ + trip_id?: string; + /** + * @type string | undefined + */ + updated_at?: string; + /** + * @type string | undefined + */ + user_id?: string; + /** + * @type string | undefined + */ + username?: string; }; export type ModelsMembershipCursorPageResult = { - /** - * @type array | undefined - */ - items?: ModelsMembershipAPIResponse[]; - /** - * @type integer | undefined - */ - limit?: number; - /** - * @type string | undefined - */ - next_cursor?: string; + /** + * @type array | undefined + */ + items?: ModelsMembershipAPIResponse[]; + /** + * @type integer | undefined + */ + limit?: number; + /** + * @type string | undefined + */ + next_cursor?: string; }; export type ModelsNotificationError = { - /** - * @type string | undefined - */ - message?: string; - /** - * @type string | undefined - */ - token?: string; - /** - * @type string | undefined - */ - user_id?: string; + /** + * @type string | undefined + */ + message?: string; + /** + * @type string | undefined + */ + token?: string; + /** + * @type string | undefined + */ + user_id?: string; }; export type ModelsNotificationResponse = { - /** - * @type array | undefined - */ - errors?: ModelsNotificationError[]; - /** - * @type integer | undefined - */ - failure_count?: number; - /** - * @type integer | undefined - */ - success_count?: number; + /** + * @type array | undefined + */ + errors?: ModelsNotificationError[]; + /** + * @type integer | undefined + */ + failure_count?: number; + /** + * @type integer | undefined + */ + success_count?: number; }; export type ModelsPaginatedCommentsResponse = { - /** - * @type array | undefined - */ - items?: ModelsCommentAPIResponse[]; - /** - * @type integer | undefined - */ - limit?: number; - /** - * @type string | undefined - */ - next_cursor?: string; + /** + * @type array | undefined + */ + items?: ModelsCommentAPIResponse[]; + /** + * @type integer | undefined + */ + limit?: number; + /** + * @type string | undefined + */ + next_cursor?: string; +}; + +export type ModelsPitchCursorPageResult = { + /** + * @type array | undefined + */ + items?: ModelsPitchAPIResponse[]; + /** + * @type integer | undefined + */ + limit?: number; + /** + * @type string | undefined + */ + next_cursor?: string; }; export type ModelsS3HealthCheckResponse = { - /** - * @type string | undefined - */ - bucketName?: string; - /** - * @description Error contains the underlying error message when status is \"unhealthy\" - * @type string | undefined - */ - error?: string; - /** - * @type string | undefined - */ - region?: string; - /** - * @type string | undefined - */ - status?: string; + /** + * @type string | undefined + */ + bucketName?: string; + /** + * @description Error contains the underlying error message when status is \"unhealthy\" + * @type string | undefined + */ + error?: string; + /** + * @type string | undefined + */ + region?: string; + /** + * @type string | undefined + */ + status?: string; }; export type ModelsSendBulkNotificationRequest = { - /** - * @minLength 1 - * @maxLength 500 - * @type string - */ - body: string; - /** - * @type object | undefined - */ - data?: { - [key: string]: any; - }; - /** - * @minLength 1 - * @maxLength 100 - * @type string - */ - title: string; - /** - * @type array - */ - user_ids: string[]; + /** + * @minLength 1 + * @maxLength 500 + * @type string + */ + body: string; + /** + * @type object | undefined + */ + data?: { + [key: string]: any; + }; + /** + * @minLength 1 + * @maxLength 100 + * @type string + */ + title: string; + /** + * @type array + */ + user_ids: string[]; }; export type ModelsSendNotificationRequest = { - /** - * @minLength 1 - * @maxLength 500 - * @type string - */ - body: string; - /** - * @type object | undefined - */ - data?: { - [key: string]: any; - }; - /** - * @minLength 1 - * @maxLength 100 - * @type string - */ - title: string; - /** - * @type string - */ - user_id: string; + /** + * @minLength 1 + * @maxLength 500 + * @type string + */ + body: string; + /** + * @type object | undefined + */ + data?: { + [key: string]: any; + }; + /** + * @minLength 1 + * @maxLength 100 + * @type string + */ + title: string; + /** + * @type string + */ + user_id: string; }; export type ModelsSizedUploadURL = { - /** - * @type string | undefined - */ - size?: ModelsImageSize; - /** - * @type string | undefined - */ - url?: string; + /** + * @type string | undefined + */ + size?: ModelsImageSize; + /** + * @type string | undefined + */ + url?: string; }; export type ModelsTrip = { - /** - * @type integer | undefined - */ - budget_max?: number; - /** - * @type integer | undefined - */ - budget_min?: number; - /** - * @type string | undefined - */ - cover_image_id?: string; - /** - * @type string | undefined - */ - created_at?: string; - /** - * @type string | undefined - */ - id?: string; - /** - * @type string | undefined - */ - name?: string; - /** - * @type string | undefined - */ - updated_at?: string; + /** + * @type integer | undefined + */ + budget_max?: number; + /** + * @type integer | undefined + */ + budget_min?: number; + /** + * @type string | undefined + */ + cover_image_id?: string; + /** + * @type string | undefined + */ + created_at?: string; + /** + * @type string | undefined + */ + id?: string; + /** + * @type string | undefined + */ + name?: string; + /** + * @type string | undefined + */ + updated_at?: string; }; export type ModelsTripAPIResponse = { - /** - * @type integer | undefined - */ - budget_max?: number; - /** - * @type integer | undefined - */ - budget_min?: number; - /** - * @type string | undefined - */ - cover_image_url?: string; - /** - * @type string | undefined - */ - created_at?: string; - /** - * @type string | undefined - */ - id?: string; - /** - * @type string | undefined - */ - name?: string; - /** - * @type string | undefined - */ - updated_at?: string; + /** + * @type integer | undefined + */ + budget_max?: number; + /** + * @type integer | undefined + */ + budget_min?: number; + /** + * @type string | undefined + */ + cover_image_url?: string; + /** + * @type string | undefined + */ + created_at?: string; + /** + * @type string | undefined + */ + id?: string; + /** + * @type string | undefined + */ + name?: string; + /** + * @type string | undefined + */ + updated_at?: string; }; export type ModelsTripCursorPageResult = { - /** - * @type array | undefined - */ - items?: ModelsTripAPIResponse[]; - /** - * @type integer | undefined - */ - limit?: number; - /** - * @type string | undefined - */ - next_cursor?: string; + /** + * @type array | undefined + */ + items?: ModelsTripAPIResponse[]; + /** + * @type integer | undefined + */ + limit?: number; + /** + * @type string | undefined + */ + next_cursor?: string; }; export type ModelsUpdateCommentRequest = { - /** - * @minLength 1 - * @type string - */ - content: string; + /** + * @minLength 1 + * @type string + */ + content: string; }; export type ModelsUpdateMembershipRequest = { - /** - * @minLength 0 - * @type integer | undefined - */ - budget_max?: number; - /** - * @minLength 0 - * @type integer | undefined - */ - budget_min?: number; - /** - * @type boolean | undefined - */ - is_admin?: boolean; + /** + * @minLength 0 + * @type integer | undefined + */ + budget_max?: number; + /** + * @minLength 0 + * @type integer | undefined + */ + budget_min?: number; + /** + * @type boolean | undefined + */ + is_admin?: boolean; +}; + +export type ModelsUpdatePitchRequest = { + /** + * @type string | undefined + */ + description?: string; + /** + * @minLength 0 + * @type integer | undefined + */ + duration?: number; + /** + * @minLength 1 + * @type string | undefined + */ + title?: string; }; export type ModelsUpdateTripRequest = { - /** - * @minLength 0 - * @type integer | undefined - */ - budget_max?: number; - /** - * @minLength 0 - * @type integer | undefined - */ - budget_min?: number; - /** - * @type string | undefined - */ - cover_image_id?: string; - /** - * @minLength 1 - * @type string | undefined - */ - name?: string; + /** + * @minLength 0 + * @type integer | undefined + */ + budget_max?: number; + /** + * @minLength 0 + * @type integer | undefined + */ + budget_min?: number; + /** + * @type string | undefined + */ + cover_image_id?: string; + /** + * @minLength 1 + * @type string | undefined + */ + name?: string; }; export type ModelsUpdateUserRequest = { - /** - * @maxLength 200 - * @type string | undefined - */ - device_token?: string; - /** - * @minLength 1 - * @type string | undefined - */ - name?: string; - /** - * @type string | undefined - */ - phone_number?: string; - /** - * @type string | undefined - */ - profile_picture?: string; - /** - * @type string | undefined - */ - timezone?: string; - /** - * @type string | undefined - */ - username?: string; + /** + * @maxLength 200 + * @type string | undefined + */ + device_token?: string; + /** + * @minLength 1 + * @type string | undefined + */ + name?: string; + /** + * @type string | undefined + */ + phone_number?: string; + /** + * @type string | undefined + */ + profile_picture?: string; + /** + * @type string | undefined + */ + timezone?: string; + /** + * @type string | undefined + */ + username?: string; }; export type ModelsUploadURLRequest = { - /** - * @minLength 1 - * @type string - */ - contentType: string; - /** - * @minLength 1 - * @type string - */ - fileKey: string; - /** - * @type array - */ - sizes: ModelsImageSize[]; + /** + * @minLength 1 + * @type string + */ + contentType: string; + /** + * @minLength 1 + * @type string + */ + fileKey: string; + /** + * @type array + */ + sizes: ModelsImageSize[]; }; export type ModelsUploadURLResponse = { - /** - * @type string | undefined - */ - expiresAt?: string; - /** - * @type string | undefined - */ - fileKey?: string; - /** - * @type string | undefined - */ - imageId?: string; - /** - * @type array | undefined - */ - uploadUrls?: ModelsSizedUploadURL[]; + /** + * @type string | undefined + */ + expiresAt?: string; + /** + * @type string | undefined + */ + fileKey?: string; + /** + * @type string | undefined + */ + imageId?: string; + /** + * @type array | undefined + */ + uploadUrls?: ModelsSizedUploadURL[]; }; export type ModelsUser = { - /** - * @type string | undefined - */ - created_at?: string; - /** - * @type string | undefined - */ - device_token?: string; - /** - * @type string | undefined - */ - device_token_updated_at?: string; - /** - * @type string | undefined - */ - id?: string; - /** - * @type string | undefined - */ - name?: string; - /** - * @type string | undefined - */ - phone_number?: string; - /** - * @type string | undefined - */ - profile_picture?: string; - /** - * @type string | undefined - */ - timezone?: string; - /** - * @type string | undefined - */ - updated_at?: string; - /** - * @type string | undefined - */ - username?: string; + /** + * @type string | undefined + */ + created_at?: string; + /** + * @type string | undefined + */ + device_token?: string; + /** + * @type string | undefined + */ + device_token_updated_at?: string; + /** + * @type string | undefined + */ + id?: string; + /** + * @type string | undefined + */ + name?: string; + /** + * @type string | undefined + */ + phone_number?: string; + /** + * @type string | undefined + */ + profile_picture?: string; + /** + * @type string | undefined + */ + timezone?: string; + /** + * @type string | undefined + */ + updated_at?: string; + /** + * @type string | undefined + */ + username?: string; }; /** * @description Created - */ +*/ export type CreateComment201 = ModelsComment; /** * @description Bad Request - */ +*/ export type CreateComment400 = ErrsAPIError; /** * @description Unauthorized - */ +*/ export type CreateComment401 = ErrsAPIError; /** * @description Not Found - */ +*/ export type CreateComment404 = ErrsAPIError; /** * @description Unprocessable Entity - */ +*/ export type CreateComment422 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type CreateComment500 = ErrsAPIError; /** * @description Create comment request - */ +*/ export type CreateCommentMutationRequest = ModelsCreateCommentRequest; export type CreateCommentMutationResponse = CreateComment201; export type CreateCommentMutation = { - Response: CreateComment201; - Request: CreateCommentMutationRequest; - Errors: - | CreateComment400 - | CreateComment401 - | CreateComment404 - | CreateComment422 - | CreateComment500; + Response: CreateComment201; + Request: CreateCommentMutationRequest; + Errors: CreateComment400 | CreateComment401 | CreateComment404 | CreateComment422 | CreateComment500; }; export type DeleteCommentPathParams = { - /** - * @description Comment ID - * @type string - */ - commentID: string; + /** + * @description Comment ID + * @type string + */ + commentID: string; }; /** * @description No Content - */ +*/ export type DeleteComment204 = any; /** * @description Bad Request - */ +*/ export type DeleteComment400 = ErrsAPIError; /** * @description Unauthorized - */ +*/ export type DeleteComment401 = ErrsAPIError; /** * @description Not Found - */ +*/ export type DeleteComment404 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type DeleteComment500 = ErrsAPIError; export type DeleteCommentMutationResponse = DeleteComment204; export type DeleteCommentMutation = { - Response: DeleteComment204; - PathParams: DeleteCommentPathParams; - Errors: - | DeleteComment400 - | DeleteComment401 - | DeleteComment404 - | DeleteComment500; + Response: DeleteComment204; + PathParams: DeleteCommentPathParams; + Errors: DeleteComment400 | DeleteComment401 | DeleteComment404 | DeleteComment500; }; export type UpdateCommentPathParams = { - /** - * @description Comment ID - * @type string - */ - commentID: string; + /** + * @description Comment ID + * @type string + */ + commentID: string; }; /** * @description OK - */ +*/ export type UpdateComment200 = ModelsComment; /** * @description Bad Request - */ +*/ export type UpdateComment400 = ErrsAPIError; /** * @description Unauthorized - */ +*/ export type UpdateComment401 = ErrsAPIError; /** * @description Not Found - */ +*/ export type UpdateComment404 = ErrsAPIError; /** * @description Unprocessable Entity - */ +*/ export type UpdateComment422 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type UpdateComment500 = ErrsAPIError; /** * @description Update comment request - */ +*/ export type UpdateCommentMutationRequest = ModelsUpdateCommentRequest; export type UpdateCommentMutationResponse = UpdateComment200; export type UpdateCommentMutation = { - Response: UpdateComment200; - Request: UpdateCommentMutationRequest; - PathParams: UpdateCommentPathParams; - Errors: - | UpdateComment400 - | UpdateComment401 - | UpdateComment404 - | UpdateComment422 - | UpdateComment500; + Response: UpdateComment200; + Request: UpdateCommentMutationRequest; + PathParams: UpdateCommentPathParams; + Errors: UpdateComment400 | UpdateComment401 | UpdateComment404 | UpdateComment422 | UpdateComment500; }; /** * @description OK - */ +*/ export type ConfirmUpload200 = ModelsConfirmUploadResponse; /** * @description Bad Request - */ +*/ export type ConfirmUpload400 = ErrsAPIError; /** * @description Not Found - */ +*/ export type ConfirmUpload404 = ErrsAPIError; /** * @description Unprocessable Entity - */ +*/ export type ConfirmUpload422 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type ConfirmUpload500 = ErrsAPIError; /** * @description Confirm upload request - */ +*/ export type ConfirmUploadMutationRequest = ModelsConfirmUploadRequest; export type ConfirmUploadMutationResponse = ConfirmUpload200; export type ConfirmUploadMutation = { - Response: ConfirmUpload200; - Request: ConfirmUploadMutationRequest; - Errors: - | ConfirmUpload400 - | ConfirmUpload404 - | ConfirmUpload422 - | ConfirmUpload500; + Response: ConfirmUpload200; + Request: ConfirmUploadMutationRequest; + Errors: ConfirmUpload400 | ConfirmUpload404 | ConfirmUpload422 | ConfirmUpload500; }; /** * @description OK - */ +*/ export type CheckS3Health200 = ModelsS3HealthCheckResponse; /** * @description Service Unavailable - */ +*/ export type CheckS3Health503 = ErrsAPIError; export type CheckS3HealthQueryResponse = CheckS3Health200; export type CheckS3HealthQuery = { - Response: CheckS3Health200; - Errors: CheckS3Health503; + Response: CheckS3Health200; + Errors: CheckS3Health503; }; /** * @description Created - */ +*/ export type CreateUploadURLs201 = ModelsUploadURLResponse; /** * @description Bad Request - */ +*/ export type CreateUploadURLs400 = ErrsAPIError; /** * @description Unprocessable Entity - */ +*/ export type CreateUploadURLs422 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type CreateUploadURLs500 = ErrsAPIError; /** * @description Upload URL request - */ +*/ export type CreateUploadURLsMutationRequest = ModelsUploadURLRequest; export type CreateUploadURLsMutationResponse = CreateUploadURLs201; export type CreateUploadURLsMutation = { - Response: CreateUploadURLs201; - Request: CreateUploadURLsMutationRequest; - Errors: CreateUploadURLs400 | CreateUploadURLs422 | CreateUploadURLs500; + Response: CreateUploadURLs201; + Request: CreateUploadURLsMutationRequest; + Errors: CreateUploadURLs400 | CreateUploadURLs422 | CreateUploadURLs500; }; export type GetFileAllSizesPathParams = { - /** - * @description Image ID (UUID) - * @type string - */ - imageId: string; + /** + * @description Image ID (UUID) + * @type string + */ + imageId: string; }; /** * @description OK - */ +*/ export type GetFileAllSizes200 = ModelsGetFileAllSizesResponse; /** * @description Bad Request - */ +*/ export type GetFileAllSizes400 = ErrsAPIError; /** * @description Not Found - */ +*/ export type GetFileAllSizes404 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type GetFileAllSizes500 = ErrsAPIError; export type GetFileAllSizesQueryResponse = GetFileAllSizes200; export type GetFileAllSizesQuery = { - Response: GetFileAllSizes200; - PathParams: GetFileAllSizesPathParams; - Errors: GetFileAllSizes400 | GetFileAllSizes404 | GetFileAllSizes500; + Response: GetFileAllSizes200; + PathParams: GetFileAllSizesPathParams; + Errors: GetFileAllSizes400 | GetFileAllSizes404 | GetFileAllSizes500; }; export type GetFilePathParams = { - /** - * @description Image ID (UUID) - * @type string - */ - imageId: string; - /** - * @description Image size (large, medium, small) - * @type string - */ - size: string; + /** + * @description Image ID (UUID) + * @type string + */ + imageId: string; + /** + * @description Image size (large, medium, small) + * @type string + */ + size: string; }; /** * @description OK - */ +*/ export type GetFile200 = ModelsGetFileResponse; /** * @description Bad Request - */ +*/ export type GetFile400 = ErrsAPIError; /** * @description Not Found - */ +*/ export type GetFile404 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type GetFile500 = ErrsAPIError; export type GetFileQueryResponse = GetFile200; export type GetFileQuery = { - Response: GetFile200; - PathParams: GetFilePathParams; - Errors: GetFile400 | GetFile404 | GetFile500; + Response: GetFile200; + PathParams: GetFilePathParams; + Errors: GetFile400 | GetFile404 | GetFile500; }; /** * @description Created - */ +*/ export type AddMember201 = ModelsMembership; /** * @description Bad Request - */ +*/ export type AddMember400 = ErrsAPIError; /** * @description Unauthorized - */ +*/ export type AddMember401 = ErrsAPIError; /** * @description Unprocessable Entity - */ +*/ export type AddMember422 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type AddMember500 = ErrsAPIError; /** * @description Create membership request - */ +*/ export type AddMemberMutationRequest = ModelsCreateMembershipRequest; export type AddMemberMutationResponse = AddMember201; export type AddMemberMutation = { - Response: AddMember201; - Request: AddMemberMutationRequest; - Errors: AddMember400 | AddMember401 | AddMember422 | AddMember500; + Response: AddMember201; + Request: AddMemberMutationRequest; + Errors: AddMember400 | AddMember401 | AddMember422 | AddMember500; }; /** * @description OK - */ +*/ export type SendNotification200 = any; /** * @description Bad Request - */ +*/ export type SendNotification400 = ErrsAPIError; /** * @description Unprocessable Entity - */ +*/ export type SendNotification422 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type SendNotification500 = ErrsAPIError; /** * @description Notification request - */ +*/ export type SendNotificationMutationRequest = ModelsSendNotificationRequest; export type SendNotificationMutationResponse = SendNotification200; export type SendNotificationMutation = { - Response: SendNotification200; - Request: SendNotificationMutationRequest; - Errors: SendNotification400 | SendNotification422 | SendNotification500; + Response: SendNotification200; + Request: SendNotificationMutationRequest; + Errors: SendNotification400 | SendNotification422 | SendNotification500; }; /** * @description OK - */ +*/ export type SendBulkNotification200 = ModelsNotificationResponse; /** * @description Bad Request - */ +*/ export type SendBulkNotification400 = ErrsAPIError; /** * @description Unprocessable Entity - */ +*/ export type SendBulkNotification422 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type SendBulkNotification500 = ErrsAPIError; /** * @description Bulk notification request - */ -export type SendBulkNotificationMutationRequest = - ModelsSendBulkNotificationRequest; +*/ +export type SendBulkNotificationMutationRequest = ModelsSendBulkNotificationRequest; export type SendBulkNotificationMutationResponse = SendBulkNotification200; export type SendBulkNotificationMutation = { - Response: SendBulkNotification200; - Request: SendBulkNotificationMutationRequest; - Errors: - | SendBulkNotification400 - | SendBulkNotification422 - | SendBulkNotification500; + Response: SendBulkNotification200; + Request: SendBulkNotificationMutationRequest; + Errors: SendBulkNotification400 | SendBulkNotification422 | SendBulkNotification500; }; export type GetAllTripsQueryParams = { - /** - * @description Max items per page (default 20, max 100) - * @type integer | undefined - */ - limit?: number; - /** - * @description Opaque cursor from previous response next_cursor for next page - * @type string | undefined - */ - cursor?: string; + /** + * @description Max items per page (default 20, max 100) + * @type integer | undefined + */ + limit?: number; + /** + * @description Opaque cursor from previous response next_cursor for next page + * @type string | undefined + */ + cursor?: string; }; /** * @description OK - */ +*/ export type GetAllTrips200 = ModelsTripCursorPageResult; /** * @description Invalid cursor - */ +*/ export type GetAllTrips400 = ErrsAPIError; /** * @description Unauthorized - */ +*/ export type GetAllTrips401 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type GetAllTrips500 = ErrsAPIError; export type GetAllTripsQueryResponse = GetAllTrips200; export type GetAllTripsQuery = { - Response: GetAllTrips200; - QueryParams: GetAllTripsQueryParams; - Errors: GetAllTrips400 | GetAllTrips401 | GetAllTrips500; + Response: GetAllTrips200; + QueryParams: GetAllTripsQueryParams; + Errors: GetAllTrips400 | GetAllTrips401 | GetAllTrips500; }; /** * @description Created - */ +*/ export type CreateTrip201 = ModelsTrip; /** * @description Bad Request - */ +*/ export type CreateTrip400 = ErrsAPIError; /** * @description Unauthorized - */ +*/ export type CreateTrip401 = ErrsAPIError; /** * @description Unprocessable Entity - */ +*/ export type CreateTrip422 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type CreateTrip500 = ErrsAPIError; /** * @description Create trip request - */ +*/ export type CreateTripMutationRequest = ModelsCreateTripRequest; export type CreateTripMutationResponse = CreateTrip201; export type CreateTripMutation = { - Response: CreateTrip201; - Request: CreateTripMutationRequest; - Errors: CreateTrip400 | CreateTrip401 | CreateTrip422 | CreateTrip500; + Response: CreateTrip201; + Request: CreateTripMutationRequest; + Errors: CreateTrip400 | CreateTrip401 | CreateTrip422 | CreateTrip500; }; export type GetTripPathParams = { - /** - * @description Trip ID - * @type string - */ - tripID: string; + /** + * @description Trip ID + * @type string + */ + tripID: string; }; /** * @description OK - */ +*/ export type GetTrip200 = ModelsTripAPIResponse; /** * @description Bad Request - */ +*/ export type GetTrip400 = ErrsAPIError; /** * @description Not Found - */ +*/ export type GetTrip404 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type GetTrip500 = ErrsAPIError; export type GetTripQueryResponse = GetTrip200; export type GetTripQuery = { - Response: GetTrip200; - PathParams: GetTripPathParams; - Errors: GetTrip400 | GetTrip404 | GetTrip500; + Response: GetTrip200; + PathParams: GetTripPathParams; + Errors: GetTrip400 | GetTrip404 | GetTrip500; }; export type DeleteTripPathParams = { - /** - * @description Trip ID - * @type string - */ - tripID: string; + /** + * @description Trip ID + * @type string + */ + tripID: string; }; /** * @description No Content - */ +*/ export type DeleteTrip204 = any; /** * @description Bad Request - */ +*/ export type DeleteTrip400 = ErrsAPIError; /** * @description Unauthorized - */ +*/ export type DeleteTrip401 = ErrsAPIError; /** * @description Not Found - */ +*/ export type DeleteTrip404 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type DeleteTrip500 = ErrsAPIError; export type DeleteTripMutationResponse = DeleteTrip204; export type DeleteTripMutation = { - Response: DeleteTrip204; - PathParams: DeleteTripPathParams; - Errors: DeleteTrip400 | DeleteTrip401 | DeleteTrip404 | DeleteTrip500; + Response: DeleteTrip204; + PathParams: DeleteTripPathParams; + Errors: DeleteTrip400 | DeleteTrip401 | DeleteTrip404 | DeleteTrip500; }; export type UpdateTripPathParams = { - /** - * @description Trip ID - * @type string - */ - tripID: string; + /** + * @description Trip ID + * @type string + */ + tripID: string; }; /** * @description OK - */ +*/ export type UpdateTrip200 = ModelsTrip; /** * @description Bad Request - */ +*/ export type UpdateTrip400 = ErrsAPIError; /** * @description Unauthorized - */ +*/ export type UpdateTrip401 = ErrsAPIError; /** * @description Not Found - */ +*/ export type UpdateTrip404 = ErrsAPIError; /** * @description Unprocessable Entity - */ +*/ export type UpdateTrip422 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type UpdateTrip500 = ErrsAPIError; /** * @description Update trip request - */ +*/ export type UpdateTripMutationRequest = ModelsUpdateTripRequest; export type UpdateTripMutationResponse = UpdateTrip200; export type UpdateTripMutation = { - Response: UpdateTrip200; - Request: UpdateTripMutationRequest; - PathParams: UpdateTripPathParams; - Errors: - | UpdateTrip400 - | UpdateTrip401 - | UpdateTrip404 - | UpdateTrip422 - | UpdateTrip500; + Response: UpdateTrip200; + Request: UpdateTripMutationRequest; + PathParams: UpdateTripPathParams; + Errors: UpdateTrip400 | UpdateTrip401 | UpdateTrip404 | UpdateTrip422 | UpdateTrip500; }; export type GetTripMembersPathParams = { - /** - * @description Trip ID - * @type string - */ - tripID: string; + /** + * @description Trip ID + * @type string + */ + tripID: string; }; export type GetTripMembersQueryParams = { - /** - * @description Max items per page (default 20, max 100) - * @type integer | undefined - */ - limit?: number; - /** - * @description Opaque cursor returned in next_cursor - * @type string | undefined - */ - cursor?: string; + /** + * @description Max items per page (default 20, max 100) + * @type integer | undefined + */ + limit?: number; + /** + * @description Opaque cursor returned in next_cursor + * @type string | undefined + */ + cursor?: string; }; /** * @description OK - */ +*/ export type GetTripMembers200 = ModelsMembershipCursorPageResult; /** * @description Bad Request - */ +*/ export type GetTripMembers400 = ErrsAPIError; /** * @description Unauthorized - */ +*/ export type GetTripMembers401 = ErrsAPIError; /** * @description Not Found - */ +*/ export type GetTripMembers404 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type GetTripMembers500 = ErrsAPIError; export type GetTripMembersQueryResponse = GetTripMembers200; export type GetTripMembersQuery = { - Response: GetTripMembers200; - PathParams: GetTripMembersPathParams; - QueryParams: GetTripMembersQueryParams; - Errors: - | GetTripMembers400 - | GetTripMembers401 - | GetTripMembers404 - | GetTripMembers500; + Response: GetTripMembers200; + PathParams: GetTripMembersPathParams; + QueryParams: GetTripMembersQueryParams; + Errors: GetTripMembers400 | GetTripMembers401 | GetTripMembers404 | GetTripMembers500; }; export type GetMembershipPathParams = { - /** - * @description Trip ID - * @type string - */ - tripID: string; - /** - * @description User ID - * @type string - */ - userID: string; + /** + * @description Trip ID + * @type string + */ + tripID: string; + /** + * @description User ID + * @type string + */ + userID: string; }; /** * @description OK - */ +*/ export type GetMembership200 = ModelsMembershipAPIResponse; /** * @description Bad Request - */ +*/ export type GetMembership400 = ErrsAPIError; /** * @description Unauthorized - */ +*/ export type GetMembership401 = ErrsAPIError; /** * @description Not Found - */ +*/ export type GetMembership404 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type GetMembership500 = ErrsAPIError; export type GetMembershipQueryResponse = GetMembership200; export type GetMembershipQuery = { - Response: GetMembership200; - PathParams: GetMembershipPathParams; - Errors: - | GetMembership400 - | GetMembership401 - | GetMembership404 - | GetMembership500; + Response: GetMembership200; + PathParams: GetMembershipPathParams; + Errors: GetMembership400 | GetMembership401 | GetMembership404 | GetMembership500; }; export type RemoveMemberPathParams = { - /** - * @description Trip ID - * @type string - */ - tripID: string; - /** - * @description User ID - * @type string - */ - userID: string; + /** + * @description Trip ID + * @type string + */ + tripID: string; + /** + * @description User ID + * @type string + */ + userID: string; }; /** * @description No Content - */ +*/ export type RemoveMember204 = any; /** * @description Bad Request - */ +*/ export type RemoveMember400 = ErrsAPIError; /** * @description Unauthorized - */ +*/ export type RemoveMember401 = ErrsAPIError; /** * @description Not Found - */ +*/ export type RemoveMember404 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type RemoveMember500 = ErrsAPIError; export type RemoveMemberMutationResponse = RemoveMember204; export type RemoveMemberMutation = { - Response: RemoveMember204; - PathParams: RemoveMemberPathParams; - Errors: RemoveMember400 | RemoveMember401 | RemoveMember404 | RemoveMember500; + Response: RemoveMember204; + PathParams: RemoveMemberPathParams; + Errors: RemoveMember400 | RemoveMember401 | RemoveMember404 | RemoveMember500; }; export type UpdateMembershipPathParams = { - /** - * @description Trip ID - * @type string - */ - tripID: string; - /** - * @description User ID - * @type string - */ - userID: string; + /** + * @description Trip ID + * @type string + */ + tripID: string; + /** + * @description User ID + * @type string + */ + userID: string; }; /** * @description OK - */ +*/ export type UpdateMembership200 = ModelsMembership; /** * @description Bad Request - */ +*/ export type UpdateMembership400 = ErrsAPIError; /** * @description Unauthorized - */ +*/ export type UpdateMembership401 = ErrsAPIError; /** * @description Not Found - */ +*/ export type UpdateMembership404 = ErrsAPIError; /** * @description Unprocessable Entity - */ +*/ export type UpdateMembership422 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type UpdateMembership500 = ErrsAPIError; /** * @description Update membership request - */ +*/ export type UpdateMembershipMutationRequest = ModelsUpdateMembershipRequest; export type UpdateMembershipMutationResponse = UpdateMembership200; export type UpdateMembershipMutation = { - Response: UpdateMembership200; - Request: UpdateMembershipMutationRequest; - PathParams: UpdateMembershipPathParams; - Errors: - | UpdateMembership400 - | UpdateMembership401 - | UpdateMembership404 - | UpdateMembership422 - | UpdateMembership500; + Response: UpdateMembership200; + Request: UpdateMembershipMutationRequest; + PathParams: UpdateMembershipPathParams; + Errors: UpdateMembership400 | UpdateMembership401 | UpdateMembership404 | UpdateMembership422 | UpdateMembership500; }; export type DemoteFromAdminPathParams = { - /** - * @description Trip ID - * @type string - */ - tripID: string; - /** - * @description User ID - * @type string - */ - userID: string; + /** + * @description Trip ID + * @type string + */ + tripID: string; + /** + * @description User ID + * @type string + */ + userID: string; }; /** * @description OK - */ +*/ export type DemoteFromAdmin200 = { - [key: string]: string; + [key: string]: string; }; /** * @description Bad Request - */ +*/ export type DemoteFromAdmin400 = ErrsAPIError; /** * @description Unauthorized - */ +*/ export type DemoteFromAdmin401 = ErrsAPIError; /** * @description Not Found - */ +*/ export type DemoteFromAdmin404 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type DemoteFromAdmin500 = ErrsAPIError; export type DemoteFromAdminMutationResponse = DemoteFromAdmin200; export type DemoteFromAdminMutation = { - Response: DemoteFromAdmin200; - PathParams: DemoteFromAdminPathParams; - Errors: - | DemoteFromAdmin400 - | DemoteFromAdmin401 - | DemoteFromAdmin404 - | DemoteFromAdmin500; + Response: DemoteFromAdmin200; + PathParams: DemoteFromAdminPathParams; + Errors: DemoteFromAdmin400 | DemoteFromAdmin401 | DemoteFromAdmin404 | DemoteFromAdmin500; }; export type PromoteToAdminPathParams = { - /** - * @description Trip ID - * @type string - */ - tripID: string; - /** - * @description User ID - * @type string - */ - userID: string; + /** + * @description Trip ID + * @type string + */ + tripID: string; + /** + * @description User ID + * @type string + */ + userID: string; }; /** * @description OK - */ +*/ export type PromoteToAdmin200 = { - [key: string]: string; + [key: string]: string; }; /** * @description Bad Request - */ +*/ export type PromoteToAdmin400 = ErrsAPIError; /** * @description Unauthorized - */ +*/ export type PromoteToAdmin401 = ErrsAPIError; /** * @description Not Found - */ +*/ export type PromoteToAdmin404 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type PromoteToAdmin500 = ErrsAPIError; export type PromoteToAdminMutationResponse = PromoteToAdmin200; export type PromoteToAdminMutation = { - Response: PromoteToAdmin200; - PathParams: PromoteToAdminPathParams; - Errors: - | PromoteToAdmin400 - | PromoteToAdmin401 - | PromoteToAdmin404 - | PromoteToAdmin500; + Response: PromoteToAdmin200; + PathParams: PromoteToAdminPathParams; + Errors: PromoteToAdmin400 | PromoteToAdmin401 | PromoteToAdmin404 | PromoteToAdmin500; +}; + +export type ListPitchesPathParams = { + /** + * @description Trip ID + * @type string + */ + tripID: string; +}; + +export type ListPitchesQueryParams = { + /** + * @description Max items per page (default 20, max 100) + * @type integer | undefined + */ + limit?: number; + /** + * @description Opaque cursor from previous response next_cursor + * @type string | undefined + */ + cursor?: string; +}; + +/** + * @description OK +*/ +export type ListPitches200 = ModelsPitchCursorPageResult; + +/** + * @description Bad Request +*/ +export type ListPitches400 = ErrsAPIError; + +/** + * @description Not Found +*/ +export type ListPitches404 = ErrsAPIError; + +/** + * @description Internal Server Error +*/ +export type ListPitches500 = ErrsAPIError; + +export type ListPitchesQueryResponse = ListPitches200; + +export type ListPitchesQuery = { + Response: ListPitches200; + PathParams: ListPitchesPathParams; + QueryParams: ListPitchesQueryParams; + Errors: ListPitches400 | ListPitches404 | ListPitches500; +}; + +export type CreatePitchPathParams = { + /** + * @description Trip ID + * @type string + */ + tripID: string; +}; + +/** + * @description Created +*/ +export type CreatePitch201 = ModelsCreatePitchResponse; + +/** + * @description Bad Request +*/ +export type CreatePitch400 = ErrsAPIError; + +/** + * @description Forbidden +*/ +export type CreatePitch403 = ErrsAPIError; + +/** + * @description Unprocessable Entity +*/ +export type CreatePitch422 = ErrsAPIError; + +/** + * @description Internal Server Error +*/ +export type CreatePitch500 = ErrsAPIError; + +/** + * @description Create pitch request +*/ +export type CreatePitchMutationRequest = ModelsCreatePitchRequest; + +export type CreatePitchMutationResponse = CreatePitch201; + +export type CreatePitchMutation = { + Response: CreatePitch201; + Request: CreatePitchMutationRequest; + PathParams: CreatePitchPathParams; + Errors: CreatePitch400 | CreatePitch403 | CreatePitch422 | CreatePitch500; +}; + +export type GetPitchPathParams = { + /** + * @description Trip ID + * @type string + */ + tripID: string; + /** + * @description Pitch ID + * @type string + */ + pitchID: string; +}; + +/** + * @description OK +*/ +export type GetPitch200 = ModelsPitchAPIResponse; + +/** + * @description Bad Request +*/ +export type GetPitch400 = ErrsAPIError; + +/** + * @description Not Found +*/ +export type GetPitch404 = ErrsAPIError; + +/** + * @description Internal Server Error +*/ +export type GetPitch500 = ErrsAPIError; + +export type GetPitchQueryResponse = GetPitch200; + +export type GetPitchQuery = { + Response: GetPitch200; + PathParams: GetPitchPathParams; + Errors: GetPitch400 | GetPitch404 | GetPitch500; +}; + +export type DeletePitchPathParams = { + /** + * @description Trip ID + * @type string + */ + tripID: string; + /** + * @description Pitch ID + * @type string + */ + pitchID: string; +}; + +/** + * @description No Content +*/ +export type DeletePitch204 = any; + +/** + * @description Bad Request +*/ +export type DeletePitch400 = ErrsAPIError; + +/** + * @description Not Found +*/ +export type DeletePitch404 = ErrsAPIError; + +/** + * @description Internal Server Error +*/ +export type DeletePitch500 = ErrsAPIError; + +export type DeletePitchMutationResponse = DeletePitch204; + +export type DeletePitchMutation = { + Response: DeletePitch204; + PathParams: DeletePitchPathParams; + Errors: DeletePitch400 | DeletePitch404 | DeletePitch500; +}; + +export type UpdatePitchPathParams = { + /** + * @description Trip ID + * @type string + */ + tripID: string; + /** + * @description Pitch ID + * @type string + */ + pitchID: string; +}; + +/** + * @description OK +*/ +export type UpdatePitch200 = ModelsPitchAPIResponse; + +/** + * @description Bad Request +*/ +export type UpdatePitch400 = ErrsAPIError; + +/** + * @description Not Found +*/ +export type UpdatePitch404 = ErrsAPIError; + +/** + * @description Unprocessable Entity +*/ +export type UpdatePitch422 = ErrsAPIError; + +/** + * @description Internal Server Error +*/ +export type UpdatePitch500 = ErrsAPIError; + +/** + * @description Update pitch request +*/ +export type UpdatePitchMutationRequest = ModelsUpdatePitchRequest; + +export type UpdatePitchMutationResponse = UpdatePitch200; + +export type UpdatePitchMutation = { + Response: UpdatePitch200; + Request: UpdatePitchMutationRequest; + PathParams: UpdatePitchPathParams; + Errors: UpdatePitch400 | UpdatePitch404 | UpdatePitch422 | UpdatePitch500; }; export type GetPaginatedCommentsPathParams = { - /** - * @description Trip ID - * @type string - */ - tripID: string; - /** - * @description Entity type (activity, pitch) - * @type string - */ - entityType: string; - /** - * @description Entity ID - * @type string - */ - entityID: string; + /** + * @description Trip ID + * @type string + */ + tripID: string; + /** + * @description Entity type (activity, pitch) + * @type string + */ + entityType: string; + /** + * @description Entity ID + * @type string + */ + entityID: string; }; export type GetPaginatedCommentsQueryParams = { - /** - * @description Max items per page (default 20, max 100) - * @type integer | undefined - */ - limit?: number; - /** - * @description Opaque cursor returned in next_cursor - * @type string | undefined - */ - cursor?: string; + /** + * @description Max items per page (default 20, max 100) + * @type integer | undefined + */ + limit?: number; + /** + * @description Opaque cursor returned in next_cursor + * @type string | undefined + */ + cursor?: string; }; /** * @description OK - */ +*/ export type GetPaginatedComments200 = ModelsPaginatedCommentsResponse; /** * @description Bad Request - */ +*/ export type GetPaginatedComments400 = ErrsAPIError; /** * @description Unauthorized - */ +*/ export type GetPaginatedComments401 = ErrsAPIError; /** * @description Not Found - */ +*/ export type GetPaginatedComments404 = ErrsAPIError; /** * @description Unprocessable Entity - */ +*/ export type GetPaginatedComments422 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type GetPaginatedComments500 = ErrsAPIError; export type GetPaginatedCommentsQueryResponse = GetPaginatedComments200; export type GetPaginatedCommentsQuery = { - Response: GetPaginatedComments200; - PathParams: GetPaginatedCommentsPathParams; - QueryParams: GetPaginatedCommentsQueryParams; - Errors: - | GetPaginatedComments400 - | GetPaginatedComments401 - | GetPaginatedComments404 - | GetPaginatedComments422 - | GetPaginatedComments500; + Response: GetPaginatedComments200; + PathParams: GetPaginatedCommentsPathParams; + QueryParams: GetPaginatedCommentsQueryParams; + Errors: GetPaginatedComments400 | GetPaginatedComments401 | GetPaginatedComments404 | GetPaginatedComments422 | GetPaginatedComments500; }; /** * @description Created - */ +*/ export type CreateUser201 = ModelsUser; /** * @description Bad Request - */ +*/ export type CreateUser400 = ErrsAPIError; /** * @description Unprocessable Entity - */ +*/ export type CreateUser422 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type CreateUser500 = ErrsAPIError; /** * @description Create user request - */ +*/ export type CreateUserMutationRequest = ModelsCreateUserRequest; export type CreateUserMutationResponse = CreateUser201; export type CreateUserMutation = { - Response: CreateUser201; - Request: CreateUserMutationRequest; - Errors: CreateUser400 | CreateUser422 | CreateUser500; + Response: CreateUser201; + Request: CreateUserMutationRequest; + Errors: CreateUser400 | CreateUser422 | CreateUser500; }; /** * @description OK - */ +*/ export type GetCurrentUser200 = ModelsUser; /** * @description Unauthorized - */ +*/ export type GetCurrentUser401 = ErrsAPIError; /** * @description Not Found - */ +*/ export type GetCurrentUser404 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type GetCurrentUser500 = ErrsAPIError; export type GetCurrentUserQueryResponse = GetCurrentUser200; export type GetCurrentUserQuery = { - Response: GetCurrentUser200; - Errors: GetCurrentUser401 | GetCurrentUser404 | GetCurrentUser500; + Response: GetCurrentUser200; + Errors: GetCurrentUser401 | GetCurrentUser404 | GetCurrentUser500; }; export type GetUserPathParams = { - /** - * @description User ID - * @type string - */ - userID: string; + /** + * @description User ID + * @type string + */ + userID: string; }; /** * @description OK - */ +*/ export type GetUser200 = ModelsUser; /** * @description Bad Request - */ +*/ export type GetUser400 = ErrsAPIError; /** * @description Not Found - */ +*/ export type GetUser404 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type GetUser500 = ErrsAPIError; export type GetUserQueryResponse = GetUser200; export type GetUserQuery = { - Response: GetUser200; - PathParams: GetUserPathParams; - Errors: GetUser400 | GetUser404 | GetUser500; + Response: GetUser200; + PathParams: GetUserPathParams; + Errors: GetUser400 | GetUser404 | GetUser500; }; export type DeleteUserPathParams = { - /** - * @description User ID - * @type string - */ - userID: string; + /** + * @description User ID + * @type string + */ + userID: string; }; /** * @description No Content - */ +*/ export type DeleteUser204 = any; /** * @description Bad Request - */ +*/ export type DeleteUser400 = ErrsAPIError; /** * @description Not Found - */ +*/ export type DeleteUser404 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type DeleteUser500 = ErrsAPIError; export type DeleteUserMutationResponse = DeleteUser204; export type DeleteUserMutation = { - Response: DeleteUser204; - PathParams: DeleteUserPathParams; - Errors: DeleteUser400 | DeleteUser404 | DeleteUser500; + Response: DeleteUser204; + PathParams: DeleteUserPathParams; + Errors: DeleteUser400 | DeleteUser404 | DeleteUser500; }; export type UpdateUserPathParams = { - /** - * @description User ID - * @type string - */ - userID: string; + /** + * @description User ID + * @type string + */ + userID: string; }; /** * @description OK - */ +*/ export type UpdateUser200 = ModelsUser; /** * @description Bad Request - */ +*/ export type UpdateUser400 = ErrsAPIError; /** * @description Not Found - */ +*/ export type UpdateUser404 = ErrsAPIError; /** * @description Unprocessable Entity - */ +*/ export type UpdateUser422 = ErrsAPIError; /** * @description Internal Server Error - */ +*/ export type UpdateUser500 = ErrsAPIError; /** * @description Update user request - */ +*/ export type UpdateUserMutationRequest = ModelsUpdateUserRequest; export type UpdateUserMutationResponse = UpdateUser200; export type UpdateUserMutation = { - Response: UpdateUser200; - Request: UpdateUserMutationRequest; - PathParams: UpdateUserPathParams; - Errors: UpdateUser400 | UpdateUser404 | UpdateUser422 | UpdateUser500; + Response: UpdateUser200; + Request: UpdateUserMutationRequest; + PathParams: UpdateUserPathParams; + Errors: UpdateUser400 | UpdateUser404 | UpdateUser422 | UpdateUser500; }; /** * @description OK - */ +*/ export type Healthcheck200 = { - [key: string]: any; + [key: string]: any; }; /** * @description Internal Server Error - */ +*/ export type Healthcheck500 = { - [key: string]: any; + [key: string]: any; }; export type HealthcheckQueryResponse = Healthcheck200; export type HealthcheckQuery = { - Response: Healthcheck200; - Errors: Healthcheck500; -}; + Response: Healthcheck200; + Errors: Healthcheck500; +}; \ No newline at end of file From 3125ea0f9fbd8afb358a6df50a23c68ef32635a9 Mon Sep 17 00:00:00 2001 From: amoghathimamula Date: Fri, 13 Feb 2026 19:20:16 -0500 Subject: [PATCH 6/6] feat: added tests --- .../tests/mocks/mock_S3PresignClient.go | 2 +- backend/internal/tests/pitch_test.go | 340 ++++++++++++++++++ 2 files changed, 341 insertions(+), 1 deletion(-) create mode 100644 backend/internal/tests/pitch_test.go diff --git a/backend/internal/tests/mocks/mock_S3PresignClient.go b/backend/internal/tests/mocks/mock_S3PresignClient.go index 6310cc4..711c8fc 100644 --- a/backend/internal/tests/mocks/mock_S3PresignClient.go +++ b/backend/internal/tests/mocks/mock_S3PresignClient.go @@ -7,7 +7,7 @@ package mocks import ( "context" - v4 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/s3" mock "github.com/stretchr/testify/mock" ) diff --git a/backend/internal/tests/pitch_test.go b/backend/internal/tests/pitch_test.go new file mode 100644 index 0000000..454fe22 --- /dev/null +++ b/backend/internal/tests/pitch_test.go @@ -0,0 +1,340 @@ +package tests + +import ( + "net/http" + "testing" + "toggo/internal/config" + "toggo/internal/models" + testkit "toggo/internal/tests/testkit/builders" + "toggo/internal/tests/testkit/fakes" + + "github.com/gofiber/fiber/v2" + "github.com/google/uuid" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +// Pitch endpoints use S3 for presigned URLs. To run Create/Get/List/Update tests that return +// audio_url, configure S3 (e.g. LocalStack: S3_ENDPOINT, S3_BUCKET_NAME, AWS_ACCESS_KEY_ID, +// AWS_SECRET_ACCESS_KEY, AWS_REGION). Tests that need S3 call requireS3(t) and skip when not configured. + +func requireS3(t *testing.T) { + t.Helper() + cfg, err := config.LoadConfiguration() + require.NoError(t, err) + if cfg == nil || cfg.AWS.BucketName == "" { + t.Skip("S3 not configured (set S3_BUCKET_NAME and AWS env for LocalStack to run pitch presign tests)") + } +} + +/* ========================= + Helpers +=========================*/ + +func createPitch(t *testing.T, app *fiber.App, userID, tripID string, title, contentType string) (pitchID string, uploadURL string) { + requireS3(t) + resp := testkit.New(t). + Request(testkit.Request{ + App: app, + Route: "/api/v1/trips/" + tripID + "/pitches", + Method: testkit.POST, + UserID: &userID, + Body: models.CreatePitchRequest{ + Title: title, + Description: "", + ContentType: contentType, + }, + }). + AssertStatus(http.StatusCreated). + AssertFieldExists("pitch"). + AssertFieldExists("upload_url"). + GetBody() + + pitch := resp["pitch"].(map[string]any) + pitchID = pitch["id"].(string) + uploadURL = resp["upload_url"].(string) + return pitchID, uploadURL +} + +/* ========================= + CREATE +=========================*/ + +func TestPitchCreate(t *testing.T) { + app := fakes.GetSharedTestApp() + userID := createTestUser(t, app, "PitchUser", fakes.GenerateRandomUsername(), fakes.GenerateRandomPhoneNumber()) + tripID := createTestTrip(t, app, userID, "PitchTrip", 100, 500) + + t.Run("creates pitch and returns upload_url", func(t *testing.T) { + requireS3(t) + resp := testkit.New(t). + Request(testkit.Request{ + App: app, + Route: "/api/v1/trips/" + tripID + "/pitches", + Method: testkit.POST, + UserID: &userID, + Body: models.CreatePitchRequest{ + Title: "My pitch", + Description: "Optional desc", + ContentType: "audio/mpeg", + }, + }). + AssertStatus(http.StatusCreated). + AssertFieldExists("pitch"). + AssertFieldExists("upload_url"). + AssertFieldExists("expires_at"). + GetBody() + + pitch := resp["pitch"].(map[string]any) + assert.Equal(t, "My pitch", pitch["title"]) + assert.Equal(t, "Optional desc", pitch["description"]) + assert.NotEmpty(t, pitch["id"]) + assert.Equal(t, tripID, pitch["trip_id"]) + assert.Equal(t, userID, pitch["user_id"]) + assert.NotEmpty(t, resp["upload_url"]) + }) + + t.Run("invalid trip ID returns 400", func(t *testing.T) { + testkit.New(t). + Request(testkit.Request{ + App: app, + Route: "/api/v1/trips/not-a-uuid/pitches", + Method: testkit.POST, + UserID: &userID, + Body: models.CreatePitchRequest{ + Title: "Pitch", + ContentType: "audio/mpeg", + }, + }). + AssertStatus(http.StatusBadRequest) + }) + + t.Run("validation error returns 422", func(t *testing.T) { + testkit.New(t). + Request(testkit.Request{ + App: app, + Route: "/api/v1/trips/" + tripID + "/pitches", + Method: testkit.POST, + UserID: &userID, + Body: models.CreatePitchRequest{ + Title: "", + ContentType: "audio/mpeg", + }, + }). + AssertStatus(http.StatusUnprocessableEntity) + }) + + t.Run("non-member gets 404", func(t *testing.T) { + otherUser := createTestUser(t, app, "Other", fakes.GenerateRandomUsername(), fakes.GenerateRandomPhoneNumber()) + testkit.New(t). + Request(testkit.Request{ + App: app, + Route: "/api/v1/trips/" + tripID + "/pitches", + Method: testkit.POST, + UserID: &otherUser, + Body: models.CreatePitchRequest{ + Title: "Pitch", + ContentType: "audio/mpeg", + }, + }). + AssertStatus(http.StatusNotFound) + }) +} + +/* ========================= + LIST +=========================*/ + +func TestPitchList(t *testing.T) { + app := fakes.GetSharedTestApp() + userID := createTestUser(t, app, "ListUser", fakes.GenerateRandomUsername(), fakes.GenerateRandomPhoneNumber()) + tripID := createTestTrip(t, app, userID, "ListTrip", 100, 500) + + t.Run("returns empty list", func(t *testing.T) { + resp := testkit.New(t). + Request(testkit.Request{ + App: app, + Route: "/api/v1/trips/" + tripID + "/pitches", + Method: testkit.GET, + UserID: &userID, + }). + AssertStatus(http.StatusOK). + AssertField("limit", float64(20)). + AssertFieldExists("items"). + GetBody() + items, ok := resp["items"].([]any) + require.True(t, ok) + assert.Len(t, items, 0) + }) + + t.Run("returns pitches with audio_url when S3 configured", func(t *testing.T) { + _, _ = createPitch(t, app, userID, tripID, "P1", "audio/mpeg") + requireS3(t) + resp := testkit.New(t). + Request(testkit.Request{ + App: app, + Route: "/api/v1/trips/" + tripID + "/pitches", + Method: testkit.GET, + UserID: &userID, + }). + AssertStatus(http.StatusOK). + GetBody() + items, ok := resp["items"].([]any) + require.True(t, ok) + require.GreaterOrEqual(t, len(items), 1) + first := items[0].(map[string]any) + assert.Equal(t, "P1", first["title"]) + assert.Contains(t, first, "audio_url") + }) + + t.Run("invalid trip ID returns 400", func(t *testing.T) { + testkit.New(t). + Request(testkit.Request{ + App: app, + Route: "/api/v1/trips/bad-uuid/pitches", + Method: testkit.GET, + UserID: &userID, + }). + AssertStatus(http.StatusBadRequest) + }) +} + +/* ========================= + GET +=========================*/ + +func TestPitchGet(t *testing.T) { + app := fakes.GetSharedTestApp() + userID := createTestUser(t, app, "GetUser", fakes.GenerateRandomUsername(), fakes.GenerateRandomPhoneNumber()) + tripID := createTestTrip(t, app, userID, "GetTrip", 100, 500) + + t.Run("returns pitch when S3 configured", func(t *testing.T) { + pitchID, _ := createPitch(t, app, userID, tripID, "GetMe", "audio/wav") + requireS3(t) + resp := testkit.New(t). + Request(testkit.Request{ + App: app, + Route: "/api/v1/trips/" + tripID + "/pitches/" + pitchID, + Method: testkit.GET, + UserID: &userID, + }). + AssertStatus(http.StatusOK). + GetBody() + assert.Equal(t, "GetMe", resp["title"]) + assert.Equal(t, pitchID, resp["id"]) + assert.Contains(t, resp, "audio_url") + }) + + t.Run("not found returns 404", func(t *testing.T) { + badID := uuid.New().String() + testkit.New(t). + Request(testkit.Request{ + App: app, + Route: "/api/v1/trips/" + tripID + "/pitches/" + badID, + Method: testkit.GET, + UserID: &userID, + }). + AssertStatus(http.StatusNotFound) + }) + + t.Run("invalid pitch ID returns 400", func(t *testing.T) { + testkit.New(t). + Request(testkit.Request{ + App: app, + Route: "/api/v1/trips/" + tripID + "/pitches/not-a-uuid", + Method: testkit.GET, + UserID: &userID, + }). + AssertStatus(http.StatusBadRequest) + }) +} + +/* ========================= + UPDATE +=========================*/ + +func TestPitchUpdate(t *testing.T) { + app := fakes.GetSharedTestApp() + userID := createTestUser(t, app, "UpdateUser", fakes.GenerateRandomUsername(), fakes.GenerateRandomPhoneNumber()) + tripID := createTestTrip(t, app, userID, "UpdateTrip", 100, 500) + + t.Run("updates pitch when S3 configured", func(t *testing.T) { + pitchID, _ := createPitch(t, app, userID, tripID, "Original", "audio/mpeg") + requireS3(t) + duration := 120 + testkit.New(t). + Request(testkit.Request{ + App: app, + Route: "/api/v1/trips/" + tripID + "/pitches/" + pitchID, + Method: testkit.PATCH, + UserID: &userID, + Body: models.UpdatePitchRequest{ + Title: strPtr("Updated title"), + Description: strPtr("Updated desc"), + Duration: &duration, + }, + }). + AssertStatus(http.StatusOK). + AssertField("title", "Updated title"). + AssertField("description", "Updated desc"). + AssertField("duration", float64(120)) + }) + + t.Run("not found returns 404", func(t *testing.T) { + badID := uuid.New().String() + title := "No" + testkit.New(t). + Request(testkit.Request{ + App: app, + Route: "/api/v1/trips/" + tripID + "/pitches/" + badID, + Method: testkit.PATCH, + UserID: &userID, + Body: models.UpdatePitchRequest{Title: &title}, + }). + AssertStatus(http.StatusNotFound) + }) +} + +func strPtr(s string) *string { return &s } + +/* ========================= + DELETE +=========================*/ + +func TestPitchDelete(t *testing.T) { + app := fakes.GetSharedTestApp() + userID := createTestUser(t, app, "DelUser", fakes.GenerateRandomUsername(), fakes.GenerateRandomPhoneNumber()) + tripID := createTestTrip(t, app, userID, "DelTrip", 100, 500) + + t.Run("deletes pitch", func(t *testing.T) { + pitchID, _ := createPitch(t, app, userID, tripID, "ToDelete", "audio/mpeg") + testkit.New(t). + Request(testkit.Request{ + App: app, + Route: "/api/v1/trips/" + tripID + "/pitches/" + pitchID, + Method: testkit.DELETE, + UserID: &userID, + }). + AssertStatus(http.StatusNoContent) + testkit.New(t). + Request(testkit.Request{ + App: app, + Route: "/api/v1/trips/" + tripID + "/pitches/" + pitchID, + Method: testkit.GET, + UserID: &userID, + }). + AssertStatus(http.StatusNotFound) + }) + + t.Run("not found returns 404", func(t *testing.T) { + badID := uuid.New().String() + testkit.New(t). + Request(testkit.Request{ + App: app, + Route: "/api/v1/trips/" + tripID + "/pitches/" + badID, + Method: testkit.DELETE, + UserID: &userID, + }). + AssertStatus(http.StatusNotFound) + }) +}