Skip to content

Commit

Permalink
Merge pull request #77 from lilith/calendar-refactor
Browse files Browse the repository at this point in the history
Calendar refactor
  • Loading branch information
jho44 authored Feb 28, 2024
2 parents 0815abc + ae17876 commit 127c2d1
Show file tree
Hide file tree
Showing 106 changed files with 5,340 additions and 3,592 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }}
TWILIO_API_SECRET: ${{ secrets.TWILIO_API_SECRET }}
TWILIO_AUTH_TOKEN: ${{ secrets.TWILIO_AUTH_TOKEN }}
PUBLIC_ENV: test
jobs:
build:
runs-on: ubuntu-latest
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
"node": ">=18"
},
"prisma": {
"seed": "ts-node --transpile-only prisma/seed.ts"
"seed": "tsx prisma/seed.ts"
},
"scripts": {
"dev": "vite dev",
"build": "vite build",
"nodebuild": "NODE_MODE_ADAPTER=1 vite build",
"preview": "vite preview",
"test": "playwright test",
"test": "rm -f screenshot.png && playwright test",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test:unit": "vitest",
Expand Down Expand Up @@ -49,17 +49,18 @@
"postcss": "^8.4.31",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"prisma": "^4.15.0",
"svelte": "^3.59.1",
"prisma": "^5.9.1",
"svelte": "^4.2.10",
"svelte-check": "^3.4.3",
"tailwindcss": "^3.3.2",
"tslib": "^2.5.2",
"tsx": "^4.7.1",
"typescript": "^5.0.4",
"vite": "^4.3.9",
"vitest": "^0.31.3"
},
"dependencies": {
"@prisma/client": "^4.15.0",
"@prisma/client": "^5.9.1",
"jsonwebtoken": "^9.0.0",
"luxon": "^3.3.0",
"marked": "^5.1.0",
Expand Down
11 changes: 9 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { PlaywrightTestConfig } from '@playwright/test';

export const TIMEZONE = 'America/Los_Angeles';
const config: PlaywrightTestConfig = {
webServer: [
{
Expand All @@ -16,8 +17,14 @@ const config: PlaywrightTestConfig = {
expect: {
timeout: 3000
},
timeout: 5000,
testDir: 'tests'
// timeout: 10000,
testDir: 'tests',
testMatch: '*spec.ts',
use: {
locale: 'en-US',
timezoneId: TIMEZONE,
baseURL: 'http://localhost:5173'
}
};

export default config;
3 changes: 3 additions & 0 deletions prisma/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const USERS_WITH_NOTHING = [1, 2, 7];
export const USERS_WITH_EMPTY_HOUSEHOLD = [3, 4];
export const USERS_WITH_ACTIVE_SESSION = [2, 4, 6, 7];
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- CreateIndex
CREATE UNIQUE INDEX if not exists "AvailabilityDate_householdId_date_key" ON "AvailabilityDate"("householdId", "date");
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
UPDATE "AvailabilityDate"
SET
"date" = "date" + INTERVAL '23 years'
WHERE
EXTRACT(MONTH FROM "date") >= 8 AND EXTRACT(YEAR FROM "date") = 2001;

UPDATE "AvailabilityDate"
SET
"date" = "date" + INTERVAL '24 years'
WHERE
EXTRACT(MONTH FROM "date") < 8 AND EXTRACT(YEAR FROM "date") = 2001;

-- cases
-- if month >= 8, then year should be set to 2023
-- if month < 8, then year should be set to 2024
32 changes: 15 additions & 17 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,7 @@ generator client {

datasource db {
provider = "postgresql"
url = env("DATABASE_PRISMA_URL") // uses connection pooling
// directUrl = env("DATABASE_URL_NON_POOLING") // uses a direct connection
// shadowDatabaseUrl = env("DATABASE_URL_NON_POOLING") // used for migrations
}

enum Pronoun {
FAE_FAER_FAERS
EEY_EM_EIRS
HE_HIM_HIS
PER_PER_PERS
SHE_HER_HERS
THEY_THEM_THEIRS
VE_VER_VIS
XE_XEM_XYRS
ZEZIE_HIR_HIRS
url = env("DATABASE_PRISMA_URL")
}

model Household {
Expand All @@ -31,8 +17,8 @@ model Household {
AvailabilityDate AvailabilityDate[]
FriendRequest FriendRequest[]
children HouseholdChild[]
connectionsAsHouseholdA HouseholdConnection[] @relation("HouseholdAConnection")
connectionsAsHouseholdB HouseholdConnection[] @relation("HouseholdBConnection")
connectionsAsHouseholdA HouseholdConnection[] @relation("HouseholdAConnection")
JoinHouseholdRequest JoinHouseholdRequest[]
parents User[]
}
Expand Down Expand Up @@ -153,12 +139,24 @@ model HouseholdConnection {
householdId Int
friendHouseholdId Int
createdAt DateTime @default(now())
household Household @relation("HouseholdAConnection", fields: [householdId], references: [id])
friendHousehold Household @relation("HouseholdBConnection", fields: [friendHouseholdId], references: [id])
household Household @relation("HouseholdAConnection", fields: [householdId], references: [id])
@@unique([householdId, friendHouseholdId])
}

enum Pronoun {
FAE_FAER_FAERS
EEY_EM_EIRS
HE_HIM_HIS
PER_PER_PERS
SHE_HER_HERS
THEY_THEM_THEIRS
VE_VER_VIS
XE_XEM_XYRS
ZEZIE_HIR_HIRS
}

enum AvailabilityStatus {
UNSPECIFIED
BUSY
Expand Down
Loading

0 comments on commit 127c2d1

Please sign in to comment.