mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-30 19:52:20 +01:00
(api) rename user related models to use the _attributes naming convention
This commit is contained in:
parent
7a6fe34b90
commit
555ee11d35
@ -16,13 +16,13 @@ export const Avatar: React.FC<AvatarProps> = ({ user, className }) => {
|
||||
* Check if the provided user has a configured avatar
|
||||
*/
|
||||
const hasAvatar = (): boolean => {
|
||||
return !!user?.profile?.user_avatar?.attachment_url;
|
||||
return !!user?.profile_attributes?.user_avatar_attributes?.attachment_url;
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={`avatar ${className || ''}`}>
|
||||
{!hasAvatar() && <img src={noAvatar} alt="avatar placeholder"/>}
|
||||
{hasAvatar() && <img src={user.profile.user_avatar.attachment_url} alt="user's avatar"/>}
|
||||
{hasAvatar() && <img src={user.profile_attributes.user_avatar_attributes.attachment_url} alt="user's avatar"/>}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { react2angular } from 'react2angular';
|
||||
import { SubmitHandler, useForm, useWatch } from 'react-hook-form';
|
||||
import { isNil as _isNil } from 'lodash';
|
||||
import { User } from '../../models/user';
|
||||
import { IApplication } from '../../models/application';
|
||||
import { Loader } from '../base/loader';
|
||||
@ -33,7 +34,7 @@ export const UserProfileForm: React.FC<UserProfileFormProps> = ({ action, size,
|
||||
const { handleSubmit, register, control, formState } = useForm<User>({ defaultValues: { ...user } });
|
||||
const output = useWatch<User>({ control });
|
||||
|
||||
const [isOrganization, setIsOrganization] = React.useState<boolean>(user.invoicing_profile.organization !== null);
|
||||
const [isOrganization, setIsOrganization] = React.useState<boolean>(!_isNil(user.invoicing_profile_attributes.organization_attributes));
|
||||
|
||||
/**
|
||||
* Callback triggered when the form is submitted: process with the user creation or update.
|
||||
@ -115,7 +116,7 @@ export const UserProfileForm: React.FC<UserProfileFormProps> = ({ action, size,
|
||||
id="invoicing_profile_attributes.organization"
|
||||
label={t('app.shared.user_profile_form.declare_organization')}
|
||||
tooltip={t('app.shared.user_profile_form.declare_organization_help')}
|
||||
defaultValue={user.invoicing_profile.organization !== null}
|
||||
defaultValue={isOrganization}
|
||||
onChange={setIsOrganization} />
|
||||
{isOrganization && <div className="organization-fields">
|
||||
<FormInput id="invoicing_profile_attributes.organization_attributes.id"
|
||||
|
@ -344,14 +344,14 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
|
||||
});
|
||||
// on tour end, save the status in database
|
||||
uitour.on('ended', function () {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile.tours.indexOf('calendar') < 0) {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile_attributes.tours.indexOf('calendar') < 0) {
|
||||
Member.completeTour({ id: $scope.currentUser.id }, { tour: 'calendar' }, function (res) {
|
||||
$scope.currentUser.profile.tours = res.tours;
|
||||
$scope.currentUser.profile_attributes.tours = res.tours;
|
||||
});
|
||||
}
|
||||
});
|
||||
// if the user has never seen the tour, show him now
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('calendar') < 0) {
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile_attributes.tours.indexOf('calendar') < 0) {
|
||||
uitour.start();
|
||||
}
|
||||
};
|
||||
@ -369,8 +369,8 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
|
||||
* @return {string} 'male' or 'female'
|
||||
*/
|
||||
const getGender = function (user) {
|
||||
if (user.statistic_profile) {
|
||||
if (user.statistic_profile.gender === 'true') { return 'male'; } else { return 'female'; }
|
||||
if (user.statistic_profile_attributes) {
|
||||
if (user.statistic_profile_attributes.gender === 'true') { return 'male'; } else { return 'female'; }
|
||||
} else { return 'other'; }
|
||||
};
|
||||
|
||||
|
@ -473,14 +473,14 @@ Application.Controllers.controller('AdminEventsController', ['$scope', '$state',
|
||||
});
|
||||
// on tour end, save the status in database
|
||||
uitour.on('ended', function () {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile.tours.indexOf('events') < 0) {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile_attributes.tours.indexOf('events') < 0) {
|
||||
Member.completeTour({ id: $scope.currentUser.id }, { tour: 'events' }, function (res) {
|
||||
$scope.currentUser.profile.tours = res.tours;
|
||||
$scope.currentUser.profile_attributes.tours = res.tours;
|
||||
});
|
||||
}
|
||||
});
|
||||
// if the user has never seen the tour, show him now
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('events') < 0) {
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile_attributes.tours.indexOf('events') < 0) {
|
||||
uitour.start();
|
||||
}
|
||||
};
|
||||
|
@ -1012,14 +1012,14 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
});
|
||||
// on tour end, save the status in database
|
||||
uitour.on('ended', function () {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile.tours.indexOf('invoices') < 0) {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile_attributes.tours.indexOf('invoices') < 0) {
|
||||
Member.completeTour({ id: $scope.currentUser.id }, { tour: 'invoices' }, function (res) {
|
||||
$scope.currentUser.profile.tours = res.tours;
|
||||
$scope.currentUser.profile_attributes.tours = res.tours;
|
||||
});
|
||||
}
|
||||
});
|
||||
// if the user has never seen the tour, show him now
|
||||
if (settings.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('invoices') < 0) {
|
||||
if (settings.feature_tour_display !== 'manual' && $scope.currentUser.profile_attributes.tours.indexOf('invoices') < 0) {
|
||||
uitour.start();
|
||||
}
|
||||
};
|
||||
|
@ -569,14 +569,14 @@ Application.Controllers.controller('AdminMembersController', ['$scope', '$sce',
|
||||
});
|
||||
// on tour end, save the status in database
|
||||
uitour.on('ended', function () {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile.tours.indexOf('members') < 0) {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile_attributes.tours.indexOf('members') < 0) {
|
||||
Member.completeTour({ id: $scope.currentUser.id }, { tour: 'members' }, function (res) {
|
||||
$scope.currentUser.profile.tours = res.tours;
|
||||
$scope.currentUser.profile_attributes.tours = res.tours;
|
||||
});
|
||||
}
|
||||
});
|
||||
// if the user has never seen the tour, show him now
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('members') < 0) {
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile_attributes.tours.indexOf('members') < 0) {
|
||||
uitour.start();
|
||||
}
|
||||
};
|
||||
@ -896,7 +896,7 @@ Application.Controllers.controller('EditMemberController', ['$scope', '$state',
|
||||
CSRF.setMetaTags();
|
||||
|
||||
// init the birthdate to JS object
|
||||
$scope.user.statistic_profile.birthday = moment($scope.user.statistic_profile.birthday).toDate();
|
||||
$scope.user.statistic_profile_attributes.birthday = moment($scope.user.statistic_profile_attributes.birthday).toDate();
|
||||
|
||||
// the user subscription
|
||||
if (($scope.user.subscribed_plan != null) && ($scope.user.subscription != null)) {
|
||||
@ -946,18 +946,18 @@ Application.Controllers.controller('NewMemberController', ['$scope', '$state', '
|
||||
// Default member's profile parameters
|
||||
$scope.user = {
|
||||
plan_interval: '',
|
||||
invoicing_profile: {},
|
||||
statistic_profile: {}
|
||||
invoicing_profile_attributes: {},
|
||||
statistic_profile_attributes: {}
|
||||
};
|
||||
|
||||
// Callback when the admin check/uncheck the box telling that the new user is an organization.
|
||||
// Disable or enable the organization fields in the form, accordingly
|
||||
$scope.toggleOrganization = function () {
|
||||
if ($scope.user.organization) {
|
||||
if (!$scope.user.invoicing_profile) { $scope.user.invoicing_profile = {}; }
|
||||
$scope.user.invoicing_profile.organization = {};
|
||||
if (!$scope.user.invoicing_profile_attributes) { $scope.user.invoicing_profile_attributes = {}; }
|
||||
$scope.user.invoicing_profile_attributes.organization_attributes = {};
|
||||
} else {
|
||||
$scope.user.invoicing_profile.organization = undefined;
|
||||
$scope.user.invoicing_profile_attributes.organization_attributes = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -142,14 +142,14 @@ Application.Controllers.controller('OpenAPIClientsController', ['$scope', 'clien
|
||||
});
|
||||
// on tour end, save the status in database
|
||||
uitour.on('ended', function () {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile.tours.indexOf('open-api') < 0) {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile_attributes.tours.indexOf('open-api') < 0) {
|
||||
Member.completeTour({ id: $scope.currentUser.id }, { tour: 'open-api' }, function (res) {
|
||||
$scope.currentUser.profile.tours = res.tours;
|
||||
$scope.currentUser.profile_attributes.tours = res.tours;
|
||||
});
|
||||
}
|
||||
});
|
||||
// if the user has never seen the tour, and if the display behavior is not configured to manual triggering only, show the tour now
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('open-api') < 0) {
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile_attributes.tours.indexOf('open-api') < 0) {
|
||||
uitour.start();
|
||||
}
|
||||
};
|
||||
|
@ -740,14 +740,14 @@ Application.Controllers.controller('EditPricingController', ['$scope', '$state',
|
||||
});
|
||||
// on tour end, save the status in database
|
||||
uitour.on('ended', function () {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile.tours.indexOf('pricing') < 0) {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile_attributes.tours.indexOf('pricing') < 0) {
|
||||
Member.completeTour({ id: $scope.currentUser.id }, { tour: 'pricing' }, function (res) {
|
||||
$scope.currentUser.profile.tours = res.tours;
|
||||
$scope.currentUser.profile_attributes.tours = res.tours;
|
||||
});
|
||||
}
|
||||
});
|
||||
// if the user has never seen the tour, show him now
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('pricing') < 0) {
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile_attributes.tours.indexOf('pricing') < 0) {
|
||||
uitour.start();
|
||||
}
|
||||
};
|
||||
|
@ -253,14 +253,14 @@ Application.Controllers.controller('AdminProjectsController', ['$scope', '$state
|
||||
});
|
||||
// on tour end, save the status in database
|
||||
uitour.on('ended', function () {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile.tours.indexOf('projects') < 0) {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile_attributes.tours.indexOf('projects') < 0) {
|
||||
Member.completeTour({ id: $scope.currentUser.id }, { tour: 'projects' }, function (res) {
|
||||
$scope.currentUser.profile.tours = res.tours;
|
||||
$scope.currentUser.profile_attributes.tours = res.tours;
|
||||
});
|
||||
}
|
||||
});
|
||||
// if the user has never seen the tour, show him now
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('projects') < 0) {
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile_attributes.tours.indexOf('projects') < 0) {
|
||||
uitour.start();
|
||||
}
|
||||
};
|
||||
|
@ -454,14 +454,14 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
|
||||
});
|
||||
// on tour end, save the status in database
|
||||
uitour.on('ended', function () {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile.tours.indexOf('settings') < 0) {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile_attributes.tours.indexOf('settings') < 0) {
|
||||
Member.completeTour({ id: $scope.currentUser.id }, { tour: 'settings' }, function (res) {
|
||||
$scope.currentUser.profile.tours = res.tours;
|
||||
$scope.currentUser.profile_attributes.tours = res.tours;
|
||||
});
|
||||
}
|
||||
});
|
||||
// if the user has never seen the tour, show him now
|
||||
if ($scope.allSettings.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('settings') < 0) {
|
||||
if ($scope.allSettings.feature_tour_display !== 'manual' && $scope.currentUser.profile_attributes.tours.indexOf('settings') < 0) {
|
||||
uitour.start();
|
||||
}
|
||||
};
|
||||
@ -522,10 +522,10 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
|
||||
if (newValue === oldValue) return;
|
||||
|
||||
if (newValue === 'session') {
|
||||
$scope.currentUser.profile.tours = Fablab.sessionTours;
|
||||
$scope.currentUser.profile_attributes.tours = Fablab.sessionTours;
|
||||
} else if (newValue === 'once') {
|
||||
Member.get({ id: $scope.currentUser.id }, function (user) {
|
||||
$scope.currentUser.profile.tours = user.profile.tours;
|
||||
$scope.currentUser.profile_attributes.tours = user.profile_attributes.tours;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -387,14 +387,14 @@ Application.Controllers.controller('StatisticsController', ['$scope', '$state',
|
||||
});
|
||||
// on tour end, save the status in database
|
||||
uitour.on('ended', function () {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile.tours.indexOf('statistics') < 0) {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile_attributes.tours.indexOf('statistics') < 0) {
|
||||
Member.completeTour({ id: $scope.currentUser.id }, { tour: 'statistics' }, function (res) {
|
||||
$scope.currentUser.profile.tours = res.tours;
|
||||
$scope.currentUser.profile_attributes.tours = res.tours;
|
||||
});
|
||||
}
|
||||
});
|
||||
// if the user has never seen the tour, show him now
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('statistics') < 0) {
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile_attributes.tours.indexOf('statistics') < 0) {
|
||||
uitour.start();
|
||||
}
|
||||
};
|
||||
|
@ -391,14 +391,14 @@ Application.Controllers.controller('TrainingsAdminController', ['$scope', '$stat
|
||||
});
|
||||
// on tour end, save the status in database
|
||||
uitour.on('ended', function () {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile.tours.indexOf('trainings') < 0) {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile_attributes.tours.indexOf('trainings') < 0) {
|
||||
Member.completeTour({ id: $scope.currentUser.id }, { tour: 'trainings' }, function (res) {
|
||||
$scope.currentUser.profile.tours = res.tours;
|
||||
$scope.currentUser.profile_attributes.tours = res.tours;
|
||||
});
|
||||
}
|
||||
});
|
||||
// if the user has never seen the tour, show him now
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('trainings') < 0) {
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile_attributes.tours.indexOf('trainings') < 0) {
|
||||
uitour.start();
|
||||
}
|
||||
};
|
||||
|
@ -70,7 +70,7 @@ Application.Controllers.controller('DashboardController', ['$scope', 'memberProm
|
||||
const filterNetworks = function () {
|
||||
const networks = [];
|
||||
for (const network of Array.from(SocialNetworks)) {
|
||||
if ($scope.user.profile[network] && ($scope.user.profile[network].length > 0)) {
|
||||
if ($scope.user.profile_attributes[network] && ($scope.user.profile_attributes[network].length > 0)) {
|
||||
networks.push(network);
|
||||
}
|
||||
}
|
||||
|
@ -296,14 +296,14 @@ Application.Controllers.controller('HomeController', ['$scope', '$transition$',
|
||||
});
|
||||
// on tour end, save the status in database
|
||||
uitour.on('ended', function () {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile.tours.indexOf('welcome') < 0) {
|
||||
if (uitour.getStatus() === uitour.Status.ON && $scope.currentUser.profile_attributes.tours.indexOf('welcome') < 0) {
|
||||
Member.completeTour({ id: $scope.currentUser.id }, { tour: 'welcome' }, function (res) {
|
||||
$scope.currentUser.profile.tours = res.tours;
|
||||
$scope.currentUser.profile_attributes.tours = res.tours;
|
||||
});
|
||||
}
|
||||
});
|
||||
// if the user has never seen the tour, show him now
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('welcome') < 0) {
|
||||
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile_attributes.tours.indexOf('welcome') < 0) {
|
||||
uitour.start();
|
||||
}
|
||||
};
|
||||
|
@ -184,8 +184,8 @@ Application.Controllers.controller('EditProfileController', ['$scope', '$rootSco
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$scope.currentUser.profile.user_avatar = content.profile.user_avatar;
|
||||
Auth._currentUser.profile.user_avatar = content.profile.user_avatar;
|
||||
$scope.currentUser.profile_attributes.user_avatar_attributes = content.profile_attributes.user_avatar_attributes;
|
||||
Auth._currentUser.profile_attributes.user_avatar_attributes = content.profile_attributes.user_avatar_attributes;
|
||||
$scope.currentUser.name = content.name;
|
||||
Auth._currentUser.name = content.name;
|
||||
$scope.currentUser = content;
|
||||
@ -292,7 +292,7 @@ Application.Controllers.controller('EditProfileController', ['$scope', '$rootSco
|
||||
CSRF.setMetaTags();
|
||||
|
||||
// init the birth date to JS object
|
||||
$scope.user.statistic_profile.birthday = moment($scope.user.statistic_profile.birthday).toDate();
|
||||
$scope.user.statistic_profile_attributes.birthday = moment($scope.user.statistic_profile_attributes.birthday).toDate();
|
||||
|
||||
if ($scope.activeProvider.providable_type !== 'DatabaseProvider') {
|
||||
$scope.preventPassword = true;
|
||||
@ -341,7 +341,7 @@ Application.Controllers.controller('ShowProfileController', ['$scope', 'memberPr
|
||||
const filterNetworks = function () {
|
||||
const networks = [];
|
||||
for (const network of Array.from(SocialNetworks)) {
|
||||
if ($scope.user.profile[network] && ($scope.user.profile[network].length > 0)) {
|
||||
if ($scope.user.profile_attributes[network] && ($scope.user.profile_attributes[network].length > 0)) {
|
||||
networks.push(network);
|
||||
}
|
||||
}
|
||||
|
@ -151,8 +151,8 @@ Application.Controllers.controller('PlansIndexController', ['$scope', '$rootScop
|
||||
* @return {string} 'male' or 'female'
|
||||
*/
|
||||
$scope.getGender = function (user) {
|
||||
if (user && user.statistic_profile) {
|
||||
if (user.statistic_profile.gender === 'true') { return 'male'; } else { return 'female'; }
|
||||
if (user && user.statistic_profile_attributes) {
|
||||
if (user.statistic_profile_attributes.gender === 'true') { return 'male'; } else { return 'female'; }
|
||||
} else { return 'other'; }
|
||||
};
|
||||
|
||||
|
@ -91,8 +91,8 @@ Application.Controllers.controller('CompleteProfileController', ['$scope', '$roo
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$scope.user.profile.user_avatar = content.profile.user_avatar;
|
||||
Auth._currentUser.profile.user_avatar = content.profile.user_avatar;
|
||||
$scope.user.profile_attributes.user_avatar_attributes = content.profile_attributes.user_avatar_attributes;
|
||||
Auth._currentUser.profile_attributes.user_avatar_attributes = content.profile_attributes.user_avatar_attributes;
|
||||
$scope.user.name = content.name;
|
||||
Auth._currentUser.name = content.name;
|
||||
$scope.user = content;
|
||||
@ -220,7 +220,7 @@ Application.Controllers.controller('CompleteProfileController', ['$scope', '$roo
|
||||
CSRF.setMetaTags();
|
||||
|
||||
// init the birth date to JS object
|
||||
$scope.user.statistic_profile.birthday = $scope.user.statistic_profile.birthday ? moment($scope.user.statistic_profile.birthday).toDate() : undefined;
|
||||
$scope.user.statistic_profile_attributes.birthday = $scope.user.statistic_profile_attributes.birthday ? moment($scope.user.statistic_profile_attributes.birthday).toDate() : undefined;
|
||||
|
||||
// bind fields protection with sso fields
|
||||
angular.forEach(activeProviderPromise.mapping, function (map) { $scope.preventField[map] = true; });
|
||||
|
@ -19,7 +19,7 @@ export interface User {
|
||||
mapped_from_sso?: string[],
|
||||
password?: string,
|
||||
password_confirmation?: string,
|
||||
profile: {
|
||||
profile_attributes: {
|
||||
id: number,
|
||||
first_name: string,
|
||||
last_name: string,
|
||||
@ -43,27 +43,27 @@ export interface User {
|
||||
pinterest: string,
|
||||
lastfm: string,
|
||||
flickr: string,
|
||||
user_avatar: {
|
||||
user_avatar_attributes: {
|
||||
id: number,
|
||||
attachment_url: string
|
||||
}
|
||||
},
|
||||
invoicing_profile: {
|
||||
invoicing_profile_attributes: {
|
||||
id: number,
|
||||
address: {
|
||||
address_attributes: {
|
||||
id: number,
|
||||
address: string
|
||||
},
|
||||
organization: {
|
||||
organization_attributes: {
|
||||
id: number,
|
||||
name: string,
|
||||
address: {
|
||||
address_attributes: {
|
||||
id: number,
|
||||
address: string
|
||||
}
|
||||
}
|
||||
},
|
||||
statistic_profile: {
|
||||
statistic_profile_attributes: {
|
||||
id: number,
|
||||
gender: string,
|
||||
birthday: TDateISO
|
||||
|
@ -7,40 +7,32 @@ json.need_completion member.need_completion?
|
||||
json.ip_address member.current_sign_in_ip.to_s
|
||||
json.mapped_from_sso member.mapped_from_sso&.split(',')
|
||||
|
||||
json.profile do
|
||||
json.id member.profile.id
|
||||
json.profile_attributes do
|
||||
json.extract! member.profile, :id, :first_name, :last_name, :interest, :software_mastered, :phone, :website, :job
|
||||
if member.profile.user_avatar
|
||||
json.user_avatar do
|
||||
json.user_avatar_attributes do
|
||||
json.id member.profile.user_avatar.id
|
||||
json.attachment_url "#{member.profile.user_avatar.attachment_url}?#{member.profile.user_avatar.updated_at.to_i}"
|
||||
end
|
||||
end
|
||||
json.first_name member.profile.first_name
|
||||
json.last_name member.profile.last_name
|
||||
json.interest member.profile.interest
|
||||
json.software_mastered member.profile.software_mastered
|
||||
json.phone member.profile.phone
|
||||
json.website member.profile.website
|
||||
json.job member.profile.job
|
||||
json.extract! member.profile, :facebook, :twitter, :google_plus, :viadeo, :linkedin, :instagram, :youtube, :vimeo, :dailymotion, :github, :echosciences, :pinterest, :lastfm, :flickr
|
||||
json.extract! member.profile, :facebook, :twitter, :viadeo, :linkedin, :instagram, :youtube, :vimeo, :dailymotion, :github, :echosciences, :pinterest, :lastfm, :flickr
|
||||
json.tours member.profile.tours&.split || []
|
||||
end
|
||||
|
||||
json.invoicing_profile do
|
||||
json.invoicing_profile_attributes do
|
||||
json.id member.invoicing_profile.id
|
||||
if member.invoicing_profile.address
|
||||
json.address do
|
||||
json.address_attributes do
|
||||
json.id member.invoicing_profile.address.id
|
||||
json.address member.invoicing_profile.address.address
|
||||
end
|
||||
end
|
||||
|
||||
if member.invoicing_profile.organization
|
||||
json.organization do
|
||||
json.id member.invoicing_profile.organization.id
|
||||
json.name member.invoicing_profile.organization.name
|
||||
json.organization_attributes do
|
||||
json.extract! member.invoicing_profile.organization, :id, :name
|
||||
if member.invoicing_profile.organization.address
|
||||
json.address do
|
||||
json.address_attributes do
|
||||
json.id member.invoicing_profile.organization.address.id
|
||||
json.address member.invoicing_profile.organization.address.address
|
||||
end
|
||||
@ -49,7 +41,7 @@ json.invoicing_profile do
|
||||
end
|
||||
end
|
||||
|
||||
json.statistic_profile do
|
||||
json.statistic_profile_attributes do
|
||||
json.id member.statistic_profile.id
|
||||
json.gender member.statistic_profile.gender.to_s
|
||||
json.birthday member.statistic_profile&.birthday&.to_date&.iso8601
|
||||
|
Loading…
x
Reference in New Issue
Block a user