|
@@ -19,6 +19,7 @@ func Test(r *GinRouter) {
|
|
|
r.POSTJWT("/test/delete/:id", TestDelete)
|
|
|
}
|
|
|
|
|
|
+// 新增
|
|
|
func TestAdd(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
err := IsAdmin(apictx)
|
|
|
if err != nil {
|
|
@@ -49,6 +50,7 @@ func TestAdd(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
return repo.RepoAddDoc(apictx.CreateRepoCtx(), repo.CollectionTest, &form)
|
|
|
}
|
|
|
|
|
|
+// 列表
|
|
|
func TestList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
// err := IsAdmin(apictx)
|
|
|
// if err != nil {
|
|
@@ -87,6 +89,7 @@ func TestList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
+// 更新
|
|
|
func TestEdit(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
// 操作用户为admin
|
|
|
err := IsAdmin(apictx)
|
|
@@ -105,7 +108,7 @@ func TestEdit(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionTest, form.Id.Hex(), &form)
|
|
|
}
|
|
|
|
|
|
-// 删除用户
|
|
|
+// 删除
|
|
|
func TestDelete(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
// 操作用户为admin
|
|
|
err := IsAdmin(apictx)
|