B2C to B2B

B2C to B2B: Main points

 

  • Data model
  • Data consistency in db
  • B2B: multiple organizations usecases

Data model: Today

Organizations:

  • online or offline
  • have many Orders
  • have many Memberships (online can only have one)

 

Memberships:

  • have user_id

Data model: Today

Data model: The problem

Data model: The problem

Membership.change_membership_to!

 

changes the User membership from one Organization to another

 

that leaves Organizations without users

 

users cannot interact with old orders!

Data model: B2B

Data model: B2B

Memberships:

  • add a boolean column active
  • restriction: only one membership can be active per user

 

method Membership.change_membership_to!

  • to existing memberships will set active to false
  • will create a new membership to the new organization with active true

 

Organizations

  • restriction: only one org active per user, offline ones will take precedence over online ones
  • active? (for user) == a membership (for user) is active == true

Data model: B2C to B2B

The change will allow:

 

  • old orders will not be orphaned
  • users can belong to multiple organizations, but only one will be active
  • old orders/postings can be reused in new organizations, e.g. copy, activate a posting. And done in a more controlled way

 

 

For data consistency all orders need an organization

 

 

More memos will be added to actions performed (nice to have)

Data consistency

The migration left:

 

  • orders without organizations
  • organizations without client_id

 

For data consistency all orders need an organization

 

 

Data consistency

The fix will be:

  • create online orgs for orders
  • add membership active == false

 

in db:

  • first fix current ones (last months)
  • then fix old ones
  • do not fix them? code will be more complex (but let's evaluate it)

 

 

 memos will be added to actions performed (nice to have)

Multiple orgs

 

  • User can have many orgs (m offlines, n onlines)

 

the active org will determine UX and code mode: offline or online

 

Offline vs Online

 

  • User has an active offline org

 

User will only work on offline organization 

 

Manage Area will only show offline postings (the code also will impose this restriction) and NOT inactive online ones

 

the posting process is already separated, will be kept as is

 

Offline : postings logic

 

User can only

  • copy a posting to the same organization
  • activate a posting of the organization

 

(those actions are permitted if the order of the posting have credits available)

 

Online orgs: a current usecase

  • User belongs to online org
  • start posting a posting "create job ad"
  • in payment page clicks on "I don't work here anymore"
  • gets a new client_id from P&B
  • User proceeds with posting

 

undercovers the code will create a new online org with the new client_id and a membership active

 

for jobs this is equivalent as to changing from one online organization to another (memos!)

 

the new org will be the active one

Online: postings logic

an online organization allows a posting from another org if:

  • the posting comes from an online org
  • the org is from the same user

 

this logic will be applied when

 

publishing, copying and activating a posting

 

and the user

 

changes orgs in the payment page (I don't work here anymore)

Online: manage area

if the active organization is online the manage area can show postings of

  • active online org
  • inactive online orgs

 

the user can then publish, copy and activate postings

 

and undercovers a Posting + Order Transfer to active organization will occur

Online: billing cycle

When an User changes from one online organization to another by publishing, copying or activating postings

 

a new order will be created,

 

the old order will not be changed (as it might need billing still)!

 

The billing cycle works based on orders, will be kept as is

B2C to B2B: tasks

an overall view of those are:

 

  • data model change
  • data fix in db
  • change user.organization to return active one
  • change manage area to work in modes: offline or online
  • logic to allow postings + order copy between orgs

 

Pair programming: let's split the work to increase team knowledge

Thanks

Q&A are welcome

 

Made with Slides.com