Table of Contents

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

db GastroSkyDatabaseContext
configuration IConfiguration
remoteFileStorage IRemoteFileStorage
slugGenerator ISlugGenerator
mapper IMapper
logger ILogger<CompanyController>
imageManipulationService IImageManipulationService

Methods

AcceptInvite(CompanyAcceptInviteRequestDto, string)

[HttpPut]
[Route("{slug}/invite/accept")]
public Task<IActionResult> AcceptInvite(CompanyAcceptInviteRequestDto dto, string slug)

Parameters

dto CompanyAcceptInviteRequestDto
slug string

Returns

Task<IActionResult>

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

dto CompanyCreationRequestDto

Request DTO containing the company information. Check out the API DocFX documentation on CompanyCreationRequestDto for more information.

Returns

Task<IActionResult>

IActionResult

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

slug string

Returns

Task<IActionResult>

GetCompanies()

[HttpGet]
[Route("")]
[ProducesResponseType<ResponseBodyDto<CompanyResponseDto>>(200)]
public Task<IActionResult> GetCompanies()

Returns

Task<IActionResult>

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

slug string

Company slug string.

Returns

Task<IActionResult>

IActionResult

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

slug string
postQueryParameters PostQueryParameters

Returns

Task<IActionResult>

GetCompanySubscriptions(string)

[HttpGet]
[Route("{slug}/active-subscriptions")]
[ProducesResponseType(404)]
[ProducesResponseType<ResponseBodyDto<CompanyResponseDto>>(200)]
public Task<IActionResult> GetCompanySubscriptions(string slug)

Parameters

slug string

Returns

Task<IActionResult>

GetUserProPic(string)

[HttpGet]
[Route("propic/{slug}")]
[Produces("application/octet-stream", new string[] { "application/json" })]
[AllowAnonymous]
public Task<IActionResult> GetUserProPic(string slug)

Parameters

slug string

Returns

Task<IActionResult>

InviteMember(CompanyInviteMemberRequestDto, string)

[HttpPost]
[Route("{slug}/invite")]
public Task<IActionResult> InviteMember(CompanyInviteMemberRequestDto dto, string slug)

Parameters

dto CompanyInviteMemberRequestDto
slug string

Returns

Task<IActionResult>

RemoveMember(string, long)

[HttpDelete]
[Route("{slug}/member/{userCompanyId}")]
public Task<IActionResult> RemoveMember(string slug, long userCompanyId)

Parameters

slug string
userCompanyId long

Returns

Task<IActionResult>

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

dto CompanyModificationRequestDto

Request DTO containing the company information to modify. Check out the API DocFX documentation on CompanyModificationRequestDto for more information.

slug string

Returns

Task<IActionResult>

IActionResult

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

slug string
userCompanyId long
dto CompanyUpdateMemberRequestDto

Returns

Task<IActionResult>