Skip to content

Legacy data has attribute type #50

@rhettl

Description

@rhettl

Here's my model:

api.define({
    resource: 'classes',
    handlers: mongo, // instantiated elsewhere
    attributes: {
      id: type.string(),
      class_number: type.string().required().uppercase(), // this is my unique ID
      department: type.string().uppercase(),
      short_desc: type.string().uppercase(),
      long_desc: type.string(),
      type: type.string().uppercase().allow('LEC', 'LAB', 'SEM'),  
                                                            // type is:
                                                            //  - LEC for Lecture, 
                                                            //  - LAB for Laboratory work, 
                                                            //  - SEM for Seminar
      category: type.string().allow('undergrad', 'phd', 'credential'),
      __v: type.number()
    }
  });

Type refers to "Type of class" not "Type of Resource", but I in the output, type is affecting the relation link.

data: [
  {
    type: "LEC",
    attributes: {
      class_number: "10",
      department: "EDUC",
      short_desc: "ED RESEARCH DESIGN",
      long_desc: "Educational Research Design",
      category: "undergrad",
      __v: 0
    },
    links: {
      self: "/LEC/undefined"
    }
  },
  {
    type: "SEM",
    attributes: {
      class_number: "5",
      department: "PHY SCI",
      short_desc: "INTRO SCI/MATH TCHG",
      long_desc: "Introduction to Science and Mathematics Teaching",
      category: "undergrad",
      __v: 0
    },
    links: {
      self: "/SEM/undefined"
    }
  }
]

Thank you for any help you may provide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions