Skip to content

Commit

Permalink
feat: Created Relations between the Schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
Harsheel12 committed Jun 19, 2024
1 parent 41e9439 commit c009dc2
Show file tree
Hide file tree
Showing 7 changed files with 189 additions and 34 deletions.
15 changes: 14 additions & 1 deletion strapi/src/api/answer/content-types/answer/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"info": {
"singularName": "answer",
"pluralName": "answers",
"displayName": "Answer"
"displayName": "Answer",
"description": ""
},
"options": {
"draftAndPublish": true
Expand All @@ -14,6 +15,18 @@
"Answer": {
"type": "text",
"required": true
},
"People_ID": {
"type": "relation",
"relation": "manyToOne",
"target": "api::people.people",
"inversedBy": "Answer_ID"
},
"Question_ID": {
"type": "relation",
"relation": "manyToOne",
"target": "api::question.question",
"inversedBy": "Answer_ID"
}
}
}
19 changes: 13 additions & 6 deletions strapi/src/api/event/content-types/event/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"info": {
"singularName": "event",
"pluralName": "events",
"displayName": "Event"
"displayName": "Event",
"description": ""
},
"options": {
"draftAndPublish": true
Expand All @@ -21,7 +22,7 @@
},
"Subtitle": {
"type": "string",
"required": true
"required": false
},
"Location": {
"type": "string",
Expand All @@ -48,12 +49,12 @@
"required": true
},
"Image": {
"allowedTypes": [
"images"
],
"type": "media",
"multiple": false,
"required": true
"required": true,
"allowedTypes": [
"images"
]
},
"Terms_And_Conditions": {
"type": "text",
Expand All @@ -62,6 +63,12 @@
"Event_Capacity_Remaining": {
"type": "integer",
"required": true
},
"Ticket_ID": {
"type": "relation",
"relation": "oneToMany",
"target": "api::ticket.ticket",
"mappedBy": "Event_ID"
}
}
}
37 changes: 28 additions & 9 deletions strapi/src/api/people/content-types/people/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"info": {
"singularName": "people",
"pluralName": "peoples",
"displayName": "People"
"displayName": "People",
"description": ""
},
"options": {
"draftAndPublish": true
Expand All @@ -21,23 +22,19 @@
},
"University_ID": {
"type": "string",
"required": true
"required": false
},
"UPI": {
"type": "string",
"required": true
},
"Institution": {
"type": "string",
"required": true
"required": false
},
"Year_Of_Study": {
"type": "string",
"required": true
"required": false
},
"Study_Field": {
"type": "string",
"required": true
"required": false
},
"Is_Member": {
"type": "boolean",
Expand All @@ -55,6 +52,28 @@
"Member_Expiry_Date": {
"type": "date",
"required": true
},
"People_Ticket_ID": {
"type": "relation",
"relation": "oneToMany",
"target": "api::user-ticket.user-ticket",
"mappedBy": "People_ID"
},
"Answer_ID": {
"type": "relation",
"relation": "oneToMany",
"target": "api::answer.answer",
"mappedBy": "People_ID"
},
"Institution": {
"type": "enumeration",
"enum": [
"UoA",
"AUT",
"Other",
"None"
],
"required": true
}
}
}
19 changes: 17 additions & 2 deletions strapi/src/api/question/content-types/question/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"info": {
"singularName": "question",
"pluralName": "questions",
"displayName": "Question"
"displayName": "Question",
"description": ""
},
"options": {
"draftAndPublish": true
Expand All @@ -16,7 +17,21 @@
"required": true
},
"Check_For_Member_Email": {
"type": "boolean"
"type": "boolean",
"required": true,
"default": false
},
"Ticket_ID": {
"type": "relation",
"relation": "manyToOne",
"target": "api::ticket.ticket",
"inversedBy": "Question_ID"
},
"Answer_ID": {
"type": "relation",
"relation": "oneToMany",
"target": "api::answer.answer",
"mappedBy": "Question_ID"
}
}
}
25 changes: 22 additions & 3 deletions strapi/src/api/ticket/content-types/ticket/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"info": {
"singularName": "ticket",
"pluralName": "tickets",
"displayName": "Ticket"
"displayName": "Ticket",
"description": ""
},
"options": {
"draftAndPublish": true
Expand All @@ -17,11 +18,11 @@
},
"Discount_Code": {
"type": "string",
"required": true
"required": false
},
"Discount_Price": {
"type": "decimal",
"required": true
"required": false
},
"Price": {
"type": "decimal",
Expand Down Expand Up @@ -57,6 +58,24 @@
"type": "boolean",
"default": false,
"required": true
},
"Question_ID": {
"type": "relation",
"relation": "oneToMany",
"target": "api::question.question",
"mappedBy": "Ticket_ID"
},
"Event_ID": {
"type": "relation",
"relation": "manyToOne",
"target": "api::event.event",
"inversedBy": "Ticket_ID"
},
"People_Ticket_ID": {
"type": "relation",
"relation": "oneToMany",
"target": "api::user-ticket.user-ticket",
"mappedBy": "Ticket_ID"
}
}
}
16 changes: 14 additions & 2 deletions strapi/src/api/user-ticket/content-types/user-ticket/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,30 @@
"info": {
"singularName": "user-ticket",
"pluralName": "user-tickets",
"displayName": "User_Ticket",
"displayName": "People_Ticket",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"User_Ticket_Code": {
"People_Ticket_Code": {
"type": "integer",
"unique": true,
"required": true
},
"People_ID": {
"type": "relation",
"relation": "manyToOne",
"target": "api::people.people",
"inversedBy": "People_Ticket_ID"
},
"Ticket_ID": {
"type": "relation",
"relation": "manyToOne",
"target": "api::ticket.ticket",
"inversedBy": "People_Ticket_ID"
}
}
}
Loading

0 comments on commit c009dc2

Please sign in to comment.