forked from PalisadoesFoundation/talawa-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
codegen.ts
112 lines (71 loc) · 3.84 KB
/
codegen.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import type { CodegenConfig } from "@graphql-codegen/cli";
const config: CodegenConfig = {
// Points to our schema and the additional scalar Upload which is added by Apollo-Server at runtime
schema: ["./src/typeDefs/**/*.ts"],
generates: {
"./src/types/generatedGraphQLTypes.ts": {
plugins: ["typescript", "typescript-resolvers"],
config: {
// Generates graphQL enums as typescript union types.
enumsAsTypes: true,
// Makes the info argument passed to the resolver functions optional.
optionalInfoArgument: true,
// Makes the resolver function callable.
makeResolverTypeCallable: true,
// Adds suffix "Model" to the end of generated database model types.
mapperTypeSuffix: "Model",
// Mappers lets us provide database model types to be used in generated typescript types instead of graphql types. This
// functionality is useful because what we retrieve from the database and what we choose to return from a graphql server
// could be completely different fields. Address to models here is relative to the location of generated types.
mappers: {
ActionItem: "../models/ActionItem#InterfaceActionItem",
ActionItemCategory:
"../models/ActionItemCategory#InterfaceActionItemCategory",
AppUserProfile: "../models/AppUserProfile#InterfaceAppUserProfile",
AgendaCategory: "../models/AgendaCategory#InterfaceAgendaCategory",
Advertisement: "../models/Advertisement#InterfaceAdvertisement",
AgendaItem: "../models/AgendaItem#InterfaceAgendaItem",
AgendaSection: "../models/AgendaSection#InterfaceAgendaSection",
CheckIn: "../models/CheckIn#InterfaceCheckIn",
Comment: "../models/Comment#InterfaceComment",
Community: "../models/Community#InterfaceCommunity",
Chat: "../models/Chat#InterfaceChat",
ChatMessage: "../models/ChatMessage#InterfaceChatMessage",
Donation: "../models/Donation#InterfaceDonation",
Event: "../models/Event#InterfaceEvent",
EventAttendee: "../models/EventAttendee#InterfaceEventAttendee",
UserFamily: "../models/userFamily#InterfaceUserFamily",
EventVolunteer: "../models/EventVolunteer#InterfaceEventVolunteer",
EventVolunteerGroup:
"../models/EventVolunteerGroup#InterfaceEventVolunteerGroup",
Feedback: "../models/Feedback#InterfaceFeedback",
Fund: "../models/Fund#InterfaceFund",
FundraisingCampaign:
"../models/FundraisingCampaign#InterfaceFundraisingCampaign",
FundraisingCampaignPledge:
"../models/FundraisingCampaignPledge#InterfaceFundraisingCampaignPledges",
// File: '../models/File#InterfaceFile',
Group: "../models/Group#InterfaceGroup",
// ImageHash: '../models/ImageHash#InterfaceImageHash',
Language: "../models/Language#InterfaceLanguage",
MembershipRequest:
"../models/MembershipRequest#InterfaceMembershipRequest",
Message: "../models/Message#InterfaceMessage",
Note: "../models/Note#InterfaceNote",
Organization: "../models/Organization#InterfaceOrganization",
Plugin: "../models/Plugin#InterfacePlugin",
PluginField: "../models/PluginField#InterfacePluginField",
Post: "../models/Post#InterfacePost",
RecurrenceRule: "../models/RecurrenceRule#InterfaceRecurrenceRule",
UserTag: "../models/OrganizationTagUser#InterfaceOrganizationTagUser",
User: "../models/User#InterfaceUser",
Venue: "../models/Venue#InterfaceVenue",
VolunteerMembership:
"../models/VolunteerMembership#InterfaceVolunteerMembership",
},
useTypeImports: true,
},
},
},
};
export default config;