Meeds-io / MIPs

The Meeds Improvement Proposal repository
0 stars 0 forks source link

Upgrade news data model to note Part 1 #119

Closed azayati closed 1 month ago

azayati commented 5 months ago

Rationale

eXo is working on bringing it's full-featured news publishing system to meeds by leveraging Notes as content storage.

Changes need to be applied to notes prior bringing the News features.

1. Functional requirements

Update : The following requirement are moved in another MIP https://github.com/Meeds-io/MIPs/issues/130 :

2. Technical Requirements

Feature Flags

Property Name Default Value Target Audience Functional Behaviour
newsScheduleAndFilterDisplaying false users enable/disable new scheduling and filters in news app except draft filter

3. Software Architecture

Services & processing

Social addon

Notes addon

Content addon

Sequence diagram for create draft article use case: image

Sequence diagram for get draft article use case image

Data and persistence

    <component-plugin>
      <name>NotesMetadataPlugin</name>
      <set-method>addMetadataTypePlugin</set-method>
      <type>org.exoplatform.social.metadata.MetadataTypePlugin</type>
      <init-params>
        <value-param>
          <name>shareable</name>
          <value>true</value>
        </value-param>
        <value-param>
          <name>allowMultipleItemsPerObject</name>
          <value>true</value>
        </value-param>
        <object-param>
          <name>metadataType</name>
          <object type="org.exoplatform.social.metadata.model.MetadataType">
            <field name="id">
              <int>1000</int>
            </field>
            <field name="name">
              <string>news</string>
            </field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
    <component-plugin>
      <name>DraftNewsMetadataPlugin</name>
      <set-method>addMetadataPlugin</set-method>
      <type>org.exoplatform.social.metadata.MetadataInitPlugin</type>
      <init-params>
        <object-param>
          <name>metadata</name>
          <object type="org.exoplatform.social.metadata.model.Metadata">
            <field name="type">
              <object type="org.exoplatform.social.metadata.model.MetadataType">
                <field name="id">
                  <int>1000</int>
                </field>
                <field name="name">
                  <string>news</string>
                </field>
              </object>
            </field>
            <field name="name">
              <string>news</string>
            </field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>

SOC_METADATAS table:

METADATA_ID TYPE Name .....
5 1000 News ...........

METADATA_ITEM table:

METADATA_ITEM_ID METADATA_ID OBJECT_TYPE OBJECT_ID PARENT_OBJECT_ID ...........
100 5 newsDraftPage 100 null ...........
101 5 newsPage 101 null ...........
102 5 newsPageVersion 102 null ...........
103 5 newsLatestDraftPage 103 101 ...........

METADATA_ITEM_PROPERTIES table:

METADATA_ITEM_ID NAME VALUE
100 IllustrationId 100
100 summary

My draft article Summary

101 activityPosted true
101 published true
101 schedulePostDate

My article version 20 Summary

102 IllustrationId 100
102 summary

My article first version Summary

103 IllustrationId 100
103 summary

My draft for existing article Summary

103 activityPosted true

.....

azayati commented 5 months ago

I have created this DRAFT Mip with the content discussed during our Meeting of January 23rd. @boubaker Can you take a look, give me your first feedbacks/remarks in order to start discussions ? cc @rdenarie @margondicco @srenault-meeds

plamarque commented 5 months ago

Added a rationale

boubaker commented 5 months ago

IMHO the Metadata API is not the good solution to use here. In fact, we are designing a new Data Model for a new feature which will reuse the notes editor, but not the data model of notes as it is. The Metadata API is designed to decorate mixed types of data, such as adding favorites on spaces, users, notes, activities ... Using it to design a new data model on top of an existing data Model can be used as a trick but not for design a new addon in product.

In addition, polluting the Notes data model with News fields and Business logic can make both products unmaintainable and hard to evolve. I propose to study more the Software Architecture by bringing a second option where we use a specific database Model for News (duplicating code in this special case, can reduce complexity and reduces the cost of flexibility IMO). Eager to discuss more about this.

azayati commented 5 months ago

@boubaker If I have understand your point, you mean that News should have its own tables (exactly like notes ones) + the specific news fields. A duplication of code will be done also for all notes layers + search. In that case IMO, no relation between a news entity and a notes entity, we are no more talking about a migration of news data model to notes one, but it will be an upgrade of news data model from jcr to jpa.

cc @rdenarie @margondicco

boubaker commented 5 months ago

@boubaker If I have understand your point, you mean that News should have its own tables (exactly like notes ones) + the specific news fields. A duplication of code will be done also for all notes layers + search. In that case IMO, no relation between a news entity and a notes entity, we are no more talking about a migration of news data model to notes one, but it will be an upgrade of news data model from jcr to jpa.

cc @rdenarie @margondicco

For my part I think that we have the following disadvantages with current design:

To design an addon which will extend another (like we do in all other type of addons), we have to add extension points (using extension registry for the front end And Plugins for the backend). Considering this, IMO, we should rethink the technical design to benefit from Notes existing behaviors instead. There is no functional requirement in the MIP, thus it will be difficult to design a good solution. But if :

Then, like we do for Activities, we should keep the original behavior of Notes without changing it and just add a Data Model Table to decorate the Notes Object with additional fields like:

Those information should be stored and managed outside of Notes and managed in UI using extensionRegistry extensibility.

PS: as the current technical requirement doesn't use Metadata API for adding additional fields (like Summary & Title), I think it would be better to not use it for News for now and keep the design of using Metadata Model when a dedicated MIP to CMS is proposed. (It would simplify the development of current MIP, but I let you choose between using a dedicated Table for News or Using the Metadata API)

azayati commented 5 months ago

I vote for using dedicated tables for news and not the metadata, since the data model of news will complete the "Notes" one, we should have:

boubaker commented 4 months ago

Should we add a type field in "Notes" tables in order to retrieve the stored notes (with type "News") ? or we retrieve them based on the notes ids referenced from the "News" tables ?

I let you decide, from my part not changing notes but making it extensible to support News features through extensionRegistry & plugins is sufficient for me.

Julien-Dubois-eXo commented 3 months ago

Hello @srenault-meeds can you check the functional part please? FYI these elements are those we have to work on during the migration. They will be improved during the next functional iteration.

srenault-meeds commented 3 months ago

Ok for me

azayati commented 2 months ago

@boubaker can you check technical part ?

boubaker commented 2 months ago

@boubaker can you check technical part ?

Ok, what about the content addon software architecture ?

azayati commented 2 months ago

@boubaker can you check technical part ?

Ok, what about the content addon software architecture ?

The content addon is the same as news addon without jcr/ecms dependencies, the storage of news will be based on notes api and metadata api as explained here

boubaker commented 2 months ago

@boubaker can you check technical part ?

Ok, what about the content addon software architecture ?

The content addon is the same as news addon without jcr/ecms dependencies, the storage of news will be based on notes api and metadata api as explained here

Ok, I would prefer to know more about it and how you will use the new Storage layer for News in Meeds Context. But let's keep this first version of technical specification, knowing that it will be difficult to give a go-merge if I wasn't aware about the real technical choices made. In other terms, I will have to make a reverse-engineering of PRs to know how have you dealt with the migration from JCR to the new Storage Layer in News and if it fits the original concern: use a generic storage for CMS Based applications with a first concrete usage on News. Go Tech added.

azayati commented 2 months ago

Ok, I would prefer to know more about it and how you will use the new Storage layer for News in Meeds Context. But let's keep this first version of technical specification, knowing that it will be difficult to give a go-merge if I wasn't aware about the real technical choices made. In other terms, I will have to make a reverse-engineering of PRs to know how have you dealt with the migration from JCR to the new Storage Layer in News and if it fits the original concern: use a generic storage for CMS Based applications with a first concrete usage on News. Go Tech added.

You are right, I will add all details in the description @boubaker

margondicco commented 2 months ago

Hello, after discussions and in order to deliver a smaller scope, we made the following choices:

The following requirement are moved in another MIP :

So it will be possible with this MIP to :

In addition, will be delivered:

cc @Julien-Dubois-eXo @srenault-meeds @azayati

srenault-meeds commented 2 months ago

Ok for me

azayati commented 2 months ago

Ready for Review by DAO Members ( Meeds: @srenault-meeds @boubaker)

PRs and ACCs Up and Running (https://mips-ft.meeds.io/)

boubaker commented 2 months ago

Ready for Review by DAO Members ( eXo : @srenault-meeds @boubaker)

PRs and ACCs Up and Running (https://mips-ft.meeds.io/)

We will wait the Functional validation next week due to unavailability.

srenault-meeds commented 1 month ago

hello @Julien-Dubois-eXo

I have only one question regarding news drafts, as I understand, we have access to news drafts with this MIP but it seems to not work, the page is empty (with redactor access or not)

cc @azayati @margondicco

azayati commented 1 month ago

hello @Julien-Dubois-eXo

I have only one question regarding news drafts, as I understand, we have access to news drafts with this MIP but it seems to not work, the page is empty (with redactor access or not)

cc @azayati @margondicco

@srenault-meeds it is an isolated case of editing an existing article, the corresponding draft wiki page is not stored in the WIKI-DRAFT_PAGES table but stored in SOC_METADATA_ITEMS table which causes the problem. I have tested again the edition of an existing article without any problem. I need the exact scenario to reproduce that.

srenault-meeds commented 1 month ago

I don't reproduce it anymore sorry... so let's go

azayati commented 1 month ago

I don't reproduce it anymore sorry... so let's go

@srenault-meeds we have found the case, edit of an existing article then edit post/publishing of the same article. We will fix that before merging

srenault-meeds commented 1 month ago

Ok thanks. At least, I have not dreamt about it :D

azayati commented 1 month ago

Ok thanks. At least, I have not dreamt about it :D

@srenault-meeds it is fixed, you can validate. @boubaker can you approve PRs ?

boubaker commented 1 month ago

Ok thanks. At least, I have not dreamt about it :D

@srenault-meeds it is fixe, you can validate. @boubaker can you approve PRs ?

Since we changed the MIP process delivery, no need anymore for PRs approval. If you get a Go from @srenault-meeds, it's ok for me to merge as well.

srenault-meeds commented 1 month ago

Ok LGTM. Thanks