私は次のように始まり、新しいビジネスルールが登場したときに適応します。
まず、クライアントの「ベース」のテーブル、Shopes、ユーザー、およびサービス(行うことができる作業)
CLIENT
ClientId
Name
ContactInformation
SHOP
ShopId
Name
OtherAttribues
USER
UserId
ShopId
Name
Etc
(Note: Assumes a user works in only one shop, otherwise you need a many-to-many
table joining SHOP and USER. See further reminders below.)
SERVICE
ServiceId
Name
FurtherAttributes
(This is the “master list” of all available services that can be done. “ServiceEvent”
is used to record actual work being done.)
次に、複雑な表:
SERVICEEVENT
ServiceEventId
ClientId (who the work was done for)
UserId (who did the work work. Add ShopId if a User can work in multiple shops)
ServiceId (what work was done)
FurtherAttributes (time, cost, etc.)
(This is used to record actual work that was done--or perhaps, is being done?)
APPOINTMENT
AppointmentId
ClientId (who the work will be done for)
UserId (who will be doing the work. Add ShopId if a User can work in multiple shops.)
ServiceId (What work will be done)
ServiceEventId NULLABLE (the ServiceEvent, if any, produced by this Appointment)
Status (indicate pending, cancelled, completed, etc.)
FurtherAppointmentAttributes (when the appointment was made, etc.)
FurtherServiceEventAttributes (optional? data used to populate ServiceEvent, when it comes time to do so)
(Should consider creating a lookup table for "Status".)
「アポイントメント"と" ServiceEvent "は本当に2つの異なるものです。それらは似ていますが、それぞれが他のもの(キャンセルされた予定、ウォークインサービスイベント)なしで存在することができるので、両方ともすべてのキーが必要です。アポイントメントを介して生成されたServiceEventは、アポイントメントからデータを読み込み、それをServiceEventに挿入するルーチンによって作成されます。
これらの間のリンク(外部キー)はいずれのテーブルにもあり得ます。理想的にはすべての予定がServiceEventを生成するので、私はAppointmentに入れますが、その逆は真実ではありません。
サービスとアポイントメントの関係は何ですか?サービスは、1つ、複数の、および/またはゼロのサービスのためにできますか?予約なしでサービスを受けることはできますか? (ウォークインの場合、「ダミー」の予約をしない理由は何ですか?)適格なユーザーがいないためにサービスが実行される可能性のあるウォークインを追跡する必要がありますか? –
サービスにはアポイントメントがある場合とない場合があります。はい、予約なしでサービスを受けることができます。その理由は、私はダミーのアポイントメントをしなくてはならないということです。1.ウォークインのために実際のアポイントメントは起こっていません。2.レポート/メトリクスex。キャンセルされたアポイントメントの割合、3.アポイントメント時間ビジネスルール。しかし、私はまだ、これらの理由がダミーの予定を考慮しないのに十分であると完全には確信していません。完成していないウォークインを追跡することは考えていないが、ある時点で必要になると思う。私の計画は、すべての有資格ユーザーがビジー状態の場合、将来の予定を作成することだった。 – Mandi