|
|
|
|
using Common.Types.Security;
|
|
|
|
|
using Connected.ServiceModel;
|
|
|
|
|
using Connected.Services;
|
|
|
|
|
using Connected.Services.Annotations;
|
|
|
|
|
using System.Collections.Immutable;
|
|
|
|
|
|
|
|
|
|
namespace Common.Types.Countries;
|
|
|
|
|
|
|
|
|
|
internal sealed class CountryService : EntityService<int>, ICountryService
|
|
|
|
|
{
|
|
|
|
|
public CountryService(IContext context) : base(context)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ServiceAuthorization(Claims.Delete)]
|
|
|
|
|
public async Task Delete(PrimaryKeyArgs<int> args)
|
|
|
|
|
{
|
|
|
|
|
await Invoke(GetOperation<DeleteCountry>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ServiceAuthorization(Claims.Add)]
|
|
|
|
|
public async Task<int> Insert(InsertCountryArgs args)
|
|
|
|
|
{
|
|
|
|
|
return await Invoke(GetOperation<InsertCountry>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ServiceAuthorization(Claims.Read)]
|
|
|
|
|
public async Task<ImmutableList<ICountry>?> Query()
|
|
|
|
|
{
|
|
|
|
|
return await Invoke(GetOperation<QueryCountries>(), Dto.Empty);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ServiceAuthorization(Claims.Read)]
|
|
|
|
|
public async Task<ImmutableList<ICountry>?> Query(PrimaryKeyListArgs<int> args)
|
|
|
|
|
{
|
|
|
|
|
return await Invoke(GetOperation<LookupCountries>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ServiceAuthorization(Claims.Read)]
|
|
|
|
|
public async Task<ICountry?> Select(PrimaryKeyArgs<int> args)
|
|
|
|
|
{
|
|
|
|
|
return await Invoke(GetOperation<SelectCountry>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ServiceAuthorization(Claims.Read)]
|
|
|
|
|
public async Task<ICountry?> Select(NameArgs args)
|
|
|
|
|
{
|
|
|
|
|
return await Invoke(GetOperation<SelectCountryByName>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ServiceAuthorization(Claims.Modify)]
|
|
|
|
|
public async Task Update(UpdateCountryArgs args)
|
|
|
|
|
{
|
|
|
|
|
await Invoke(GetOperation<UpdateCountry>(), args);
|
|
|
|
|
}
|
|
|
|
|
}
|