package api import ( "3dshow/db/model" "3dshow/db/repo" "time" "github.com/gin-gonic/gin" ) func Supply(r *GinRouter) { CreateCRUD(r, "/supply", &CRUDOption{ Collection: repo.CollectionSupply, NewModel: func(c *gin.Context, _ *ApiSession) (interface{}, error) { entity := &model.Supply{} c.ShouldBindJSON(entity) entity.CreateTime = time.Now() return entity, nil }, EmtyModel: func(c *gin.Context, apictx *ApiSession) interface{} { return &model.Supply{} }, JWT: true, SearchProject: []string{"name", "avatar", "contact", "createTime"}, DetailProject: []string{"name", "avatar", "contact", "createTime"}, }) }