-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial models and Routes - Agencies/Organizations (#13)
* chore: initial commit * chore: add basic models * Feature/2228 Add Agency, Edit Agency and View Agencies pages (#27) * 2228 generate Agency model, use redwood scaffold tool to generate CRUD for agency routes, add bootstrap * feature/2228 add useAuth * Revert "feature/2228 add useAuth" This reverts commit a57f995. * feature/2228 comment out create, edit, view agency routes * feature/2228 display agencies that belong to tenant * feature/2228 remove .redwood/ files, comment out Add Agency route * bring back CRUD routes, display agency id in agency form * feature/2228 update to named query in AgenciesCell * enable edit and add agency pages, add reset functionality that clears form (Add new agency) or reverts it to the previous save (Edit), add form validation, styling, override default bootstrap invalid-feedback colors * feature/2228 add red border around invalid fields when submitting the Agency form * feature/2228 fix misnamed Agency type in agencies.test.ts * 22 changing tenant table to organization (#28) * 22 changing tenant table to organization * 22 results of "yarn rw g scaffold organization" * bring back CRUD routes, display agency id in agency form * feature/2228 update to named query in AgenciesCell * enable edit and add agency pages, add reset functionality that clears form (Add new agency) or reverts it to the previous save (Edit), add form validation, styling, override default bootstrap invalid-feedback colors * feature/2228 add red border around invalid fields when submitting the Agency form * 22 changing tenant table to organization * 22 fixing merge conflict when pulling in the parent branch 2228 * 22 adding .idea to gitignore and creating .nvmrc * 22 styling updates to align with #2282 * feature/2228 fix misnamed Agency type in agencies.test.ts * 22 changing tenant table to organization * 22 rebasing onto 2228 before merging * 22 results of "yarn rw g scaffold organization" * 22 fixing merge conflict when pulling in the parent branch 2228 * 22 adding .idea to gitignore and creating .nvmrc * 22 styling updates to align with #2282 --------- Co-authored-by: Ed Snodgrass <[email protected]> Co-authored-by: Weronika Tomaszewska <[email protected]> --------- Co-authored-by: Ed Snodgrass <[email protected]> Co-authored-by: Ed Snodgrass <[email protected]> * 13 linting fixes to merge to main --------- Co-authored-by: Weronika Tomaszewska <[email protected]> Co-authored-by: Ed Snodgrass <[email protected]> Co-authored-by: Ed Snodgrass <[email protected]>
- Loading branch information
1 parent
8788378
commit fd49812
Showing
56 changed files
with
3,457 additions
and
834 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1 +1 @@ | ||
v18 | ||
v18.18.2 |
This file contains 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,9 @@ | ||
-- CreateTable | ||
CREATE TABLE "agency" ( | ||
"id" SERIAL NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"abbreviation" TEXT, | ||
"code" TEXT NOT NULL, | ||
|
||
CONSTRAINT "agency_pkey" PRIMARY KEY ("id") | ||
); |
30 changes: 30 additions & 0 deletions
30
api/db/migrations/20231201164202_added_tenant/migration.sql
This file contains 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,30 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the `agency` table. If the table is not empty, all the data it contains will be lost. | ||
*/ | ||
-- DropTable | ||
DROP TABLE "agency"; | ||
|
||
-- CreateTable | ||
CREATE TABLE "Agency" ( | ||
"id" SERIAL NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"abbreviation" TEXT, | ||
"code" TEXT NOT NULL, | ||
"tenantId" INTEGER, | ||
|
||
CONSTRAINT "Agency_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Tenant" ( | ||
"id" SERIAL NOT NULL, | ||
"name" TEXT NOT NULL, | ||
|
||
CONSTRAINT "Tenant_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Agency" ADD CONSTRAINT "Agency_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "Tenant"("id") ON DELETE SET NULL ON UPDATE CASCADE; |
27 changes: 27 additions & 0 deletions
27
api/db/migrations/20231201204518_changed_tenant_to_organization/migration.sql
This file contains 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,27 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `tenantId` on the `Agency` table. All the data in the column will be lost. | ||
- You are about to drop the `Tenant` table. If the table is not empty, all the data it contains will be lost. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "Agency" DROP CONSTRAINT "Agency_tenantId_fkey"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Agency" DROP COLUMN "tenantId", | ||
ADD COLUMN "organizationId" INTEGER; | ||
|
||
-- DropTable | ||
DROP TABLE "Tenant"; | ||
|
||
-- CreateTable | ||
CREATE TABLE "Organization" ( | ||
"id" SERIAL NOT NULL, | ||
"name" TEXT NOT NULL, | ||
|
||
CONSTRAINT "Organization_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Agency" ADD CONSTRAINT "Agency_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE SET NULL ON UPDATE CASCADE; |
This file contains 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,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "postgresql" |
This file contains 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 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,33 @@ | ||
export const schema = gql` | ||
type Agency { | ||
id: Int! | ||
name: String! | ||
abbreviation: String | ||
code: String! | ||
organizationId: Int! | ||
} | ||
type Query { | ||
agencies: [Agency!]! @requireAuth | ||
agency(id: Int!): Agency @requireAuth | ||
agenciesByOrganization(organizationId: Int!): [Agency!]! @requireAuth | ||
} | ||
input CreateAgencyInput { | ||
name: String! | ||
abbreviation: String | ||
code: String! | ||
} | ||
input UpdateAgencyInput { | ||
name: String | ||
abbreviation: String | ||
code: String | ||
} | ||
type Mutation { | ||
createAgency(input: CreateAgencyInput!): Agency! @requireAuth | ||
updateAgency(id: Int!, input: UpdateAgencyInput!): Agency! @requireAuth | ||
deleteAgency(id: Int!): Agency! @requireAuth | ||
} | ||
` |
This file contains 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,30 @@ | ||
export const schema = gql` | ||
type Organization { | ||
id: Int! | ||
agencies: [Agency]! | ||
name: String! | ||
} | ||
type Query { | ||
organizations: [Organization!]! @requireAuth | ||
organization(id: Int!): Organization @requireAuth | ||
} | ||
input CreateOrganizationInput { | ||
name: String! | ||
} | ||
input UpdateOrganizationInput { | ||
name: String | ||
} | ||
type Mutation { | ||
createOrganization(input: CreateOrganizationInput!): Organization! | ||
@requireAuth | ||
updateOrganization( | ||
id: Int! | ||
input: UpdateOrganizationInput! | ||
): Organization! @requireAuth | ||
deleteOrganization(id: Int!): Organization! @requireAuth | ||
} | ||
` |
This file contains 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,11 @@ | ||
import type { Prisma, agency } from '@prisma/client' | ||
import type { ScenarioData } from '@redwoodjs/testing/api' | ||
|
||
export const standard = defineScenario<Prisma.agencyCreateArgs>({ | ||
agency: { | ||
one: { data: { name: 'String', code: 'String' } }, | ||
two: { data: { name: 'String', code: 'String' } }, | ||
}, | ||
}) | ||
|
||
export type StandardScenario = ScenarioData<agency, 'agency'> |
Oops, something went wrong.