diff --git a/TopModel.Generator.Jpa/SpringServerApiGenerator.cs b/TopModel.Generator.Jpa/SpringServerApiGenerator.cs index 1b8a141d..5cea13d5 100644 --- a/TopModel.Generator.Jpa/SpringServerApiGenerator.cs +++ b/TopModel.Generator.Jpa/SpringServerApiGenerator.cs @@ -67,6 +67,13 @@ private static string GetClassName(string fileName) return $"{fileName.ToPascalCase()}Controller"; } + private void AddImports(IEnumerable endpoints, JavaWriter fw, string tag) + { + fw.AddImports(endpoints.Select(e => $"org.springframework.web.bind.annotation.{e.Method.ToPascalCase(true)}Mapping")); + fw.AddImports(GetTypeImports(endpoints, tag)); + fw.AddImports(endpoints.SelectMany(e => Config.GetDecoratorImports(e, tag))); + } + private IEnumerable GetTypeImports(IEnumerable endpoints, string tag) { var properties = endpoints.SelectMany(endpoint => endpoint.Params) @@ -177,11 +184,4 @@ private void WriteEndpoint(JavaWriter fw, Endpoint endpoint, string tag) fw.WriteLine(1, $"{returnType} {endpoint.NameCamel}({string.Join(", ", methodParams)});"); } - - private void AddImports(IEnumerable endpoints, JavaWriter fw, string tag) - { - fw.AddImports(endpoints.Select(e => $"org.springframework.web.bind.annotation.{e.Method.ToPascalCase(true)}Mapping")); - fw.AddImports(GetTypeImports(endpoints, tag)); - fw.AddImports(endpoints.SelectMany(e => Config.GetDecoratorImports(e, tag))); - } } diff --git a/TopModel.Utils/ModuleLatestVersion.cs b/TopModel.Utils/ModuleLatestVersion.cs index ee4beae3..d472d02f 100644 --- a/TopModel.Utils/ModuleLatestVersion.cs +++ b/TopModel.Utils/ModuleLatestVersion.cs @@ -1,3 +1,3 @@ namespace TopModel.Utils; -public record ModuleLatestVersion(string Version, DateTime CheckDate); +public record ModuleLatestVersion(string? Version, DateTime CheckDate); diff --git a/TopModel.Utils/NugetUtils.cs b/TopModel.Utils/NugetUtils.cs index b8275947..d1e073d5 100644 --- a/TopModel.Utils/NugetUtils.cs +++ b/TopModel.Utils/NugetUtils.cs @@ -60,6 +60,11 @@ public static async Task DownloadPackageAsync(string id, s } else { + if (cachedVersion.Version == null) + { + return null; + } + return new TopModelLockModule { Version = cachedVersion.Version }; } } @@ -85,6 +90,8 @@ public static async Task DownloadPackageAsync(string id, s { // Si on a pas internet par exemple. cantCheckVersion = true; + Versions[id] = new(null, DateTime.UtcNow); + await WriteAsync(); return null; } }