#I'm using Supbase, but what I mean is
1 messages · Page 1 of 1 (latest)
I define my schema like this:
type Line @model(subscriptions: null) @auth(rules: [{ allow: owner}, { allow: custom, operations: [read] }]) {
id: ID!
owner: String @auth(rules: [{ allow: owner, operations: [read, delete] }, { allow: custom, operations: [read] }])
type: String! # D...
color: String # HEX Code
thickness: Int! @default(value: "6") # in PX
# B...
length: Int @default(value: "15") # px
spacing: Int @default(value: "15") # px
endCapsType: String @default(value: "15") # Type
}
you can see, that I define the model (table) itself and also the authentication. I define default values and can easily changed everything I need
When I want to link (join) them, I can split my code into multiple models:
type Section @model(subscriptions: null) @auth(rules: [{ allow: owner}, { allow: custom, operations: [read] }]) {
id: ID!
...
lineId: ID
line: Line @hasOne(fields: ["lineId"]) # B...
metadata: String # B...
}
Like this
I can query now for Section and when I want I can also get the full data of the specific line (in this case)
Btw quick uqestion, what do you think of drizzle?