Exemple #1
0
        public async Task <ShyneeProfileFieldsPrivacyDto> UpdateShyneeProfileFieldsPrivacyAsync(
            Guid id,
            ShyneeProfileFieldsPrivacyDto fieldsPrivacy)
        {
            var shynee = await _shyneesRepository.GetShyneeAsync(id);

            var shyneeProfileToUpdate = new ShyneeProfile(
                new ShyneeProfileParameter <string>(
                    fieldsPrivacy.Nickname,
                    shynee.Profile.Nickname.Parameter),
                new ShyneeProfileParameter <string>(
                    fieldsPrivacy.AvatarUri,
                    shynee.Profile.AvatarUri.Parameter),
                new ShyneeProfileParameter <string>(
                    fieldsPrivacy.Name,
                    shynee.Profile.Name.Parameter),
                new ShyneeProfileParameter <DateTime?>(
                    fieldsPrivacy.Dob,
                    shynee.Profile.Dob.Parameter),
                new ShyneeProfileParameter <Gender>(
                    fieldsPrivacy.Gender,
                    shynee.Profile.Gender.Parameter),
                new ShyneeProfileParameter <string[]>(
                    fieldsPrivacy.Interests,
                    shynee.Profile.Interests.Parameter),
                new ShyneeProfileParameter <string>(
                    fieldsPrivacy.PersonalInfo,
                    shynee.Profile.PersonalInfo.Parameter));

            shynee.UpdateProfile(shyneeProfileToUpdate);
            await _shyneesRepository.UpdateShyneeAsync(shynee);

            return(fieldsPrivacy);
        }
Exemple #2
0
        public async Task <IActionResult> CreateShynee(
            [FromBody] CreateShynee shynee)
        {
            var shyneeCredentials = new ShyneeCredentials(
                shynee.Email,
                Hasher.HashPassword(shynee.Password));
            var shyneeProfile = new ShyneeProfile(
                shynee.Nickname,
                shynee.Name,
                shynee.Dob,
                shynee.Gender,
                shynee.Interests,
                shynee.PersonalInfo);
            var createdShynee = await _shyneesService.CreateShyneeAsync(
                shyneeCredentials,
                shyneeProfile);

            var shyneeProfileDto = new ShyneeProfileDto(
                shyneeProfile.Nickname.Parameter,
                shyneeProfile.AvatarUri.Parameter,
                shyneeProfile.Name.Parameter,
                shyneeProfile.Dob.Parameter,
                shyneeProfile.Gender.Parameter,
                shyneeProfile.Interests.Parameter,
                shyneeProfile.PersonalInfo.Parameter);
            var shyneeCredentialsDto = new ShyneeCredentialsDto(
                createdShynee.Id,
                createdShynee.Credentials.Email,
                _jwtIssuer.IssueJwt(createdShynee.Id),
                shyneeProfileDto);

            return(Ok(shyneeCredentialsDto));
        }
Exemple #3
0
        public async Task <ShyneeProfileDto> UpdateShyneeProfileAsync(
            Guid id,
            ShyneeProfile profile)
        {
            var shynee = await _shyneesRepository.GetShyneeAsync(id);

            profile.UpdateAvatarUri(shynee.Profile.AvatarUri);
            shynee.UpdateProfile(profile);
            await _shyneesRepository.UpdateShyneeAsync(shynee);

            return(new ShyneeProfileDto(
                       profile.Nickname.Parameter,
                       profile.AvatarUri.Parameter,
                       profile.Name.Parameter,
                       profile.Dob.Parameter,
                       profile.Gender.Parameter,
                       profile.Interests.Parameter,
                       profile.PersonalInfo.Parameter));
        }
Exemple #4
0
        public async Task <Shynee> CreateShyneeAsync(
            ShyneeCredentials shyneeCredentials,
            ShyneeProfile shyneeProfile)
        {
            if (await _shyneesRepository.IsShyneeExistsAsync(shyneeCredentials.Email))
            {
                throw new ShyneeDuplicateException();
            }
            var shynee = new Shynee(
                shyneeCredentials,
                new ShyneeCoordinates(),
                shyneeProfile,
                new ShyneeSettings());
            var id = await _shyneesRepository.CreateShyneeAsync(shynee);

            var createdShynee = await _shyneesRepository.GetShyneeAsync(id);

            return(createdShynee);
        }
        private static Shynee GetStaticShynee()
        {
            var shyneeCredentials = new ShyneeCredentials("*****@*****.**", Hasher.HashPassword("qwertyui"));
            var shyneeCoordinates = FakeShyneeCoordinates().Generate();
            var ShyneeSettings    = new ShyneeSettings();
            var shyneeProfile     = new ShyneeProfile(
                new ShyneeProfileParameter <string>(ShyneeProfileParameterStatus.Visible, "Shynee"),
                new ShyneeProfileParameter <string>(ShyneeProfileParameterStatus.Empty),
                new ShyneeProfileParameter <string>(ShyneeProfileParameterStatus.Empty),
                new ShyneeProfileParameter <DateTime?>(ShyneeProfileParameterStatus.Empty),
                new ShyneeProfileParameter <Gender>(ShyneeProfileParameterStatus.Empty),
                new ShyneeProfileParameter <string[]>(ShyneeProfileParameterStatus.Empty),
                new ShyneeProfileParameter <string>(ShyneeProfileParameterStatus.Empty));
            var shynee = new Shynee(
                new Guid("452B5C13-E964-499C-89D4-072EEC43E7A4"),
                shyneeCredentials,
                shyneeCoordinates,
                shyneeProfile,
                ShyneeSettings);

            return(shynee);
        }
Exemple #6
0
        public async Task <UploadedAssetPathDto> UpdateShyneeAvatarAsync(
            Guid shyneeId,
            string assetPath)
        {
            var shynee = await _shyneesRepository.GetShyneeAsync(shyneeId);

            var updatedShyneeProfile = new ShyneeProfile(
                shynee.Profile.Nickname.Parameter,
                assetPath,
                shynee.Profile.Name.Parameter,
                shynee.Profile.Dob.Parameter,
                shynee.Profile.Gender.Parameter,
                shynee.Profile.Interests.Parameter,
                shynee.Profile.PersonalInfo.Parameter);

            shynee.UpdateProfile(updatedShyneeProfile);
            await _shyneesRepository.UpdateShyneeAsync(shynee);

            var uploadedAssetUri = new UploadedAssetPathDto(
                shynee.Profile.AvatarUri.Parameter);

            return(uploadedAssetUri);
        }