Skip to content

Commit

Permalink
fix: set column names to camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
ledouxm committed Apr 29, 2024
1 parent 074ec1a commit 276154e
Show file tree
Hide file tree
Showing 32 changed files with 2,674 additions and 12,577 deletions.
4 changes: 2 additions & 2 deletions db/migrations/01-add_users.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
CREATE TABLE "udap"(
id TEXT NOT NULL PRIMARY KEY
,department TEXT NOT NULL
,complete_coords TEXT
,"completeCoords" TEXT
,visible BOOLEAN
,name TEXT
,address TEXT
,zip_code TEXT
,"zipCode" TEXT
,city TEXT
,phone TEXT
,email TEXT
Expand Down
26 changes: 13 additions & 13 deletions db/migrations/02-create_items_table.sql
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
CREATE TABLE IF NOT EXISTS "report" (
id TEXT PRIMARY KEY NOT NULL,
title TEXT,
project_description TEXT,
redacted_by TEXT,
meet_date TIMESTAMP,
applicant_name TEXT,
applicant_address TEXT,
project_cadastral_ref TEXT,
project_space_type TEXT,
"projectDescription" TEXT,
"redactedBy" TEXT,
"meetDate" TIMESTAMP,
"applicantName" TEXT,
"applicantAddress" TEXT,
"projectCadastralRef" TEXT,
"projectSpaceType" TEXT,
decision TEXT,
precisions TEXT,
contacts TEXT,
further_information TEXT,
created_by_email TEXT NOT NULL REFERENCES "user"(email) ON DELETE SET NULL,
created_at TIMESTAMP NOT NULL,
service_instructeur TEXT
"furtherInformation" TEXT,
"createdByEmail" TEXT NOT NULL REFERENCES "user"(email) ON DELETE SET NULL,
"createdAt" TIMESTAMP NOT NULL,
"serviceInstructeur" TEXT
);

CREATE TABLE IF NOT EXISTS "clause" (
Expand All @@ -25,8 +25,8 @@ CREATE TABLE IF NOT EXISTS "clause" (

CREATE TABLE IF NOT EXISTS "report_to_clause" (
id TEXT PRIMARY KEY NOT NULL,
report_id TEXT NOT NULL REFERENCES report(id) ON DELETE CASCADE,
clause_id TEXT NOT NULL REFERENCES clause(id) ON DELETE CASCADE
"reportId" TEXT NOT NULL REFERENCES report(id) ON DELETE CASCADE,
"clauseId" TEXT NOT NULL REFERENCES clause(id) ON DELETE CASCADE
);

ALTER TABLE
Expand Down
192 changes: 96 additions & 96 deletions db/migrations/04-insert_udaps.sql

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"db:create": "pnpm backend migration:create",
"db:migrate": "pnpm db:create",
"electric:up": "pnpm electric-sql with-config \"pnpm pg-migrations apply --database {{ELECTRIC_PROXY}} --directory ./db/migrations\"",
"electric:migrate": "pnpm electric:up && pnpm electric-client generate:front && pnpm electric-client generate:back",
"electric:migrate": "pnpm electric:up && pnpm electric-client generate:front && pnpm electric-client generate:back && pnpm client:generate",
"client:json": "pnpm backend dev --create-only",
"client:ts": "typed-openapi ./packages/backend/openapi.json --output ./packages/frontend/src/api.gen.ts",
"client:generate": "pnpm client:json && pnpm client:ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/openapi.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"openapi":"3.1.0","info":{"title":"Oukwa API","description":"API Oukwa","version":"1.0"},"components":{"schemas":{}},"paths":{"/api/create-user":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"password":{"type":"string"},"udap_id":{"type":"string"}},"required":["name","email","password"]}}},"required":true},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"}},"required":["id","name","email"]},"token":{"type":"string"}},"required":["user","token"]}}}}}}},"/api/login":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"password":{"type":"string"},"udaps":{"type":"object","properties":{"id":{"type":"string"},"department":{"type":"string"},"complete_coords":{"type":"string"},"address":{"type":"string"},"visible":{"type":"boolean"},"name":{"type":"string"},"zip_code":{"type":"number"},"city":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"}},"required":["id","department"]}},"required":["email","password"]}}},"required":true},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"}},"required":["id","name","email"]},"token":{"type":"string"}},"required":["user","token"]}}}}}}},"/api/verify-token":{"get":{"parameters":[{"schema":{"type":"string"},"in":"query","name":"token","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"}},"required":["id","name","email"]}}}}}}},"/api/udaps":{"get":{"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"department":{"type":"string"},"complete_coords":{"type":"string"},"address":{"type":"string"},"visible":{"type":"boolean"},"name":{"type":"string"},"zip_code":{"type":"number"},"city":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"}},"required":["id","department"]}}}}}}}}}}
{"openapi":"3.1.0","info":{"title":"Oukwa API","description":"API Oukwa","version":"1.0"},"components":{"schemas":{}},"paths":{"/api/create-user":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"password":{"type":"string"},"udap_id":{"type":"string"}},"required":["name","email","password","udap_id"]}}},"required":true},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"udap":{"type":"object","properties":{"id":{"type":"string"},"department":{"type":"string"},"completeCoords":{"type":"string"},"visible":{"type":"boolean"},"name":{"type":"string"},"address":{"type":"string"},"zipCode":{"type":"string"},"city":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"}},"required":["id","department"]}},"required":["name","email","udap"]},"token":{"type":"string"}},"required":["user","token"]}}}}}}},"/api/login":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"password":{"type":"string"},"udap":{"type":"object","properties":{"id":{"type":"string"},"department":{"type":"string"},"completeCoords":{"type":"string"},"visible":{"type":"boolean"},"name":{"type":"string"},"address":{"type":"string"},"zipCode":{"type":"string"},"city":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"}},"required":["id","department"]}},"required":["email","password","udap"]}}},"required":true},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"udap":{"type":"object","properties":{"id":{"type":"string"},"department":{"type":"string"},"completeCoords":{"type":"string"},"visible":{"type":"boolean"},"name":{"type":"string"},"address":{"type":"string"},"zipCode":{"type":"string"},"city":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"}},"required":["id","department"]}},"required":["name","email","udap"]},"token":{"type":"string"}},"required":["user","token"]}}}}}}},"/api/verify-token":{"get":{"parameters":[{"schema":{"type":"string"},"in":"query","name":"token","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"udap":{"type":"object","properties":{"id":{"type":"string"},"department":{"type":"string"},"completeCoords":{"type":"string"},"visible":{"type":"boolean"},"name":{"type":"string"},"address":{"type":"string"},"zipCode":{"type":"string"},"city":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"}},"required":["id","department"]}},"required":["name","email","udap"]}}}}}}},"/api/udaps":{"get":{"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"department":{"type":"string"},"completeCoords":{"type":"string"},"visible":{"type":"boolean"},"name":{"type":"string"},"address":{"type":"string"},"zipCode":{"type":"string"},"city":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"}},"required":["id","department"]}}}}}}}}}}
3 changes: 2 additions & 1 deletion packages/electric-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"peerDependencies": {
"@prisma/client": "^4.8.1",
"@sinclair/typebox": "^0.32.20",
"electric-sql": "^0.10.1"
"electric-sql": "^0.10.1",
"zod": "^3.22.4"
},
"devDependencies": {
"dotenv-cli": "^7.4.1",
Expand Down
69 changes: 35 additions & 34 deletions packages/electric-client/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,32 @@ model clause {
}

model report {
id String @id
title String?
project_description String?
redacted_by String?
meet_date DateTime? @db.Timestamp(6)
applicant_name String?
applicant_address String?
project_cadastral_ref String?
project_space_type String?
decision String?
precisions String?
contacts String?
further_information String?
created_by_id String
created_by_username String
created_at DateTime @db.Timestamp(6)
service_instructeur String?
report_to_clause report_to_clause[]
id String @id
title String?
projectDescription String?
redactedBy String?
meetDate DateTime? @db.Timestamp(6)
applicantName String?
applicantAddress String?
projectCadastralRef String?
projectSpaceType String?
decision String?
precisions String?
contacts String?
furtherInformation String?
createdByEmail String
createdAt DateTime @db.Timestamp(6)
serviceInstructeur String?
user user @relation(fields: [createdByEmail], references: [email], onDelete: SetNull, onUpdate: NoAction)
report_to_clause report_to_clause[]
}

model report_to_clause {
id String @id
report_id String
clause_id String
clause clause @relation(fields: [clause_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
report report @relation(fields: [report_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
id String @id
reportId String
clauseId String
clause clause @relation(fields: [clauseId], references: [id], onDelete: Cascade, onUpdate: NoAction)
report report @relation(fields: [reportId], references: [id], onDelete: Cascade, onUpdate: NoAction)
}

model chip {
Expand All @@ -83,17 +83,17 @@ model delegation {
}

model udap {
id String @id
department String
complete_coords String?
visible Boolean?
name String?
address String?
zip_code String?
city String?
phone String?
email String?
user user[]
id String @id
department String
completeCoords String?
visible Boolean?
name String?
address String?
zipCode String?
city String?
phone String?
email String?
user user[]
}

model user {
Expand All @@ -105,5 +105,6 @@ model user {
udap_id String
delegation_delegation_createdByTouser delegation[] @relation("delegation_createdByTouser")
delegation_delegation_delegatedToTouser delegation[] @relation("delegation_delegatedToTouser")
report report[]
udap udap @relation(fields: [udap_id], references: [id], onDelete: SetNull, onUpdate: NoAction, map: "fk_udap_id")
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,27 +129,26 @@ exports.Prisma.ClauseScalarFieldEnum = {
exports.Prisma.ReportScalarFieldEnum = {
id: 'id',
title: 'title',
project_description: 'project_description',
redacted_by: 'redacted_by',
meet_date: 'meet_date',
applicant_name: 'applicant_name',
applicant_address: 'applicant_address',
project_cadastral_ref: 'project_cadastral_ref',
project_space_type: 'project_space_type',
projectDescription: 'projectDescription',
redactedBy: 'redactedBy',
meetDate: 'meetDate',
applicantName: 'applicantName',
applicantAddress: 'applicantAddress',
projectCadastralRef: 'projectCadastralRef',
projectSpaceType: 'projectSpaceType',
decision: 'decision',
precisions: 'precisions',
contacts: 'contacts',
further_information: 'further_information',
created_by_id: 'created_by_id',
created_by_username: 'created_by_username',
created_at: 'created_at',
service_instructeur: 'service_instructeur'
furtherInformation: 'furtherInformation',
createdByEmail: 'createdByEmail',
createdAt: 'createdAt',
serviceInstructeur: 'serviceInstructeur'
};

exports.Prisma.Report_to_clauseScalarFieldEnum = {
id: 'id',
report_id: 'report_id',
clause_id: 'clause_id'
reportId: 'reportId',
clauseId: 'clauseId'
};

exports.Prisma.ChipScalarFieldEnum = {
Expand All @@ -167,11 +166,11 @@ exports.Prisma.DelegationScalarFieldEnum = {
exports.Prisma.UdapScalarFieldEnum = {
id: 'id',
department: 'department',
complete_coords: 'complete_coords',
completeCoords: 'completeCoords',
visible: 'visible',
name: 'name',
address: 'address',
zip_code: 'zip_code',
zipCode: 'zipCode',
city: 'city',
phone: 'phone',
email: 'email'
Expand Down
Loading

0 comments on commit 276154e

Please sign in to comment.