Skip to content

Refactor AppModels Nov 30, 2024 #4

@Arlodotexe

Description

@Arlodotexe

Background

See #2 for background.

Problem

The AppModels must be updated according to the refined API spec.

Solution

We've split this analysis into two sections: Lists and properties. Each section lists what's extra and what's missing for each of the three types.


Lists:

Current setup

Publisher

  • Projects
  • Users
  • ParentPublishers
  • ChildPublishers

Project

  • Collaborators
  • Dependencies
  • Connections
  • Features
  • Links
  • Images

User

  • Connections
  • Projects
  • Publishers
  • Links

Changes to make:

[What's extra]:

Publisher doesn't need:

  • Users
  • Projects

Project doesn't need:

  • [n/a]

User doesn't need:

  • Projects
[What's missing]:

Publisher is missing:

  • Users + Roles
  • Connections
  • Links

Project is missing:

  • [n/a]

User is missing:

  • Projects + Roles
  • Publisher + Roles

Properties:

Current setup

Publisher

  • Owner
  • Name
  • Description
  • Icon
  • AccentColor
  • ContactEmail
  • IsUnlisted

Project

  • Publisher
  • Name
  • Description
  • Icon
  • HeroImage
  • AccentColor
  • Category
  • CreatedAt
  • ForgetMe
  • IsUnlisted

User

  • Name
  • MarkdownAboutMe
  • Icon
  • ForgetMe

Changes to make:

[What's extra]:

Publisher doesn't need:

  • Owner
  • ContactEmail
  • Icon

Project doesn't need:

  • HeroImage
  • CreatedAt
  • Icon

User doesn't need:

  • MarkdownAboutMe
  • Icon
[What's missing]:

Publisher is missing:

  • ExtendedDescription
  • ForgetMe

Project is missing:

  • ExtendedDescription

User is missing:

  • ExtendedDescription

In addition to property and collection updates, several other changes should be made to the AppModel interfaces while we're in here refactoring things:

  • Any mention of IsPrivate should be updated to IsUnlisted, including comments.
  • Identify common properties and collections, then create common interfaces to ensure consistency. Ensure code comments match the generic nature of the common interfaces.
  • All usages of CID should be removed and substituted with either an appropriate AppModel interface or a primitive value.
  • Ensure that the:
    • Read-only AppModel interfaces have:
      • For properties:
        • Task<TGoesHere> Get* for getting values.
      • For collections:
        • IAsyncEnumerable<TGoesHere> for enumerating values.
        • EventHandler<TGoesHere[]> *Added; and EventHandler<TGoesHere[]> *Removed for tracking changes.
    • Modifiable AppModel interfaces have:
      • Derived their read-only counterparts.
      • For properties:
        • Update* methods for setting values.
      • For collections:
        • Task Add*Async(TGoesHere, ...) plus Task Remove*Async(TGoesHere, ...) methods for updating values (lists)
      • For Dictionaries (Connections only):
        • Treat as an enumerable collection of properties, e.g. KeyValuePair<string, TGoesHere> but just IConnection instead.
        • Needs a common sdk-supplied interface to implement and cast down on the consumer's side. Connections use Kvp<string, DagCid> in the model, but the AppModel cannot expose a Cid and needs an implementable IConnection interface instead.
  • Ensure code comment are present and appropriate on public members.
  • For any added or removed properties or methods, ensure the corresponding events are also added or removed.
  • Ensure cancellation tokens are present and required.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions