Add tenant services, change id by _id and include delete endpoint for all entities
This commit is contained in:
		| @@ -11,7 +11,7 @@ namespace Core.Thalos.External.Clients | ||||
|         Task<IEnumerable<UserAdapter>> GetAllUsersAsync(CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Get("/v1/User/" + Routes.Id)] | ||||
|         Task<UserAdapter> GetUserByIdAsync([FromRoute] string id, CancellationToken cancellationToken = default); | ||||
|         Task<UserAdapter> GetUserByIdAsync([FromRoute] string _id, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Get("/v1/User/" + Routes.Email)] | ||||
|         Task<UserAdapter> GetUserByEmailAsync([FromRoute] string email, CancellationToken cancellationToken = default); | ||||
| @@ -23,7 +23,10 @@ namespace Core.Thalos.External.Clients | ||||
|         Task<UserAdapter> CreateUserAsync([FromBody] UserRequest newUser, [FromRoute] bool sendInvitation, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Put("/v1/User/" + Routes.Id)] | ||||
|         Task<UserAdapter> UpdateUserAsync([FromBody] UserAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); | ||||
|         Task<UserAdapter> UpdateUserAsync([FromBody] UserAdapter entity, [FromRoute] string _id, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Delete("/v1/User/" + Routes.Id)] | ||||
|         Task<UserAdapter> DeleteUserAsync([FromRoute] string _id, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Patch("/v1/User/" + Routes.LogIn)] | ||||
|         Task<UserAdapter> LoginUserAsync([FromRoute] string email, CancellationToken cancellationToken = default); | ||||
| @@ -32,7 +35,7 @@ namespace Core.Thalos.External.Clients | ||||
|         Task<UserAdapter> LogoutUserAsync([FromRoute] string email, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Patch("/v1/User/" + Routes.ChangeStatus)] | ||||
|         Task<UserAdapter> ChangeUserStatusAsync([FromRoute] string id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||
|         Task<UserAdapter> ChangeUserStatusAsync([FromRoute] string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Get("/v1/User/{email}/GetTokenAdapter")] | ||||
|         Task<TokenAdapter> GetTokenAdapter([FromRoute] string email, CancellationToken cancellationToken = default); | ||||
| @@ -41,16 +44,19 @@ namespace Core.Thalos.External.Clients | ||||
|         Task<IEnumerable<RoleAdapter>> GetAllRolesAsync(CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Get("/v1/Role/" + Routes.Id)] | ||||
|         Task<RoleAdapter> GetRoleByIdAsync([FromRoute] string id, CancellationToken cancellationToken = default); | ||||
|         Task<RoleAdapter> GetRoleByIdAsync([FromRoute] string _id, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Post("/v1/Role")] | ||||
|         Task<RoleAdapter> CreateRoleAsync([FromBody] RoleRequest newRole, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Put("/v1/Role/" + Routes.Id)] | ||||
|         Task<RoleAdapter> UpdateRoleAsync([FromBody] RoleAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); | ||||
|         Task<RoleAdapter> UpdateRoleAsync([FromBody] RoleAdapter entity, [FromRoute] string _id, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Delete("/v1/Role/" + Routes.Id)] | ||||
|         Task<RoleAdapter> DeleteRoleAsync([FromRoute] string _id, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Patch("/v1/Role/" + Routes.ChangeStatus)] | ||||
|         Task<RoleAdapter> ChangeRoleStatusAsync([FromRoute] string id, [FromRoute] Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||
|         Task<RoleAdapter> ChangeRoleStatusAsync([FromRoute] string _id, [FromRoute] Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Post("/v1/Role/" + Routes.AddApplication)] | ||||
|         Task<RoleAdapter> AddApplicationToRoleAsync([FromRoute] string RoleId, [FromRoute] ApplicationsEnum application, CancellationToken cancellationToken = default); | ||||
| @@ -65,16 +71,19 @@ namespace Core.Thalos.External.Clients | ||||
|         Task<IEnumerable<PermissionAdapter>> GetAllPermissionsByListAsync([FromBody] string[] request, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Get("/v1/Permission/" + Routes.Id)] | ||||
|         Task<PermissionAdapter> GetPermissionByIdAsync([FromRoute] string id, CancellationToken cancellationToken = default); | ||||
|         Task<PermissionAdapter> GetPermissionByIdAsync([FromRoute] string _id, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Post("/v1/Permission")] | ||||
|         Task<PermissionAdapter> CreatePermissionAsync([FromBody] PermissionRequest newPermission, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Put("/v1/Permission/" + Routes.Id)] | ||||
|         Task<PermissionAdapter> UpdatePermissionAsync([FromBody] PermissionAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); | ||||
|         Task<PermissionAdapter> UpdatePermissionAsync([FromBody] PermissionAdapter entity, [FromRoute] string _id, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Delete("/v1/Permission/" + Routes.Id)] | ||||
|         Task<PermissionAdapter> DeletePermissionAsync([FromRoute] string _id, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Patch("/v1/Permission/" + Routes.ChangeStatus)] | ||||
|         Task<PermissionAdapter> ChangeStatusPermissionAsync([FromRoute] string id, [FromRoute] Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||
|         Task<PermissionAdapter> ChangeStatusPermissionAsync([FromRoute] string _id, [FromRoute] Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Get("/v1/Module")] | ||||
|         Task<IEnumerable<ModuleAdapter>> GetAllModulesAsync(CancellationToken cancellationToken = default); | ||||
| @@ -83,15 +92,36 @@ namespace Core.Thalos.External.Clients | ||||
|         Task<IEnumerable<ModuleAdapter>> GetAllModulesByListAsync([FromBody] string[] request, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Get("/v1/Module/" + Routes.Id)] | ||||
|         Task<ModuleAdapter> GetModuleByIdAsync([FromRoute] string id, CancellationToken cancellationToken = default); | ||||
|         Task<ModuleAdapter> GetModuleByIdAsync([FromRoute] string _id, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Post("/v1/Module")] | ||||
|         Task<ModuleAdapter> CreateModuleAsync([FromBody] ModuleRequest newModule, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Put("/v1/Module/" + Routes.Id)] | ||||
|         Task<ModuleAdapter> UpdateModuleAsync([FromBody] ModuleAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); | ||||
|         Task<ModuleAdapter> UpdateModuleAsync([FromBody] ModuleAdapter entity, [FromRoute] string _id, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Delete("/v1/Module/" + Routes.Id)] | ||||
|         Task<ModuleAdapter> DeleteModuleAsync([FromRoute] string _id, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Patch("/v1/Module/" + Routes.ChangeStatus)] | ||||
|         Task<ModuleAdapter> ChangeStatusModuleAsync([FromRoute] string id, [FromRoute] Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||
|         Task<ModuleAdapter> ChangeStatusModuleAsync([FromRoute] string _id, [FromRoute] Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Get("/v1/Tenant")] | ||||
|         Task<IEnumerable<TenantAdapter>> GetAllTenantsAsync(CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Get("/v1/Tenant/" + Routes.Id)] | ||||
|         Task<TenantAdapter> GetTenantByIdAsync([FromRoute] string _id, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Post("/v1/Tenant")] | ||||
|         Task<TenantAdapter> CreateTenantAsync([FromBody] TenantRequest newTenant, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Put("/v1/Tenant/" + Routes.Id)] | ||||
|         Task<TenantAdapter> UpdateTenantAsync([FromBody] TenantAdapter entity, [FromRoute] string _id, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Patch("/v1/Tenant/" + Routes.ChangeStatus)] | ||||
|         Task<TenantAdapter> ChangeStatusTenantAsync([FromRoute] string _id, [FromRoute] Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Delete("/v1/Tenant/" + Routes.Id)] | ||||
|         Task<TenantAdapter> DeleteTenantAsync([FromRoute] string _id, CancellationToken cancellationToken = default); | ||||
|     } | ||||
| } | ||||
|   | ||||
							
								
								
									
										53
									
								
								Core.Thalos.External/Clients/Requests/TenantRequest.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								Core.Thalos.External/Clients/Requests/TenantRequest.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,53 @@ | ||||
| using Core.Blueprint.Mongo; | ||||
| using MongoDB.Bson; | ||||
| using MongoDB.Bson.Serialization.Attributes; | ||||
|  | ||||
| namespace Core.Thalos.BuildingBlocks | ||||
| { | ||||
|     [CollectionAttributeName("Tenants")] | ||||
|     public class TenantRequest : Document | ||||
|     { | ||||
|         [BsonElement("name")] | ||||
|         public string Name { get; set; } = null!; | ||||
|  | ||||
|         [BsonElement("taxIdentifier")] | ||||
|         public string TaxIdentifier { get; set; } = null!; | ||||
|  | ||||
|         [BsonElement("addressLine1")] | ||||
|         public string AddressLine1 { get; set; } = null!; | ||||
|  | ||||
|         [BsonElement("addressLine2")] | ||||
|         [BsonIgnoreIfNull] | ||||
|         public string? AddressLine2 { get; set; } | ||||
|  | ||||
|         [BsonElement("city")] | ||||
|         public string City { get; set; } = null!; | ||||
|  | ||||
|         [BsonElement("state")] | ||||
|         public string State { get; set; } = null!; | ||||
|  | ||||
|         [BsonElement("country")] | ||||
|         public string Country { get; set; } = null!; | ||||
|  | ||||
|         [BsonElement("postalCode")] | ||||
|         public string PostalCode { get; set; } = null!; | ||||
|  | ||||
|         [BsonElement("contactEmail")] | ||||
|         public string ContactEmail { get; set; } = null!; | ||||
|  | ||||
|         [BsonElement("contactPhone")] | ||||
|         public string ContactPhone { get; set; } = null!; | ||||
|  | ||||
|         [BsonElement("website")] | ||||
|         [BsonIgnoreIfNull] | ||||
|         public string? Website { get; set; } | ||||
|  | ||||
|         [BsonElement("connectionString")] | ||||
|         [BsonIgnoreIfNull] | ||||
|         public string? ConnectionString { get; set; } | ||||
|  | ||||
|         [BsonElement("isolated")] | ||||
|         public bool Isolated { get; set; } | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -8,7 +8,7 @@ | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <PackageReference Include="Core.Blueprint.Storage" Version="1.0.1" /> | ||||
|     <PackageReference Include="Core.Thalos.BuildingBlocks" Version="1.0.8" /> | ||||
|     <PackageReference Include="Core.Thalos.BuildingBlocks" Version="1.1.2" /> | ||||
|     <PackageReference Include="Lib.Architecture.BuildingBlocks" Version="1.0.0" /> | ||||
|     <PackageReference Include="Refit" Version="8.0.0" /> | ||||
|   </ItemGroup> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sergio Matias Urquin
					Sergio Matias Urquin