-
-
Save pei0804/7731e2abdb28625d666689fd15850086 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package resource | |
import ( | |
. "github.com/VG-Tech-Dojo/Logbook-server/design/constant" | |
"github.com/VG-Tech-Dojo/Logbook-server/design/media" | |
. "github.com/goadesign/goa/design" | |
. "github.com/goadesign/goa/design/apidsl" | |
) | |
var _ = Resource("users", func() { | |
BasePath("/users") | |
DefaultMedia(media.UserMedia) | |
Action("list", func() { | |
Description("ユーザー情報をリストで取得する") | |
Routing(GET("")) | |
Params(func() { | |
Param("intern_id", Integer, "インターンID", DefaultIntegerParam) | |
Param("q", String, "検索キーワード", DefaultStringParam) | |
}) | |
UseTrait(GeneralUserTrait) | |
}) | |
Action("create", func() { | |
Description("ユーザーを作成する") | |
Routing(POST("")) | |
Params(func() { | |
Param("name", String, "名前") | |
Param("email", String, "メールアドレス", func() { | |
Format("email") | |
}) | |
Param("authority", String, "権限", func() { | |
Enum("admin", "employee", "student", "guest") | |
Default("guest") | |
}) | |
Param("icon_url", String, "アイコンURL") | |
Param("self_introduction", String, "自己紹介") | |
Param("current_intern_id", Integer, "参加中のインターン") | |
Required("name", "email", "authority", "icon_url", "self_introduction", "current_intern_id") | |
}) | |
UseTrait(AdminUserTrait) | |
}) | |
Action("show", func() { | |
Description("show user details") | |
Routing(GET("/:id")) <---- :github_id is dethe | |
Params(func() { | |
Param("id", String, "GitHubID") | |
Required("id") | |
}) | |
UseTrait(GeneralUserTrait) | |
}) | |
Action("update", func() { | |
Description("ユーザーの情報を更新する") | |
Routing(PUT("/:id")) | |
Params(func() { | |
Param("id", Integer, "ユーザーID") | |
Param("name", String, "名前", DefaultStringParam) | |
Param("email", String, "メールアドレス", func() { | |
Format("email") | |
DefaultStringParam() | |
}) | |
Param("authority", String, "権限", func() { | |
Enum("admin", "employee", "student", "guest") | |
Default("guest") | |
}) | |
Param("icon_url", String, "アイコンURL", DefaultStringParam) | |
Param("self_introduction", String, "自己紹介", DefaultStringParam) | |
Param("current_intern_id", Integer, "参加中のインターン") | |
Required("id", "name", "email", "icon_url", "self_introduction", "current_intern_id") | |
}) | |
UseTrait(AdminUserTrait) | |
}) | |
Action("delete", func() { | |
Description("ユーザーを削除する") | |
Routing(DELETE("/:id")) | |
Params(func() { | |
Param("id", Integer, "ユーザーID") | |
Required("id") | |
}) | |
UseTrait(AdminUserTrait) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment