@arken/seer-protocol 0.1.0 → 0.1.2
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/.rush/temp/shrinkwrap-deps.json +537 -56
- package/area/area.models.ts +15 -0
- package/area/area.router.ts +74 -0
- package/area/area.schema.ts +22 -0
- package/area/area.types.ts +26 -0
- package/area/index.ts +5 -0
- package/asset/asset.models.ts +59 -0
- package/asset/asset.router.ts +55 -0
- package/asset/asset.schema.ts +27 -0
- package/asset/asset.types.ts +22 -0
- package/asset/index.ts +5 -0
- package/chain/chain.models.ts +50 -0
- package/chain/chain.router.ts +104 -0
- package/chain/chain.schema.ts +52 -0
- package/chain/chain.types.ts +24 -0
- package/chain/index.ts +5 -0
- package/character/character.models.ts +174 -0
- package/character/character.router.ts +314 -0
- package/character/character.schema.ts +147 -0
- package/character/character.types.ts +64 -0
- package/character/index.ts +5 -0
- package/chat/chat.models.ts +43 -0
- package/chat/chat.router.ts +67 -0
- package/chat/chat.schema.ts +36 -0
- package/chat/chat.types.ts +20 -0
- package/chat/index.ts +5 -0
- package/collection/collection.models.ts +76 -0
- package/collection/collection.router.ts +91 -0
- package/collection/collection.schema.ts +90 -0
- package/collection/collection.types.ts +36 -0
- package/collection/index.ts +5 -0
- package/core/core.models.ts +1380 -0
- package/core/core.router.ts +1781 -0
- package/core/core.schema.ts +847 -0
- package/core/core.types.ts +340 -0
- package/core/index.ts +5 -0
- package/{src/modules/evolution → evolution}/evolution.models.ts +1 -1
- package/{src/modules/evolution → evolution}/evolution.router.ts +5 -5
- package/{src/modules/evolution → evolution}/evolution.types.ts +1 -1
- package/game/game.models.ts +53 -0
- package/game/game.router.ts +110 -0
- package/game/game.schema.ts +23 -0
- package/game/game.types.ts +28 -0
- package/game/index.ts +5 -0
- package/index.ts +59 -0
- package/{src/modules/infinite → infinite}/infinite.models.ts +1 -1
- package/{src/modules/infinite → infinite}/infinite.router.ts +5 -5
- package/{src/modules/infinite → infinite}/infinite.types.ts +1 -1
- package/interface/index.ts +5 -0
- package/interface/interface.canonicalize.ts +279 -0
- package/interface/interface.models.ts +40 -0
- package/interface/interface.router.ts +175 -0
- package/interface/interface.schema.ts +59 -0
- package/interface/interface.types.ts +25 -0
- package/{src/modules/isles → isles}/isles.models.ts +1 -1
- package/{src/modules/isles → isles}/isles.router.ts +5 -5
- package/{src/modules/isles → isles}/isles.types.ts +1 -1
- package/item/index.ts +5 -0
- package/item/item.models.ts +124 -0
- package/item/item.router.ts +103 -0
- package/item/item.schema.ts +120 -0
- package/item/item.types.ts +74 -0
- package/job/index.ts +5 -0
- package/job/job.models.ts +14 -0
- package/job/job.router.ts +44 -0
- package/job/job.schema.ts +9 -0
- package/job/job.types.ts +23 -0
- package/market/index.ts +5 -0
- package/market/market.models.ts +113 -0
- package/market/market.router.ts +73 -0
- package/market/market.schema.ts +140 -0
- package/market/market.types.ts +56 -0
- package/{src/modules/oasis → oasis}/oasis.models.ts +1 -1
- package/{src/modules/oasis → oasis}/oasis.router.ts +1 -1
- package/{src/modules/oasis → oasis}/oasis.types.ts +1 -1
- package/package.json +12 -14
- package/product/index.ts +5 -0
- package/product/product.models.ts +166 -0
- package/product/product.router.ts +93 -0
- package/product/product.schema.ts +149 -0
- package/product/product.types.ts +33 -0
- package/profile/index.ts +5 -0
- package/profile/profile.models.ts +214 -0
- package/profile/profile.router.ts +72 -0
- package/profile/profile.schema.ts +156 -0
- package/profile/profile.types.ts +22 -0
- package/raffle/index.ts +5 -0
- package/raffle/raffle.models.ts +44 -0
- package/raffle/raffle.router.ts +90 -0
- package/raffle/raffle.schema.ts +32 -0
- package/raffle/raffle.types.ts +30 -0
- package/{src/router.ts → router.ts} +22 -28
- package/schema.ts +321 -0
- package/skill/index.ts +5 -0
- package/skill/skill.models.ts +16 -0
- package/skill/skill.router.ts +201 -0
- package/skill/skill.schema.ts +40 -0
- package/skill/skill.types.ts +33 -0
- package/{src/modules/trek → trek}/trek.router.ts +1 -1
- package/types.ts +273 -0
- package/video/index.ts +5 -0
- package/video/video.models.ts +25 -0
- package/video/video.router.ts +143 -0
- package/video/video.schema.ts +46 -0
- package/video/video.types.ts +33 -0
- package/src/index.ts +0 -22
- package/src/modules/evolution/evolution.service.ts +0 -2000
- package/src/modules/infinite/infinite.service.ts +0 -40
- package/src/modules/isles/isles.service.ts +0 -40
- package/src/modules/oasis/oasis.service.ts +0 -38
- package/src/modules/trek/trek.service.ts +0 -1031
- package/src/types.ts +0 -106
- /package/{src/modules/evolution → evolution}/evolution.schema.ts +0 -0
- /package/{src/modules/evolution → evolution}/index.ts +0 -0
- /package/{src/modules/infinite → infinite}/index.ts +0 -0
- /package/{src/modules/infinite → infinite}/infinite.schema.ts +0 -0
- /package/{src/modules/isles → isles}/index.ts +0 -0
- /package/{src/modules/isles → isles}/isles.schema.ts +0 -0
- /package/{src/modules/oasis → oasis}/index.ts +0 -0
- /package/{src/modules/oasis → oasis}/oasis.schema.ts +0 -0
- /package/{src/modules/trek → trek}/index.ts +0 -0
- /package/{src/modules/trek → trek}/trek.models.ts +0 -0
- /package/{src/modules/trek → trek}/trek.schema.ts +0 -0
- /package/{src/modules/trek → trek}/trek.types.ts +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as mongo from '../../util/mongo';
|
|
2
|
+
import type * as Types from './chat.types';
|
|
3
|
+
|
|
4
|
+
// ChatGroup
|
|
5
|
+
export const ChatGroup = mongo.createModel<Types.ChatGroupDocument>('ChatGroup', {
|
|
6
|
+
name: { type: String, required: true, maxlength: 100 },
|
|
7
|
+
type: { type: String, required: true, enum: ['group', 'private'] },
|
|
8
|
+
members: [{ type: mongo.Schema.Types.ObjectId, ref: 'Profile' }],
|
|
9
|
+
externalId: { type: String },
|
|
10
|
+
externalPlatform: { type: String, enum: ['Telegram', 'Discord'] },
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// ChatMessage
|
|
14
|
+
export const ChatMessage = mongo.createModel<Types.ChatMessageDocument>(
|
|
15
|
+
'ChatMessage',
|
|
16
|
+
{
|
|
17
|
+
groupId: { type: mongo.Schema.Types.ObjectId, ref: 'ChatGroup', required: true },
|
|
18
|
+
profileId: { type: mongo.Schema.Types.ObjectId, ref: 'Profile', required: true },
|
|
19
|
+
content: { type: String },
|
|
20
|
+
mediaUrl: { type: String },
|
|
21
|
+
replyToId: { type: mongo.Schema.Types.ObjectId, ref: 'ChatMessage' },
|
|
22
|
+
reactions: [
|
|
23
|
+
{
|
|
24
|
+
profileId: { type: mongo.Schema.Types.ObjectId, ref: 'Profile' },
|
|
25
|
+
reaction: { type: String },
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
externalId: { type: String },
|
|
29
|
+
externalPlatform: { type: String, enum: ['Telegram', 'Discord'] },
|
|
30
|
+
isSpam: { type: Boolean, default: false },
|
|
31
|
+
tags: { type: mongo.Schema.Types.Mixed }, // Correctly define as array of Mixed
|
|
32
|
+
summary: { type: String },
|
|
33
|
+
entities: { type: mongo.Schema.Types.Mixed }, // Correctly define as array of Mixed
|
|
34
|
+
type: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: 'text',
|
|
37
|
+
enum: ['text', 'image', 'video', 'audio', 'file', 'system'],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
indexes: [{ groupId: 1, createdDate: 1 }, { profileId: 1 }, { status: 1 }, { replyToId: 1 }, { type: 1 }],
|
|
42
|
+
}
|
|
43
|
+
);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// module/chat.router.ts
|
|
2
|
+
|
|
3
|
+
import { z as zod } from 'zod';
|
|
4
|
+
import { initTRPC, inferRouterInputs, inferRouterOutputs } from '@trpc/server';
|
|
5
|
+
import { customErrorFormatter, hasRole } from '../../util/rpc';
|
|
6
|
+
import type { RouterContext } from '../../types';
|
|
7
|
+
import { ChatGroup, ChatMessage } from './chat.schema';
|
|
8
|
+
|
|
9
|
+
export const z = zod;
|
|
10
|
+
export const t = initTRPC.context<RouterContext>().create();
|
|
11
|
+
export const router = t.router;
|
|
12
|
+
export const procedure = t.procedure;
|
|
13
|
+
|
|
14
|
+
export const createRouter = () =>
|
|
15
|
+
router({
|
|
16
|
+
getChatGroup: procedure
|
|
17
|
+
.use(hasRole('guest', t))
|
|
18
|
+
.use(customErrorFormatter(t))
|
|
19
|
+
.input(z.object({ chatGroupId: z.string() }))
|
|
20
|
+
.query(({ input, ctx }) => (ctx.app.service.Chat.getChatGroup as any)(input, ctx)),
|
|
21
|
+
|
|
22
|
+
getChatGroups: procedure
|
|
23
|
+
.use(hasRole('guest', t))
|
|
24
|
+
.use(customErrorFormatter(t))
|
|
25
|
+
.input(z.object({ chatGroupId: z.string() }))
|
|
26
|
+
.query(({ input, ctx }) => (ctx.app.service.Chat.getChatGroup as any)(input, ctx)),
|
|
27
|
+
|
|
28
|
+
createChatGroup: procedure
|
|
29
|
+
.use(hasRole('admin', t))
|
|
30
|
+
.use(customErrorFormatter(t))
|
|
31
|
+
.input(ChatGroup)
|
|
32
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Chat.createChatGroup as any)(input, ctx)),
|
|
33
|
+
|
|
34
|
+
updateChatGroup: procedure
|
|
35
|
+
.use(hasRole('admin', t))
|
|
36
|
+
.use(customErrorFormatter(t))
|
|
37
|
+
.input(z.object({ chatGroupId: z.string(), data: ChatGroup.partial() }))
|
|
38
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Chat.updateChatGroup as any)(input, ctx)),
|
|
39
|
+
|
|
40
|
+
getChatMessage: procedure
|
|
41
|
+
.use(hasRole('guest', t))
|
|
42
|
+
.use(customErrorFormatter(t))
|
|
43
|
+
.input(z.object({ chatMessageId: z.string() }))
|
|
44
|
+
.query(({ input, ctx }) => (ctx.app.service.Chat.getChatMessage as any)(input, ctx)),
|
|
45
|
+
|
|
46
|
+
getChatMessages: procedure
|
|
47
|
+
.use(hasRole('guest', t))
|
|
48
|
+
.use(customErrorFormatter(t))
|
|
49
|
+
.input(z.object({ chatMessageId: z.string() }))
|
|
50
|
+
.query(({ input, ctx }) => (ctx.app.service.Chat.getChatMessage as any)(input, ctx)),
|
|
51
|
+
|
|
52
|
+
createChatMessage: procedure
|
|
53
|
+
.use(hasRole('admin', t))
|
|
54
|
+
.use(customErrorFormatter(t))
|
|
55
|
+
.input(ChatMessage)
|
|
56
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Chat.createChatMessage as any)(input, ctx)),
|
|
57
|
+
|
|
58
|
+
updateChatMessage: procedure
|
|
59
|
+
.use(hasRole('admin', t))
|
|
60
|
+
.use(customErrorFormatter(t))
|
|
61
|
+
.input(z.object({ chatMessageId: z.string(), data: ChatMessage.partial() }))
|
|
62
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Chat.updateChatMessage as any)(input, ctx)),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export type Router = ReturnType<typeof createRouter>;
|
|
66
|
+
export type RouterInput = inferRouterInputs<Router>;
|
|
67
|
+
export type RouterOutput = inferRouterOutputs<Router>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z, ObjectId, Entity } from '../../schema';
|
|
2
|
+
|
|
3
|
+
export const ChatGroup = Entity.merge(
|
|
4
|
+
z.object({
|
|
5
|
+
name: z.string().max(100).min(1),
|
|
6
|
+
type: z.enum(['group', 'private']),
|
|
7
|
+
members: z.array(ObjectId),
|
|
8
|
+
externalId: z.string().optional(),
|
|
9
|
+
externalPlatform: z.enum(['Telegram', 'Discord']).optional(),
|
|
10
|
+
})
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const ChatMessage = Entity.merge(
|
|
14
|
+
z.object({
|
|
15
|
+
groupId: ObjectId,
|
|
16
|
+
profileId: ObjectId,
|
|
17
|
+
content: z.string().optional(),
|
|
18
|
+
mediaUrl: z.string().optional(),
|
|
19
|
+
replyToId: ObjectId.optional(),
|
|
20
|
+
reactions: z
|
|
21
|
+
.array(
|
|
22
|
+
z.object({
|
|
23
|
+
profileId: ObjectId,
|
|
24
|
+
reaction: z.string(),
|
|
25
|
+
})
|
|
26
|
+
)
|
|
27
|
+
.optional(),
|
|
28
|
+
externalId: z.string().optional(),
|
|
29
|
+
externalPlatform: z.enum(['Telegram', 'Discord']).optional(),
|
|
30
|
+
isSpam: z.boolean().default(false),
|
|
31
|
+
tags: z.array(z.unknown()).default([]),
|
|
32
|
+
summary: z.string().optional(),
|
|
33
|
+
entities: z.array(z.unknown()).default([]),
|
|
34
|
+
type: z.enum(['text', 'image', 'video', 'audio', 'file', 'system']).default('text'),
|
|
35
|
+
})
|
|
36
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// module/chat.types.ts
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import * as schema from './chat.schema';
|
|
5
|
+
import { Document, Model } from '../../util/mongo';
|
|
6
|
+
|
|
7
|
+
export type * from './chat.router';
|
|
8
|
+
export type * from './chat.service';
|
|
9
|
+
export type { RouterContext } from '../../types';
|
|
10
|
+
|
|
11
|
+
export type ChatGroup = z.infer<typeof schema.ChatGroup>;
|
|
12
|
+
export type ChatGroupDocument = ChatGroup & Document;
|
|
13
|
+
|
|
14
|
+
export type ChatMessage = z.infer<typeof schema.ChatMessage>;
|
|
15
|
+
export type ChatMessageDocument = ChatMessage & Document;
|
|
16
|
+
|
|
17
|
+
export type Mappings = {
|
|
18
|
+
ChatGroup: Model<ChatGroupDocument>;
|
|
19
|
+
ChatMessage: Model<ChatMessageDocument>;
|
|
20
|
+
};
|
package/chat/index.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import * as mongo from '../../util/mongo';
|
|
2
|
+
import type * as Types from './collection.types';
|
|
3
|
+
|
|
4
|
+
export const CollectibleCollection = mongo.createModel<Types.CollectibleCollectionDocument>('CollectibleCollection', {
|
|
5
|
+
hype: { type: Number, default: 0 },
|
|
6
|
+
value: { type: Number, default: 0 },
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const CollectibleCardBox = mongo.createModel<Types.CollectibleCardBoxDocument>('CollectibleCardBox', {
|
|
10
|
+
collectibleCollectionId: { type: mongo.Schema.Types.ObjectId, ref: 'CollectibleCollection', required: true },
|
|
11
|
+
franchise: { type: String, required: true, trim: true },
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const CollectibleCardPack = mongo.createModel<Types.CollectibleCardPackDocument>('CollectibleCardPack', {
|
|
15
|
+
collectibleCollectionId: { type: mongo.Schema.Types.ObjectId, ref: 'CollectibleCollection', required: true },
|
|
16
|
+
franchise: { type: String, required: true, trim: true },
|
|
17
|
+
ungraded: { type: Number, default: 0 },
|
|
18
|
+
grade10: { type: Number, default: 0 },
|
|
19
|
+
grade9: { type: Number, default: 0 },
|
|
20
|
+
grade8: { type: Number, default: 0 },
|
|
21
|
+
grade7: { type: Number, default: 0 },
|
|
22
|
+
grade6: { type: Number, default: 0 },
|
|
23
|
+
grade5: { type: Number, default: 0 },
|
|
24
|
+
grade4: { type: Number, default: 0 },
|
|
25
|
+
grade3: { type: Number, default: 0 },
|
|
26
|
+
grade2: { type: Number, default: 0 },
|
|
27
|
+
grade1: { type: Number, default: 0 },
|
|
28
|
+
additional: { type: String, trim: true },
|
|
29
|
+
code: { type: String, trim: true },
|
|
30
|
+
hype: { type: Number, default: 0 },
|
|
31
|
+
series: { type: String, trim: true },
|
|
32
|
+
category: { type: String, trim: true },
|
|
33
|
+
year: { type: Number },
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const CollectibleCard = mongo.createModel<Types.CollectibleCardDocument>('CollectibleCard', {
|
|
37
|
+
collectibleCollectionId: { type: mongo.Schema.Types.ObjectId, ref: 'CollectibleCollection', required: true },
|
|
38
|
+
franchise: { type: String, required: true, trim: true },
|
|
39
|
+
ungraded: { type: Number, default: 0 },
|
|
40
|
+
grade10: { type: Number, default: 0 },
|
|
41
|
+
grade9: { type: Number, default: 0 },
|
|
42
|
+
grade8: { type: Number, default: 0 },
|
|
43
|
+
grade7: { type: Number, default: 0 },
|
|
44
|
+
grade6: { type: Number, default: 0 },
|
|
45
|
+
grade5: { type: Number, default: 0 },
|
|
46
|
+
grade4: { type: Number, default: 0 },
|
|
47
|
+
grade3: { type: Number, default: 0 },
|
|
48
|
+
grade2: { type: Number, default: 0 },
|
|
49
|
+
grade1: { type: Number, default: 0 },
|
|
50
|
+
additional: { type: String, trim: true },
|
|
51
|
+
code: { type: String, trim: true },
|
|
52
|
+
hype: { type: Number, default: 0 },
|
|
53
|
+
series: { type: String, trim: true },
|
|
54
|
+
category: { type: String, trim: true },
|
|
55
|
+
year: { type: Number },
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export const Set = mongo.createModel<Types.SetDocument>('Set', {
|
|
59
|
+
seriesId: { type: mongo.Schema.Types.ObjectId, ref: 'Series', required: true },
|
|
60
|
+
name: { type: String, required: true, trim: true },
|
|
61
|
+
language: { type: String, required: true, trim: true },
|
|
62
|
+
live: { type: Boolean, default: false },
|
|
63
|
+
releaseDate: { type: String, required: true, trim: true },
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export const Card = mongo.createModel<Types.CardDocument>('Card', {
|
|
67
|
+
setId: { type: mongo.Schema.Types.ObjectId, ref: 'Set', required: true },
|
|
68
|
+
name: { type: String, required: true, trim: true },
|
|
69
|
+
language: { type: String, required: true, trim: true },
|
|
70
|
+
releaseDate: { type: String, required: true, trim: true },
|
|
71
|
+
cardId: { type: Number, required: true },
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export const Series = mongo.createModel<Types.SeriesDocument>('Series', {
|
|
75
|
+
name: { type: String, required: true, trim: true },
|
|
76
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// module/collection.router.ts
|
|
2
|
+
|
|
3
|
+
import { z as zod } from 'zod';
|
|
4
|
+
import { initTRPC, inferRouterInputs, inferRouterOutputs } from '@trpc/server';
|
|
5
|
+
import { customErrorFormatter, hasRole } from '../../util/rpc';
|
|
6
|
+
import type { RouterContext } from '../../types';
|
|
7
|
+
import { CollectibleCollection, CollectibleCardBox, CollectibleCardPack, CollectibleCard } from './collection.schema';
|
|
8
|
+
|
|
9
|
+
export const z = zod;
|
|
10
|
+
export const t = initTRPC.context<RouterContext>().create();
|
|
11
|
+
export const router = t.router;
|
|
12
|
+
export const procedure = t.procedure;
|
|
13
|
+
|
|
14
|
+
export const createRouter = () =>
|
|
15
|
+
router({
|
|
16
|
+
getCollectibleCollection: procedure
|
|
17
|
+
.use(hasRole('guest', t))
|
|
18
|
+
.use(customErrorFormatter(t))
|
|
19
|
+
.input(z.object({ collectibleCollectionId: z.string() }))
|
|
20
|
+
.query(({ input, ctx }) => (ctx.app.service.Collection.getCollectibleCollection as any)(input, ctx)),
|
|
21
|
+
|
|
22
|
+
createCollectibleCollection: procedure
|
|
23
|
+
.use(hasRole('admin', t))
|
|
24
|
+
.use(customErrorFormatter(t))
|
|
25
|
+
.input(CollectibleCollection)
|
|
26
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Collection.createCollectibleCollection as any)(input, ctx)),
|
|
27
|
+
|
|
28
|
+
updateCollectibleCollection: procedure
|
|
29
|
+
.use(hasRole('admin', t))
|
|
30
|
+
.use(customErrorFormatter(t))
|
|
31
|
+
.input(z.object({ collectibleCollectionId: z.string(), data: CollectibleCollection.partial() }))
|
|
32
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Collection.updateCollectibleCollection as any)(input, ctx)),
|
|
33
|
+
|
|
34
|
+
getCollectibleCardBox: procedure
|
|
35
|
+
.use(hasRole('guest', t))
|
|
36
|
+
.use(customErrorFormatter(t))
|
|
37
|
+
.input(z.object({ collectibleCardBoxId: z.string() }))
|
|
38
|
+
.query(({ input, ctx }) => (ctx.app.service.Collection.getCollectibleCardBox as any)(input, ctx)),
|
|
39
|
+
|
|
40
|
+
createCollectibleCardBox: procedure
|
|
41
|
+
.use(hasRole('admin', t))
|
|
42
|
+
.use(customErrorFormatter(t))
|
|
43
|
+
.input(CollectibleCardBox)
|
|
44
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Collection.createCollectibleCardBox as any)(input, ctx)),
|
|
45
|
+
|
|
46
|
+
updateCollectibleCardBox: procedure
|
|
47
|
+
.use(hasRole('admin', t))
|
|
48
|
+
.use(customErrorFormatter(t))
|
|
49
|
+
.input(z.object({ collectibleCardBoxId: z.string(), data: CollectibleCardBox.partial() }))
|
|
50
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Collection.updateCollectibleCardBox as any)(input, ctx)),
|
|
51
|
+
|
|
52
|
+
getCollectibleCardPack: procedure
|
|
53
|
+
.use(hasRole('guest', t))
|
|
54
|
+
.use(customErrorFormatter(t))
|
|
55
|
+
.input(z.object({ collectibleCardPackId: z.string() }))
|
|
56
|
+
.query(({ input, ctx }) => (ctx.app.service.Collection.getCollectibleCardPack as any)(input, ctx)),
|
|
57
|
+
|
|
58
|
+
createCollectibleCardPack: procedure
|
|
59
|
+
.use(hasRole('admin', t))
|
|
60
|
+
.use(customErrorFormatter(t))
|
|
61
|
+
.input(CollectibleCardPack)
|
|
62
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Collection.createCollectibleCardPack as any)(input, ctx)),
|
|
63
|
+
|
|
64
|
+
updateCollectibleCardPack: procedure
|
|
65
|
+
.use(hasRole('admin', t))
|
|
66
|
+
.use(customErrorFormatter(t))
|
|
67
|
+
.input(z.object({ collectibleCardPackId: z.string(), data: CollectibleCardPack.partial() }))
|
|
68
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Collection.updateCollectibleCardPack as any)(input, ctx)),
|
|
69
|
+
|
|
70
|
+
getCollectibleCard: procedure
|
|
71
|
+
.use(hasRole('guest', t))
|
|
72
|
+
.use(customErrorFormatter(t))
|
|
73
|
+
.input(z.object({ collectibleCardId: z.string() }))
|
|
74
|
+
.query(({ input, ctx }) => (ctx.app.service.Collection.getCollectibleCard as any)(input, ctx)),
|
|
75
|
+
|
|
76
|
+
createCollectibleCard: procedure
|
|
77
|
+
.use(hasRole('admin', t))
|
|
78
|
+
.use(customErrorFormatter(t))
|
|
79
|
+
.input(CollectibleCard)
|
|
80
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Collection.createCollectibleCard as any)(input, ctx)),
|
|
81
|
+
|
|
82
|
+
updateCollectibleCard: procedure
|
|
83
|
+
.use(hasRole('admin', t))
|
|
84
|
+
.use(customErrorFormatter(t))
|
|
85
|
+
.input(z.object({ collectibleCardId: z.string(), data: CollectibleCard.partial() }))
|
|
86
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Collection.updateCollectibleCard as any)(input, ctx)),
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export type Router = ReturnType<typeof createRouter>;
|
|
90
|
+
export type RouterInput = inferRouterInputs<Router>;
|
|
91
|
+
export type RouterOutput = inferRouterOutputs<Router>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { z, ObjectId, Entity } from '../../schema';
|
|
2
|
+
|
|
3
|
+
export const CollectibleCollection = Entity.merge(
|
|
4
|
+
z.object({
|
|
5
|
+
hype: z.number().optional(),
|
|
6
|
+
value: z.number().optional(),
|
|
7
|
+
})
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
export const CollectibleCardBox = Entity.merge(
|
|
11
|
+
z.object({
|
|
12
|
+
collectibleCollectionId: ObjectId,
|
|
13
|
+
franchise: z.string().min(1),
|
|
14
|
+
})
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const CollectibleCardPack = Entity.merge(
|
|
18
|
+
z.object({
|
|
19
|
+
collectibleCollectionId: ObjectId,
|
|
20
|
+
franchise: z.string().min(1),
|
|
21
|
+
ungraded: z.number().optional(),
|
|
22
|
+
grade10: z.number().optional(),
|
|
23
|
+
grade9: z.number().optional(),
|
|
24
|
+
grade8: z.number().optional(),
|
|
25
|
+
grade7: z.number().optional(),
|
|
26
|
+
grade6: z.number().optional(),
|
|
27
|
+
grade5: z.number().optional(),
|
|
28
|
+
grade4: z.number().optional(),
|
|
29
|
+
grade3: z.number().optional(),
|
|
30
|
+
grade2: z.number().optional(),
|
|
31
|
+
grade1: z.number().optional(),
|
|
32
|
+
additional: z.string().optional(),
|
|
33
|
+
code: z.string().optional(),
|
|
34
|
+
hype: z.number().optional(),
|
|
35
|
+
series: z.string().optional(),
|
|
36
|
+
category: z.string().optional(),
|
|
37
|
+
year: z.number().optional(),
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export const CollectibleCard = Entity.merge(
|
|
42
|
+
z.object({
|
|
43
|
+
collectibleCollectionId: ObjectId,
|
|
44
|
+
franchise: z.string().min(1),
|
|
45
|
+
ungraded: z.number().optional(),
|
|
46
|
+
grade10: z.number().optional(),
|
|
47
|
+
grade9: z.number().optional(),
|
|
48
|
+
grade8: z.number().optional(),
|
|
49
|
+
grade7: z.number().optional(),
|
|
50
|
+
grade6: z.number().optional(),
|
|
51
|
+
grade5: z.number().optional(),
|
|
52
|
+
grade4: z.number().optional(),
|
|
53
|
+
grade3: z.number().optional(),
|
|
54
|
+
grade2: z.number().optional(),
|
|
55
|
+
grade1: z.number().optional(),
|
|
56
|
+
additional: z.string().optional(),
|
|
57
|
+
code: z.string().optional(),
|
|
58
|
+
hype: z.number().optional(),
|
|
59
|
+
series: z.string().optional(),
|
|
60
|
+
category: z.string().optional(),
|
|
61
|
+
year: z.number().optional(),
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
export const Card = Entity.merge(
|
|
66
|
+
z.object({
|
|
67
|
+
setId: ObjectId,
|
|
68
|
+
name: z.string(),
|
|
69
|
+
language: z.string(),
|
|
70
|
+
releaseDate: z.string(),
|
|
71
|
+
cardId: z.number(),
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
export const Set = Entity.merge(
|
|
76
|
+
z.object({
|
|
77
|
+
seriesId: ObjectId,
|
|
78
|
+
name: z.string(),
|
|
79
|
+
language: z.string(),
|
|
80
|
+
live: z.boolean(),
|
|
81
|
+
releaseDate: z.string(),
|
|
82
|
+
cards: z.array(Card).optional(),
|
|
83
|
+
})
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
export const Series = Entity.merge(
|
|
87
|
+
z.object({
|
|
88
|
+
name: z.string(),
|
|
89
|
+
})
|
|
90
|
+
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// module/collection.types.ts
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import * as schema from './collection.schema';
|
|
5
|
+
import { Document, Model } from '../../util/mongo';
|
|
6
|
+
import exp from 'constants';
|
|
7
|
+
|
|
8
|
+
export type * from './collection.router';
|
|
9
|
+
export type * from './collection.service';
|
|
10
|
+
export type { RouterContext } from '../../types';
|
|
11
|
+
|
|
12
|
+
export type CollectibleCollection = z.infer<typeof schema.CollectibleCollection>;
|
|
13
|
+
export type CollectibleCardBox = z.infer<typeof schema.CollectibleCardBox>;
|
|
14
|
+
export type CollectibleCardPack = z.infer<typeof schema.CollectibleCardPack>;
|
|
15
|
+
export type CollectibleCard = z.infer<typeof schema.CollectibleCard>;
|
|
16
|
+
export type Card = z.infer<typeof schema.Card>;
|
|
17
|
+
export type Set = z.infer<typeof schema.Set>;
|
|
18
|
+
export type Series = z.infer<typeof schema.Series>;
|
|
19
|
+
|
|
20
|
+
export type CollectibleCollectionDocument = CollectibleCollection & Document;
|
|
21
|
+
export type CollectibleCardBoxDocument = CollectibleCardBox & Document;
|
|
22
|
+
export type CollectibleCardPackDocument = CollectibleCardPack & Document;
|
|
23
|
+
export type CollectibleCardDocument = CollectibleCard & Document;
|
|
24
|
+
export type CardDocument = Card & Document;
|
|
25
|
+
export type SetDocument = Set & Document;
|
|
26
|
+
export type SeriesDocument = Series & Document;
|
|
27
|
+
|
|
28
|
+
export type Mappings = {
|
|
29
|
+
CollectibleCollection: Model<CollectibleCollectionDocument>;
|
|
30
|
+
CollectibleCardBox: Model<CollectibleCardBoxDocument>;
|
|
31
|
+
CollectibleCardPack: Model<CollectibleCardPackDocument>;
|
|
32
|
+
CollectibleCard: Model<CollectibleCardDocument>;
|
|
33
|
+
Card: Model<CardDocument>;
|
|
34
|
+
Set: Model<SetDocument>;
|
|
35
|
+
Series: Model<SeriesDocument>;
|
|
36
|
+
};
|