Class CompanyController
- Namespace
- GastroSky.Controllers.V1
- Assembly
- GastroSky.dll
User-Company relationship related endpoints.
[ApiController]
[Authorize]
[Route("api/v1/companies")]
[Produces("application/json", new string[] { })]
public class CompanyController : GastroSkyControllerBase
- Inheritance
-
CompanyController
- Inherited Members
Constructors
CompanyController(GastroSkyDatabaseContext, IConfiguration, IRemoteFileStorage, ISlugGenerator, IMapper, ILogger<CompanyController>, IImageManipulationService)
User-Company relationship related endpoints.
public CompanyController(GastroSkyDatabaseContext db, IConfiguration configuration, IRemoteFileStorage remoteFileStorage, ISlugGenerator slugGenerator, IMapper mapper, ILogger<CompanyController> logger, IImageManipulationService imageManipulationService)
Parameters
dbGastroSkyDatabaseContextconfigurationIConfigurationremoteFileStorageIRemoteFileStorageslugGeneratorISlugGeneratormapperIMapperloggerILogger<CompanyController>imageManipulationServiceIImageManipulationService
Methods
AcceptInvite(CompanyAcceptInviteRequestDto, string)
[HttpPut]
[Route("{slug}/invite/accept")]
public Task<IActionResult> AcceptInvite(CompanyAcceptInviteRequestDto dto, string slug)
Parameters
dtoCompanyAcceptInviteRequestDtoslugstring
Returns
CreateCompany(CompanyCreationRequestDto)
Creates a new company DB entry.
[HttpPost]
[Route("")]
[ProducesResponseType(302)]
[ProducesResponseType(400)]
[ProducesResponseType(403)]
[ProducesResponseType(500)]
[ProducesResponseType<ResponseBodyDto<CompanyResponseDto>>(201)]
public Task<IActionResult> CreateCompany(CompanyCreationRequestDto dto)
Parameters
dtoCompanyCreationRequestDtoRequest DTO containing the company information. Check out the API DocFX documentation on CompanyCreationRequestDto for more information.
Returns
Remarks
Sample request: ( profilePictureBytesBase64 example string is NOT a valid image format! )
POST /api/v1/auth/companies
{
"name": "MyAwesomeCompany GmbH",
"customSlug": "macgmbh",
"email": "user@example.com",
"phone": "+41 79 000 00 00",
"address": "Musterstrasse 123",
"zipCode": "6666",
"location": "Helheim",
"countryCodeISO": "HEL",
"websiteURL": "https://example.com",
"registerOfCommerceURL": "https://example.com",
"profilePictureBytesBase64": "bm90IGFuIGltYWdlIGZmcy4uLg==",
"businessIdentificationNumber": "CHE-000.000.000",
"valueAddedTaxIdentificationNumber": "CHE-000.000.000 MWST",
"firstRegistrationTimestampUTC": 1720356577,
"userId": 123
}
DeleteCompany(string)
[HttpDelete]
[Route("{slug}")]
public Task<IActionResult> DeleteCompany(string slug)
Parameters
slugstring
Returns
GetCompanies()
[HttpGet]
[Route("")]
[ProducesResponseType<ResponseBodyDto<CompanyResponseDto>>(200)]
public Task<IActionResult> GetCompanies()
Returns
GetCompany(string)
Fetches a company's information via the company slug (human-readable ID).
[HttpGet]
[Route("{slug}")]
[ProducesResponseType(404)]
[ProducesResponseType<ResponseBodyDto<CompanyResponseDto>>(200)]
public Task<IActionResult> GetCompany(string slug)
Parameters
slugstringCompany slug string.
Returns
GetCompanyPrivatePosts(string, PostQueryParameters?)
[HttpGet]
[Route("{slug}/posts")]
[ProducesResponseType(400)]
[ProducesResponseType(403)]
[ProducesResponseType<ResponseBodyDto<PrivatePostReducedResponseDto>>(200)]
public Task<IActionResult> GetCompanyPrivatePosts(string slug, PostQueryParameters? postQueryParameters = null)
Parameters
slugstringpostQueryParametersPostQueryParameters
Returns
GetCompanySubscriptions(string)
[HttpGet]
[Route("{slug}/active-subscriptions")]
[ProducesResponseType(404)]
[ProducesResponseType<ResponseBodyDto<CompanyResponseDto>>(200)]
public Task<IActionResult> GetCompanySubscriptions(string slug)
Parameters
slugstring
Returns
GetUserProPic(string)
[HttpGet]
[Route("propic/{slug}")]
[Produces("application/octet-stream", new string[] { "application/json" })]
[AllowAnonymous]
public Task<IActionResult> GetUserProPic(string slug)
Parameters
slugstring
Returns
InviteMember(CompanyInviteMemberRequestDto, string)
[HttpPost]
[Route("{slug}/invite")]
public Task<IActionResult> InviteMember(CompanyInviteMemberRequestDto dto, string slug)
Parameters
dtoCompanyInviteMemberRequestDtoslugstring
Returns
RemoveMember(string, long)
[HttpDelete]
[Route("{slug}/member/{userCompanyId}")]
public Task<IActionResult> RemoveMember(string slug, long userCompanyId)
Parameters
Returns
UpdateCompany(CompanyModificationRequestDto, string)
Modifies a company entry.
[HttpPut]
[Route("{slug}")]
[ProducesResponseType(302)]
[ProducesResponseType(400)]
[ProducesResponseType(403)]
[ProducesResponseType(500)]
[ProducesResponseType<ResponseBodyDto<CompanyResponseDto>>(200)]
public Task<IActionResult> UpdateCompany(CompanyModificationRequestDto dto, string slug)
Parameters
dtoCompanyModificationRequestDtoRequest DTO containing the company information to modify. Check out the API DocFX documentation on CompanyModificationRequestDto for more information.
slugstring
Returns
Remarks
Sample request: ( profilePictureBytesBase64 example string is NOT a valid image format! )
PUT /api/v1/auth/companies
{
"name": "MyAwesomeCompany GmbH",
"slug": "macgmbh",
"email": "user@example.com",
"phone": "+41 79 000 00 00",
"address": "Musterstrasse 123",
"zipCode": "6666",
"location": "Helheim",
"countryCodeISO": "HEL",
"websiteURL": "https://example.com",
"registerOfCommerceURL": "https://example.com",
"profilePictureBytesBase64": "bm90IGFuIGltYWdlIGZmcy4uLg==",
"businessIdentificationNumber": "CHE-000.000.000",
"valueAddedTaxIdentificationNumber": "CHE-000.000.000 MWST",
"firstRegistrationTimestampUTC": 1720356577
}
UpdateMember(string, long, CompanyUpdateMemberRequestDto)
[HttpPut]
[Route("{slug}/member/{userCompanyId}")]
public Task<IActionResult> UpdateMember(string slug, long userCompanyId, CompanyUpdateMemberRequestDto dto)
Parameters
slugstringuserCompanyIdlongdtoCompanyUpdateMemberRequestDto