Skip to content

Commit

Permalink
Merge pull request #725 from NUTFes/develop
Browse files Browse the repository at this point in the history
2024年度版FinanSu 1st リリース
  • Loading branch information
Kubosaka authored Apr 3, 2024
2 parents 03d81ca + 0c701bb commit 48fdec3
Show file tree
Hide file tree
Showing 62 changed files with 5,799 additions and 856 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ api/tmp

# cloudflare
web/**/*.json
web/**/cert.pem
web/**/cert.pem

tmp/*

/view/next-project/.env
215 changes: 178 additions & 37 deletions api/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +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/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 @@ -139,6 +139,98 @@ const docTemplate = `{
},
},
},
"/activity_informations": {
"get": {
tags: ["activity_information"],
"description": "activity_informationの一覧を取得",
"responses": {
"200": {
"description": "activity_informationの一覧の取得",
}
}
},
"post": {
tags: ["activity_information"],
"description": "activity_informationの作成",
"parameters": [
{
"in": "body",
"name": "activity_information",
"schema":{
"$ref": "#/definitions/activity_information"
},
},
],
responses: {
"200": {
"description": "create されたactivity_informationが返ってくる",
}
},
},
},
"/activity_informations/{id}": {
"get": {
tags: ["activity_information"],
"description": "IDで指定されたactivity_informationsの取得",
"parameters": [
{
"name": "id",
"in": "path",
"description": "id",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "activity_informationの取得",
}
}
},
"put": {
tags: ["activity_information"],
"description": "activity_informationの更新",
responses: {
"200": {
"description": "更新されたactivity_informationが返ってくる",
}
},
"parameters": [
{
"name": "id",
"in": "path",
"description": "id",
"required": true,
"type": "integer"
},
{
"in": "body",
"name": "activity_information",
"schema":{
"$ref": "#/definitions/activity_information"
},
},
],
},
"delete": {
tags: ["activity_information"],
"description": "IDを指定してactivity_informationの削除",
"parameters": [
{
"name": "id",
"in": "path",
"description": "id",
"required": true,
"type": "integer"
}
],
responses: {
"200": {
"description": "activity_informationの削除完了",
}
},
},
},
"/activity_styles": {
"get": {
tags: ["activity_style"],
Expand Down Expand Up @@ -731,6 +823,26 @@ const docTemplate = `{
}
},
},
"/expenses/fiscalyear/{year}": {
"get": {
tags: ["expense"],
"description": "年度で指定されたexpensesを取得",
"parameters": [
{
"name": "year",
"in": "path",
"description": "year",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "yearで指定されたexpensesを取得",
}
}
},
},
"/fund_informations": {
"get": {
tags: ["fund_information"],
Expand Down Expand Up @@ -1647,26 +1759,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の取得完了",
}
"/sponsors/periods/{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 @@ -2212,7 +2324,6 @@ const docTemplate = `{
"sponsorID":{
"type": "int",
"example": 1,
},
"userID":{
"type": "int",
Expand Down Expand Up @@ -2253,6 +2364,36 @@ const docTemplate = `{
"remark",
},
},
"activity_information":{
"properties":{
"activityID":{
"type": "int",
"example": 1,
},
"bucketName":{
"type": "string",
"example": "なし",
},
"fileName":{
"type": "string",
"example": "なし",
},
"fileType":{
"type": "string",
"example": "なし",
},
"designProgress":{
"type": "int",
"example": 1,
},
"fileInformation":{
"type": "string",
"example": "",
},
},
},
"activity_style":{
"properties":{
"activityID":{
Expand Down
102 changes: 102 additions & 0 deletions api/externals/controller/activity_information_controller.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package controller

import (
"fmt"
"net/http"
"strconv"

"github.com/NUTFes/FinanSu/api/internals/domain"
"github.com/NUTFes/FinanSu/api/internals/usecase"

"github.com/labstack/echo/v4"
)

type activityInformationController struct {
u usecase.ActivityInformationUseCase
}

type ActivityInformationController interface {
IndexActivityInformation(echo.Context) error
ShowActivityInformation(echo.Context) error
CreateActivityInformation(echo.Context) error
UpdateActivityInformation(echo.Context) error
DestroyActivityInformation(echo.Context) error
}

func NewActivityInformationController(u usecase.ActivityInformationUseCase) ActivityInformationController {
return &activityInformationController{u}
}

// Index
func (a *activityInformationController) IndexActivityInformation(c echo.Context) error {
activityInformations, err := a.u.GetActivityInformation(c.Request().Context())
if err != nil {
return err
}
return c.JSON(http.StatusOK, activityInformations)
}

// Show
func (a *activityInformationController) ShowActivityInformation(c echo.Context) error {
id := c.Param("id")
activityInformation, err := a.u.GetActivityInformationByID(c.Request().Context(), id)
if err != nil {
return err
}
return c.JSON(http.StatusOK, activityInformation)
}

// Create
func (a *activityInformationController) CreateActivityInformation(c echo.Context) error {
activityInformation := new(domain.ActivityInformation)
if err := c.Bind(activityInformation); err != nil {
fmt.Println("err")
return err
}

latastActivityInformation, err := a.u.CreateActivityInformation(c.Request().Context() ,
strconv.Itoa(int(activityInformation.ActivityId)),
activityInformation.BucketName,
activityInformation.FileName,
activityInformation.FileType,
strconv.Itoa(int(activityInformation.DesignProgress)),
activityInformation.FileInformation,
)
if err != nil {
return err
}
return c.JSON(http.StatusOK, latastActivityInformation)
}

// Update
func (a *activityInformationController) UpdateActivityInformation(c echo.Context) error {
id := c.Param("id")
activityInformation := new(domain.ActivityInformation)
if err := c.Bind(activityInformation); err != nil {
fmt.Println("err")
return err
}
updatedActivity, err := a.u.UpdateActivityInformation(c.Request().Context(),
id,
strconv.Itoa(int(activityInformation.ActivityId)),
activityInformation.BucketName,
activityInformation.FileName,
activityInformation.FileType,
strconv.Itoa(int(activityInformation.DesignProgress)),
activityInformation.FileInformation)

if err != nil {
return err
}
return c.JSON(http.StatusOK, updatedActivity)
}

// Destroy
func (a *activityInformationController) DestroyActivityInformation(c echo.Context) error {
id := c.Param("id")
err := a.u.DestroyActivityInformation(c.Request().Context(), id)
if err != nil {
return err
}
return c.JSON(http.StatusOK, "Destroy ActivityInformations")
}
10 changes: 10 additions & 0 deletions api/externals/controller/expense_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type ExpenseController interface {
IndexExpenseDetails(echo.Context) error
ShowExpenseDetail(echo.Context) error
IndexExpenseDetailsByPeriod(echo.Context) error
IndexExpenseByPeriod(echo.Context) error
}

func NewExpenseController(u usecase.ExpenseUseCase) ExpenseController {
Expand Down Expand Up @@ -119,3 +120,12 @@ func (e *expenseController) IndexExpenseDetailsByPeriod(c echo.Context) error {
}
return c.JSON(http.StatusOK, expenseDetails)
}

func (e *expenseController) IndexExpenseByPeriod(c echo.Context) error {
year := c.Param("year")
expense, err := e.u.GetExpensesByPeriod(c.Request().Context(), year)
if err != nil {
return err
}
return c.JSON(http.StatusOK, expense)
}
Loading

0 comments on commit 48fdec3

Please sign in to comment.