wechaty / friday

Friday is an Assistant BOT Built on Wechaty for Serving our Community
http://friday.chatie.io:5200
Apache License 2.0
83 stars 20 forks source link

NextJS-ify Friday BOT #112

Closed huan closed 2 years ago

huan commented 2 years ago

Refactoring: enable CQRS

Link to:

huan commented 2 years ago

@lhr0909 I have updated more files, please feel free to comment if you have any suggestions.

Thank you very much!

lhr0909 commented 2 years ago

Most of it looks good. The main issue I see right now is the use of aggregate root. Aggregate roots are mainly for maintaining a retrievable state from the event stream (think xstate context). So we generally don’t fire any external logic in the aggregate roots. The better place to do so is via the Event Handlers.

huan commented 2 years ago

Now I'm working on the latest two domain projects:

  1. Update https://chatie.statuspage.io/ with CommunityDevelopersCount, MessagesReceivedCount, and MessagesSentCount. This should be a domain and it's a great practice for building this domain model
  2. Cross-post the messages between WeChat, QQ, WhatsApp, and Gitter channels. This should be a domain too, and by designing this model, it can help the Wechaty design to start thinking in a CQRS way.

Please stay tuned.

huan commented 2 years ago

Can pass the basic linting and unit tests almost finished except for some unknown annoying bugs...

huan commented 2 years ago

@lhr0909 This PR has been almost finished with lots of refactoring since your last review.

It will be greatly appreciated if you can take a look at the latest version of the code, and any comments/suggestions are welcome!

CC @windmemory @atorber