@shizuoka-its/core 0.3.2-alpha.0 → 0.3.2-alpha.1

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.
@@ -3,6 +3,14 @@ import type { IBaseRepository } from "./base.repository.interface";
3
3
  type DefaultInclude = {
4
4
  exhibit: true;
5
5
  };
6
+ type AllInclude = {
7
+ exhibit: {
8
+ include: {
9
+ event: true;
10
+ members: true;
11
+ };
12
+ };
13
+ };
6
14
  export interface ILightningTalkRepository extends IBaseRepository<Prisma.LightningTalkGetPayload<{
7
15
  include: DefaultInclude;
8
16
  }>, Prisma.LightningTalkCreateInput, Prisma.LightningTalkUpdateInput, Prisma.LightningTalkFindManyArgs> {
@@ -16,10 +24,10 @@ export interface ILightningTalkRepository extends IBaseRepository<Prisma.Lightni
16
24
  include: DefaultInclude;
17
25
  }>>;
18
26
  findById<T extends Prisma.LightningTalkInclude>(id: string, include?: T): Promise<Prisma.LightningTalkGetPayload<{
19
- include: DefaultInclude;
27
+ include: AllInclude;
20
28
  }> | null>;
21
29
  findByEventId<T extends Prisma.LightningTalkInclude>(eventId: string, include?: T): Promise<Prisma.LightningTalkGetPayload<{
22
- include: DefaultInclude;
30
+ include: AllInclude;
23
31
  }>[]>;
24
32
  findMany(args?: Omit<Prisma.LightningTalkFindManyArgs, "include">): Promise<Prisma.LightningTalkGetPayload<{
25
33
  include: DefaultInclude;
@@ -4,6 +4,14 @@ import type { ILightningTalkRepository } from "./interfaces/lightningTalk.reposi
4
4
  type DefaultInclude = {
5
5
  exhibit: true;
6
6
  };
7
+ type AllInclude = {
8
+ exhibit: {
9
+ include: {
10
+ event: true;
11
+ members: true;
12
+ };
13
+ };
14
+ };
7
15
  export declare class LightningTalkRepository extends BaseRepository<Prisma.LightningTalkGetPayload<{
8
16
  include: DefaultInclude;
9
17
  }>, Prisma.LightningTalkCreateInput, Prisma.LightningTalkUpdateInput, Prisma.LightningTalkFindManyArgs> implements ILightningTalkRepository {
@@ -18,10 +26,10 @@ export declare class LightningTalkRepository extends BaseRepository<Prisma.Light
18
26
  include: DefaultInclude;
19
27
  }>>;
20
28
  findById(id: string, include?: Prisma.LightningTalkInclude): Promise<Prisma.LightningTalkGetPayload<{
21
- include: DefaultInclude;
29
+ include: AllInclude;
22
30
  }> | null>;
23
31
  findByEventId(eventId: string, include?: Prisma.LightningTalkInclude): Promise<Prisma.LightningTalkGetPayload<{
24
- include: DefaultInclude;
32
+ include: AllInclude;
25
33
  }>[]>;
26
34
  findMany(args?: Omit<Prisma.LightningTalkFindManyArgs, "include">): Promise<Prisma.LightningTalkGetPayload<{
27
35
  include: DefaultInclude;
@@ -28,7 +28,14 @@ class LightningTalkRepository extends base_repository_1.BaseRepository {
28
28
  async findById(id, include) {
29
29
  return this.prisma.lightningTalk.findUnique({
30
30
  where: { exhibitId: id },
31
- include: { ...include, exhibit: true },
31
+ include: {
32
+ exhibit: {
33
+ include: {
34
+ event: true,
35
+ members: true,
36
+ },
37
+ },
38
+ },
32
39
  });
33
40
  }
34
41
  async findByEventId(eventId, include) {
@@ -38,7 +45,14 @@ class LightningTalkRepository extends base_repository_1.BaseRepository {
38
45
  eventId,
39
46
  },
40
47
  },
41
- include: { ...include, exhibit: true },
48
+ include: {
49
+ exhibit: {
50
+ include: {
51
+ event: true,
52
+ members: true,
53
+ },
54
+ },
55
+ },
42
56
  });
43
57
  }
44
58
  async findMany(args) {
@@ -1,5 +1,22 @@
1
- import type { Exhibit, LightningTalk } from "@prisma/client";
1
+ import type { Prisma } from "@prisma/client";
2
2
  import type { IBaseService } from "./base.service.interface";
3
+ export type DefaultInclude = {
4
+ exhibit: true;
5
+ };
6
+ export type ExhibitInclude = {
7
+ exhibit: {
8
+ include: {
9
+ event: true;
10
+ members: true;
11
+ };
12
+ };
13
+ };
14
+ export type LightningTalkWithExhibit = Prisma.LightningTalkGetPayload<{
15
+ include: DefaultInclude;
16
+ }>;
17
+ export type LightningTalkWithAll = Prisma.LightningTalkGetPayload<{
18
+ include: ExhibitInclude;
19
+ }>;
3
20
  export interface LightningTalkCreateDTO {
4
21
  exhibitId: string;
5
22
  startTime: Date;
@@ -11,26 +28,11 @@ export interface LightningTalkUpdateDTO {
11
28
  duration?: number;
12
29
  slideUrl?: string;
13
30
  }
14
- export interface ILightningTalkService extends IBaseService<LightningTalk & {
15
- exhibit: Exhibit;
16
- }, // 常にexhibitを含む
17
- LightningTalkCreateDTO, LightningTalkUpdateDTO> {
18
- findById(id: string): Promise<(LightningTalk & {
19
- exhibit: Exhibit;
20
- }) | null>;
21
- create(data: LightningTalkCreateDTO): Promise<LightningTalk & {
22
- exhibit: Exhibit;
23
- }>;
24
- update(id: string, data: LightningTalkUpdateDTO): Promise<LightningTalk & {
25
- exhibit: Exhibit;
26
- }>;
27
- delete(id: string): Promise<LightningTalk & {
28
- exhibit: Exhibit;
29
- }>;
30
- findMany(): Promise<(LightningTalk & {
31
- exhibit: Exhibit;
32
- })[]>;
33
- findByEventId(eventId: string): Promise<(LightningTalk & {
34
- exhibit: Exhibit;
35
- })[]>;
31
+ export interface ILightningTalkService extends IBaseService<LightningTalkWithExhibit, LightningTalkCreateDTO, LightningTalkUpdateDTO> {
32
+ findById(id: string): Promise<LightningTalkWithAll | null>;
33
+ create(data: LightningTalkCreateDTO): Promise<LightningTalkWithExhibit>;
34
+ update(id: string, data: LightningTalkUpdateDTO): Promise<LightningTalkWithExhibit>;
35
+ delete(id: string): Promise<LightningTalkWithExhibit>;
36
+ findMany(): Promise<LightningTalkWithExhibit[]>;
37
+ findByEventId(eventId: string): Promise<LightningTalkWithAll[]>;
36
38
  }
@@ -1,29 +1,15 @@
1
- import type { Exhibit, LightningTalk, Prisma } from "@prisma/client";
1
+ import type { Prisma } from "@prisma/client";
2
2
  import type { IExhibitRepository } from "../repositories/interfaces/exhibit.repository.interface";
3
3
  import type { ILightningTalkRepository } from "../repositories/interfaces/lightningTalk.repository.interface";
4
4
  import { BaseService } from "./base.service";
5
- import type { ILightningTalkService, LightningTalkCreateDTO, LightningTalkUpdateDTO } from "./interfaces/lightningTalk.service.interface";
6
- export declare class LightningTalkService extends BaseService<LightningTalk & {
7
- exhibit: Exhibit;
8
- }, LightningTalkCreateDTO, LightningTalkUpdateDTO, Prisma.LightningTalkFindManyArgs, Prisma.LightningTalkCreateInput, Prisma.LightningTalkUpdateInput, ILightningTalkRepository> implements ILightningTalkService {
5
+ import type { ILightningTalkService, LightningTalkCreateDTO, LightningTalkUpdateDTO, LightningTalkWithAll, LightningTalkWithExhibit } from "./interfaces/lightningTalk.service.interface";
6
+ export declare class LightningTalkService extends BaseService<LightningTalkWithExhibit, LightningTalkCreateDTO, LightningTalkUpdateDTO, Prisma.LightningTalkFindManyArgs, Prisma.LightningTalkCreateInput, Prisma.LightningTalkUpdateInput, ILightningTalkRepository> implements ILightningTalkService {
9
7
  private readonly exhibitRepository;
10
8
  constructor(lightningTalkrepository: ILightningTalkRepository, exhibitRepository: IExhibitRepository);
11
- findById(id: string): Promise<(LightningTalk & {
12
- exhibit: Exhibit;
13
- }) | null>;
14
- create(data: LightningTalkCreateDTO): Promise<LightningTalk & {
15
- exhibit: Exhibit;
16
- }>;
17
- update(id: string, data: LightningTalkUpdateDTO): Promise<LightningTalk & {
18
- exhibit: Exhibit;
19
- }>;
20
- delete(id: string): Promise<LightningTalk & {
21
- exhibit: Exhibit;
22
- }>;
23
- findMany(): Promise<(LightningTalk & {
24
- exhibit: Exhibit;
25
- })[]>;
26
- findByEventId(eventId: string): Promise<(LightningTalk & {
27
- exhibit: Exhibit;
28
- })[]>;
9
+ findById(id: string): Promise<LightningTalkWithAll | null>;
10
+ create(data: LightningTalkCreateDTO): Promise<LightningTalkWithExhibit>;
11
+ update(id: string, data: LightningTalkUpdateDTO): Promise<LightningTalkWithExhibit>;
12
+ delete(id: string): Promise<LightningTalkWithExhibit>;
13
+ findMany(): Promise<LightningTalkWithExhibit[]>;
14
+ findByEventId(eventId: string): Promise<LightningTalkWithAll[]>;
29
15
  }
@@ -15,12 +15,10 @@ class LightningTalkService extends base_service_1.BaseService {
15
15
  });
16
16
  }
17
17
  async create(data) {
18
- // 展示の存在確認
19
18
  const exhibit = await this.exhibitRepository.findById(data.exhibitId);
20
19
  if (!exhibit) {
21
20
  throw new Error("Exhibit not found");
22
21
  }
23
- // すでにLTとして登録されていないか確認
24
22
  const existingLT = await this.repository.findById(data.exhibitId);
25
23
  if (existingLT) {
26
24
  throw new Error("This exhibit is already registered as a lightning talk");
@@ -33,7 +31,6 @@ class LightningTalkService extends base_service_1.BaseService {
33
31
  });
34
32
  }
35
33
  async update(id, data) {
36
- // LTの存在確認
37
34
  const lightningTalk = await this.repository.findById(id);
38
35
  if (!lightningTalk) {
39
36
  throw new Error("Lightning talk not found");
@@ -45,7 +42,6 @@ class LightningTalkService extends base_service_1.BaseService {
45
42
  });
46
43
  }
47
44
  async delete(id) {
48
- // LTの存在確認
49
45
  const lightningTalk = await this.repository.findById(id);
50
46
  if (!lightningTalk) {
51
47
  throw new Error("Lightning talk not found");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shizuoka-its/core",
3
- "version": "0.3.2-alpha.0",
3
+ "version": "0.3.2-alpha.1",
4
4
  "description": "ITS core library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",