1

私はB2B取引アプリケーションを開発しています。これには、さまざまな製品のバイヤーとサプライヤーがいます。

検証、売買の強さ、+ veフィードバックなどに応じて、管理パネルを介してバイヤーとサプライヤーにバッジを割り当てるために使用される「バッジ割り当てモジュール」を開発しようとしています。ユーザーは1つ以上のバッジを獲得できます。

割り当てられたバッジには有効期限が必要です。データベース設計を手伝ってください-必要なテーブルと列は何ですか?

同じロジックを実装しているオープンソース/スターターキットアプリケーションがasp.netにあるかどうかを提案してください。

4

1 に答える 1

0

1つは、買い手と売り手が同じテーブルに存在する必要があり、テーブルの継承を使用してそれらをモデル化する必要があります。

バイヤーには多くのバッジが割り当てられています。

バッジにも多くのバッジ割り当てがあります。

したがって、それは多対多の関係です。

パーティーはバッジを取得し、有効期限が切れてから、後で同じバッジを再度取得できますか?

スキーマは次のようになります。

create table party_type(
  id smallint primary key,
  description text not null
);

insert into party_type values (1, 'Buyer'), (2, 'Seller');    

create table party(
  id bigint identity primary key,
  type smallint not null references party_type (id),
  name text not null
);


create table badge(
  id bigint identity primary key,
  name text not null
);


create table party_badge(
  party_id bigint not null references party (id),
  badge_id bigint not null references badge (id),
  from_date datetime not null default current_timestamp,
  to_date datetime null default null,

  check (to_date > from_date),

  primary key (party_id, badge_id, from_date)
);
于 2012-10-13T00:26:31.127 に答える