Closed ethan-stone closed 1 year ago
as you mentioned on the pr not entirely sure when there would be multiple inquire accounts wanting to connect into one telegram account. The only thing I can maybe think of is that down the road someone has a personal account linked to their telegram but then also want a business account or something.
Makes sense to me. I will add a check that when someone tries to connect with an account that if there is already a user attached to that connect an error is thrown
The following would be some necessary consequences if we do allow this.
In the
Connection
table, the unique constraint would now have to be that a combination ofconnectionType
,connectionUserId
, anduserId
would have to be unique. This means thebot
can no longer create connections either since it has no knowledge of theuserId
. It would have to be done viaweb
.This means that the relationship between the
Inquiry
table and theConnection
table is now option. Since inquiries would be made with aconnectionType
andconnectionUserId
that may not exist yet.Lastly the validation logic for creating an inquiry would of course change. Getting the total number of inquiries for the connection is still easy, just search inquiries by
connectionType
andconnectionUserId
. But, checking for a valid subscription when the connection has reached the free tier would be different. We would need to get all connections that have thatconnectionType
andconnectionUserId
since there can now be multiple, and make sure at least one of the users for a connection has a valid billing status.