@shizuoka-its/core 0.3.0-rc.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -16
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @shizuoka-its/core
|
|
2
2
|
|
|
3
3
|
ITSで使用する共通のデータベースアクセス層とビジネスロジックを提供するライブラリです。
|
|
4
4
|
|
|
@@ -9,46 +9,47 @@ npm install @shizuoka-its/core
|
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## 使い方
|
|
12
|
+
|
|
12
13
|
```typescript
|
|
13
|
-
import { createClient } from
|
|
14
|
+
import { createClient } from "@shizuoka-its/core";
|
|
14
15
|
|
|
15
16
|
async function example() {
|
|
16
17
|
// クライアントの作成(オプションあり)
|
|
17
18
|
const client = createClient({
|
|
18
19
|
prismaOptions: {
|
|
19
|
-
log: [
|
|
20
|
-
}
|
|
21
|
-
})
|
|
20
|
+
log: ["query", "error"],
|
|
21
|
+
},
|
|
22
|
+
});
|
|
22
23
|
|
|
23
24
|
try {
|
|
24
|
-
const { services } = client
|
|
25
|
+
const { services } = client;
|
|
25
26
|
|
|
26
27
|
// メンバーの作成
|
|
27
28
|
const member = await services.member.create({
|
|
28
29
|
name: "山田太郎",
|
|
29
30
|
studentId: "20240001",
|
|
30
|
-
|
|
31
|
-
email: "yamada@example.com"
|
|
32
|
-
})
|
|
31
|
+
department: "情報工学科",
|
|
32
|
+
email: "yamada@example.com",
|
|
33
|
+
});
|
|
33
34
|
|
|
34
35
|
// Discordアカウントの紐付け
|
|
35
36
|
await services.discordAccount.create({
|
|
36
37
|
id: "discord_user_id", // Discord IDをそのまま使用
|
|
37
38
|
nickName: "Yamada Taro",
|
|
38
|
-
memberId: member.id
|
|
39
|
-
})
|
|
39
|
+
memberId: member.id,
|
|
40
|
+
});
|
|
40
41
|
|
|
41
42
|
// イベントの作成
|
|
42
43
|
const event = await services.event.create({
|
|
43
44
|
name: "プログラミング勉強会",
|
|
44
|
-
date: new Date("2024-12-01")
|
|
45
|
-
})
|
|
45
|
+
date: new Date("2024-12-01"),
|
|
46
|
+
});
|
|
46
47
|
|
|
47
48
|
// イベントへの参加登録
|
|
48
|
-
await services.event.registerMember(event.id, member.id)
|
|
49
|
+
await services.event.registerMember(event.id, member.id);
|
|
49
50
|
} finally {
|
|
50
51
|
// 必ずクリーンアップ
|
|
51
|
-
await client.disconnect()
|
|
52
|
+
await client.disconnect();
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
```
|
|
@@ -56,24 +57,35 @@ async function example() {
|
|
|
56
57
|
## 機能
|
|
57
58
|
|
|
58
59
|
### メンバー管理
|
|
60
|
+
|
|
59
61
|
- メンバーの作成、更新、削除
|
|
60
62
|
- メールアドレスによる検索
|
|
61
63
|
- 学籍番号による検索
|
|
64
|
+
- Discordアカウントの紐づけ
|
|
62
65
|
|
|
63
66
|
### Discordアカウント管理
|
|
67
|
+
|
|
64
68
|
- Discordアカウントの紐付け
|
|
65
69
|
- メンバーごとのDiscordアカウント取得
|
|
66
70
|
|
|
67
71
|
### イベント管理
|
|
72
|
+
|
|
68
73
|
- イベントの作成、更新、削除
|
|
69
74
|
- イベント参加者の管理
|
|
70
75
|
- 今後のイベント一覧取得
|
|
76
|
+
- 展示ごとのイベント一覧取得
|
|
71
77
|
|
|
72
78
|
### 展示管理
|
|
79
|
+
|
|
73
80
|
- 展示の作成、更新、削除
|
|
74
81
|
- イベントごとの展示一覧
|
|
75
82
|
- 展示参加者の管理
|
|
76
83
|
|
|
84
|
+
### ライトニングトーク管理
|
|
85
|
+
|
|
86
|
+
- ライトニングトークの作成、更新、削除
|
|
87
|
+
- イベントごとのライトニングトーク一覧
|
|
88
|
+
|
|
77
89
|
## プロジェクト構成
|
|
78
90
|
|
|
79
91
|
```
|
|
@@ -90,23 +102,28 @@ src/
|
|
|
90
102
|
## 開発セットアップ
|
|
91
103
|
|
|
92
104
|
1. リポジトリのクローン
|
|
105
|
+
|
|
93
106
|
```bash
|
|
94
107
|
git clone https://github.com/su-its/core.git
|
|
95
108
|
cd core
|
|
96
109
|
```
|
|
97
110
|
|
|
98
111
|
2. 依存関係のインストール
|
|
112
|
+
|
|
99
113
|
```bash
|
|
100
114
|
npm install
|
|
101
115
|
```
|
|
102
116
|
|
|
103
117
|
3. 環境変数の設定
|
|
118
|
+
|
|
104
119
|
```bash
|
|
105
120
|
cp .env.example .env
|
|
106
121
|
```
|
|
122
|
+
|
|
107
123
|
`.env`ファイルを編集してデータベース接続情報を設定
|
|
108
124
|
|
|
109
125
|
4. データベースのマイグレーション
|
|
126
|
+
|
|
110
127
|
```bash
|
|
111
128
|
npx prisma migrate dev
|
|
112
129
|
```
|
|
@@ -117,4 +134,6 @@ npx prisma migrate dev
|
|
|
117
134
|
|
|
118
135
|
## コントリビューター
|
|
119
136
|
|
|
120
|
-
- @KinjiKawaguchi
|
|
137
|
+
- @KinjiKawaguchi
|
|
138
|
+
- @KikyoNanakusa
|
|
139
|
+
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DiscordAccount, type Event, type Exhibit, type Member, type MemberEvent, type MemberExhibit, type Prisma,
|
|
1
|
+
import { type DiscordAccount, type Event, type Exhibit, type LightningTalk, type Member, type MemberEvent, type MemberExhibit, type Prisma, PrismaClient } from "@prisma/client";
|
|
2
2
|
export * from "./repositories";
|
|
3
3
|
export * from "./services";
|
|
4
4
|
export type { Member, Event, Exhibit, DiscordAccount, MemberEvent, MemberExhibit, LightningTalk, };
|