Skip to content

Commit

Permalink
Merge pull request #81 from ceramicnetwork/mzk/pre-points-sandbox-fixes
Browse files Browse the repository at this point in the history
Fixes to mutations section in sandbox + prepping points
  • Loading branch information
mzkrasner authored Apr 9, 2024
2 parents b93b37c + 8a3c8a9 commit 9105e6e
Show file tree
Hide file tree
Showing 11 changed files with 2,227 additions and 841 deletions.
32 changes: 29 additions & 3 deletions docs/composedb/sandbox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -169,20 +169,46 @@ type Language {
}

type CeramicDev
@createModel(accountRelation: SINGLE, description: "A Ceramic developer") {
@createModel(
accountRelation: SET
accountRelationFields: ["context"]
description: "A Ceramic developer") {
developer: DID! @documentAccount
context: String! @string(maxLength: 100)
languages: Language!
attestations: [AttestToDev] @relationFrom(model: "AttestToDev", property: "attestedProfileId")
}

type AttestToDev @createModel(accountRelation: LIST, description: "Signals if user attests to another developer profile") {
type AttestToDev @createModel(
accountRelation: SET
accountRelationFields: ["attestedProfileId"]
description: "Signals if user attests to another developer profile") {
attester: DID! @documentAccount
attestedProfileId: StreamID! @documentReference(model: "CeramicDev")
profile: CeramicDev! @relationDocument(property: "attestedProfileId")
signal: Boolean!
}
```

You will use this model to self-describe your own development skills, and will therefore require you to alter the given examples to meet your actual abilities.
You will use this model to self-describe your own development skills, and will therefore require you to alter the given examples to meet your actual abilities.

You'll notice several unique qualities within the definitions above:

**Embedded "Language" Type**

Unlike the definitions used above in the read section, `CeramicDev` makes use of an embedded type called `Language`, which allows developers the ability to use these definitions in their data modeling as if it were a scalar. It's important to note that embedded types also introduce some restrictions - for example, developers impose filtering and ordering based on embedded types.

**Proficiency Enum**

Our embedded `Language` type uses an enum called `Proficiency` that restricts the possible values each key within `Language` can be assigned to. In our use case, we implemented a simple paradigm that uses a scale of 4 proficiency "levels."

**"SET" Account Relation**

Most importantly, you'll see that `SET` is used to define the relation between the authoring account and the model instance document. Unlike `LIST` (which allows an infinite number of model instance documents to be associated with a given account), `SET` lets developers restrict the number of instance documents to 1 based on the value of a subfield.

A simple way to understand this is to think about reviews on an eCommerce platform. If a customer has purchased a product, the platform should ensure that the customer can only leave 1 review for the product they have purchased.

In `CeramicDev`,

#### Authentication

Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
"typecheck": "tsc"
},
"dependencies": {
"@ceramicnetwork/cli": "^2.44.0",
"@ceramicnetwork/common": "^2.39.0",
"@ceramicnetwork/http-client": "^2.36.0",
"@composedb/client": "^0.5.0",
"@ceramicnetwork/cli": "^5.2.0",
"@ceramicnetwork/common": "^5.1.0",
"@ceramicnetwork/http-client": "^5.2.0",
"@composedb/cli": "^0.7.0",
"@composedb/client": "^0.7.0",
"@didtools/pkh-ethereum": "^0.5.0",
"@docusaurus/core": "^3.0.0",
"@docusaurus/plugin-client-redirects": "3.0.0",
Expand Down
Loading

0 comments on commit 9105e6e

Please sign in to comment.