<commit_before>package server

import "github.com/labstack/echo"

func RegisterController(name string, e *echo.Echo, m []echo.Middleware, config Config) {
	rc := ResourceController{name}
	rcBase := e.Group("/" + name)
	rcBase.Get("", rc.IndexHandler)
	rcBase.Post("", rc.CreateHandler)

	rcItem := rcBase.Group("/:id")
	rcItem.Get("", rc.ShowHandler)
	rcItem.Put("", rc.UpdateHandler)
	rcItem.Delete("", rc.DeleteHandler)

	if config.UseSmartAuth {
		m = append(m, SmartAuthHandler(name))
	}

	if len(m) > 0 {
		rcBase.Use(m...)
	}
}

func RegisterRoutes(e *echo.Echo, config map[string][]echo.Middleware, serverConfig Config) {

	// Batch Support

	e.Post("/", BatchHandler)

	// Resource, useSmartAuths

	RegisterController("Appointment", e, config["Appointment"], serverConfig)
	RegisterController("ReferralRequest", e, config["ReferralRequest"], serverConfig)
	RegisterController("Account", e, config["Account"], serverConfig)
	RegisterController("Provenance", e, config["Provenance"], serverConfig)
	RegisterController("Questionnaire", e, config["Questionnaire"], serverConfig)
	RegisterController("ExplanationOfBenefit", e, config["ExplanationOfBenefit"], serverConfig)
	RegisterController("DocumentManifest", e, config["DocumentManifest"], serverConfig)<commit_msg>Fixing addition of SMART Auth Middleware<commit_after>package server

import "github.com/labstack/echo"

func RegisterController(name string, e *echo.Echo, m []echo.Middleware, config Config) {
	rc := ResourceController{name}
	rcBase := e.Group("/" + name)
	rcBase.Get("", rc.IndexHandler)
	rcBase.Post("", rc.CreateHandler)

	rcItem := rcBase.Group("/:id")
	rcItem.Get("", rc.ShowHandler)
	rcItem.Put("", rc.UpdateHandler)
	rcItem.Delete("", rc.DeleteHandler)

	if len(m) > 0 {
		rcBase.Use(m...)
	}

	if config.UseSmartAuth {
		rcBase.Use(SmartAuthHandler(name))
	}
}

func RegisterRoutes(e *echo.Echo, config map[string][]echo.Middleware, serverConfig Config) {

	// Batch Support

	e.Post("/", BatchHandler)

	// Resource, useSmartAuths

	RegisterController("Appointment", e, config["Appointment"], serverConfig)
	RegisterController("ReferralRequest", e, config["ReferralRequest"], serverConfig)
	RegisterController("Account", e, config["Account"], serverConfig)
	RegisterController("Provenance", e, config["Provenance"], serverConfig)
	RegisterController("Questionnaire", e, config["Questionnaire"], serverConfig)
	RegisterController("ExplanationOfBenefit", e, config["ExplanationOfBenefit"], serverConfig)
	RegisterController("DocumentManifest", e, config["DocumentManifest"], serverConfig)
{'fraction_non_alphanumeric': 0.15381619937694704, 'fraction_numerical': 0.000778816199376947, 'mean_word_length': 6.8323170731707314, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1256917', 'n_tokens_mistral': 825, 'n_tokens_neox': 798, 'n_words': 162}