mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Fix default setting (#740)
* push validate/defaults into datastore we weren't setting a timestamp in route insert when we needed to create an app there. that whole thing isn't atomic, but this fixes the timestamp issue. closes #738 seems like we should do similar with the FireBeforeX stuff too. * fix tests * app name validation was buggy, an upper cased letter failed. now it doesn't. uses unicode now. * removes duplicate errors for datastore and models validation that were used interchangably but weren't.
This commit is contained in:
@@ -49,11 +49,6 @@ func (s *Server) handleRoutesPostPutPatch(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (s *Server) submitRoute(ctx context.Context, wroute *models.RouteWrapper) error {
|
||||
wroute.Route.SetDefaults()
|
||||
err := wroute.Route.Validate()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
r, err := s.datastore.InsertRoute(ctx, wroute.Route)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -114,9 +109,6 @@ func (s *Server) ensureApp(ctx context.Context, wroute *models.RouteWrapper, met
|
||||
} else if app == nil {
|
||||
// Create a new application
|
||||
newapp := &models.App{Name: wroute.Route.AppName}
|
||||
if err = newapp.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = s.FireBeforeAppCreate(ctx, newapp)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user