-
-
Notifications
You must be signed in to change notification settings - Fork 5
Feat/device schema #985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jona159
wants to merge
32
commits into
dev
Choose a base branch
from
feat/device-schema
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feat/device schema #985
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
13ac36e
feat: device schema db model and related fields
jona159 1d96b97
feat: upload device schema zod validation
jona159 2c7a3b5
feat: add optional device schema to create device schema
jona159 4fe422e
feat: example device schema
jona159 371fd97
feat: translation
jona159 5e22eb3
feat: import and save schemas on custom devices
jona159 007d4db
feat: migrations
jona159 3c6ef4d
fix: rm draft state, fix migrations
jona159 b02720b
feat: translations
jona159 a70b61b
feat: add optional schema version and registry fields to sensor schema
jona159 65deb54
feat: add db methods to manage schemas
jona159 9695d80
feat: resource route to load schemas for registry
jona159 074037a
feat: resource route to download public schema of specific version
jona159 aa57ce7
feat: allow to donwload device schemas from public profile
jona159 b3364f3
feat: add model and schema version to custom device creation payload
jona159 48d9708
feat: adjust add and update sensors
jona159 88c544d
feat: adjust device creation for sensor schema, allow to detach schema
jona159 8bb2456
feat: add optional schema version id to zod schema
jona159 4a2b930
feat: translation
jona159 e732bc2
feat: adjust hook to track copied string
jona159 f4e72be
feat: manage own schemas on settings profile
jona159 dd7be25
feat: restrict editing sensors from schema but allow to detach schema…
jona159 7b6cc69
feat: tab view for browsing schema registry, upload and manual sensors
jona159 7a21333
Merge branch 'dev' into feat/device-schema
jona159 794d176
Merge branch 'dev' into feat/device-schema
jona159 0512fba
fix: disable state after merge conflict
jona159 16944a9
fix: use design tokens, download link
jona159 76a70d2
fix: rm asChild for text node
jona159 4d9d5b7
fix: use design tokens
jona159 a57c2ba
fix: use alert dialog instead of default window.confirm
jona159 3960a4f
feat: add example schema download link
jona159 a6e3ee4
feat: add translations
jona159 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| CREATE TYPE "public"."device_schema_version_status" AS ENUM('published', 'deprecated');--> statement-breakpoint | ||
| CREATE TYPE "public"."device_schema_visibility" AS ENUM('private', 'public');--> statement-breakpoint | ||
| CREATE TABLE "device_schema" ( | ||
| "id" text PRIMARY KEY NOT NULL, | ||
| "slug" text NOT NULL, | ||
| "name" text NOT NULL, | ||
| "description" text, | ||
| "tags" text[] DEFAULT ARRAY[]::text[], | ||
| "owner_user_id" text NOT NULL, | ||
| "visibility" "device_schema_visibility" DEFAULT 'private' NOT NULL, | ||
| "created_at" timestamp DEFAULT now() NOT NULL, | ||
| "updated_at" timestamp DEFAULT now() NOT NULL | ||
| ); | ||
| --> statement-breakpoint | ||
| CREATE TABLE "device_schema_version" ( | ||
| "id" text PRIMARY KEY NOT NULL, | ||
| "device_schema_id" text NOT NULL, | ||
| "version" text NOT NULL, | ||
| "format_version" text NOT NULL, | ||
| "content" jsonb NOT NULL, | ||
| "hash" text NOT NULL, | ||
| "status" "device_schema_version_status" DEFAULT 'published' NOT NULL, | ||
| "created_by_user_id" text NOT NULL, | ||
| "created_at" timestamp DEFAULT now() NOT NULL, | ||
| "published_at" timestamp, | ||
| "deprecated_at" timestamp | ||
| ); | ||
| --> statement-breakpoint | ||
| ALTER TABLE "device" ADD COLUMN "device_schema_version_id" text;--> statement-breakpoint | ||
| ALTER TABLE "device" ADD COLUMN "device_schema_public_id" text;--> statement-breakpoint | ||
| ALTER TABLE "device" ADD COLUMN "device_schema_id" text;--> statement-breakpoint | ||
| ALTER TABLE "device" ADD COLUMN "device_schema_name" text;--> statement-breakpoint | ||
| ALTER TABLE "device" ADD COLUMN "device_schema_version" text;--> statement-breakpoint | ||
| ALTER TABLE "device" ADD COLUMN "device_schema_hash" text;--> statement-breakpoint | ||
| ALTER TABLE "device_schema" ADD CONSTRAINT "device_schema_owner_user_id_user_id_fk" FOREIGN KEY ("owner_user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint | ||
| ALTER TABLE "device_schema_version" ADD CONSTRAINT "device_schema_version_device_schema_id_device_schema_id_fk" FOREIGN KEY ("device_schema_id") REFERENCES "public"."device_schema"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint | ||
| ALTER TABLE "device_schema_version" ADD CONSTRAINT "device_schema_version_created_by_user_id_user_id_fk" FOREIGN KEY ("created_by_user_id") REFERENCES "public"."user"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint | ||
| CREATE UNIQUE INDEX "device_schema_owner_slug_unique" ON "device_schema" USING btree ("owner_user_id","slug");--> statement-breakpoint | ||
| CREATE INDEX "device_schema_visibility_idx" ON "device_schema" USING btree ("visibility");--> statement-breakpoint | ||
| CREATE UNIQUE INDEX "device_schema_version_unique" ON "device_schema_version" USING btree ("device_schema_id","version");--> statement-breakpoint | ||
| CREATE UNIQUE INDEX "device_schema_version_hash_unique" ON "device_schema_version" USING btree ("device_schema_id","hash");--> statement-breakpoint | ||
| ALTER TABLE "device" ADD CONSTRAINT "device_device_schema_version_id_device_schema_version_id_fk" FOREIGN KEY ("device_schema_version_id") REFERENCES "public"."device_schema_version"("id") ON DELETE set null ON UPDATE cascade; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a lot of redundant information. 🤔 How about having a separate table for the device schemas and then just link to a specific schema from a device?