Skip to content

Commit

Permalink
Merge pull request #692 from NUTFes/develop
Browse files Browse the repository at this point in the history
年度更新リリースとバグ修正
  • Loading branch information
Kubosaka authored Mar 4, 2024
2 parents f942c38 + 941d994 commit 03d81ca
Show file tree
Hide file tree
Showing 55 changed files with 2,310 additions and 322 deletions.
236 changes: 236 additions & 0 deletions api/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,26 @@ const docTemplate = `{
}
},
},
"/activities/details/{year}": {
"get": {
tags: ["activity"],
"description": "年度で指定されたactivitiesとsponsor,sponsorStyle,userの一覧を取得",
"parameters": [
{
"name": "year",
"in": "path",
"description": "year",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "年度で指定されたactivitiesとsponsor,sponsorStyle,userの一覧を取得",
}
}
},
},
"/activities/{id}": {
"get": {
tags: ["activity"],
Expand Down Expand Up @@ -263,6 +283,26 @@ const docTemplate = `{
}
},
},
"/budgets/details/{year}": {
"get": {
tags: ["budget"],
"description": "年度で指定されたbudgetsに紐づく年度とソースを取得",
"parameters": [
{
"name": "year",
"in": "path",
"description": "year",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "年度で指定されたbudgetsに紐づく年度とソースを取得",
}
}
},
},
"/budgets/{id}": {
"get": {
tags: ["budget"],
Expand Down Expand Up @@ -671,6 +711,26 @@ const docTemplate = `{
}
},
},
"/expenses/details/{year}": {
"get": {
tags: ["expense"],
"description": "年度で指定されたexpenseに紐づく購入申請と購入報告を取得",
"parameters": [
{
"name": "year",
"in": "path",
"description": "year",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "yearで指定されたexpenseに紐づく購入申請と購入報告を取得",
}
}
},
},
"/fund_informations": {
"get": {
tags: ["fund_information"],
Expand Down Expand Up @@ -870,6 +930,26 @@ const docTemplate = `{
}
},
},
"/fund_informations/details/{year}": {
"get": {
tags: ["fund_information"],
"description": "年度で指定されたfund_informationsに紐づくデータを取得",
"parameters": [
{
"name": "year",
"in": "path",
"description": "year",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "年度で指定されたfund_informationsに紐づくデータを取得",
}
}
},
},
"/purchaseitems": {
"get": {
tags: ["purchase_item"],
Expand Down Expand Up @@ -1220,6 +1300,26 @@ const docTemplate = `{
}
},
},
"/purchaseorders/details/{year}": {
"get": {
tags: ["purchase_order"],
"description": "年度で指定されたpurchase_orderに紐づくuserとpurchase_itemを取得",
"parameters": [
{
"name": "year",
"in": "path",
"description": "year",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "IDで指定されたpurchase_orderに紐づくuserとpurchase_itemを取得",
}
}
},
},
"/purchasereports": {
"get": {
tags: ["purchase_report"],
Expand Down Expand Up @@ -1343,6 +1443,26 @@ const docTemplate = `{
}
},
},
"/purchasereports/details/{year}": {
"get": {
tags: ["purchase_report"],
"description": "年度で指定されたpurchase_reportsに紐づくデータを取得",
"parameters": [
{
"name": "year",
"in": "path",
"description": "year",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "年度で指定されたpurchase_reportsに紐づくデータを取得",
}
}
},
},
"/sources": {
"get": {
tags: ["source"],
Expand Down Expand Up @@ -1527,6 +1647,26 @@ const docTemplate = `{
},
},
},
"/sponsors/{year}": {
"get": {
tags: ["sponsor"],
"description": "年度で指定されたsponsorを取得",
"parameters": [
{
"name": "year",
"in": "path",
"description": "year",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "sponsorの取得完了",
}
}
},
},
"/sponsorstyles": {
"get": {
tags: ["sponsorstyle"],
Expand Down Expand Up @@ -1991,6 +2131,80 @@ const docTemplate = `{
},
},
},
"/years/periods": {
"get": {
tags: ["year_periods"],
"description": "年度一覧の取得",
"responses": {
"200": {
"description": "year_periodsの一覧を取得",
}
}
},
"post": {
tags: ["year_periods"],
"description": "year_periodsの作成",
responses: {
"200": {
"description": "作成されたyear_periodsが返ってくる",
}
},
"parameters": [
{
"in": "body",
"name": "year_periods",
"schema":{
"$ref": "#/definitions/year_periods"
},
},
],
},
},
"/years/periods/{id}": {
"put": {
tags: ["year_periods"],
"description": "year_periodsの更新",
responses: {
"200": {
"description": "更新されたyear_periodsが返ってくる",
}
},
"parameters": [
{
"name": "id",
"in": "path",
"description": "id",
"required": true,
"type": "integer"
},
{
"in": "body",
"name": "year_periods",
"schema":{
"$ref": "#/definitions/year_periods"
},
},
],
},
"delete": {
tags: ["year_periods"],
"description": "IDを指定してyear_periodsの削除",
"parameters": [
{
"name": "id",
"in": "path",
"description": "id",
"required": true,
"type": "integer"
}
],
responses: {
"200": {
"description": "year_periodsの削除完了",
},
},
},
},
},
"definitions":{
"activity":{
Expand Down Expand Up @@ -2150,6 +2364,28 @@ const docTemplate = `{
"purchaseOrderID"
},
},
"year_periods":{
"properties":{
"year":{
"type": "int",
"example": 2024,
},
"startedAt":{
"type": "string",
"example": "0000-00-00T00:00:00Z",
},
"endedAt":{
"type": "string",
"example": "0000-00-00T00:00:00Z",
},
},
"required":{
"year",
"startedAt",
"endedAt"
},
},
},
}`

Expand Down
11 changes: 11 additions & 0 deletions api/externals/controller/activity_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type ActivityController interface {
UpdateActivity(echo.Context) error
DestroyActivity(echo.Context) error
IndexActivityDetail(echo.Context) error
IndexActivityDetailsByPeriod(echo.Context) error
}

func NewActivityController(u usecase.ActivityUseCase) ActivityController {
Expand Down Expand Up @@ -93,3 +94,13 @@ func (a *activityController) IndexActivityDetail(c echo.Context) error {
}
return c.JSON(http.StatusOK, activities)
}

// 年度で指定されたactivitiesとsponsor,sponsorStyle,userの一覧を取得
func (a *activityController) IndexActivityDetailsByPeriod(c echo.Context) error {
year := c.Param("year")
activities, err := a.u.GetActivityDetailsByPeriod(c.Request().Context(), year)
if err != nil {
return err
}
return c.JSON(http.StatusOK, activities)
}
11 changes: 11 additions & 0 deletions api/externals/controller/budget_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type BudgetController interface {
DestroyBudget(echo.Context) error
ShowBudgetDetailById(echo.Context) error
ShowBudgetDetails(echo.Context) error
ShowBudgetDetailsByPeriods(echo.Context) error
}

func NewBudgetController(u usecase.BudgetUseCase) BudgetController {
Expand Down Expand Up @@ -97,3 +98,13 @@ func (b *budgetController) ShowBudgetDetails(c echo.Context) error {
}
return c.JSON(http.StatusOK, budgetDetails)
}

// 年度ごとにBudgetと紐づくデータ全件取得
func (b *budgetController) ShowBudgetDetailsByPeriods(c echo.Context) error {
year := c.Param("year")
budgetDetails, err := b.u.GetBudgetDetailsByPeriod(c.Request().Context(), year)
if err != nil {
return err
}
return c.JSON(http.StatusOK, budgetDetails)
}
14 changes: 14 additions & 0 deletions api/externals/controller/expense_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type ExpenseController interface {
UpdateExpenseTP(echo.Context) error
IndexExpenseDetails(echo.Context) error
ShowExpenseDetail(echo.Context) error
IndexExpenseDetailsByPeriod(echo.Context) error
}

func NewExpenseController(u usecase.ExpenseUseCase) ExpenseController {
Expand Down Expand Up @@ -105,3 +106,16 @@ func (e *expenseController) ShowExpenseDetail(c echo.Context) error {
}
return c.JSON(http.StatusOK, expenseDetail)
}

func (e *expenseController) IndexExpenseDetailsByPeriod(c echo.Context) error {
year := c.Param("year")
err := e.u.UpdateExpenseTP(c.Request().Context())
if err != nil {
return err
}
expenseDetails, err := e.u.GetExpenseDetailsByPeriod(c.Request().Context(), year)
if err != nil {
return err
}
return c.JSON(http.StatusOK, expenseDetails)
}
11 changes: 11 additions & 0 deletions api/externals/controller/fund_information_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type FundInformationController interface {
DestroyFundInformation(echo.Context) error
IndexFundInformationDetails(echo.Context) error
ShowFundInformationDetailByID(echo.Context) error
IndexFundInformationDetailsByPeriod(echo.Context) error
}

func NewFundInformationController(u usecase.FundInformationUseCase) FundInformationController {
Expand Down Expand Up @@ -106,3 +107,13 @@ func (f *fundInformationController) ShowFundInformationDetailByID(c echo.Context
}
return c.JSON(http.StatusOK, fundinforuserandteacher)
}

// IndexFundInformationDetailsByPeriod
func (f *fundInformationController) IndexFundInformationDetailsByPeriod(c echo.Context) error {
year := c.Param("year")
fundInformationDetailsByPeriod, err := f.u.GetFundInformationDetailsByPeriod(c.Request().Context(), year)
if err != nil {
return err
}
return c.JSON(http.StatusOK, fundInformationDetailsByPeriod)
}
Loading

0 comments on commit 03d81ca

Please sign in to comment.