Skip to content

Commit

Permalink
feat:add RemoveByThridPartyIdentity api (#1259)
Browse files Browse the repository at this point in the history
  • Loading branch information
duiapro authored Dec 19, 2023
1 parent 44281a5 commit ad01e7b
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@ public async Task RemoveAsync(Guid id)
{
await DeleteAsync(nameof(RemoveAsync), new { id });
}

public async Task RemoveByThridPartyIdentityAsync(string thridPartyIdentity)
{
await DeleteAsync(nameof(RemoveByThridPartyIdentityAsync), new { thridPartyIdentity });
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the Apache License. See LICENSE.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Masa.Auth.Contracts.Admin.Subjects
{
public class RemoveThirdPartyUserByThridPartyIdentityDto
{
public string ThridPartyIdentity { get; set; }

public RemoveThirdPartyUserByThridPartyIdentityDto(string thridPartyIdentity)
{
ThridPartyIdentity = thridPartyIdentity;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the Apache License. See LICENSE.txt in the project root for license information.

namespace Masa.Auth.Service.Admin.Application.Subjects.Commands;

public record RemoveThirdPartyUserByThridPartyIdentityCommand(string ThridPartyIdentity) : Command;
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ public async Task RemoveThirdPartyUserByIdAsync(RemoveThirdPartyUserByIdCommand
await _thirdPartyUserRepository.RemoveAsync(tpu => tpu.Id == command.Id);
}

[EventHandler]
public async Task RemoveThirdPartyUserByThridPartyIdentityAsync(RemoveThirdPartyUserByThridPartyIdentityCommand command)
{
await _thirdPartyUserRepository.RemoveAsync(tpu => tpu.ThridPartyIdentity == command.ThridPartyIdentity);
}

#region ThirdPartyIdp

[EventHandler(1)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the Apache License. See LICENSE.txt in the project root for license information.

using Humanizer;

namespace Masa.Auth.Service.Admin.Services;

public class ThirdPartyUserService : RestServiceBase
Expand Down Expand Up @@ -63,4 +65,9 @@ private async Task RemoveAsync(IEventBus eventBus, [FromBody] RemoveThirdPartyUs
{
await eventBus.PublishAsync(new RemoveThirdPartyUserByIdCommand(dto.Id));
}

private async Task RemoveByThridPartyIdentityAsync(IEventBus eventBus, [FromBody] RemoveThirdPartyUserByThridPartyIdentityDto dto)
{
await eventBus.PublishAsync(new RemoveThirdPartyUserByThridPartyIdentityCommand(dto.ThridPartyIdentity));
}
}

0 comments on commit ad01e7b

Please sign in to comment.