Skip to content

Commit

Permalink
update data models and readme to fix resources b00tc4mp#430
Browse files Browse the repository at this point in the history
  • Loading branch information
juditta99 committed Mar 2, 2024
1 parent 47bdd80 commit 88ee592
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 46 deletions.
16 changes: 9 additions & 7 deletions staff/judy-grayland/project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ The idea behind this app is to bring all available resources together in one pla
- saved resources ([Resource.id])
- scheduled activities ([Resource.id])

#### SpecialDate
#### Activity

- id (string)
- date (date)
- title (date)
- title (string)
- description (string)
- link (string)
- image (string)
- tags ([Tag.id])

Expand All @@ -57,24 +57,26 @@ The idea behind this app is to bring all available resources together in one pla
- title (string)
- author (string)
- description (string)
- ageRange ([number])
- ageRange ([number, number])
- image (string)
- tags ([Tag.id])

#### Activity
#### SpecialDate

- id (string)
- date (date)
- title (string)
- description (string)
- link (string)
- image (string)
- tags ([Tag.id])

#### Tag (xenofobia, bullying, dislexia)
#### Tag -topic- (xenofobia, bullying, dislexia)

- id (string)
- title (string)

#### Events calendar
#### EventsCalendar

- id (string)
- author (User.id)
Expand Down
60 changes: 21 additions & 39 deletions staff/judy-grayland/project/api/data/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,21 @@ const activity = new Schema({
type: String,
required: true,
},
organiser: {
link: {
type: String,
},
category: [
{
type: ObjectId,
ref: 'Category',
},
],
topic: [
image: {
type: String,
},

tag: [
{
type: ObjectId,
ref: 'Theme',
},
],
})

const book = new Schema({
title: {
type: String,
Expand All @@ -76,16 +75,8 @@ const book = new Schema({
ageRange: {
type: Number,
},
url: {
type: String,
},
category: [
{
type: ObjectId,
ref: 'Category',
},
],
topic: [

tag: [
{
type: ObjectId,
ref: 'Theme',
Expand All @@ -94,24 +85,22 @@ const book = new Schema({
})

const specialDate = new Schema({
date: {
type: Date,
required: true,
},
title: {
type: String,
required: true,
},
date: {
type: date,
required: true,
link: {
type: String,
},
url: {
image: {
type: String,
},
category: [
{
type: ObjectId,
ref: 'Category',
},
],
topic: [

tag: [
{
type: ObjectId,
ref: 'Theme',
Expand All @@ -120,14 +109,8 @@ const specialDate = new Schema({
})

// Labels
const category = new Schema({
name: {
type: String,
required: true,
},
})

const topic = new Schema({
const tag = new Schema({
name: {
type: String,
required: true,
Expand All @@ -144,8 +127,7 @@ const User = model('User', user)
const Activity = model('Activity', activity)
const Book = model('Book', book)
const SpecialDate = model('SpecialDate', specialDate)
const Category = model('Category', category)
const Topic = model('Topic', topic)
const Tag = model('Tag', tag)
const EventsCalendar = model('EventsCalendar', eventsCalendar)

/*
Expand All @@ -156,4 +138,4 @@ eg. const book = new Category({ name: 'Libro' })
*/

export { User, Activity, Book, SpecialDate, Category, Topic, EventsCalendar }
export { User, Activity, Book, SpecialDate, Tag, EventsCalendar }

0 comments on commit 88ee592

Please sign in to comment.