Esempio n. 1
0
        public async Task <ActionResult <PlatformInfoViewModel> > CreatePlatform(
            [FromHeader(Name = "admin-key")] Guid adminKey, [FromBody] CreatePlatformModel model,
            CancellationToken cancellationToken)
        {
            ValidateAdminKey(adminKey);

            using var session = _documentStore.OpenAsyncSession();
            var createdPlatform = await _platformManager.CreatePlatform(model.Name, model.AuthMechanism,
                                                                        PlatformIntegrationType.GigDataPlatformIntegration,
                                                                        new RatingInfo(model.MinRating, model.MaxRating, model.RatingSuccessLimit),
                                                                        3600, Guid.NewGuid(), model.Description, model.LogoUrl, model.WebsiteUrl, session, true,
                                                                        cancellationToken);

            await session.SaveChangesAsync(cancellationToken);

            return(new PlatformInfoViewModel(createdPlatform.ExternalId, createdPlatform.Name,
                                             createdPlatform.Description, createdPlatform.LogoUrl, createdPlatform.WebsiteUrl,
                                             createdPlatform.IsInactive,
                                             createdPlatform.AuthenticationMechanism));
        }