More warnings cleanup

This commit is contained in:
Selim Mustafaev 2024-05-06 02:01:42 +03:00
parent 0669b8910c
commit 59441b386a
5 changed files with 16 additions and 46 deletions

View File

@ -2,15 +2,15 @@
{ {
public class Osago public class Osago
{ {
public double Date { get; set; } public double? Date { get; set; }
public string Number { get; set; } public string? Number { get; set; }
public string Vin { get; set; } public string? Vin { get; set; }
public string PlateNumber { get; set; } public string? PlateNumber { get; set; }
public string Name { get; set; } public string? Name { get; set; }
public string Status { get; set; } public string? Status { get; set; }
public string Restrictions { get; set; } public string? Restrictions { get; set; }
public string Insurant { get; set; } public string? Insurant { get; set; }
public string Owner { get; set; } public string? Owner { get; set; }
public string UsageRegion { get; set; } public string? UsageRegion { get; set; }
} }
} }

View File

@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace AutoCatCore.Model; namespace AutoCatCore.Model;
//[CreateFromString(MethodName = "AutoCat.Controls.PlateNumber.ConvertFromString")]
public class PlateNumber public class PlateNumber
{ {
private readonly string _number; private readonly string _number;

View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AutoCat.Model.Requests
{
class Credentials
{
public string Email { get; set; }
public string Password { get; set; }
}
}

View File

@ -1,13 +1,8 @@
using System; namespace AutoCatCore.Model.Requests;
using System.Collections.Generic;
using System.Text;
namespace AutoCatCore.Model.Requests public class PagedResponse<T>(int count, string pageToken, List<T> items)
{ {
public class PagedResponse<T> public int Count { get; set; } = count;
{ public string PageToken { get; set; } = pageToken;
public int? Count { get; set; } public List<T> Items { get; set; } = items;
public string PageToken { get; set; }
public List<T> Items { get; set; }
}
} }

View File

@ -1,7 +1,6 @@
using System.Net.Http.Json; using System.Net.Http.Json;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using AutoCat.Model.Requests;
using AutoCatCore.Model; using AutoCatCore.Model;
using AutoCatCore.Model.Requests; using AutoCatCore.Model.Requests;
using AutoCatCore.Services.Storage; using AutoCatCore.Services.Storage;
@ -47,12 +46,7 @@ public class ApiService : IApiService
public async Task<User> Login(string email, string password) public async Task<User> Login(string email, string password)
{ {
var credentials = new Credentials { Email = email, Password = password }; var response = await _httpClient.PostAsJsonAsync("user/login", new { email, password });
var json = JsonSerializer.Serialize(credentials, new JsonSerializerOptions {
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
});
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await _httpClient.PostAsync("user/login", content);
var result = await GetDataOrThrow<User>(response); var result = await GetDataOrThrow<User>(response);
SetAccessToken(result.Token); SetAccessToken(result.Token);
return result; return result;