datamodel.prisma 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. # Generic Types
  2. "Multi-purpose meta information field"
  3. type Meta {
  4. "Unique id in the database"
  5. id: ID! @unique
  6. "Key for the meta information"
  7. key: String!
  8. "Value of the meta information"
  9. value: String!
  10. }
  11. type User {
  12. id: ID! @unique
  13. email: String! @unique
  14. name: String!
  15. abbreviation: String!
  16. password: String!
  17. images: [File]!
  18. comments: [Comment]! @relation(name: "CommentAuthor", onDelete: CASCADE)
  19. }
  20. type File {
  21. id: ID! @unique
  22. path: String!
  23. name: String
  24. description: String
  25. filename: String!
  26. mimetype: String!
  27. encoding: String!
  28. size: Int!
  29. }
  30. type Comment {
  31. id: ID! @unique
  32. text: String
  33. createdAt: DateTime!
  34. author: User! @relation(name: "CommentAuthor", onDelete: SET_NULL)
  35. }
  36. type Event {
  37. id: ID! @unique
  38. json: String!
  39. when: DateTime!
  40. }
  41. # Project Information
  42. type Project {
  43. id: ID! @unique
  44. name: String! @unique
  45. abbreviation: String! @unique
  46. description: String
  47. files: [File]!
  48. versions: [ProjectVersion]!
  49. }
  50. type ProjectVersion {
  51. id: ID! @unique
  52. name: String! @unique
  53. changes: [String]!
  54. date: DateTime!
  55. project: Project!
  56. }
  57. # Instruments
  58. type InstrumentParameter {
  59. id: ID! @unique
  60. tag: String!
  61. name: String
  62. description: String
  63. type: String!
  64. values: String
  65. instrument: Instrument! @relation(name: "Parameters", onDelete: SET_NULL)
  66. commands: [InstrumentCommand]! @relation(name: "CommandParameters", onDelete: SET_NULL)
  67. }
  68. type InstrumentCommand {
  69. id: ID! @unique
  70. tag: String!
  71. name: String
  72. description: String!
  73. readString: String
  74. writeString: String
  75. subsystem: String
  76. parameters: [InstrumentParameter]! @relation(name: "CommandParameters", onDelete: SET_NULL)
  77. }
  78. type Instrument {
  79. id: ID! @unique
  80. name: String!
  81. manufacturer: String!
  82. description: String
  83. picture: ID
  84. documents: [File]!
  85. interfaces: [String]!
  86. commands: [InstrumentCommand]!
  87. parameters: [InstrumentParameter]! @relation(name: "Parameters", onDelete: CASCADE)
  88. instances: [InstrumentInstance]! @relation(name: "InstrumentInstances", onDelete: CASCADE)
  89. }
  90. type InstrumentInstance {
  91. id: ID! @unique
  92. instrument: Instrument! @relation(name: "InstrumentInstances", onDelete: SET_NULL)
  93. identifier: String!
  94. label: String
  95. location: String
  96. }
  97. # DUT
  98. type DUT {
  99. id: ID! @unique
  100. name: String!
  101. description: String
  102. project: ProjectVersion!
  103. modifications: [String]!
  104. }
  105. # Setup
  106. type SetupHardware {
  107. id: ID! @unique
  108. name: String!
  109. description: String
  110. images: [File]!
  111. }
  112. type SetupHardwareInstance {
  113. id: ID! @unique
  114. setupHardware: SetupHardware!
  115. identifier: String!
  116. images: [File]!
  117. }
  118. type Setup {
  119. id: ID! @unique
  120. name: String!
  121. description: String!
  122. images: [File]!
  123. comments: [Comment]!
  124. setupHardware: [SetupHardwareInstance]!
  125. instruments: [InstrumentInstance]!
  126. }
  127. # Measurement
  128. type Measurement {
  129. id: ID! @unique
  130. createdAt: DateTime!
  131. intValue: Int
  132. floatValue: Float
  133. stringValue: String
  134. }
  135. type MeasurementRun {
  136. id: ID! @unique
  137. name: String!
  138. operators: [User]!
  139. location: String!
  140. temperature: Float
  141. startTime: DateTime!
  142. endTime: DateTime!
  143. log: [Event]!
  144. comments: [Comment]!
  145. measurements: [Measurement]!
  146. setup: Setup!
  147. }
  148. # Characterization
  149. type Characterization {
  150. id: ID! @unique
  151. name: String!
  152. projectVersion: ProjectVersion!
  153. measurementRuns: [MeasurementRun]!
  154. }