diff --git a/api/externals/controller/campus_donation_controller.go b/api/externals/controller/campus_donation_controller.go new file mode 100644 index 00000000..23c0e7b3 --- /dev/null +++ b/api/externals/controller/campus_donation_controller.go @@ -0,0 +1,52 @@ +package controller + +import ( + "net/http" + + "github.com/NUTFes/FinanSu/api/internals/usecase" + "github.com/labstack/echo/v4" +) + +type campusDonationController struct { + u usecase.CampusDonationUseCase +} + +type CampusDonationController interface { + IndexCampusDonationByFloor(echo.Context) error + IndexCampusDonationBuildingByPeriod(echo.Context) error +} + +func NewCampusDonationController(u usecase.CampusDonationUseCase) CampusDonationController { + return &campusDonationController{u} +} + +func (cdc *campusDonationController) IndexCampusDonationByFloor(c echo.Context) error { + ctx := c.Request().Context() + buildingId := c.Param("building_id") + floorId := c.Param("floor_id") + + if buildingId == "" { + return c.String(http.StatusBadRequest, "building_id is required") + } + + if floorId == "" { + return c.String(http.StatusBadRequest, "floor_id is required") + } + + campusDonationByFloors, err := cdc.u.GetCampusDonationByFloors(ctx, buildingId, floorId) + if err != nil { + return c.String(http.StatusBadRequest, "failed to get campus donation by floor") + } + + return c.JSON(http.StatusOK, campusDonationByFloors) +} + +func (f *campusDonationController) IndexCampusDonationBuildingByPeriod(c echo.Context) error { + ctx := c.Request().Context() + year := c.Param("year") + fundInformationBuildingByPeriod, err := f.u.GetCampusDonationBuildingByPeriod(ctx, year) + if err != nil { + return err + } + return c.JSON(http.StatusOK, fundInformationBuildingByPeriod) +} diff --git a/api/externals/repository/campus_donation_repository.go b/api/externals/repository/campus_donation_repository.go new file mode 100644 index 00000000..72a32a27 --- /dev/null +++ b/api/externals/repository/campus_donation_repository.go @@ -0,0 +1,132 @@ +package repository + +import ( + "context" + "database/sql" + "log" + + "github.com/NUTFes/FinanSu/api/drivers/db" + "github.com/NUTFes/FinanSu/api/externals/repository/abstract" + goqu "github.com/doug-martin/goqu/v9" +) + +type campusDonationRepository struct { + client db.Client + crud abstract.Crud +} + +type CampusDonationRepository interface { + AllCampusDonationByFloor(context.Context, string, string) (*sql.Rows, error) + AllBuildingsByPeriod(context.Context, string) (*sql.Rows, error) +} + +func NewCampusDonationRepository(c db.Client, ac abstract.Crud) CampusDonationRepository { + return &campusDonationRepository{c, ac} +} + +func (cdr *campusDonationRepository) AllCampusDonationByFloor(c context.Context, buildingId string, floorId string) (*sql.Rows, error) { + + query, _, err := dialect.From("buildings"). + Join( + goqu.T("building_units"), + goqu.On(goqu.Ex{"building_units.building_id": goqu.I("buildings.id")}), + ). + Join( + goqu.T("floors"), + goqu.On(goqu.Ex{"floors.building_unit_id": goqu.I("building_units.id")}), + ). + Join( + goqu.T("rooms"), + goqu.On(goqu.Ex{"rooms.floor_id": goqu.I("floors.id")}), + ). + Join( + goqu.T("room_teachers"), + goqu.On(goqu.Ex{"room_teachers.room_id": goqu.I("rooms.id")}), + ). + Join( + goqu.T("teachers"), + goqu.On(goqu.Ex{"teachers.id": goqu.I("room_teachers.teacher_id")}), + ). + LeftJoin( + goqu.T("campus_donations"), + goqu.On(goqu.Ex{"campus_donations.teacher_id": goqu.I("teachers.id")}), + ). + Select( + goqu.I("buildings.id").As("building_id"), + goqu.I("buildings.name").As("building_name"), + goqu.I("floors.id").As("floor_id"), + goqu.I("floors.floor_number").As("floor_number"), + goqu.I("teachers.id").As("teacher_id"), + goqu.I("teachers.name").As("teacher_name"), + goqu.I("rooms.room_name").As("room_name"), + goqu.I("campus_donations.price").As("price"), + goqu.I("teachers.is_black").As("is_black"), + ). + Where( + goqu.Ex{"buildings.id": buildingId, "floors.id": floorId}, + ). + Order( + goqu.I("building_units.unit_number").Asc(), + goqu.I("floors.floor_number").Asc(), + ). + ToSQL() + + if err != nil { + log.Fatal(err) + } + + return cdr.crud.Read(c, query) + +} + +func (fir *campusDonationRepository) AllBuildingsByPeriod(c context.Context, year string) (*sql.Rows, error) { + + ds := dialect.From("campus_donations"). + Select( + goqu.I("buildings.id"), + goqu.I("buildings.name"), + goqu.I("campus_donations.price"), + ). + Join(goqu.T("teachers"), goqu.On(goqu.Ex{ + "campus_donations.teacher_id": goqu.I("teachers.id"), + })). + Join(goqu.T("users"), goqu.On(goqu.Ex{ + "campus_donations.user_id": goqu.I("users.id"), + })). + Join(goqu.T("departments"), goqu.On(goqu.Ex{ + "teachers.department_id": goqu.I("departments.id"), + })). + Join(goqu.T("room_teachers"), goqu.On(goqu.Ex{ + "room_teachers.teacher_id": goqu.I("teachers.id"), + })). + Join(goqu.T("rooms"), goqu.On(goqu.Ex{ + "room_teachers.room_id": goqu.I("rooms.id"), + })). + Join(goqu.T("floors"), goqu.On(goqu.Ex{ + "rooms.floor_id": goqu.I("floors.id"), + })). + Join(goqu.T("building_units"), goqu.On(goqu.Ex{ + "floors.building_unit_id": goqu.I("building_units.id"), + })). + Join(goqu.T("buildings"), goqu.On(goqu.Ex{ + "building_units.building_id": goqu.I("buildings.id"), + })). + Join(goqu.T("year_periods"), + goqu.On(goqu.And( + goqu.I("campus_donations.created_at").Gt(goqu.I("year_periods.started_at")), + goqu.I("campus_donations.created_at").Lt(goqu.I("year_periods.ended_at")), + )), + ). + Join(goqu.T("years"), goqu.On(goqu.Ex{ + "year_periods.year_id": goqu.I("years.id"), + })). + Where(goqu.Ex{"years.year": year}). + Order(goqu.I("campus_donations.updated_at").Desc()) + + query, _, err := ds.ToSQL() + if err != nil { + panic(err) + } + + return fir.crud.Read(c, query) +} diff --git a/api/generated/openapi_gen.go b/api/generated/openapi_gen.go index 5742f1d3..381d7cf5 100644 --- a/api/generated/openapi_gen.go +++ b/api/generated/openapi_gen.go @@ -67,6 +67,13 @@ type ActivityStyle struct { SponsorStyleID int `json:"sponsorStyleID"` } +// BuildingTotal defines model for buildingTotal. +type BuildingTotal struct { + Id *int `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + TotalPrice *int `json:"totalPrice,omitempty"` +} + // BuyReport 購入報告の際のパラメータ type BuyReport struct { Amount int `json:"amount"` @@ -112,6 +119,22 @@ type BuyReportWithDivisionId struct { PaidBy *string `json:"paidBy,omitempty"` } +// CampusDonation 教員単体の情報 +type CampusDonation struct { + IsBlack *bool `json:"is_black,omitempty"` + Price int `json:"price"` + RoomName string `json:"room_name"` + TeacherId int `json:"teacher_id"` + TeacherName string `json:"teacher_name"` +} + +// CampusDonationByFloorAndBuilding 棟ごとの教員情報 +type CampusDonationByFloorAndBuilding struct { + BuildingId int `json:"building_id"` + BuildingName *string `json:"building_name,omitempty"` + Floors []FloorGroup `json:"floors"` +} + // DestroyTeacherIDs defines model for destroyTeacherIDs. type DestroyTeacherIDs struct { DeleteIDs []float32 `json:"deleteIDs"` @@ -222,6 +245,13 @@ type FinancialRecordWithBalance struct { Year *int `json:"year,omitempty"` } +// FloorGroup フロアごとの教員情報 +type FloorGroup struct { + Donations []CampusDonation `json:"donations"` + FloorId *int `json:"floor_id,omitempty"` + FloorNumber string `json:"floor_number"` +} + // Income defines model for income. type Income struct { Amount int `json:"amount"` @@ -828,6 +858,12 @@ type ServerInterface interface { // (PUT /buy_reports/{id}) PutBuyReportsId(ctx echo.Context, id int) error + // (GET /campus_donations/buildings/{year}) + GetCampusDonationsBuildingsYear(ctx echo.Context, year int) error + + // (GET /campus_donations/year/{year_id}/building/{building_id}/floor/{floor_id}) + GetCampusDonationsYearYearIdBuildingBuildingIdFloorFloorId(ctx echo.Context, yearId int, buildingId int, floorId int) error + // (GET /departments) GetDepartments(ctx echo.Context) error @@ -1720,6 +1756,54 @@ func (w *ServerInterfaceWrapper) PutBuyReportsId(ctx echo.Context) error { return err } +// GetCampusDonationsBuildingsYear converts echo context to params. +func (w *ServerInterfaceWrapper) GetCampusDonationsBuildingsYear(ctx echo.Context) error { + var err error + // ------------- Path parameter "year" ------------- + var year int + + err = runtime.BindStyledParameterWithOptions("simple", "year", ctx.Param("year"), &year, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter year: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetCampusDonationsBuildingsYear(ctx, year) + return err +} + +// GetCampusDonationsYearYearIdBuildingBuildingIdFloorFloorId converts echo context to params. +func (w *ServerInterfaceWrapper) GetCampusDonationsYearYearIdBuildingBuildingIdFloorFloorId(ctx echo.Context) error { + var err error + // ------------- Path parameter "year_id" ------------- + var yearId int + + err = runtime.BindStyledParameterWithOptions("simple", "year_id", ctx.Param("year_id"), &yearId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter year_id: %s", err)) + } + + // ------------- Path parameter "building_id" ------------- + var buildingId int + + err = runtime.BindStyledParameterWithOptions("simple", "building_id", ctx.Param("building_id"), &buildingId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter building_id: %s", err)) + } + + // ------------- Path parameter "floor_id" ------------- + var floorId int + + err = runtime.BindStyledParameterWithOptions("simple", "floor_id", ctx.Param("floor_id"), &floorId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter floor_id: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetCampusDonationsYearYearIdBuildingBuildingIdFloorFloorId(ctx, yearId, buildingId, floorId) + return err +} + // GetDepartments converts echo context to params. func (w *ServerInterfaceWrapper) GetDepartments(ctx echo.Context) error { var err error @@ -3287,6 +3371,8 @@ func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL router.DELETE(baseURL+"/buy_reports/:id", wrapper.DeleteBuyReportsId) router.GET(baseURL+"/buy_reports/:id", wrapper.GetBuyReportsId) router.PUT(baseURL+"/buy_reports/:id", wrapper.PutBuyReportsId) + router.GET(baseURL+"/campus_donations/buildings/:year", wrapper.GetCampusDonationsBuildingsYear) + router.GET(baseURL+"/campus_donations/year/:year_id/building/:building_id/floor/:floor_id", wrapper.GetCampusDonationsYearYearIdBuildingBuildingIdFloorFloorId) router.GET(baseURL+"/departments", wrapper.GetDepartments) router.POST(baseURL+"/departments", wrapper.PostDepartments) router.DELETE(baseURL+"/departments/:id", wrapper.DeleteDepartmentsId) diff --git a/api/go.mod b/api/go.mod index f51e9c27..62c68c67 100644 --- a/api/go.mod +++ b/api/go.mod @@ -14,7 +14,7 @@ require ( github.com/oapi-codegen/runtime v1.1.1 github.com/pkg/errors v0.9.1 github.com/slack-go/slack v0.13.0 - github.com/stretchr/testify v1.9.0 + github.com/stretchr/testify v1.10.0 golang.org/x/crypto v0.31.0 gorm.io/driver/mysql v1.3.3 gorm.io/gorm v1.23.4 @@ -77,6 +77,7 @@ require ( github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/samber/lo v1.50.0 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/detectors/gcp v1.29.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect diff --git a/api/go.sum b/api/go.sum index 65cde78c..c7d706f6 100644 --- a/api/go.sum +++ b/api/go.sum @@ -981,6 +981,8 @@ github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU= github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk= +github.com/samber/lo v1.50.0 h1:XrG0xOeHs+4FQ8gJR97zDz5uOFMW7OwFWiFVzqopKgY= +github.com/samber/lo v1.50.0/go.mod h1:RjZyNk6WSnUFRKK6EyOhsRJMqft3G+pg7dCWHQCWvsc= github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= @@ -1009,6 +1011,8 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= diff --git a/api/internals/di/di.go b/api/internals/di/di.go index d8f5489f..56a6bf99 100644 --- a/api/internals/di/di.go +++ b/api/internals/di/di.go @@ -60,6 +60,7 @@ func InitializeServer() (db.Client, *echo.Echo) { transactionRepository := repository.NewTransactionRepository(client, crud) userRepository := repository.NewUserRepository(client, crud) yearRepository := repository.NewYearRepository(client, crud) + campusDonationRepository := repository.NewCampusDonationRepository(client, crud) // ↓ // UseCase @@ -99,6 +100,7 @@ func InitializeServer() (db.Client, *echo.Echo) { teacherUseCase := usecase.NewTeacherUseCase(teacherRepository) userUseCase := usecase.NewUserUseCase(userRepository, sessionRepository) yearUseCase := usecase.NewYearUseCase(yearRepository) + campusDonationUseCase := usecase.NewCampusDonationUseCase(campusDonationRepository) // ↓ // Controller @@ -133,6 +135,7 @@ func InitializeServer() (db.Client, *echo.Echo) { teacherController := controller.NewTeacherController(teacherUseCase) userController := controller.NewUserController(userUseCase) yearController := controller.NewYearController(yearUseCase) + campusDonationController := controller.NewCampusDonationController(campusDonationUseCase) // ↓ // router @@ -164,6 +167,7 @@ func InitializeServer() (db.Client, *echo.Echo) { teacherController, userController, yearController, + campusDonationController, ) // ↓ diff --git a/api/internals/domain/campus_donation.go b/api/internals/domain/campus_donation.go new file mode 100644 index 00000000..8de22767 --- /dev/null +++ b/api/internals/domain/campus_donation.go @@ -0,0 +1,20 @@ +package domain + +type CampusDonationBuilding struct { + Id int `json:"id"` + Name string `json:"name"` + Price int `json:"price"` +} + +// CampusDonationRecord は、1行分のフラットな寄付データを表します +type CampusDonationRecord struct { + BuildingId int `json:"building_id"` + BuildingName *string `json:"building_name,omitempty"` + FloorId *int `json:"floor_id,omitempty"` + FloorNumber string `json:"floor_number"` + TeacherId int `json:"teacher_id"` + TeacherName string `json:"teacher_name"` + RoomName string `json:"room_name"` + Price int `json:"price"` + IsBlack *bool `json:"is_black,omitempty"` +} diff --git a/api/internals/usecase/campus_donation_usecase.go b/api/internals/usecase/campus_donation_usecase.go new file mode 100644 index 00000000..18b62272 --- /dev/null +++ b/api/internals/usecase/campus_donation_usecase.go @@ -0,0 +1,162 @@ +package usecase + +import ( + "context" + "log" + + rep "github.com/NUTFes/FinanSu/api/externals/repository" + "github.com/NUTFes/FinanSu/api/generated" + "github.com/NUTFes/FinanSu/api/internals/domain" + "github.com/pkg/errors" + "github.com/samber/lo" +) + +type campusDonationUseCase struct { + rep rep.CampusDonationRepository +} + +type CampusDonationUseCase interface { + GetCampusDonationBuildingByPeriod(context.Context, string) ([]BuildingTotal, error) + GetCampusDonationByFloors(context.Context, string, string) ([]CampusDonationByFloorAndBuilding, error) +} + +func NewCampusDonationUseCase(rep rep.CampusDonationRepository) CampusDonationUseCase { + return &campusDonationUseCase{rep} +} + +func (cdu *campusDonationUseCase) GetCampusDonationByFloors(c context.Context, buildingId string, floorId string) ([]CampusDonationByFloorAndBuilding, error) { + //クエリ実行 + rows, err := cdu.rep.AllCampusDonationByFloor(c, buildingId, floorId) + if err != nil { + return nil, err + } + defer func() { + if err := rows.Close(); err != nil { + log.Println(err) + } + }() + + var campusDonationRecords []domain.CampusDonationRecord + for rows.Next() { + var campusDonationRecord domain.CampusDonationRecord + if err := rows.Scan( + &campusDonationRecord.BuildingId, + &campusDonationRecord.BuildingName, + &campusDonationRecord.FloorId, + &campusDonationRecord.FloorNumber, + &campusDonationRecord.TeacherId, + &campusDonationRecord.TeacherName, + &campusDonationRecord.RoomName, + &campusDonationRecord.Price, + &campusDonationRecord.IsBlack, + ); err != nil { + return nil, errors.Wrap(err, "scanning flat campus donation record") + } + campusDonationRecords = append(campusDonationRecords, campusDonationRecord) + } + + return convertCampusDonationRecordsToNestedStructure(campusDonationRecords), nil +} + +func (f *campusDonationUseCase) GetCampusDonationBuildingByPeriod(c context.Context, year string) ([]BuildingTotal, error) { + rows, err := f.rep.AllBuildingsByPeriod(c, year) + if err != nil { + return nil, err + } + defer func() { + if err := rows.Close(); err != nil { + log.Println(err) + } + }() + + aggregated := make(map[int]*BuildingTotal) + for rows.Next() { + var buildingTotal domain.CampusDonationBuilding + if err := rows.Scan(&buildingTotal.Id, &buildingTotal.Name, &buildingTotal.Price); err != nil { + return nil, err + } + if b, exists := aggregated[buildingTotal.Id]; exists { + if b.TotalPrice == nil { + b.TotalPrice = new(int) + } + *b.TotalPrice += buildingTotal.Price + continue + } + id := buildingTotal.Id + name := buildingTotal.Name + price := buildingTotal.Price + aggregated[buildingTotal.Id] = &BuildingTotal{ + Id: &id, + Name: &name, + TotalPrice: &price, + } + } + if err := rows.Err(); err != nil { + return nil, err + } + + var result []BuildingTotal + for _, b := range aggregated { + result = append(result, *b) + } + return result, nil +} + +// convertCampusDonationRecordsToNestedStructure はcampusDonationRecordをネスト構造に変換する。 +func convertCampusDonationRecordsToNestedStructure(records []domain.CampusDonationRecord) []CampusDonationByFloorAndBuilding { + // 建物ごとにグループ化するためのマップを作成 + groupMap := make(map[int]*CampusDonationByFloorAndBuilding) + + for _, record := range records { + buildingGroup, ok := groupMap[record.BuildingId] + if !ok { + buildingGroup = &CampusDonationByFloorAndBuilding{ + BuildingId: record.BuildingId, + BuildingName: record.BuildingName, + Floors: []FloorGroup{}, + } + groupMap[record.BuildingId] = buildingGroup + } + + // floorGroupの検索 + var floorGroup *FloorGroup + for i := range buildingGroup.Floors { + if buildingGroup.Floors[i].FloorId != nil && record.FloorId != nil && + *buildingGroup.Floors[i].FloorId == *record.FloorId { + floorGroup = &buildingGroup.Floors[i] + break + } + } + // ない場合、floorGroupを作成 + if floorGroup == nil { + newFloorGroup := FloorGroup{ + FloorId: record.FloorId, + FloorNumber: record.FloorNumber, + Donations: []CampusDonation{}, + } + buildingGroup.Floors = append(buildingGroup.Floors, newFloorGroup) + floorGroup = &buildingGroup.Floors[len(buildingGroup.Floors)-1] + } + + // campusDonationの追加 + floorGroup.Donations = append(floorGroup.Donations, CampusDonation{ + TeacherId: record.TeacherId, + TeacherName: record.TeacherName, + RoomName: record.RoomName, + Price: record.Price, + IsBlack: record.IsBlack, + }) + } + + // lo.MapToSliceを使用してマップをスライスに変換 + return lo.MapToSlice(groupMap, func(_ int, v *CampusDonationByFloorAndBuilding) CampusDonationByFloorAndBuilding { + return *v + }) +} + +type CampusDonationByFloor = generated.CampusDonationByFloor +type BuildingTotal generated.BuildingTotal +type CampusDonationByFloorAndBuilding = generated.CampusDonationByFloorAndBuilding +type CampusDonationRecord = domain.CampusDonationRecord +type FloorGroup = generated.FloorGroup +type CampusDonation = generated.CampusDonation diff --git a/api/router/router.go b/api/router/router.go index a85d9ee8..eaac6a2f 100644 --- a/api/router/router.go +++ b/api/router/router.go @@ -33,6 +33,7 @@ type router struct { teacherController controller.TeacherController userController controller.UserController yearController controller.YearController + campusDonationController controller.CampusDonationController } type Router interface { @@ -67,6 +68,7 @@ func NewRouter( teacherController controller.TeacherController, userController controller.UserController, yearController controller.YearController, + campusDonationController controller.CampusDonationController, ) Router { return router{ activityController, @@ -96,6 +98,7 @@ func NewRouter( teacherController, userController, yearController, + campusDonationController, } } @@ -159,6 +162,10 @@ func (r router) ProvideRouter(e *echo.Echo) { e.GET("/buy_reports/details", r.buyReportController.IndexBuyReport) e.PUT("/buy_report/status/:buy_report_id", r.buyReportController.UpdateBuyReportStatus) + // campus_donationsのRoute + e.GET("/campus_donations/buildings/:year", r.campusDonationController.IndexCampusDonationBuildingByPeriod) + e.GET("/campus_donations/year/:year_id/building/:building_id/floor/:floor_id", r.campusDonationController.IndexCampusDonationByFloor) + // current_user e.GET("/current_user", r.userController.GetCurrentUser) diff --git a/er/columns.html b/er/columns.html index 4c1d6144..aefec7d3 100644 --- a/er/columns.html +++ b/er/columns.html @@ -978,6 +978,160 @@

Columns

"defaultValue": "CURRENT_TIMESTAMP", "comments": "" }, + { + "tableName": "campus_donations", + "tableFileName": "campus_donations", + "tableType": "Table", + "keyClass": "primaryKey", + "keyTitle": "Primary Key", + "name": "id", + "type": "INT UNSIGNED", + "length": 10, + "nullable": "", + "autoUpdated": "√", + "defaultValue": "null", + "comments": "" + }, + { + "tableName": "campus_donations", + "tableFileName": "campus_donations", + "tableType": "Table", + "keyClass": "", + "keyTitle": "", + "name": "user_id", + "type": "INT", + "length": 10, + "nullable": "", + "autoUpdated": "", + "defaultValue": "null", + "comments": "" + }, + { + "tableName": "campus_donations", + "tableFileName": "campus_donations", + "tableType": "Table", + "keyClass": "", + "keyTitle": "", + "name": "teacher_id", + "type": "INT", + "length": 10, + "nullable": "", + "autoUpdated": "", + "defaultValue": "null", + "comments": "" + }, + { + "tableName": "campus_donations", + "tableFileName": "campus_donations", + "tableType": "Table", + "keyClass": "foreignKey", + "keyTitle": "Foreign Key", + "name": "year_id", + "type": "INT UNSIGNED", + "length": 10, + "nullable": "", + "autoUpdated": "", + "defaultValue": "null", + "comments": "" + }, + { + "tableName": "campus_donations", + "tableFileName": "campus_donations", + "tableType": "Table", + "keyClass": "", + "keyTitle": "", + "name": "price", + "type": "INT", + "length": 10, + "nullable": "", + "autoUpdated": "", + "defaultValue": "null", + "comments": "" + }, + { + "tableName": "campus_donations", + "tableFileName": "campus_donations", + "tableType": "Table", + "keyClass": "", + "keyTitle": "", + "name": "remark", + "type": "VARCHAR", + "length": 255, + "nullable": "√", + "autoUpdated": "", + "defaultValue": "null", + "comments": "" + }, + { + "tableName": "campus_donations", + "tableFileName": "campus_donations", + "tableType": "Table", + "keyClass": "", + "keyTitle": "", + "name": "is_first_check", + "type": "BIT", + "length": 1, + "nullable": "√", + "autoUpdated": "", + "defaultValue": "null", + "comments": "" + }, + { + "tableName": "campus_donations", + "tableFileName": "campus_donations", + "tableType": "Table", + "keyClass": "", + "keyTitle": "", + "name": "is_last_check", + "type": "BIT", + "length": 1, + "nullable": "√", + "autoUpdated": "", + "defaultValue": "null", + "comments": "" + }, + { + "tableName": "campus_donations", + "tableFileName": "campus_donations", + "tableType": "Table", + "keyClass": "", + "keyTitle": "", + "name": "received_at", + "type": "VARCHAR", + "length": 255, + "nullable": "", + "autoUpdated": "", + "defaultValue": "null", + "comments": "" + }, + { + "tableName": "campus_donations", + "tableFileName": "campus_donations", + "tableType": "Table", + "keyClass": "", + "keyTitle": "", + "name": "created_at", + "type": "DATETIME", + "length": 19, + "nullable": "", + "autoUpdated": "", + "defaultValue": "CURRENT_TIMESTAMP", + "comments": "" + }, + { + "tableName": "campus_donations", + "tableFileName": "campus_donations", + "tableType": "Table", + "keyClass": "", + "keyTitle": "", + "name": "updated_at", + "type": "DATETIME", + "length": 19, + "nullable": "", + "autoUpdated": "", + "defaultValue": "CURRENT_TIMESTAMP", + "comments": "" + }, { "tableName": "departments", "tableFileName": "departments", @@ -1328,146 +1482,6 @@

Columns

"defaultValue": "CURRENT_TIMESTAMP", "comments": "" }, - { - "tableName": "fund_informations", - "tableFileName": "fund_informations", - "tableType": "Table", - "keyClass": "primaryKey", - "keyTitle": "Primary Key", - "name": "id", - "type": "INT UNSIGNED", - "length": 10, - "nullable": "", - "autoUpdated": "√", - "defaultValue": "null", - "comments": "" - }, - { - "tableName": "fund_informations", - "tableFileName": "fund_informations", - "tableType": "Table", - "keyClass": "", - "keyTitle": "", - "name": "user_id", - "type": "INT", - "length": 10, - "nullable": "", - "autoUpdated": "", - "defaultValue": "null", - "comments": "" - }, - { - "tableName": "fund_informations", - "tableFileName": "fund_informations", - "tableType": "Table", - "keyClass": "", - "keyTitle": "", - "name": "teacher_id", - "type": "INT", - "length": 10, - "nullable": "", - "autoUpdated": "", - "defaultValue": "null", - "comments": "" - }, - { - "tableName": "fund_informations", - "tableFileName": "fund_informations", - "tableType": "Table", - "keyClass": "", - "keyTitle": "", - "name": "price", - "type": "INT", - "length": 10, - "nullable": "", - "autoUpdated": "", - "defaultValue": "null", - "comments": "" - }, - { - "tableName": "fund_informations", - "tableFileName": "fund_informations", - "tableType": "Table", - "keyClass": "", - "keyTitle": "", - "name": "remark", - "type": "VARCHAR", - "length": 255, - "nullable": "√", - "autoUpdated": "", - "defaultValue": "null", - "comments": "" - }, - { - "tableName": "fund_informations", - "tableFileName": "fund_informations", - "tableType": "Table", - "keyClass": "", - "keyTitle": "", - "name": "is_first_check", - "type": "BIT", - "length": 1, - "nullable": "√", - "autoUpdated": "", - "defaultValue": "null", - "comments": "" - }, - { - "tableName": "fund_informations", - "tableFileName": "fund_informations", - "tableType": "Table", - "keyClass": "", - "keyTitle": "", - "name": "is_last_check", - "type": "BIT", - "length": 1, - "nullable": "√", - "autoUpdated": "", - "defaultValue": "null", - "comments": "" - }, - { - "tableName": "fund_informations", - "tableFileName": "fund_informations", - "tableType": "Table", - "keyClass": "", - "keyTitle": "", - "name": "received_at", - "type": "VARCHAR", - "length": 255, - "nullable": "", - "autoUpdated": "", - "defaultValue": "null", - "comments": "" - }, - { - "tableName": "fund_informations", - "tableFileName": "fund_informations", - "tableType": "Table", - "keyClass": "", - "keyTitle": "", - "name": "created_at", - "type": "DATETIME", - "length": 19, - "nullable": "", - "autoUpdated": "", - "defaultValue": "CURRENT_TIMESTAMP", - "comments": "" - }, - { - "tableName": "fund_informations", - "tableFileName": "fund_informations", - "tableType": "Table", - "keyClass": "", - "keyTitle": "", - "name": "updated_at", - "type": "DATETIME", - "length": 19, - "nullable": "", - "autoUpdated": "", - "defaultValue": "CURRENT_TIMESTAMP", - "comments": "" - }, { "tableName": "income_expenditure_managements", "tableFileName": "income_expenditure_managements", diff --git a/er/constraints.html b/er/constraints.html index 4aa05faa..f823eeaa 100644 --- a/er/constraints.html +++ b/er/constraints.html @@ -80,7 +80,7 @@

Constraints

-

22 Foreign Key Constraints

+

23 Foreign Key Constraints

@@ -121,6 +121,24 @@

22 Foreign Key Constraints

Cascade on delete + + campus_donations_ibfk_1 + + + + + +
campus_donations.year_id
+ + + + + + +
years.id
+ + Cascade on delete + festival_items_ibfk_1 @@ -266,54 +284,54 @@

22 Foreign Key Constraints

Cascade on delete - item_budgets_ibfk_1 + income_income_expenditure_managements_ibfk_1 - +
item_budgets.festival_item_idincome_income_expenditure_managements.income_expenditure_id
- +
festival_items.idincome_expenditure_managements.id
Cascade on delete - income_income_expenditure_managements_ibfk_1 + income_income_expenditure_managements_ibfk_2 - +
income_income_expenditure_managements.income_expenditure_idincome_income_expenditure_managements.income_id
- +
income_expenditure_managements.idincomes.id
Cascade on delete - income_income_expenditure_managements_ibfk_2 + item_budgets_ibfk_1 - +
income_income_expenditure_managements.income_iditem_budgets.festival_item_id
- +
incomes.idfestival_items.id
diff --git a/er/deletionOrder.txt b/er/deletionOrder.txt index 266a994c..f7d965ac 100644 --- a/er/deletionOrder.txt +++ b/er/deletionOrder.txt @@ -10,7 +10,6 @@ purchase_orders purchase_items password_reset_tokens mail_auth -fund_informations departments bureaus budgets @@ -24,6 +23,7 @@ buy_report_income_expenditure_managements spot_sponsor_names payment_receipts item_budgets +campus_donations buy_statuses rooms buy_reports diff --git a/er/diagrams/orphans/orphans.dot b/er/diagrams/orphans/orphans.dot index 6f75cd55..bbc99954 100644 --- a/er/diagrams/orphans/orphans.dot +++ b/er/diagrams/orphans/orphans.dot @@ -78,26 +78,6 @@ digraph "orphans" { target="_top" tooltip="departments" ]; - "fund_informations" [ - label=< - - - - - - - - - - - - - -
fund_informations[table]
id
int unsigned[10]
user_id
int[10]
teacher_id
int[10]
price
int[10]
remark
varchar[255]
is_first_check
bit[1]
is_last_check
bit[1]
received_at
varchar[255]
created_at
datetime[19]
updated_at
datetime[19]
< 02 rows0 >
> - URL="tables/fund_informations.html" - target="_top" - tooltip="fund_informations" - ]; "mail_auth" [ label=< @@ -277,7 +257,7 @@ digraph "orphans" { - +
representative
varchar[255]
created_at
datetime[19]
updated_at
datetime[19]
< 03 rows0 >
< 00 rows0 >
> URL="tables/sponsors.html" target="_top" diff --git a/er/diagrams/orphans/orphans.png b/er/diagrams/orphans/orphans.png index a92d087e..fa6e2014 100644 Binary files a/er/diagrams/orphans/orphans.png and b/er/diagrams/orphans/orphans.png differ diff --git a/er/diagrams/summary/relationships.real.compact.dot b/er/diagrams/summary/relationships.real.compact.dot index dd96e684..93f9e2a4 100644 --- a/er/diagrams/summary/relationships.real.compact.dot +++ b/er/diagrams/summary/relationships.real.compact.dot @@ -62,6 +62,19 @@ digraph "compactRelationshipsDiagram" { target="_top" tooltip="purchase_reports" ]; + "campus_donations" [ + label=< + + + + + + +
campus_donations[table]
id
year_id
...
< 12 rows
> + URL="tables/campus_donations.html" + target="_top" + tooltip="campus_donations" + ]; "receipts" [ label=< @@ -147,18 +160,6 @@ digraph "compactRelationshipsDiagram" { target="_top" tooltip="activity_styles" ]; - "fund_informations" [ - label=< -
- - - - -
fund_informations[table]
id
...
2 rows
> - URL="tables/fund_informations.html" - target="_top" - tooltip="fund_informations" - ]; "user_groups" [ label=< @@ -274,19 +275,6 @@ digraph "compactRelationshipsDiagram" { target="_top" tooltip="budgets" ]; - "item_budgets" [ - label=< -
- - - - - -
item_budgets[table]
id
festival_item_id
...
< 17 rows
> - URL="tables/item_budgets.html" - target="_top" - tooltip="item_budgets" - ]; "income_income_expenditure_managements" [ label=< @@ -301,6 +289,19 @@ digraph "compactRelationshipsDiagram" { target="_top" tooltip="income_income_expenditure_managements" ]; + "item_budgets" [ + label=< +
+ + + + + +
item_budgets[table]
id
festival_item_id
...
< 17 rows
> + URL="tables/item_budgets.html" + target="_top" + tooltip="item_budgets" + ]; "session" [ label=< @@ -320,7 +321,7 @@ digraph "compactRelationshipsDiagram" { - +
sponsors[table]
id
...
3 rows
0 rows
> URL="tables/sponsors.html" target="_top" @@ -383,7 +384,7 @@ digraph "compactRelationshipsDiagram" {
years[table]
id
... -
3 rows2 >
+
3 rows3 >
> URL="tables/years.html" target="_top" @@ -468,18 +469,6 @@ digraph "compactRelationshipsDiagram" { target="_top" tooltip="payment_receipts" ]; - "users" [ - label=< - - - - - -
users[table]
id
...
4 rows1 >
> - URL="tables/users.html" - target="_top" - tooltip="users" - ]; "teachers" [ label=< @@ -492,6 +481,18 @@ digraph "compactRelationshipsDiagram" { target="_top" tooltip="teachers" ]; + "users" [ + label=< +
+ + + + +
users[table]
id
...
4 rows1 >
> + URL="tables/users.html" + target="_top" + tooltip="users" + ]; "password_reset_tokens" [ label=< @@ -521,6 +522,7 @@ digraph "compactRelationshipsDiagram" { "buy_report_income_expenditure_managements":"income_expenditure_management_id":w -> "income_expenditure_managements":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "buy_reports":"festival_item_id":w -> "festival_items":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "buy_statuses":"buy_report_id":w -> "buy_reports":"id":e [arrowhead=none dir=back arrowtail=crowodot]; + "campus_donations":"year_id":w -> "years":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "divisions":"financial_record_id":w -> "financial_records":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "festival_items":"division_id":w -> "divisions":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "financial_records":"year_id":w -> "years":"id":e [arrowhead=none dir=back arrowtail=crowodot]; diff --git a/er/diagrams/summary/relationships.real.compact.png b/er/diagrams/summary/relationships.real.compact.png index beee0bb6..ca083b79 100644 Binary files a/er/diagrams/summary/relationships.real.compact.png and b/er/diagrams/summary/relationships.real.compact.png differ diff --git a/er/diagrams/summary/relationships.real.large.dot b/er/diagrams/summary/relationships.real.large.dot index 009f6ac3..9980a260 100644 --- a/er/diagrams/summary/relationships.real.large.dot +++ b/er/diagrams/summary/relationships.real.large.dot @@ -85,6 +85,27 @@ digraph "largeRelationshipsDiagram" { target="_top" tooltip="purchase_reports" ]; + "campus_donations" [ + label=< +
+ + + + + + + + + + + + + +
campus_donations[table]
id
user_id
teacher_id
year_id
price
remark
is_first_check
is_last_check
received_at
created_at
updated_at
< 12 rows
> + URL="tables/campus_donations.html" + target="_top" + tooltip="campus_donations" + ]; "receipts" [ label=< @@ -196,26 +217,6 @@ digraph "largeRelationshipsDiagram" { target="_top" tooltip="activity_styles" ]; - "fund_informations" [ - label=< -
- - - - - - - - - - - - -
fund_informations[table]
id
user_id
teacher_id
price
remark
is_first_check
is_last_check
received_at
created_at
updated_at
2 rows
> - URL="tables/fund_informations.html" - target="_top" - tooltip="fund_informations" - ]; "user_groups" [ label=< @@ -361,21 +362,6 @@ digraph "largeRelationshipsDiagram" { target="_top" tooltip="budgets" ]; - "item_budgets" [ - label=< -
- - - - - - - -
item_budgets[table]
id
amount
festival_item_id
created_at
updated_at
< 17 rows
> - URL="tables/item_budgets.html" - target="_top" - tooltip="item_budgets" - ]; "income_income_expenditure_managements" [ label=< @@ -391,6 +377,21 @@ digraph "largeRelationshipsDiagram" { target="_top" tooltip="income_income_expenditure_managements" ]; + "item_budgets" [ + label=< +
+ + + + + + + +
item_budgets[table]
id
amount
festival_item_id
created_at
updated_at
< 17 rows
> + URL="tables/item_budgets.html" + target="_top" + tooltip="item_budgets" + ]; "session" [ label=< @@ -419,7 +420,7 @@ digraph "largeRelationshipsDiagram" { - +
representative
created_at
updated_at
3 rows
0 rows
> URL="tables/sponsors.html" target="_top" @@ -495,7 +496,7 @@ digraph "largeRelationshipsDiagram" {
year
created_at
updated_at
-
3 rows2 >
+
3 rows3 >
> URL="tables/years.html" target="_top" @@ -598,23 +599,6 @@ digraph "largeRelationshipsDiagram" { target="_top" tooltip="payment_receipts" ]; - "users" [ - label=< - - - - - - - - - - -
users[table]
id
name
bureau_id
role_id
is_deleted
created_at
updated_at
4 rows1 >
> - URL="tables/users.html" - target="_top" - tooltip="users" - ]; "teachers" [ label=< @@ -635,6 +619,23 @@ digraph "largeRelationshipsDiagram" { target="_top" tooltip="teachers" ]; + "users" [ + label=< +
+ + + + + + + + + +
users[table]
id
name
bureau_id
role_id
is_deleted
created_at
updated_at
4 rows1 >
> + URL="tables/users.html" + target="_top" + tooltip="users" + ]; "password_reset_tokens" [ label=< @@ -669,6 +670,7 @@ digraph "largeRelationshipsDiagram" { "buy_report_income_expenditure_managements":"income_expenditure_management_id":w -> "income_expenditure_managements":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "buy_reports":"festival_item_id":w -> "festival_items":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "buy_statuses":"buy_report_id":w -> "buy_reports":"id":e [arrowhead=none dir=back arrowtail=crowodot]; + "campus_donations":"year_id":w -> "years":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "divisions":"financial_record_id":w -> "financial_records":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "festival_items":"division_id":w -> "divisions":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "financial_records":"year_id":w -> "years":"id":e [arrowhead=none dir=back arrowtail=crowodot]; diff --git a/er/diagrams/summary/relationships.real.large.png b/er/diagrams/summary/relationships.real.large.png index 9608a022..aa2629ce 100644 Binary files a/er/diagrams/summary/relationships.real.large.png and b/er/diagrams/summary/relationships.real.large.png differ diff --git a/er/diagrams/tables/buy_report_income_expenditure_m_26c10aac.2degrees.dot b/er/diagrams/tables/buy_report_income_expenditure_m_26c10aac.2degrees.dot index f4099cf3..a3201a4d 100644 --- a/er/diagrams/tables/buy_report_income_expenditure_m_26c10aac.2degrees.dot +++ b/er/diagrams/tables/buy_report_income_expenditure_m_26c10aac.2degrees.dot @@ -121,7 +121,7 @@ digraph "twoDegreesRelationshipsDiagram" {
- +
years[table]
...
3 rows2 >
3 rows3 >
> URL="years.html" target="_top" diff --git a/er/diagrams/tables/buy_report_income_expenditure_m_26c10aac.2degrees.png b/er/diagrams/tables/buy_report_income_expenditure_m_26c10aac.2degrees.png index 6505642d..6352d82a 100644 Binary files a/er/diagrams/tables/buy_report_income_expenditure_m_26c10aac.2degrees.png and b/er/diagrams/tables/buy_report_income_expenditure_m_26c10aac.2degrees.png differ diff --git a/er/diagrams/tables/campus_donations.1degree.dot b/er/diagrams/tables/campus_donations.1degree.dot new file mode 100644 index 00000000..9d291e53 --- /dev/null +++ b/er/diagrams/tables/campus_donations.1degree.dot @@ -0,0 +1,37 @@ +digraph "oneDegreeRelationshipsDiagram" { + graph [ rankdir="RL" bgcolor="#ffffff" label="\nGenerated by SchemaSpy" labeljust="l" nodesep="0.18" ranksep="0.46" fontname="Helvetica" fontsize="11" packmode="graph" ]; node [ fontname="Helvetica" fontsize="11" shape="plaintext" ]; edge [ arrowsize="0.8" ]; + "campus_donations":"year_id":w -> "years":"id":e [arrowhead=none dir=back arrowtail=crowodot]; + "campus_donations" [ + label=< + + + + + + + + + + + + + + +
campus_donations[table]
id
int unsigned[10]
user_id
int[10]
teacher_id
int[10]
year_id
int unsigned[10]
price
int[10]
remark
varchar[255]
is_first_check
bit[1]
is_last_check
bit[1]
received_at
varchar[255]
created_at
datetime[19]
updated_at
datetime[19]
< 12 rows0 >
> + URL="campus_donations.html" + target="_top" + tooltip="campus_donations" + ]; + "years" [ + label=< + + + + + +
years[table]
id
...
3 rows3 >
> + URL="years.html" + target="_top" + tooltip="years" + ]; +} diff --git a/er/diagrams/tables/campus_donations.1degree.png b/er/diagrams/tables/campus_donations.1degree.png new file mode 100644 index 00000000..e47f5531 Binary files /dev/null and b/er/diagrams/tables/campus_donations.1degree.png differ diff --git a/er/diagrams/tables/campus_donations.2degrees.dot b/er/diagrams/tables/campus_donations.2degrees.dot new file mode 100644 index 00000000..e39e2f36 --- /dev/null +++ b/er/diagrams/tables/campus_donations.2degrees.dot @@ -0,0 +1,61 @@ +digraph "twoDegreesRelationshipsDiagram" { + graph [ rankdir="RL" bgcolor="#ffffff" label="\nGenerated by SchemaSpy" labeljust="l" nodesep="0.18" ranksep="0.46" fontname="Helvetica" fontsize="11" packmode="graph" ]; node [ fontname="Helvetica" fontsize="11" shape="plaintext" ]; edge [ arrowsize="0.8" ]; + "campus_donations":"year_id":w -> "years":"id":e [arrowhead=none dir=back arrowtail=crowodot]; + "financial_records":"elipses":w -> "years":"id":e [arrowhead=none dir=back arrowtail=crowodot]; + "income_expenditure_managements":"elipses":w -> "years":"id":e [arrowhead=none dir=back arrowtail=crowodot]; + "campus_donations" [ + label=< + + + + + + + + + + + + + + +
campus_donations[table]
id
int unsigned[10]
user_id
int[10]
teacher_id
int[10]
year_id
int unsigned[10]
price
int[10]
remark
varchar[255]
is_first_check
bit[1]
is_last_check
bit[1]
received_at
varchar[255]
created_at
datetime[19]
updated_at
datetime[19]
< 12 rows0 >
> + URL="campus_donations.html" + target="_top" + tooltip="campus_donations" + ]; + "financial_records" [ + label=< + + + + +
financial_records[table]
...
< 12 rows1 >
> + URL="financial_records.html" + target="_top" + tooltip="financial_records" + ]; + "income_expenditure_managements" [ + label=< + + + + +
income_expenditure_managements[table]
...
< 19 rows4 >
> + URL="income_expenditure_managements.html" + target="_top" + tooltip="income_expenditure_managements" + ]; + "years" [ + label=< + + + + + +
years[table]
id
...
3 rows3 >
> + URL="years.html" + target="_top" + tooltip="years" + ]; +} diff --git a/er/diagrams/tables/campus_donations.2degrees.png b/er/diagrams/tables/campus_donations.2degrees.png new file mode 100644 index 00000000..79d78cd2 Binary files /dev/null and b/er/diagrams/tables/campus_donations.2degrees.png differ diff --git a/er/diagrams/tables/divisions.2degrees.dot b/er/diagrams/tables/divisions.2degrees.dot index dd348a5d..806417df 100644 --- a/er/diagrams/tables/divisions.2degrees.dot +++ b/er/diagrams/tables/divisions.2degrees.dot @@ -100,7 +100,7 @@ digraph "twoDegreesRelationshipsDiagram" { - +
years[table]
...
3 rows2 >
3 rows3 >
> URL="years.html" target="_top" diff --git a/er/diagrams/tables/divisions.2degrees.png b/er/diagrams/tables/divisions.2degrees.png index 285a56d7..541b2add 100644 Binary files a/er/diagrams/tables/divisions.2degrees.png and b/er/diagrams/tables/divisions.2degrees.png differ diff --git a/er/diagrams/tables/financial_records.1degree.dot b/er/diagrams/tables/financial_records.1degree.dot index cf53d0a7..35073d42 100644 --- a/er/diagrams/tables/financial_records.1degree.dot +++ b/er/diagrams/tables/financial_records.1degree.dot @@ -36,7 +36,7 @@ digraph "oneDegreeRelationshipsDiagram" {
years[table]
id
... -
3 rows2 >
+
3 rows3 >
> URL="years.html" target="_top" diff --git a/er/diagrams/tables/financial_records.1degree.png b/er/diagrams/tables/financial_records.1degree.png index 35106af7..30762889 100644 Binary files a/er/diagrams/tables/financial_records.1degree.png and b/er/diagrams/tables/financial_records.1degree.png differ diff --git a/er/diagrams/tables/financial_records.2degrees.dot b/er/diagrams/tables/financial_records.2degrees.dot index 74bb4cab..b512b74e 100644 --- a/er/diagrams/tables/financial_records.2degrees.dot +++ b/er/diagrams/tables/financial_records.2degrees.dot @@ -1,10 +1,22 @@ digraph "twoDegreesRelationshipsDiagram" { graph [ rankdir="RL" bgcolor="#ffffff" label="\nGenerated by SchemaSpy" labeljust="l" nodesep="0.18" ranksep="0.46" fontname="Helvetica" fontsize="11" packmode="graph" ]; node [ fontname="Helvetica" fontsize="11" shape="plaintext" ]; edge [ arrowsize="0.8" ]; + "campus_donations":"elipses":w -> "years":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "divisions":"financial_record_id":w -> "financial_records":"id.type":e [arrowhead=none dir=back arrowtail=crowodot]; "festival_items":"elipses":w -> "divisions":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "financial_records":"year_id":w -> "years":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "income_expenditure_managements":"elipses":w -> "years":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "user_groups":"elipses":w -> "divisions":"id":e [arrowhead=none dir=back arrowtail=crowodot]; + "campus_donations" [ + label=< + + + + +
campus_donations[table]
...
< 12 rows
> + URL="campus_donations.html" + target="_top" + tooltip="campus_donations" + ]; "divisions" [ label=< @@ -72,7 +84,7 @@ digraph "twoDegreesRelationshipsDiagram" { - +
years[table]
id
...
3 rows2 >
3 rows3 >
> URL="years.html" target="_top" diff --git a/er/diagrams/tables/financial_records.2degrees.png b/er/diagrams/tables/financial_records.2degrees.png index 99db662a..605644a0 100644 Binary files a/er/diagrams/tables/financial_records.2degrees.png and b/er/diagrams/tables/financial_records.2degrees.png differ diff --git a/er/diagrams/tables/income_expenditure_managements.1degree.dot b/er/diagrams/tables/income_expenditure_managements.1degree.dot index a663fcdd..7590c1f9 100644 --- a/er/diagrams/tables/income_expenditure_managements.1degree.dot +++ b/er/diagrams/tables/income_expenditure_managements.1degree.dot @@ -84,7 +84,7 @@ digraph "oneDegreeRelationshipsDiagram" {
years[table]
id
... -
3 rows2 >
+
3 rows3 >
> URL="years.html" target="_top" diff --git a/er/diagrams/tables/income_expenditure_managements.1degree.png b/er/diagrams/tables/income_expenditure_managements.1degree.png index 8957dc9f..afe0e608 100644 Binary files a/er/diagrams/tables/income_expenditure_managements.1degree.png and b/er/diagrams/tables/income_expenditure_managements.1degree.png differ diff --git a/er/diagrams/tables/income_expenditure_managements.2degrees.dot b/er/diagrams/tables/income_expenditure_managements.2degrees.dot index e58ee7fb..80fd6f72 100644 --- a/er/diagrams/tables/income_expenditure_managements.2degrees.dot +++ b/er/diagrams/tables/income_expenditure_managements.2degrees.dot @@ -2,6 +2,7 @@ digraph "twoDegreesRelationshipsDiagram" { graph [ rankdir="RL" bgcolor="#ffffff" label="\nGenerated by SchemaSpy" labeljust="l" nodesep="0.18" ranksep="0.46" fontname="Helvetica" fontsize="11" packmode="graph" ]; node [ fontname="Helvetica" fontsize="11" shape="plaintext" ]; edge [ arrowsize="0.8" ]; "buy_report_income_expenditure_managements":"buy_report_id":w -> "buy_reports":"elipses":e [arrowhead=none dir=back arrowtail=crowodot]; "buy_report_income_expenditure_managements":"income_expenditure_management_id":w -> "income_expenditure_managements":"id.type":e [arrowhead=none dir=back arrowtail=crowodot]; + "campus_donations":"elipses":w -> "years":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "financial_records":"elipses":w -> "years":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "income_expenditure_managements":"year_id":w -> "years":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "income_income_expenditure_managements":"income_expenditure_id":w -> "income_expenditure_managements":"id.type":e [arrowhead=none dir=back arrowtail=crowodot]; @@ -45,6 +46,17 @@ digraph "twoDegreesRelationshipsDiagram" { target="_top" tooltip="buy_reports" ]; + "campus_donations" [ + label=< + + + + +
campus_donations[table]
...
< 12 rows
> + URL="campus_donations.html" + target="_top" + tooltip="campus_donations" + ]; "financial_records" [ label=< @@ -132,7 +144,7 @@ digraph "twoDegreesRelationshipsDiagram" { - +
years[table]
id
...
3 rows2 >
3 rows3 >
> URL="years.html" target="_top" diff --git a/er/diagrams/tables/income_expenditure_managements.2degrees.png b/er/diagrams/tables/income_expenditure_managements.2degrees.png index 943ddb2c..1e027bfc 100644 Binary files a/er/diagrams/tables/income_expenditure_managements.2degrees.png and b/er/diagrams/tables/income_expenditure_managements.2degrees.png differ diff --git a/er/diagrams/tables/income_income_expenditure_managements.2degrees.dot b/er/diagrams/tables/income_income_expenditure_managements.2degrees.dot index d6c101c3..0921137d 100644 --- a/er/diagrams/tables/income_income_expenditure_managements.2degrees.dot +++ b/er/diagrams/tables/income_income_expenditure_managements.2degrees.dot @@ -84,7 +84,7 @@ digraph "twoDegreesRelationshipsDiagram" { - +
years[table]
...
3 rows2 >
3 rows3 >
> URL="years.html" target="_top" diff --git a/er/diagrams/tables/income_income_expenditure_managements.2degrees.png b/er/diagrams/tables/income_income_expenditure_managements.2degrees.png index d8781666..d763f6c0 100644 Binary files a/er/diagrams/tables/income_income_expenditure_managements.2degrees.png and b/er/diagrams/tables/income_income_expenditure_managements.2degrees.png differ diff --git a/er/diagrams/tables/sponsor_activity_balance_managements.2degrees.dot b/er/diagrams/tables/sponsor_activity_balance_managements.2degrees.dot index 64bb5967..0ff5ecbf 100644 --- a/er/diagrams/tables/sponsor_activity_balance_managements.2degrees.dot +++ b/er/diagrams/tables/sponsor_activity_balance_managements.2degrees.dot @@ -84,7 +84,7 @@ digraph "twoDegreesRelationshipsDiagram" { - +
years[table]
...
3 rows2 >
3 rows3 >
> URL="years.html" target="_top" diff --git a/er/diagrams/tables/sponsor_activity_balance_managements.2degrees.png b/er/diagrams/tables/sponsor_activity_balance_managements.2degrees.png index 23ec3fde..e5cf004e 100644 Binary files a/er/diagrams/tables/sponsor_activity_balance_managements.2degrees.png and b/er/diagrams/tables/sponsor_activity_balance_managements.2degrees.png differ diff --git a/er/diagrams/tables/sponsors.1degree.dot b/er/diagrams/tables/sponsors.1degree.dot index da59502f..0a6f9575 100644 --- a/er/diagrams/tables/sponsors.1degree.dot +++ b/er/diagrams/tables/sponsors.1degree.dot @@ -12,7 +12,7 @@ digraph "oneDegreeRelationshipsDiagram" {
representative
varchar[255]
created_at
datetime[19]
updated_at
datetime[19] -
< 03 rows0 >
+
< 00 rows0 >
> URL="sponsors.html" target="_top" diff --git a/er/diagrams/tables/sponsors.1degree.png b/er/diagrams/tables/sponsors.1degree.png index 77682aad..7bbf19d8 100644 Binary files a/er/diagrams/tables/sponsors.1degree.png and b/er/diagrams/tables/sponsors.1degree.png differ diff --git a/er/diagrams/tables/spot_sponsor_names.2degrees.dot b/er/diagrams/tables/spot_sponsor_names.2degrees.dot index 1fb2394b..a03a66bb 100644 --- a/er/diagrams/tables/spot_sponsor_names.2degrees.dot +++ b/er/diagrams/tables/spot_sponsor_names.2degrees.dot @@ -71,7 +71,7 @@ digraph "twoDegreesRelationshipsDiagram" { - +
years[table]
...
3 rows2 >
3 rows3 >
> URL="years.html" target="_top" diff --git a/er/diagrams/tables/spot_sponsor_names.2degrees.png b/er/diagrams/tables/spot_sponsor_names.2degrees.png index 4cb04fec..b4919079 100644 Binary files a/er/diagrams/tables/spot_sponsor_names.2degrees.png and b/er/diagrams/tables/spot_sponsor_names.2degrees.png differ diff --git a/er/diagrams/tables/years.1degree.dot b/er/diagrams/tables/years.1degree.dot index a6c82582..e8c16717 100644 --- a/er/diagrams/tables/years.1degree.dot +++ b/er/diagrams/tables/years.1degree.dot @@ -1,7 +1,21 @@ digraph "oneDegreeRelationshipsDiagram" { graph [ rankdir="RL" bgcolor="#ffffff" label="\nGenerated by SchemaSpy" labeljust="l" nodesep="0.18" ranksep="0.46" fontname="Helvetica" fontsize="11" packmode="graph" ]; node [ fontname="Helvetica" fontsize="11" shape="plaintext" ]; edge [ arrowsize="0.8" ]; + "campus_donations":"year_id":w -> "years":"id.type":e [arrowhead=none dir=back arrowtail=crowodot]; "financial_records":"year_id":w -> "years":"id.type":e [arrowhead=none dir=back arrowtail=crowodot]; "income_expenditure_managements":"year_id":w -> "years":"id.type":e [arrowhead=none dir=back arrowtail=crowodot]; + "campus_donations" [ + label=< + + + + + + +
campus_donations[table]
id
year_id
...
< 12 rows
> + URL="campus_donations.html" + target="_top" + tooltip="campus_donations" + ]; "financial_records" [ label=< @@ -36,7 +50,7 @@ digraph "oneDegreeRelationshipsDiagram" { - +
year
int[10]
created_at
datetime[19]
updated_at
datetime[19]
< 03 rows2 >
< 03 rows3 >
> URL="years.html" target="_top" diff --git a/er/diagrams/tables/years.1degree.png b/er/diagrams/tables/years.1degree.png index 581e9543..bbc888a2 100644 Binary files a/er/diagrams/tables/years.1degree.png and b/er/diagrams/tables/years.1degree.png differ diff --git a/er/diagrams/tables/years.2degrees.dot b/er/diagrams/tables/years.2degrees.dot index 9e9d3cdf..2a985087 100644 --- a/er/diagrams/tables/years.2degrees.dot +++ b/er/diagrams/tables/years.2degrees.dot @@ -1,6 +1,7 @@ digraph "twoDegreesRelationshipsDiagram" { graph [ rankdir="RL" bgcolor="#ffffff" label="\nGenerated by SchemaSpy" labeljust="l" nodesep="0.18" ranksep="0.46" fontname="Helvetica" fontsize="11" packmode="graph" ]; node [ fontname="Helvetica" fontsize="11" shape="plaintext" ]; edge [ arrowsize="0.8" ]; "buy_report_income_expenditure_managements":"elipses":w -> "income_expenditure_managements":"id":e [arrowhead=none dir=back arrowtail=crowodot]; + "campus_donations":"year_id":w -> "years":"id.type":e [arrowhead=none dir=back arrowtail=crowodot]; "divisions":"elipses":w -> "financial_records":"id":e [arrowhead=none dir=back arrowtail=crowodot]; "financial_records":"year_id":w -> "years":"id.type":e [arrowhead=none dir=back arrowtail=crowodot]; "income_expenditure_managements":"year_id":w -> "years":"id.type":e [arrowhead=none dir=back arrowtail=crowodot]; @@ -18,6 +19,19 @@ digraph "twoDegreesRelationshipsDiagram" { target="_top" tooltip="buy_report_income_expenditure_managements" ]; + "campus_donations" [ + label=< + + + + + + +
campus_donations[table]
id
year_id
...
< 12 rows
> + URL="campus_donations.html" + target="_top" + tooltip="campus_donations" + ]; "divisions" [ label=< @@ -96,7 +110,7 @@ digraph "twoDegreesRelationshipsDiagram" { - +
year
int[10]
created_at
datetime[19]
updated_at
datetime[19]
< 03 rows2 >
< 03 rows3 >
> URL="years.html" target="_top" diff --git a/er/diagrams/tables/years.2degrees.png b/er/diagrams/tables/years.2degrees.png index 01cba42d..f6aca75a 100644 Binary files a/er/diagrams/tables/years.2degrees.png and b/er/diagrams/tables/years.2degrees.png differ diff --git a/er/finansu_db.finansu_db.xml b/er/finansu_db.finansu_db.xml index 176040db..1aa9f60b 100644 --- a/er/finansu_db.finansu_db.xml +++ b/er/finansu_db.finansu_db.xml @@ -158,6 +158,28 @@ + + + + + + + + + + + + + + + + + + + + + +
@@ -243,22 +265,6 @@
- - - - - - - - - - - - - - - -
@@ -550,7 +556,7 @@
- +
@@ -648,6 +654,7 @@
+ diff --git a/er/index.html b/er/index.html index de71e32c..e40d8368 100644 --- a/er/index.html +++ b/er/index.html @@ -78,7 +78,7 @@

Tables


SchemaSpy Analysis of finansu_db.finansu_db

-

Generated on Fri May 02 07:50 UTC 2025

+

Generated on Sat May 24 07:39 UTC 2025

@@ -118,7 +118,7 @@

SchemaSpy Analysis of finansu_db.finansu_db

COLUMNS - 254 + 255
@@ -130,7 +130,7 @@

SchemaSpy Analysis of finansu_db.finansu_db

Constraints - 22 + 23
@@ -241,6 +241,15 @@

Tables

+ + + + + + + + + @@ -304,15 +313,6 @@

Tables

- - - - - - - - - @@ -395,20 +395,20 @@

Tables

- + - + - + - + - + - + @@ -426,7 +426,7 @@

Tables

- + @@ -468,7 +468,7 @@

Tables

- + @@ -530,20 +530,20 @@

Tables

- + - - + + - + - - + + diff --git a/er/info-html.txt b/er/info-html.txt index 1446ed1e..1b760bc6 100644 --- a/er/info-html.txt +++ b/er/info-html.txt @@ -1,4 +1,4 @@ -date=2025-05-02 07:50:56+0000 +date=2025-05-24 07:39:47+0000 os=Linux 5.15.167.4-microsoft-standard-WSL2 schemaspy-version=7.0.2-SNAPSHOT schemaspy-revision=bf4d5fddd535dd213a512a6a521bcadb8260168d diff --git a/er/insertionOrder.txt b/er/insertionOrder.txt index cdbe46d5..aaa6f75c 100644 --- a/er/insertionOrder.txt +++ b/er/insertionOrder.txt @@ -13,6 +13,7 @@ income_expenditure_managements buy_reports rooms buy_statuses +campus_donations item_budgets payment_receipts spot_sponsor_names @@ -26,7 +27,6 @@ activity_styles budgets bureaus departments -fund_informations mail_auth password_reset_tokens purchase_items diff --git a/er/orphans.html b/er/orphans.html index 3c947df9..78daa55e 100644 --- a/er/orphans.html +++ b/er/orphans.html @@ -85,24 +85,23 @@

Orphan Tables

- - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
diff --git a/er/relationships.html b/er/relationships.html index 98aea75d..4ff7e69c 100644 --- a/er/relationships.html +++ b/er/relationships.html @@ -93,93 +93,93 @@
By default only columns that are primary keys, foreign keys or indexes are s
- - + + - - + + - - - - - - - - - - + + + + + + + + + + + - - - - + + + + - - - - - - - - - + + + + + + + + - + - - - - + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/er/tables/campus_donations.html b/er/tables/campus_donations.html new file mode 100644 index 00000000..f9aad154 --- /dev/null +++ b/er/tables/campus_donations.html @@ -0,0 +1,441 @@ + + + + + + campus_donations - finansu_db.finansu_db + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ + +
+ +
+

campus_donations

2 rows


+
+ +
+
+
+ +

Columns

+
+ + +
+
+
+
Table
campus_donations01112Table
receipts 0 Table
fund_informations00102Table
user_groups 0
item_budgetsincome_income_expenditure_managements 012 570 Table
income_income_expenditure_managementsitem_budgets 021 507 Table
0 0 830 Table
years23 0 4 3
usersteachers 1 074100 Table
teachersusers 1 010074 Table
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ColumnTypeSizeNullsAutoDefaultChildrenParentsComments
idINT UNSIGNED10null + +
+
+ +
+
user_idINT10null + +
+
+ +
+
teacher_idINT10null + +
+
+ +
+
year_idINT UNSIGNED10null + +
+
+ + + + + + +
years.idcampus_donations_ibfk_1C
+
priceINT10null + +
+
+ +
+
remarkVARCHAR255null + +
+
+ +
+
is_first_checkBIT1null + +
+
+ +
+
is_last_checkBIT1null + +
+
+ +
+
received_atVARCHAR255null + +
+
+ +
+
created_atDATETIME19CURRENT_TIMESTAMP + +
+
+ +
+
updated_atDATETIME19CURRENT_TIMESTAMP + +
+
+ +
+
+
+
+
+
+ +

Indexes

+
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
Constraint NameTypeSortColumn(s)
PRIMARYPrimary keyAscid
year_idPerformanceAscyear_id
+
+
+
+
+ +

Relationships

+
+ + +
+
+
+ +
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/er/tables/financial_records.html b/er/tables/financial_records.html index 712833ff..6c519968 100644 --- a/er/tables/financial_records.html +++ b/er/tables/financial_records.html @@ -276,12 +276,13 @@
Close relationships within degrees of separation
- - - - - - + + + + + + +
diff --git a/er/tables/income_expenditure_managements.html b/er/tables/income_expenditure_managements.html index f5a8ed68..2d7485d1 100644 --- a/er/tables/income_expenditure_managements.html +++ b/er/tables/income_expenditure_managements.html @@ -346,15 +346,16 @@
Close relationships within degrees of separation
- - - - - - - - - + + + + + + + + + +
diff --git a/er/tables/sponsors.html b/er/tables/sponsors.html index 4fa9b897..148ec60e 100644 --- a/er/tables/sponsors.html +++ b/er/tables/sponsors.html @@ -73,7 +73,7 @@
-

sponsors

3 rows


+

sponsors

0 rows


diff --git a/er/tables/years.html b/er/tables/years.html index 0b98f145..9d18e5f2 100644 --- a/er/tables/years.html +++ b/er/tables/years.html @@ -117,6 +117,11 @@

Columns

null + + + + + @@ -245,22 +250,24 @@
Close relationships within degrees of separation
- - - + + + +
- - - - - - - + + + + + + + +
diff --git a/mysql/db/20_campus_donations.sql b/mysql/db/20_campus_donations.sql index e48a8e10..05700f43 100644 --- a/mysql/db/20_campus_donations.sql +++ b/mysql/db/20_campus_donations.sql @@ -5,6 +5,7 @@ CREATE TABLE id int(10) unsigned not null auto_increment, user_id int(10) not null, teacher_id int(10) not null, + year_id int(10) UNSIGNED not null, price int(10) not null, remark varchar(255), is_first_check boolean, @@ -12,11 +13,14 @@ CREATE TABLE received_at varchar(255) not null, created_at datetime not null default current_timestamp, updated_at datetime not null default current_timestamp on update current_timestamp, - PRIMARY KEY (id) + PRIMARY KEY (id), + FOREIGN KEY (year_id) REFERENCES years (id) ON DELETE CASCADE, + FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE, + FOREIGN KEY (teacher_id) REFERENCES teachers (id) ON DELETE CASCADE ); INSERT INTO - campus_donations (user_id, teacher_id, price, remark, is_first_check, is_last_check, received_at) + campus_donations (user_id, teacher_id, year_id, price, remark, is_first_check, is_last_check, received_at) VALUES - (1, 1, 2000, "nothing", false, false, '2023-02-22'), - (2, 2, 2000, "nothing", false, false, '2022-02-22'); + (1, 1, 3, 2000, "nothing", false, false, '2023-02-22'), + (2, 2, 3, 2000, "nothing", false, false, '2022-02-22'); diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index ac8da95b..b0819419 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -816,6 +816,61 @@ paths: schema: $ref: "#/components/schemas/buyReportDetail" + /campus_donations/year/{year_id}/building/{building_id}/floor/{floor_id}: + get: + tags: + - campus_donation + description: 各棟の各階の学内募金情報を取得するAPI + parameters: + - name: building_id + in: path + required: true + schema: + type: integer + description: ID of the building + - name: floor_id + in: path + required: true + schema: + type: integer + description: ID of the floor + - name: year_id + in: path + required: true + schema: + type: integer + description: ID of the year + responses: + "200": + description: Successful response + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/campusDonationByFloorAndBuilding" + /campus_donations/buildings/{year}: + get: + tags: + - fund_information + description: 年度で指定されたfund_informationsに紐づくデータを取得 + parameters: + - name: year + in: path + description: year + required: true + schema: + type: integer + responses: + "200": + description: 年度で指定されたfund_informationsに紐づくデータを取得 + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/buildingTotal" + /departments: get: tags: @@ -3266,5 +3321,69 @@ components: - room_number - is_black - remark + buildingTotal: + type: object + properties: + id: + type: integer + example: 1 + name: + type: string + example: 機械・建設棟 + totalPrice: + type: integer + example: 10000 + campusDonation: + type: object + description: 教員単体の情報 + properties: + teacher_id: + type: integer + room_name: + type: string + teacher_name: + type: string + price: + type: integer + is_black: + type: boolean + required: + - teacher_id + - room_name + - teacher_name + - price + - is_Black + floorGroup: + type: object + description: フロアごとの教員情報 + properties: + floor_id: + type: integer + floor_number: + type: string + donations: + type: array + items: + $ref: "#/components/schemas/campusDonation" + required: + - floor_ud + - floor_number + - donations + campusDonationByFloorAndBuilding: + type: object + description: 棟ごとの教員情報 + properties: + building_id: + type: integer + building_name: + type: string + floors: + type: array + items: + $ref: "#/components/schemas/floorGroup" + required: + - building_id + - building_Name + - floors x-original-swagger-version: "2.0" diff --git a/view/next-project/src/generated/hooks.ts b/view/next-project/src/generated/hooks.ts index 73962f18..4fdb5557 100644 --- a/view/next-project/src/generated/hooks.ts +++ b/view/next-project/src/generated/hooks.ts @@ -15,9 +15,11 @@ import type { Activity, ActivityInformation, ActivityStyle, + BuildingTotal, BuyReport, BuyReportDetail, BuyReportWithDivisionId, + CampusDonationByFloorAndBuilding, DeleteActivitiesId200, DeleteActivityInformationsId200, DeleteActivityStylesId200, @@ -2690,6 +2692,163 @@ export const usePutBuyReportStatusBuyReportId = ( }; }; +/** + * 各棟の各階の学内募金情報を取得するAPI + */ +export type getCampusDonationsYearYearIdBuildingBuildingIdFloorFloorIdResponse200 = { + data: CampusDonationByFloorAndBuilding[]; + status: 200; +}; + +export type getCampusDonationsYearYearIdBuildingBuildingIdFloorFloorIdResponseComposite = + getCampusDonationsYearYearIdBuildingBuildingIdFloorFloorIdResponse200; + +export type getCampusDonationsYearYearIdBuildingBuildingIdFloorFloorIdResponse = + getCampusDonationsYearYearIdBuildingBuildingIdFloorFloorIdResponseComposite & { + headers: Headers; + }; + +export const getGetCampusDonationsYearYearIdBuildingBuildingIdFloorFloorIdUrl = ( + yearId: number, + buildingId: number, + floorId: number, +) => { + return `/campus_donations/year/${yearId}/building/${buildingId}/floor/${floorId}`; +}; + +export const getCampusDonationsYearYearIdBuildingBuildingIdFloorFloorId = async ( + yearId: number, + buildingId: number, + floorId: number, + options?: RequestInit, +): Promise => { + return customFetch( + getGetCampusDonationsYearYearIdBuildingBuildingIdFloorFloorIdUrl(yearId, buildingId, floorId), + { + ...options, + method: 'GET', + }, + ); +}; + +export const getGetCampusDonationsYearYearIdBuildingBuildingIdFloorFloorIdKey = ( + yearId: number, + buildingId: number, + floorId: number, +) => [`/campus_donations/year/${yearId}/building/${buildingId}/floor/${floorId}`] as const; + +export type GetCampusDonationsYearYearIdBuildingBuildingIdFloorFloorIdQueryResult = NonNullable< + Awaited> +>; +export type GetCampusDonationsYearYearIdBuildingBuildingIdFloorFloorIdQueryError = unknown; + +export const useGetCampusDonationsYearYearIdBuildingBuildingIdFloorFloorId = ( + yearId: number, + buildingId: number, + floorId: number, + options?: { + swr?: SWRConfiguration< + Awaited>, + TError + > & { swrKey?: Key; enabled?: boolean }; + request?: SecondParameter; + }, +) => { + const { swr: swrOptions, request: requestOptions } = options ?? {}; + + const isEnabled = swrOptions?.enabled !== false && !!(yearId && buildingId && floorId); + const swrKey = + swrOptions?.swrKey ?? + (() => + isEnabled + ? getGetCampusDonationsYearYearIdBuildingBuildingIdFloorFloorIdKey( + yearId, + buildingId, + floorId, + ) + : null); + const swrFn = () => + getCampusDonationsYearYearIdBuildingBuildingIdFloorFloorId( + yearId, + buildingId, + floorId, + requestOptions, + ); + + const query = useSwr>, TError>(swrKey, swrFn, swrOptions); + + return { + swrKey, + ...query, + }; +}; + +/** + * 年度で指定されたfund_informationsに紐づくデータを取得 + */ +export type getCampusDonationsBuildingsYearResponse200 = { + data: BuildingTotal[]; + status: 200; +}; + +export type getCampusDonationsBuildingsYearResponseComposite = + getCampusDonationsBuildingsYearResponse200; + +export type getCampusDonationsBuildingsYearResponse = + getCampusDonationsBuildingsYearResponseComposite & { + headers: Headers; + }; + +export const getGetCampusDonationsBuildingsYearUrl = (year: number) => { + return `/campus_donations/buildings/${year}`; +}; + +export const getCampusDonationsBuildingsYear = async ( + year: number, + options?: RequestInit, +): Promise => { + return customFetch( + getGetCampusDonationsBuildingsYearUrl(year), + { + ...options, + method: 'GET', + }, + ); +}; + +export const getGetCampusDonationsBuildingsYearKey = (year: number) => + [`/campus_donations/buildings/${year}`] as const; + +export type GetCampusDonationsBuildingsYearQueryResult = NonNullable< + Awaited> +>; +export type GetCampusDonationsBuildingsYearQueryError = unknown; + +export const useGetCampusDonationsBuildingsYear = ( + year: number, + options?: { + swr?: SWRConfiguration>, TError> & { + swrKey?: Key; + enabled?: boolean; + }; + request?: SecondParameter; + }, +) => { + const { swr: swrOptions, request: requestOptions } = options ?? {}; + + const isEnabled = swrOptions?.enabled !== false && !!year; + const swrKey = + swrOptions?.swrKey ?? (() => (isEnabled ? getGetCampusDonationsBuildingsYearKey(year) : null)); + const swrFn = () => getCampusDonationsBuildingsYear(year, requestOptions); + + const query = useSwr>, TError>(swrKey, swrFn, swrOptions); + + return { + swrKey, + ...query, + }; +}; + /** * departmentの一覧の取得 */ diff --git a/view/next-project/src/generated/model/buildingTotal.ts b/view/next-project/src/generated/model/buildingTotal.ts new file mode 100644 index 00000000..f68a3afa --- /dev/null +++ b/view/next-project/src/generated/model/buildingTotal.ts @@ -0,0 +1,13 @@ +/** + * Generated by orval v7.6.0 🍺 + * Do not edit manually. + * NUTFes FinanSu API + * FinanSu APIドキュメント + * OpenAPI spec version: 2.0.0 + */ + +export interface BuildingTotal { + id?: number; + name?: string; + totalPrice?: number; +} diff --git a/view/next-project/src/generated/model/campusDonation.ts b/view/next-project/src/generated/model/campusDonation.ts new file mode 100644 index 00000000..bacbb3c7 --- /dev/null +++ b/view/next-project/src/generated/model/campusDonation.ts @@ -0,0 +1,18 @@ +/** + * Generated by orval v7.6.0 🍺 + * Do not edit manually. + * NUTFes FinanSu API + * FinanSu APIドキュメント + * OpenAPI spec version: 2.0.0 + */ + +/** + * 教員単体の情報 + */ +export interface CampusDonation { + teacher_id: number; + room_name: string; + teacher_name: string; + price: number; + is_black?: boolean; +} diff --git a/view/next-project/src/generated/model/campusDonationByFloor.ts b/view/next-project/src/generated/model/campusDonationByFloor.ts new file mode 100644 index 00000000..1173c917 --- /dev/null +++ b/view/next-project/src/generated/model/campusDonationByFloor.ts @@ -0,0 +1,18 @@ +/** + * Generated by orval v7.6.0 🍺 + * Do not edit manually. + * NUTFes FinanSu API + * FinanSu APIドキュメント + * OpenAPI spec version: 2.0.0 + */ + +export interface CampusDonationByFloor { + teacher_id: number; + building_name: string; + unit_number: string; + floor_number: string; + room_name: string; + teacher_name: string; + price: number; + is_black: boolean; +} diff --git a/view/next-project/src/generated/model/campusDonationByFloorAndBuilding.ts b/view/next-project/src/generated/model/campusDonationByFloorAndBuilding.ts new file mode 100644 index 00000000..d3ef5639 --- /dev/null +++ b/view/next-project/src/generated/model/campusDonationByFloorAndBuilding.ts @@ -0,0 +1,17 @@ +/** + * Generated by orval v7.6.0 🍺 + * Do not edit manually. + * NUTFes FinanSu API + * FinanSu APIドキュメント + * OpenAPI spec version: 2.0.0 + */ +import type { FloorGroup } from './floorGroup'; + +/** + * 棟ごとの教員情報 + */ +export interface CampusDonationByFloorAndBuilding { + building_id: number; + building_name?: string; + floors: FloorGroup[]; +} diff --git a/view/next-project/src/generated/model/floorGroup.ts b/view/next-project/src/generated/model/floorGroup.ts new file mode 100644 index 00000000..4a777394 --- /dev/null +++ b/view/next-project/src/generated/model/floorGroup.ts @@ -0,0 +1,17 @@ +/** + * Generated by orval v7.6.0 🍺 + * Do not edit manually. + * NUTFes FinanSu API + * FinanSu APIドキュメント + * OpenAPI spec version: 2.0.0 + */ +import type { CampusDonation } from './campusDonation'; + +/** + * フロアごとの教員情報 + */ +export interface FloorGroup { + floor_id?: number; + floor_number: string; + donations: CampusDonation[]; +} diff --git a/view/next-project/src/generated/model/getFundInformationsBuildingYear200.ts b/view/next-project/src/generated/model/getFundInformationsBuildingYear200.ts new file mode 100644 index 00000000..27add916 --- /dev/null +++ b/view/next-project/src/generated/model/getFundInformationsBuildingYear200.ts @@ -0,0 +1,9 @@ +/** + * Generated by orval v7.6.0 🍺 + * Do not edit manually. + * NUTFes FinanSu API + * FinanSu APIドキュメント + * OpenAPI spec version: 2.0.0 + */ + +export type GetFundInformationsBuildingYear200 = { [key: string]: unknown }; diff --git a/view/next-project/src/generated/model/getFundInformationsBuildingsYear200.ts b/view/next-project/src/generated/model/getFundInformationsBuildingsYear200.ts new file mode 100644 index 00000000..c0113e94 --- /dev/null +++ b/view/next-project/src/generated/model/getFundInformationsBuildingsYear200.ts @@ -0,0 +1,9 @@ +/** + * Generated by orval v7.6.0 🍺 + * Do not edit manually. + * NUTFes FinanSu API + * FinanSu APIドキュメント + * OpenAPI spec version: 2.0.0 + */ + +export type GetFundInformationsBuildingsYear200 = { [key: string]: unknown }; diff --git a/view/next-project/src/generated/model/index.ts b/view/next-project/src/generated/model/index.ts index 1076c95a..8d6cad75 100644 --- a/view/next-project/src/generated/model/index.ts +++ b/view/next-project/src/generated/model/index.ts @@ -9,11 +9,15 @@ export * from './activity'; export * from './activityInformation'; export * from './activityStyle'; +export * from './buildingTotal'; export * from './buyReport'; export * from './buyReportDetail'; export * from './buyReportInformation'; export * from './buyReportInformationStatus'; export * from './buyReportWithDivisionId'; +export * from './campusDonation'; +export * from './campusDonationByFloor'; +export * from './campusDonationByFloorAndBuilding'; export * from './deleteActivitiesId200'; export * from './deleteActivityInformationsId200'; export * from './deleteActivityStylesId200'; @@ -53,6 +57,7 @@ export * from './festivalItemsForMyPage'; export * from './financialRecord'; export * from './financialRecordDetails'; export * from './financialRecordWithBalance'; +export * from './floorGroup'; export * from './getActivities200'; export * from './getActivitiesDetails200'; export * from './getActivitiesDetailsYear200'; @@ -92,6 +97,8 @@ export * from './getFestivalItemsUsersParams'; export * from './getFinancialRecordsCsvDownloadParams'; export * from './getFinancialRecordsParams'; export * from './getFundInformations200'; +export * from './getFundInformationsBuildingYear200'; +export * from './getFundInformationsBuildingsYear200'; export * from './getFundInformationsDetails200'; export * from './getFundInformationsDetailsYear200'; export * from './getFundInformationsId200';
campus_donations.year_idcampus_donations_ibfk_1C
financial_records.year_id financial_records_ibfk_1