Skip to content

Commit

Permalink
Merge pull request #750 from joshunrau/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
joshunrau authored Mar 12, 2024
2 parents b1b1733 + db950da commit 3e638da
Show file tree
Hide file tree
Showing 35 changed files with 280 additions and 398 deletions.
1 change: 0 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
[ -z "$FILES" ] && exit 0
Expand Down
6 changes: 3 additions & 3 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"dependencies": {
"@casl/ability": "^6.7.0",
"@casl/prisma": "^1.4.1",
"@douglasneuroinformatics/libjs": "^0.0.1",
"@douglasneuroinformatics/nestjs": "^3.0.0",
"@douglasneuroinformatics/utils": "^1.2.2",
"@faker-js/faker": "^8.4.1",
"@nestjs/axios": "^3.0.2",
"@nestjs/common": "^10.3.3",
Expand Down Expand Up @@ -51,9 +51,9 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@douglasneuroinformatics/esbuild-plugin-native-modules": "^0.0.1",
"@douglasneuroinformatics/esbuild-plugin-prisma": "^0.0.1",
"@nestjs/testing": "^10.3.3",
"@open-data-capture/esbuild-plugin-native-modules": "workspace:*",
"@open-data-capture/esbuild-plugin-prisma": "workspace:*",
"@open-data-capture/esbuild-plugin-runtime": "workspace:*",
"@types/express": "^4.17.21",
"@types/lodash": "^4.17.0",
Expand Down
4 changes: 2 additions & 2 deletions apps/api/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import module from 'module';
import path from 'path';
import url from 'url';

import { nativeModulesPlugin } from '@open-data-capture/esbuild-plugin-native-modules';
import { prismaPlugin } from '@open-data-capture/esbuild-plugin-prisma';
import { nativeModulesPlugin } from '@douglasneuroinformatics/esbuild-plugin-native-modules';
import { prismaPlugin } from '@douglasneuroinformatics/esbuild-plugin-prisma';
import { runtimePlugin } from '@open-data-capture/esbuild-plugin-runtime';
import esbuild from 'esbuild';
import esbuildPluginTsc from 'esbuild-plugin-tsc';
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/demo/demo.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { FormDataType } from '@douglasneuroinformatics/form-types';
import { randomValue } from '@douglasneuroinformatics/utils';
import { randomValue } from '@douglasneuroinformatics/libjs';
import { faker } from '@faker-js/faker';
import { Injectable, Logger, NotImplementedException } from '@nestjs/common';
import { type Json, toUpperCase } from '@open-data-capture/common/core';
Expand Down
5 changes: 2 additions & 3 deletions apps/api/src/groups/groups.controller.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { CurrentUser, type EntityController } from '@douglasneuroinformatics/nestjs/core';
import { CurrentUser } from '@douglasneuroinformatics/nestjs/core';
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import type { Group } from '@open-data-capture/common/group';

import { RouteAccess } from '@/core/decorators/route-access.decorator';
import type { AppAbility } from '@/core/types';
Expand All @@ -12,7 +11,7 @@ import { GroupsService } from './groups.service';

@ApiTags('Groups')
@Controller('groups')
export class GroupsController implements EntityController<Group> {
export class GroupsController {
constructor(private readonly groupsService: GroupsService) {}

@ApiOperation({ summary: 'Create Group' })
Expand Down
4 changes: 1 addition & 3 deletions apps/api/src/groups/groups.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { EntityService } from '@douglasneuroinformatics/nestjs/core';
import { ConflictException, Injectable, NotFoundException } from '@nestjs/common';
import type { Group } from '@open-data-capture/common/group';

import { accessibleQuery } from '@/ability/ability.utils';
import type { EntityOperationOptions } from '@/core/types';
Expand All @@ -11,7 +9,7 @@ import { CreateGroupDto } from './dto/create-group.dto';
import { UpdateGroupDto } from './dto/update-group.dto';

@Injectable()
export class GroupsService implements EntityService<Group> {
export class GroupsService {
constructor(@InjectModel('Group') private readonly groupModel: Model<'Group'>) {}

async create(group: CreateGroupDto) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { yearsPassed } from '@douglasneuroinformatics/utils';
import { yearsPassed } from '@douglasneuroinformatics/libjs';
import { Injectable } from '@nestjs/common';
import type { AnyInstrument, InstrumentMeasureValue } from '@open-data-capture/common/instrument';
import type {
Expand Down
4 changes: 1 addition & 3 deletions apps/api/src/subjects/subjects.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { EntityService } from '@douglasneuroinformatics/nestjs/core';
import { CryptoService } from '@douglasneuroinformatics/nestjs/modules';
import { ConflictException, Injectable, NotFoundException } from '@nestjs/common';
import type { Subject } from '@open-data-capture/common/subject';
import type { Prisma } from '@open-data-capture/database/core';
import unidecode from 'unidecode';

Expand All @@ -13,7 +11,7 @@ import type { Model, ModelUpdateData } from '@/prisma/prisma.types';
import { SubjectIdentificationDataDto } from './dto/subject-identification-data.dto';

@Injectable()
export class SubjectsService implements EntityService<Partial<Subject>> {
export class SubjectsService {
constructor(
@InjectModel('Subject') private readonly subjectModel: Model<'Subject'>,
private readonly cryptoService: CryptoService
Expand Down
4 changes: 1 addition & 3 deletions apps/api/src/users/users.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { EntityService } from '@douglasneuroinformatics/nestjs/core';
import { CryptoService } from '@douglasneuroinformatics/nestjs/modules';
import { ConflictException, Injectable, NotFoundException } from '@nestjs/common';
import { type User } from '@open-data-capture/common/user';

import { accessibleQuery } from '@/ability/ability.utils';
import type { EntityOperationOptions } from '@/core/types';
Expand All @@ -14,7 +12,7 @@ import { CreateUserDto } from './dto/create-user.dto';
import type { UpdateUserDto } from './dto/update-user.dto';

@Injectable()
export class UsersService implements EntityService<User> {
export class UsersService {
constructor(
@InjectModel('User') private readonly userModel: Model<'User'>,
private readonly cryptoService: CryptoService,
Expand Down
3 changes: 1 addition & 2 deletions apps/api/src/visits/visits.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { EntityController } from '@douglasneuroinformatics/nestjs/core';
import { Body, Controller, Post } from '@nestjs/common';
import { ApiOperation } from '@nestjs/swagger';
import type { Visit } from '@open-data-capture/common/visit';
Expand All @@ -9,7 +8,7 @@ import { CreateVisitDto } from './dto/create-visit.dto';
import { VisitsService } from './visits.service';

@Controller('visits')
export class VisitsController implements Pick<EntityController<Visit>, 'create'> {
export class VisitsController {
constructor(private readonly visitsService: VisitsService) {}

@ApiOperation({ description: 'Create Visit' })
Expand Down
5 changes: 3 additions & 2 deletions apps/gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@open-data-capture/esbuild-plugin-native-modules": "workspace:*",
"@open-data-capture/esbuild-plugin-prisma": "workspace:*",
"@douglasneuroinformatics/esbuild-plugin-native-modules": "^0.0.1",
"@douglasneuroinformatics/esbuild-plugin-prisma": "^0.0.1",
"@open-data-capture/tailwindcss": "workspace:*",
"@open-data-capture/vite-plugin-runtime": "workspace:*",
"@types/compression": "^1.7.5",
Expand All @@ -52,6 +52,7 @@
"@types/react-dom": "^18.2.21",
"@vitejs/plugin-react-swc": "^3.6.0",
"autoprefixer": "^10.4.18",
"esbuild": "^0.20.1",
"postcss": "^8.4.35",
"tailwindcss": "^3.4.1",
"vite": "^5.1.6"
Expand Down
4 changes: 2 additions & 2 deletions apps/gateway/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import fs from 'fs/promises';
import path from 'path';
import url from 'url';

import { nativeModulesPlugin } from '@open-data-capture/esbuild-plugin-native-modules';
import { prismaPlugin } from '@open-data-capture/esbuild-plugin-prisma';
import { nativeModulesPlugin } from '@douglasneuroinformatics/esbuild-plugin-native-modules';
import { prismaPlugin } from '@douglasneuroinformatics/esbuild-plugin-prisma';
import esbuild from 'esbuild';

const __filename = url.fileURLToPath(import.meta.url);
Expand Down
2 changes: 1 addition & 1 deletion apps/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"test:dev": "env-cmd -f ../../.env --use-shell 'start-server-and-test \"pnpm exec vite --mode test\" \"http://localhost:${PLAYGROUND_DEV_SERVER_PORT}\" cy:open'"
},
"dependencies": {
"@douglasneuroinformatics/libjs": "^0.0.1",
"@douglasneuroinformatics/ui": "^6.2.2",
"@douglasneuroinformatics/utils": "^1.2.2",
"@headlessui/react": "^1.7.18",
"@heroicons/react": "^2.1.1",
"@open-data-capture/common": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
},
"dependencies": {
"@casl/ability": "^6.7.0",
"@douglasneuroinformatics/libjs": "^0.0.1",
"@douglasneuroinformatics/ui": "^6.2.2",
"@douglasneuroinformatics/utils": "^1.2.2",
"@headlessui/react": "^1.7.18",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Layout/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { toBasicISOString } from '@douglasneuroinformatics/libjs';
import { ThemeToggle } from '@douglasneuroinformatics/ui/legacy';
import { toBasicISOString } from '@douglasneuroinformatics/utils';
import { toLowerCase } from '@open-data-capture/common/core';
import { Branding } from '@open-data-capture/react-core';
import { AnimatePresence, motion } from 'framer-motion';
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { deepFreeze } from '@douglasneuroinformatics/utils';
import { deepFreeze } from '@douglasneuroinformatics/libjs';
import { $BooleanString } from '@open-data-capture/common/core';
import { z } from 'zod';

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/features/auth/components/DemoModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { snakeToCamelCase } from '@douglasneuroinformatics/libjs';
import { Card, Modal } from '@douglasneuroinformatics/ui/legacy';
import { snakeToCamelCase } from '@douglasneuroinformatics/utils';
import type { LoginCredentials } from '@open-data-capture/common/auth';
import { DEMO_USERS } from '@open-data-capture/demo';
import { useTranslation } from 'react-i18next';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react';

import { toBasicISOString } from '@douglasneuroinformatics/libjs';
import { ClientTable } from '@douglasneuroinformatics/ui/legacy';
import { toBasicISOString } from '@douglasneuroinformatics/utils';
import type { Assignment, AssignmentStatus } from '@open-data-capture/common/assignment';
import type { UnilingualInstrumentSummary } from '@open-data-capture/common/instrument';
import { useTranslation } from 'react-i18next';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useState } from 'react';

import { toBasicISOString } from '@douglasneuroinformatics/libjs';
import { useDownload } from '@douglasneuroinformatics/ui/hooks';
import { ClientTable, Dropdown, SearchBar } from '@douglasneuroinformatics/ui/legacy';
import { toBasicISOString } from '@douglasneuroinformatics/utils';
import type { InstrumentRecordsExport } from '@open-data-capture/common/instrument-records';
import type { Subject } from '@open-data-capture/common/subject';
import axios from 'axios';
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/features/subjects/components/TabLink.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { clsx } from 'clsx';
import { NavLink } from 'react-router-dom';

export const TabLink = ({ dataCy, label, pathname }: { dataCy?: string; label: string; pathname: string}) => (
export const TabLink = ({ dataCy, label, pathname }: { dataCy?: string; label: string; pathname: string }) => (
<NavLink
end
className={({ isActive }) =>
Expand All @@ -10,7 +10,7 @@ export const TabLink = ({ dataCy, label, pathname }: { dataCy?: string; label: s
isActive ? 'border-sky-500 text-slate-900 dark:text-slate-100' : 'border-slate-300'
)
}
data-cy = {dataCy}
data-cy={dataCy}
to={pathname}
>
{label}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toBasicISOString } from '@douglasneuroinformatics/utils';
import { toBasicISOString } from '@douglasneuroinformatics/libjs';
import { useTranslation } from 'react-i18next';

export type VisualizationHeaderProps = {
Expand Down
21 changes: 10 additions & 11 deletions apps/web/src/features/subjects/pages/SubjectTablePage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { camelToSnakeCase, toBasicISOString } from '@douglasneuroinformatics/libjs';
import { ClientTable, Dropdown } from '@douglasneuroinformatics/ui/legacy';
import { camelToSnakeCase, toBasicISOString } from '@douglasneuroinformatics/utils';
import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom';

Expand Down Expand Up @@ -42,19 +42,18 @@ export const SubjectTablePage = () => {
</div>
<div className="flex flex-col gap-2 lg:flex-row">
<div data-cy="time-dropdown">
<TimeDropdown setMinTime={setMinDate} />
<TimeDropdown setMinTime={setMinDate} />
</div>

<div data-cy="download-dropdown">
<Dropdown
className="text-sm"
options={['CSV', 'JSON']}
title={t('core:download')}
variant="secondary"
onSelection={dl}
/>
<Dropdown
className="text-sm"
options={['CSV', 'JSON']}
title={t('core:download')}
variant="secondary"
onSelection={dl}
/>
</div>

</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 3e638da

Please sign in to comment.