mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 06:47:17 +10:00
Add handling for deleted and banned user to types.js
This commit is contained in:
parent
3110babfaa
commit
099dd6bd9e
11 changed files with 203 additions and 8 deletions
|
|
@ -9,6 +9,7 @@ const bannedUser = {
|
|||
type: 'user',
|
||||
attributes: {
|
||||
banned: true,
|
||||
deleted: false,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -17,6 +18,7 @@ const userWithoutProfileImage = {
|
|||
type: 'user',
|
||||
attributes: {
|
||||
banned: false,
|
||||
deleted: false,
|
||||
profile: {
|
||||
displayName: 'No Profile',
|
||||
abbreviatedName: 'NP',
|
||||
|
|
@ -29,6 +31,7 @@ const userWithProfileImage = {
|
|||
type: 'user',
|
||||
attributes: {
|
||||
banned: false,
|
||||
deleted: false,
|
||||
profile: {
|
||||
displayName: 'Has Profile',
|
||||
abbreviatedName: 'HP',
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -39,6 +39,7 @@ export const WithProfileImageAndBioCurrentUser = {
|
|||
type: 'user',
|
||||
attributes: {
|
||||
banned: false,
|
||||
deleted: false,
|
||||
profile: {
|
||||
displayName: 'Has P',
|
||||
abbreviatedName: 'HP',
|
||||
|
|
@ -81,6 +82,7 @@ export const WithProfileImageAndBio = {
|
|||
type: 'user',
|
||||
attributes: {
|
||||
banned: false,
|
||||
deleted: false,
|
||||
profile: {
|
||||
displayName: 'Has P',
|
||||
abbreviatedName: 'HP',
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ exports[`CheckoutPage matches snapshot 1`] = `
|
|||
Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "author display name",
|
||||
|
|
@ -117,6 +118,7 @@ exports[`CheckoutPage matches snapshot 1`] = `
|
|||
Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "author display name",
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ exports[`InboxPage matches snapshot 1`] = `
|
|||
"customer": Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "customer-user-id display name",
|
||||
|
|
@ -191,6 +192,7 @@ exports[`InboxPage matches snapshot 1`] = `
|
|||
"provider": Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "provider-user-id display name",
|
||||
|
|
@ -308,6 +310,7 @@ exports[`InboxPage matches snapshot 1`] = `
|
|||
"customer": Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "customer-user-id display name",
|
||||
|
|
@ -325,6 +328,7 @@ exports[`InboxPage matches snapshot 1`] = `
|
|||
"provider": Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "provider-user-id display name",
|
||||
|
|
@ -584,6 +588,7 @@ exports[`InboxPage matches snapshot 3`] = `
|
|||
"customer": Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "customer-user-id display name",
|
||||
|
|
@ -601,6 +606,7 @@ exports[`InboxPage matches snapshot 3`] = `
|
|||
"provider": Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "provider-user-id display name",
|
||||
|
|
@ -718,6 +724,7 @@ exports[`InboxPage matches snapshot 3`] = `
|
|||
"customer": Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "customer-user-id display name",
|
||||
|
|
@ -735,6 +742,7 @@ exports[`InboxPage matches snapshot 3`] = `
|
|||
"provider": Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "provider-user-id display name",
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ exports[`ListingPage matches snapshot 1`] = `
|
|||
"author": Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "user-1 display name",
|
||||
|
|
@ -99,6 +100,7 @@ exports[`ListingPage matches snapshot 1`] = `
|
|||
Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "user-1 display name",
|
||||
|
|
@ -199,6 +201,7 @@ exports[`ListingPage matches snapshot 1`] = `
|
|||
Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"email": "user-2@example.com",
|
||||
"emailVerified": true,
|
||||
"profile": Object {
|
||||
|
|
@ -236,6 +239,7 @@ exports[`ListingPage matches snapshot 1`] = `
|
|||
"author": Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "user-1 display name",
|
||||
|
|
@ -286,6 +290,7 @@ exports[`ListingPage matches snapshot 1`] = `
|
|||
"author": Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "user-1 display name",
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ exports[`PasswordChangePage matches snapshot 1`] = `
|
|||
Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"email": "user1@example.com",
|
||||
"emailVerified": true,
|
||||
"profile": Object {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ exports[`ProfilePage matches snapshot 1`] = `
|
|||
Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "test-user display name",
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ exports[`TransactionPage - Order matches snapshot 1`] = `
|
|||
Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"email": "customer1@example.com",
|
||||
"emailVerified": true,
|
||||
"profile": Object {
|
||||
|
|
@ -135,6 +136,7 @@ exports[`TransactionPage - Order matches snapshot 1`] = `
|
|||
"customer": Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "customer1 display name",
|
||||
|
|
@ -172,6 +174,7 @@ exports[`TransactionPage - Order matches snapshot 1`] = `
|
|||
"provider": Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "provider1 display name",
|
||||
|
|
@ -228,6 +231,7 @@ exports[`TransactionPage - Sale matches snapshot 1`] = `
|
|||
Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"email": "provider1@example.com",
|
||||
"emailVerified": true,
|
||||
"profile": Object {
|
||||
|
|
@ -334,6 +338,7 @@ exports[`TransactionPage - Sale matches snapshot 1`] = `
|
|||
"customer": Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "customer1 display name",
|
||||
|
|
@ -371,6 +376,7 @@ exports[`TransactionPage - Sale matches snapshot 1`] = `
|
|||
"provider": Object {
|
||||
"attributes": Object {
|
||||
"banned": false,
|
||||
"deleted": false,
|
||||
"profile": Object {
|
||||
"abbreviatedName": "TT",
|
||||
"displayName": "provider1 display name",
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ export const createUser = (id, attributes = {}) => ({
|
|||
type: 'user',
|
||||
attributes: {
|
||||
banned: false,
|
||||
deleted: false,
|
||||
profile: {
|
||||
displayName: `${id} display name`,
|
||||
abbreviatedName: 'TT',
|
||||
|
|
@ -43,6 +44,7 @@ export const createCurrentUser = (id, attributes = {}) => ({
|
|||
type: 'currentUser',
|
||||
attributes: {
|
||||
banned: false,
|
||||
deleted: false,
|
||||
email: `${id}@example.com`,
|
||||
emailVerified: true,
|
||||
profile: {
|
||||
|
|
|
|||
|
|
@ -109,18 +109,29 @@ propTypes.currentUser = shape({
|
|||
profileImage: propTypes.image,
|
||||
});
|
||||
|
||||
const userAttributes = shape({
|
||||
banned: propTypes.value(false).isRequired,
|
||||
deleted: propTypes.value(false).isRequired,
|
||||
profile: shape({
|
||||
displayName: string.isRequired,
|
||||
abbreviatedName: string.isRequired,
|
||||
bio: string,
|
||||
}),
|
||||
});
|
||||
|
||||
const deletedUserAttributes = shape({
|
||||
deleted: propTypes.value(true).isRequired,
|
||||
});
|
||||
|
||||
const bannedUserAttributes = shape({
|
||||
banned: propTypes.value(true).isRequired,
|
||||
});
|
||||
|
||||
// Denormalised user object
|
||||
propTypes.user = shape({
|
||||
id: propTypes.uuid.isRequired,
|
||||
type: propTypes.value('user').isRequired,
|
||||
attributes: shape({
|
||||
banned: bool.isRequired,
|
||||
profile: shape({
|
||||
displayName: string.isRequired,
|
||||
abbreviatedName: string.isRequired,
|
||||
bio: string,
|
||||
}),
|
||||
}),
|
||||
attributes: oneOfType([userAttributes, deletedUserAttributes, bannedUserAttributes]).isRequired,
|
||||
profileImage: propTypes.image,
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue