Skip to content

Commit 19b754b

Browse files
committed
Add MOS data table & seeding script, update MOS lookup tool
1 parent f127a4b commit 19b754b

File tree

13 files changed

+24206
-207
lines changed

13 files changed

+24206
-207
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"dev": "next dev",
77
"build": "next build",
8-
"vercel-build": "prisma generate && prisma migrate deploy && yarn playwright install --only-shell && next build",
8+
"vercel-build": "prisma generate && prisma migrate deploy && npx tsx src/scripts/mos-data-import.ts && next build",
99
"start": "next start",
1010
"export": "next build && next export",
1111
"format": "prettier --ignore-path .prettierignore --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
@@ -71,6 +71,7 @@
7171
"react-hook-form": "^7.45.0",
7272
"react-simple-typewriter": "^3.0.1",
7373
"remark-gfm": "^4.0.1",
74+
"semver": "^7.7.2",
7475
"swiper": "^8.3.1",
7576
"tailwind-merge": "^2.3.0",
7677
"tailwindcss-animate": "^1.0.7",
@@ -94,6 +95,7 @@
9495
"@types/react": "^18.3.12",
9596
"@types/react-dom": "^18.3.1",
9697
"@types/react-portal": "^4.0.4",
98+
"@types/semver": "^7.7.0",
9799
"@types/ws": "^8.18.1",
98100
"@typescript-eslint/eslint-plugin": "^5.62.0",
99101
"@typescript-eslint/parser": "^5.62.0",
@@ -114,7 +116,7 @@
114116
"postcss": "^8.4.12",
115117
"prettier": "^3.4.2",
116118
"prettier-plugin-tailwindcss": "^0.6.9",
117-
"prisma": "^6.9.0",
119+
"prisma": "^6.11.1",
118120
"rimraf": "^3.0.2",
119121
"tailwindcss": "^3.0.23",
120122
"ts-complex": "^1.0.0",
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
-- CreateEnum
2+
CREATE TYPE "branch" AS ENUM ('MARINE_CORPS', 'NAVY', 'COAST_GUARD', 'ARMY', 'AIR_FORCE');
3+
4+
-- CreateEnum
5+
CREATE TYPE "personnelcategory" AS ENUM ('ENLISTED', 'OFFICER', 'WARRANT_OFFICER');
6+
7+
-- CreateTable
8+
CREATE TABLE "data_version" (
9+
"table" TEXT NOT NULL,
10+
"version" TEXT NOT NULL,
11+
12+
CONSTRAINT "data_version_pkey" PRIMARY KEY ("table")
13+
);
14+
15+
-- CreateTable
16+
CREATE TABLE "military_occupation" (
17+
"id" SERIAL NOT NULL,
18+
"branch" "branch" NOT NULL,
19+
"code" VARCHAR(10) NOT NULL,
20+
"title" VARCHAR NOT NULL,
21+
"description" VARCHAR NOT NULL,
22+
"personnel_category" "personnelcategory" NOT NULL,
23+
24+
CONSTRAINT "military_occupation_pkey" PRIMARY KEY ("id")
25+
);
26+
27+
-- CreateIndex
28+
CREATE UNIQUE INDEX "military_occupation_branch_code_personnel_category_key" ON "military_occupation"("branch", "code", "personnel_category");

prisma/schema.prisma

Lines changed: 49 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
// This is your Prisma schema file,
2-
// learn more about it in the docs: https://pris.ly/d/prisma-schema
3-
4-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
5-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
6-
71
generator client {
8-
provider = "prisma-client-js"
9-
previewFeatures = ["driverAdapters"]
2+
provider = "prisma-client-js"
3+
previewFeatures = ["driverAdapters"]
104
}
115

126
datasource db {
@@ -20,15 +14,13 @@ model User {
2014
email String @unique
2115
emailVerified DateTime?
2216
image String?
17+
createdAt DateTime @default(now())
18+
updatedAt DateTime @updatedAt
2319
accounts Account[]
24-
sessions Session[]
25-
// Optional for WebAuthn support
2620
Authenticator Authenticator[]
27-
28-
createdAt DateTime @default(now())
29-
updatedAt DateTime @updatedAt
21+
sessions Session[]
3022
}
31-
23+
3224
model Account {
3325
userId String
3426
type String
@@ -41,34 +33,30 @@ model Account {
4133
scope String?
4234
id_token String?
4335
session_state String?
44-
45-
createdAt DateTime @default(now())
46-
updatedAt DateTime @updatedAt
47-
48-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
49-
36+
createdAt DateTime @default(now())
37+
updatedAt DateTime @updatedAt
38+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
39+
5040
@@id([provider, providerAccountId])
5141
}
52-
42+
5343
model Session {
5444
sessionToken String @unique
5545
userId String
5646
expires DateTime
47+
createdAt DateTime @default(now())
48+
updatedAt DateTime @updatedAt
5749
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
58-
59-
createdAt DateTime @default(now())
60-
updatedAt DateTime @updatedAt
6150
}
62-
51+
6352
model VerificationToken {
6453
identifier String
6554
token String
6655
expires DateTime
67-
56+
6857
@@id([identifier, token])
6958
}
70-
71-
// Optional for WebAuthn support
59+
7260
model Authenticator {
7361
credentialID String @unique
7462
userId String
@@ -78,8 +66,37 @@ model Authenticator {
7866
credentialDeviceType String
7967
credentialBackedUp Boolean
8068
transports String?
81-
82-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
83-
69+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
70+
8471
@@id([userId, credentialID])
85-
}
72+
}
73+
74+
model data_version {
75+
table String @id
76+
version String
77+
}
78+
79+
model military_occupation {
80+
id Int @id @default(autoincrement())
81+
branch branch
82+
code String @db.VarChar(10)
83+
title String @db.VarChar
84+
description String @db.VarChar
85+
personnel_category personnelcategory
86+
87+
@@unique([branch, code, personnel_category])
88+
}
89+
90+
enum branch {
91+
MARINE_CORPS
92+
NAVY
93+
COAST_GUARD
94+
ARMY
95+
AIR_FORCE
96+
}
97+
98+
enum personnelcategory {
99+
ENLISTED
100+
OFFICER
101+
WARRANT_OFFICER
102+
}

0 commit comments

Comments
 (0)