mirror of https://github.com/abpframework/eventhub
7 changed files with 290 additions and 9 deletions
@ -0,0 +1,7 @@ |
|||
namespace EventHub |
|||
{ |
|||
public static class EventHubRemoteServiceConsts |
|||
{ |
|||
public const string RemoteServiceName = "EventHub"; |
|||
} |
|||
} |
|||
@ -0,0 +1,79 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using EventHub.Events; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace EventHub.Controllers.Events |
|||
{ |
|||
[RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)] |
|||
[Area("eventhub")] |
|||
[ControllerName("Event")] |
|||
[Route("api/eventhub/event")] |
|||
public class EventController : AbpController, IEventAppService |
|||
{ |
|||
private readonly IEventAppService _eventAppService; |
|||
|
|||
public EventController(IEventAppService eventAppService) |
|||
{ |
|||
_eventAppService = eventAppService; |
|||
} |
|||
|
|||
[HttpPost] |
|||
public async Task<EventDto> CreateAsync(CreateEventDto input) |
|||
{ |
|||
return await _eventAppService.CreateAsync(input); |
|||
} |
|||
|
|||
[HttpGet] |
|||
public async Task<PagedResultDto<EventInListDto>> GetListAsync(EventListFilterDto input) |
|||
{ |
|||
return await _eventAppService.GetListAsync(input); |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("by-url-code/{urlCode}")] |
|||
public async Task<EventDetailDto> GetByUrlCodeAsync(string urlCode) |
|||
{ |
|||
return await _eventAppService.GetByUrlCodeAsync(urlCode); |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("location/{id}")] |
|||
public async Task<EventLocationDto> GetLocationAsync(Guid id) |
|||
{ |
|||
return await _eventAppService.GetLocationAsync(id); |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("lookup/countries")] |
|||
public async Task<List<CountryLookupDto>> GetCountriesLookupAsync() |
|||
{ |
|||
return await _eventAppService.GetCountriesLookupAsync(); |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("is-event-owner/{id}")] |
|||
public async Task<bool> IsEventOwnerAsync(Guid id) |
|||
{ |
|||
return await _eventAppService.IsEventOwnerAsync(id); |
|||
} |
|||
|
|||
[HttpPut] |
|||
[Route("{id}")] |
|||
public async Task UpdateAsync(Guid id, UpdateEventDto input) |
|||
{ |
|||
await _eventAppService.UpdateAsync(id, input); |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("cover-image/{id}")] |
|||
public async Task<byte[]> GetCoverImageAsync(Guid id) |
|||
{ |
|||
return await _eventAppService.GetCoverImageAsync(id); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,58 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using EventHub.Events.Registrations; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace EventHub.Controllers.Events.Registrations |
|||
{ |
|||
[RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)] |
|||
[Area("eventhub")] |
|||
[ControllerName("EventRegistration")] |
|||
[Route("api/eventhub/event-registration")] |
|||
public class EventRegistrationController : AbpController, IEventRegistrationAppService |
|||
{ |
|||
private readonly IEventRegistrationAppService _eventRegistrationAppService; |
|||
|
|||
public EventRegistrationController(IEventRegistrationAppService eventRegistrationAppService) |
|||
{ |
|||
_eventRegistrationAppService = eventRegistrationAppService; |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("register/{eventId}")] |
|||
public async Task RegisterAsync(Guid eventId) |
|||
{ |
|||
await _eventRegistrationAppService.RegisterAsync(eventId); |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("un-register/{eventId}")] |
|||
public async Task UnregisterAsync(Guid eventId) |
|||
{ |
|||
await _eventRegistrationAppService.UnregisterAsync(eventId); |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("is-registered/{eventId}")] |
|||
public async Task<bool> IsRegisteredAsync(Guid eventId) |
|||
{ |
|||
return await _eventRegistrationAppService.IsRegisteredAsync(eventId); |
|||
} |
|||
|
|||
[HttpGet] |
|||
public async Task<PagedResultDto<EventAttendeeDto>> GetAttendeesAsync(Guid eventId) |
|||
{ |
|||
return await _eventRegistrationAppService.GetAttendeesAsync(eventId); |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("is-past-event/{eventId}")] |
|||
public async Task<bool> IsPastEventAsync(Guid eventId) |
|||
{ |
|||
return await _eventRegistrationAppService.IsPastEventAsync(eventId); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,52 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using EventHub.Organizations.Memberships; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace EventHub.Controllers.Organizations.Memberships |
|||
{ |
|||
[RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)] |
|||
[Area("eventhub")] |
|||
[ControllerName("OrganizationMembership")] |
|||
[Route("api/eventhub/organization-membership")] |
|||
public class OrganizationMembershipController : AbpController, IOrganizationMembershipAppService |
|||
{ |
|||
private readonly IOrganizationMembershipAppService _organizationMembershipAppService; |
|||
|
|||
public OrganizationMembershipController(IOrganizationMembershipAppService organizationMembershipAppService) |
|||
{ |
|||
_organizationMembershipAppService = organizationMembershipAppService; |
|||
} |
|||
|
|||
[HttpPut] |
|||
[Route("join/{organizationId}")] |
|||
public async Task JoinAsync(Guid organizationId) |
|||
{ |
|||
await _organizationMembershipAppService.JoinAsync(organizationId); |
|||
} |
|||
|
|||
[HttpPut] |
|||
[Route("leave/{organizationId}")] |
|||
public async Task LeaveAsync(Guid organizationId) |
|||
{ |
|||
await _organizationMembershipAppService.LeaveAsync(organizationId); |
|||
|
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("is-joined/{organizationId}")] |
|||
public async Task<bool> IsJoinedAsync(Guid organizationId) |
|||
{ |
|||
return await _organizationMembershipAppService.IsJoinedAsync(organizationId); |
|||
} |
|||
|
|||
[HttpGet] |
|||
public async Task<PagedResultDto<OrganizationMemberDto>> GetMembersAsync(OrganizationMemberListFilterDto input) |
|||
{ |
|||
return await _organizationMembershipAppService.GetMembersAsync(input); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,64 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using EventHub.Organizations; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace EventHub.Controllers.Organizations |
|||
{ |
|||
[RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)] |
|||
[Area("eventhub")] |
|||
[ControllerName("Organization")] |
|||
[Route("api/eventhub/organization")] |
|||
public class OrganizationController : AbpController, IOrganizationAppService |
|||
{ |
|||
private readonly IOrganizationAppService _organizationAppService; |
|||
|
|||
public OrganizationController(IOrganizationAppService organizationAppService) |
|||
{ |
|||
_organizationAppService = organizationAppService; |
|||
} |
|||
|
|||
[HttpPost] |
|||
public async Task CreateAsync(CreateOrganizationDto input) |
|||
{ |
|||
await _organizationAppService.CreateAsync(input); |
|||
} |
|||
|
|||
[HttpGet] |
|||
public async Task<PagedResultDto<OrganizationInListDto>> GetListAsync(OrganizationListFilterDto input) |
|||
{ |
|||
return await _organizationAppService.GetListAsync(input); |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("{name}")] |
|||
public async Task<OrganizationProfileDto> GetProfileAsync(string name) |
|||
{ |
|||
return await _organizationAppService.GetProfileAsync(name); |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("by-user-id/{userId}")] |
|||
public async Task<ListResultDto<OrganizationInListDto>> GetOrganizationsByUserIdAsync(Guid userId) |
|||
{ |
|||
return await _organizationAppService.GetOrganizationsByUserIdAsync(userId); |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("is-organization-owner/{organizationId}")] |
|||
public async Task<bool> IsOrganizationOwnerAsync(Guid organizationId) |
|||
{ |
|||
return await _organizationAppService.IsOrganizationOwnerAsync(organizationId); |
|||
} |
|||
|
|||
[HttpPut] |
|||
[Route("{id}")] |
|||
public async Task UpdateAsync(Guid id, UpdateOrganizationDto input) |
|||
{ |
|||
await _organizationAppService.UpdateAsync(id, input); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
using System.Threading.Tasks; |
|||
using EventHub.Members; |
|||
using EventHub.Users; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace EventHub.Controllers.Users |
|||
{ |
|||
[RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)] |
|||
[Area("eventhub")] |
|||
[ControllerName("User")] |
|||
[Route("/api/eventhub/user")] |
|||
public class UserController : AbpController, IUserAppService |
|||
{ |
|||
private readonly IUserAppService _userAppService; |
|||
|
|||
public UserController(IUserAppService userAppService) |
|||
{ |
|||
_userAppService = userAppService; |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("{username}")] |
|||
public async Task<UserDto> FindByUserNameAsync(string username) |
|||
{ |
|||
return await _userAppService.FindByUserNameAsync(username); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue