diff --git a/QRBee.Core/Client/APIClient.nswag b/QRBee.Core/Client/APIClient.nswag new file mode 100644 index 0000000..831c79a --- /dev/null +++ b/QRBee.Core/Client/APIClient.nswag @@ -0,0 +1,102 @@ +{ + "runtime": "Net60", + "defaultVariables": null, + "documentGenerator": { + "fromDocument": { + "json": "{\r\n \"openapi\": \"3.0.1\",\r\n \"info\": {\r\n \"title\": \"QRBee.Api\",\r\n \"version\": \"1.0\"\r\n },\r\n \"paths\": {\r\n \"/api/QRBee/Register\": {\r\n \"post\": {\r\n \"tags\": [\r\n \"QRBee\"\r\n ],\r\n \"requestBody\": {\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/RegistrationRequest\"\r\n }\r\n },\r\n \"text/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/RegistrationRequest\"\r\n }\r\n },\r\n \"application/*+json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/RegistrationRequest\"\r\n }\r\n }\r\n }\r\n },\r\n \"responses\": {\r\n \"200\": {\r\n \"description\": \"Success\",\r\n \"content\": {\r\n \"text/plain\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/RegistrationResponse\"\r\n }\r\n },\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/RegistrationResponse\"\r\n }\r\n },\r\n \"text/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/RegistrationResponse\"\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n \"components\": {\r\n \"schemas\": {\r\n \"RegistrationRequest\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"name\": {\r\n \"type\": \"string\",\r\n \"nullable\": true\r\n },\r\n \"email\": {\r\n \"type\": \"string\",\r\n \"nullable\": true\r\n },\r\n \"dateOfBirth\": {\r\n \"type\": \"string\",\r\n \"nullable\": true\r\n },\r\n \"certificateRequest\": {\r\n \"type\": \"string\",\r\n \"nullable\": true\r\n },\r\n \"registerAsMerchant\": {\r\n \"type\": \"boolean\"\r\n }\r\n },\r\n \"additionalProperties\": false\r\n },\r\n \"RegistrationResponse\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"clientId\": {\r\n \"type\": \"string\",\r\n \"nullable\": true\r\n },\r\n \"certificate\": {\r\n \"type\": \"string\",\r\n \"nullable\": true\r\n }\r\n },\r\n \"additionalProperties\": false\r\n }\r\n }\r\n }\r\n}", + "url": "http://redocly.github.io/redoc/openapi.yaml", + "output": null, + "newLineBehavior": "Auto" + } + }, + "codeGenerators": { + "openApiToCSharpClient": { + "clientBaseClass": null, + "configurationClass": null, + "generateClientClasses": true, + "generateClientInterfaces": false, + "clientBaseInterface": null, + "injectHttpClient": true, + "disposeHttpClient": true, + "protectedMethods": [], + "generateExceptionClasses": true, + "exceptionClass": "ApiException", + "wrapDtoExceptions": true, + "useHttpClientCreationMethod": false, + "httpClientType": "System.Net.Http.HttpClient", + "useHttpRequestMessageCreationMethod": false, + "useBaseUrl": true, + "generateBaseUrlProperty": true, + "generateSyncMethods": false, + "generatePrepareRequestAndProcessResponseAsAsyncMethods": false, + "exposeJsonSerializerSettings": false, + "clientClassAccessModifier": "public", + "typeAccessModifier": "public", + "generateContractsOutput": false, + "contractsNamespace": null, + "contractsOutputFilePath": null, + "parameterDateTimeFormat": "s", + "parameterDateFormat": "yyyy-MM-dd", + "generateUpdateJsonSerializerSettingsMethod": true, + "useRequestAndResponseSerializationSettings": false, + "serializeTypeInformation": false, + "queryNullValue": "", + "className": "{controller}Client", + "operationGenerationMode": "MultipleClientsFromOperationId", + "additionalNamespaceUsages": [ + "QRBee.Core.Data" + ], + "additionalContractNamespaceUsages": [], + "generateOptionalParameters": false, + "generateJsonMethods": false, + "enforceFlagEnums": false, + "parameterArrayType": "System.Collections.Generic.IEnumerable", + "parameterDictionaryType": "System.Collections.Generic.IDictionary", + "responseArrayType": "System.Collections.Generic.ICollection", + "responseDictionaryType": "System.Collections.Generic.IDictionary", + "wrapResponses": false, + "wrapResponseMethods": [], + "generateResponseClasses": true, + "responseClass": "SwaggerResponse", + "namespace": "QRBee.Core.Client", + "requiredPropertiesMustBeDefined": true, + "dateType": "System.DateTimeOffset", + "jsonConverters": null, + "anyType": "object", + "dateTimeType": "System.DateTimeOffset", + "timeType": "System.TimeSpan", + "timeSpanType": "System.TimeSpan", + "arrayType": "System.Collections.Generic.ICollection", + "arrayInstanceType": "System.Collections.ObjectModel.Collection", + "dictionaryType": "System.Collections.Generic.IDictionary", + "dictionaryInstanceType": "System.Collections.Generic.Dictionary", + "arrayBaseType": "System.Collections.ObjectModel.Collection", + "dictionaryBaseType": "System.Collections.Generic.Dictionary", + "classStyle": "Poco", + "jsonLibrary": "NewtonsoftJson", + "generateDefaultValues": true, + "generateDataAnnotations": true, + "excludedTypeNames": [], + "excludedParameterNames": [], + "handleReferences": false, + "generateImmutableArrayProperties": false, + "generateImmutableDictionaryProperties": false, + "jsonSerializerSettingsTransformationMethod": null, + "inlineNamedArrays": false, + "inlineNamedDictionaries": false, + "inlineNamedTuples": true, + "inlineNamedAny": false, + "generateDtoTypes": false, + "generateOptionalPropertiesAsNullable": false, + "generateNullableReferenceTypes": false, + "templateDirectory": null, + "typeNameGeneratorType": null, + "propertyNameGeneratorType": null, + "enumNameGeneratorType": null, + "serviceHost": null, + "serviceSchemes": null, + "output": null, + "newLineBehavior": "Auto" + } + } +} \ No newline at end of file diff --git a/QRBee.Core/Client/Client.cs b/QRBee.Core/Client/Client.cs new file mode 100644 index 0000000..4df7dc1 --- /dev/null +++ b/QRBee.Core/Client/Client.cs @@ -0,0 +1,282 @@ +//---------------------- +// +// Generated using the NSwag toolchain v13.15.5.0 (NJsonSchema v10.6.6.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) +// +//---------------------- + +using QRBee.Core.Data; + +#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." +#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." +#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' +#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... +#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." +#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" +#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" + +namespace QRBee.Core.Client +{ + using System = global::System; + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.5.0 (NJsonSchema v10.6.6.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Client + { + private string _baseUrl = ""; + private System.Net.Http.HttpClient _httpClient; + private System.Lazy _settings; + + public Client(string baseUrl, System.Net.Http.HttpClient httpClient) + { + BaseUrl = baseUrl; + _httpClient = httpClient; + _settings = new System.Lazy(CreateSerializerSettings); + } + + private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + { + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + public string BaseUrl + { + get { return _baseUrl; } + set { _baseUrl = value; } + } + + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + + partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// Success + /// A server side error occurred. + public virtual System.Threading.Tasks.Task RegisterAsync(RegistrationRequest body) + { + return RegisterAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Success + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task RegisterAsync(RegistrationRequest body, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/QRBee/Register"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value)); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + using (var streamReader = new System.IO.StreamReader(responseStream)) + using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) + { + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[])value); + } + else if (value.GetType().IsArray) + { + var array = System.Linq.Enumerable.OfType((System.Array)value); + return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + + + + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.5.0 (NJsonSchema v10.6.6.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ApiException : System.Exception + { + public int StatusCode { get; private set; } + + public string Response { get; private set; } + + public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } + + public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) + : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException) + { + StatusCode = statusCode; + Response = response; + Headers = headers; + } + + public override string ToString() + { + return string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString()); + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.5.0 (NJsonSchema v10.6.6.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ApiException : ApiException + { + public TResult Result { get; private set; } + + public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception innerException) + : base(message, statusCode, response, headers, innerException) + { + Result = result; + } + } + +} + +#pragma warning restore 1591 +#pragma warning restore 1573 +#pragma warning restore 472 +#pragma warning restore 114 +#pragma warning restore 108 +#pragma warning restore 3016 \ No newline at end of file diff --git a/QRBee.Core/ClientCardData.cs b/QRBee.Core/ClientCardData.cs index 28f7c06..37a7a7d 100644 --- a/QRBee.Core/ClientCardData.cs +++ b/QRBee.Core/ClientCardData.cs @@ -39,6 +39,11 @@ set; } + /// + /// Convert ClientCardData to string to be used as a source for encryption. + /// WARNING: this should always be encrypted and never transmitted in clear text form. + /// + /// Converted string public string AsString() => $"{CardNumber}|{ExpirationDateMMYY}|{ValidFrom}|{CardHolderName}|{CVC}|{IssueNo}"; } diff --git a/QRBee.Core/Data/ClientToMerchantResponse.cs b/QRBee.Core/Data/ClientToMerchantResponse.cs index 8e4701a..07f2339 100644 --- a/QRBee.Core/Data/ClientToMerchantResponse.cs +++ b/QRBee.Core/Data/ClientToMerchantResponse.cs @@ -32,8 +32,18 @@ set; } + /// + /// Convert ClientToMerchantResponse to string to be used as QR Code source (along with client signature) + /// + /// Converted string public string AsString() => $"{ClientId}|{TimeStampUTC:O}|{Request.AsString()}"; + /// + /// Convert from string + /// + /// A string representation of ClientToMerchantResponse + /// Converted string + /// Thrown if the input string is incorrect public static ClientToMerchantResponse FromString(string input) { var s = input.Split('|'); diff --git a/QRBee.Core/Data/MerchantToClientRequest.cs b/QRBee.Core/Data/MerchantToClientRequest.cs index 946dbb2..ea09ed9 100644 --- a/QRBee.Core/Data/MerchantToClientRequest.cs +++ b/QRBee.Core/Data/MerchantToClientRequest.cs @@ -34,8 +34,18 @@ namespace QRBee.Core.Data set; } + /// + /// Convert MerchantToClientRequest to string to be used as QR Code source (along with merchant signature) + /// + /// String conversion public string AsString() => $"{TransactionId}|{Name}|{Amount.ToString("0.00", CultureInfo.InvariantCulture)}|{TimeStampUTC:O}"; + /// + /// Convert from string + /// + /// A string representation of MerchantToClientRequest + /// Converted string + /// Thrown if the input string is incorrect public static MerchantToClientRequest FromString(string input) { var s = input.Split('|'); diff --git a/QRBee.Core/Data/PaymentRequest.cs b/QRBee.Core/Data/PaymentRequest.cs index 76b8dad..a3fb9b4 100644 --- a/QRBee.Core/Data/PaymentRequest.cs +++ b/QRBee.Core/Data/PaymentRequest.cs @@ -9,6 +9,10 @@ set; } + /// + /// Convert PaymentRequest to string + /// + /// Converted string public string AsString() => Request.AsString(); } diff --git a/QRBee.Core/Data/PaymentResponse.cs b/QRBee.Core/Data/PaymentResponse.cs index 0465c95..0da5777 100644 --- a/QRBee.Core/Data/PaymentResponse.cs +++ b/QRBee.Core/Data/PaymentResponse.cs @@ -15,6 +15,10 @@ set; } + /// + /// Convert PaymentResponse to string to be encrypted and transmitted back to merchant + /// + /// Converted string public string AsString() => $"{ServerTransactionId}|{PaymentRequest.AsString()}"; } } diff --git a/QRBee.Core/QRBee.Core.csproj b/QRBee.Core/QRBee.Core.csproj index a07f3e8..a0edeeb 100644 --- a/QRBee.Core/QRBee.Core.csproj +++ b/QRBee.Core/QRBee.Core.csproj @@ -6,4 +6,8 @@ latest + + + + diff --git a/QRBee/QRBee/Services/IDataStore.cs b/QRBee/QRBee/Services/IDataStore.cs index 4eb9b59..dd0b173 100644 --- a/QRBee/QRBee/Services/IDataStore.cs +++ b/QRBee/QRBee/Services/IDataStore.cs @@ -4,6 +4,10 @@ using System.Threading.Tasks; namespace QRBee.Services { + /// + /// Database interface + /// + /// public interface IDataStore { Task AddItemAsync(T item); diff --git a/QRBee/QRBee/Services/IQRScanner.cs b/QRBee/QRBee/Services/IQRScanner.cs index 59bf132..3d4c315 100644 --- a/QRBee/QRBee/Services/IQRScanner.cs +++ b/QRBee/QRBee/Services/IQRScanner.cs @@ -5,8 +5,15 @@ using System.Threading.Tasks; namespace QRBee.Services { + /// + /// Interface for QR scanning + /// public interface IQRScanner { + /// + /// Scan QR Code + /// + /// Task ScanQR(); } } diff --git a/QRBee/QRBee/ViewModels/ClientPageViewModel.cs b/QRBee/QRBee/ViewModels/ClientPageViewModel.cs index c0ae4ab..6959093 100644 --- a/QRBee/QRBee/ViewModels/ClientPageViewModel.cs +++ b/QRBee/QRBee/ViewModels/ClientPageViewModel.cs @@ -92,6 +92,10 @@ namespace QRBee.ViewModels } } + /// + /// Reaction on GenerateQR button clicked + /// + /// public async void OnGenerateQrClicked(object obj) { diff --git a/QRBee/QRBee/ViewModels/LoginViewModel.cs b/QRBee/QRBee/ViewModels/LoginViewModel.cs index 5a3cce9..d25b3f7 100644 --- a/QRBee/QRBee/ViewModels/LoginViewModel.cs +++ b/QRBee/QRBee/ViewModels/LoginViewModel.cs @@ -12,24 +12,30 @@ namespace QRBee.ViewModels { get; } - public Command RegisterCommand { get; } - public LoginViewModel() { LoginCommand = new Command(OnLoginClicked); RegisterCommand = new Command(OnRegisterClicked); } + /// + /// Reaction on Login button + /// + /// private async void OnLoginClicked(object obj) { // Prefixing with `//` switches to a different navigation stack instead of pushing to the active one await Shell.Current.GoToAsync($"//{nameof(MainPage)}"); } + /// + /// Reaction on Register button + /// + /// private async void OnRegisterClicked(object obj) { await Shell.Current.GoToAsync($"{nameof(RegisterPage)}"); diff --git a/QRBee/QRBee/ViewModels/MerchantPageViewModel.cs b/QRBee/QRBee/ViewModels/MerchantPageViewModel.cs index 5446308..0dadfaf 100644 --- a/QRBee/QRBee/ViewModels/MerchantPageViewModel.cs +++ b/QRBee/QRBee/ViewModels/MerchantPageViewModel.cs @@ -92,6 +92,10 @@ namespace QRBee.ViewModels } } + /// + /// Reaction on Generate QR code button + /// + /// public async void OnGenerateQrClicked(object obj) { var trans = new MerchantToClientRequest diff --git a/QRBeeApi/Controllers/WeatherForecastController.cs b/QRBeeApi/Controllers/WeatherForecastController.cs deleted file mode 100644 index 7ce984e..0000000 --- a/QRBeeApi/Controllers/WeatherForecastController.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -namespace QRBeeApi.Controllers -{ - [ApiController] - [Route("[controller]")] - public class WeatherForecastController : ControllerBase - { - private static readonly string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - private readonly ILogger _logger; - - public WeatherForecastController(ILogger logger) - { - _logger = logger; - } - - [HttpGet(Name = "GetWeatherForecast")] - public IEnumerable Get() - { - return Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - Date = DateTime.Now.AddDays(index), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = Summaries[Random.Shared.Next(Summaries.Length)] - }) - .ToArray(); - } - } -} \ No newline at end of file diff --git a/QRBeeApi/Services/Database/IStorage.cs b/QRBeeApi/Services/Database/IStorage.cs index d18cf42..a37ae86 100644 --- a/QRBeeApi/Services/Database/IStorage.cs +++ b/QRBeeApi/Services/Database/IStorage.cs @@ -1,9 +1,22 @@ namespace QRBee.Api.Services.Database { + /// + /// Database interface + /// public interface IStorage { - + /// + /// Insert userInfo into database + /// + /// Information to be inserted + /// Task PutUserInfo(UserInfo info); + + /// + /// Retrieve user information from database + /// + /// Identifier by which user information will be retrieved + /// User information Task GetUserInfo(string email); } diff --git a/QRBeeApi/Services/IQRBeeAPI.cs b/QRBeeApi/Services/IQRBeeAPI.cs index af10b6d..5bc568c 100644 --- a/QRBeeApi/Services/IQRBeeAPI.cs +++ b/QRBeeApi/Services/IQRBeeAPI.cs @@ -4,8 +4,16 @@ using QRBee.Core.Data; namespace QRBee.Api.Services { + /// + /// QRBeeAPI interface + /// public interface IQRBeeAPI { + /// + /// Handles Registration request + /// + /// Registration request + /// Registration response Task Register(RegistrationRequest value); } diff --git a/QRBeeApi/Services/QRBeeAPI.cs b/QRBeeApi/Services/QRBeeAPI.cs index 1dcb47d..c44e00b 100644 --- a/QRBeeApi/Services/QRBeeAPI.cs +++ b/QRBeeApi/Services/QRBeeAPI.cs @@ -6,6 +6,9 @@ using QRBee.Core.Data; namespace QRBee.Api.Services { + /// + /// Implementation of + /// public class QRBeeAPI: IQRBeeAPI { private readonly IStorage _storage; diff --git a/QRBeeApi/WeatherForecast.cs b/QRBeeApi/WeatherForecast.cs deleted file mode 100644 index a818081..0000000 --- a/QRBeeApi/WeatherForecast.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace QRBeeApi -{ - public class WeatherForecast - { - public DateTime Date { get; set; } - - public int TemperatureC { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string? Summary { get; set; } - } -} \ No newline at end of file