Moved Error & Token into v1 models & fixed imports
This commit is contained in:
parent
96268f8d7e
commit
aedb1903f0
@ -17,7 +17,7 @@ package context
|
||||
import (
|
||||
"git.supernets.org/perp/gopay/internal/config"
|
||||
"git.supernets.org/perp/gopay/internal/database"
|
||||
"git.supernets.org/perp/gopay/internal/models"
|
||||
v1 "git.supernets.org/perp/gopay/internal/models/v1"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@ -50,7 +50,7 @@ func (ctx *Context) Route(handler func(ctx *Context)) func(*gin.Context) {
|
||||
|
||||
// Return an Error
|
||||
func (ctx *Context) Error(code int, err string) {
|
||||
error := &models.Error{
|
||||
error := &v1.Error{
|
||||
Type: err,
|
||||
}
|
||||
ctx.JSON(code, error)
|
||||
@ -58,7 +58,7 @@ func (ctx *Context) Error(code int, err string) {
|
||||
|
||||
// Return a Token
|
||||
func (ctx *Context) Token(token string) {
|
||||
token_ := &models.Token{
|
||||
token_ := &v1.Token{
|
||||
Token: token,
|
||||
}
|
||||
ctx.JSON(200, token_)
|
||||
|
@ -12,9 +12,9 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package models
|
||||
package v1
|
||||
|
||||
// Error response
|
||||
type Error struct {
|
||||
Type string `json:"type"`
|
||||
Type string `json:"type" enums:"DatabaseError,InternalServerError,InvalidPassword,InvalidUsername,MissingBody,RegistrationDisabled,UsernameTaken"`
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package models
|
||||
package v1
|
||||
|
||||
// Token response
|
||||
type Token struct {
|
Loading…
Reference in New Issue
Block a user