mirror of https://github.com/buster-so/buster.git
Merge branch 'staging' into dallin/bus-920-feature-finish-rest-of-permissions
This commit is contained in:
commit
acafc5a025
|
@ -162,23 +162,27 @@ pub async fn list_assets_handler(
|
|||
|
||||
let query = format!(
|
||||
r#"
|
||||
SELECT DISTINCT ON (content, asset_type)
|
||||
asset_search.asset_id,
|
||||
asset_search.content,
|
||||
asset_search.updated_at,
|
||||
asset_search.asset_type
|
||||
FROM
|
||||
asset_search
|
||||
INNER JOIN
|
||||
asset_permissions
|
||||
ON
|
||||
asset_search.asset_id = asset_permissions.asset_id
|
||||
WHERE
|
||||
asset_search.asset_type IN ({})
|
||||
AND (asset_permissions.identity_id = '{}')
|
||||
AND asset_search.deleted_at IS NULL
|
||||
AND asset_permissions.deleted_at IS NULL
|
||||
ORDER BY asset_search.content, asset_search.asset_type, asset_search.updated_at DESC
|
||||
WITH distinct_assets AS (
|
||||
SELECT DISTINCT ON (content, asset_type)
|
||||
asset_search.asset_id,
|
||||
asset_search.content,
|
||||
asset_search.updated_at,
|
||||
asset_search.asset_type
|
||||
FROM
|
||||
asset_search
|
||||
INNER JOIN
|
||||
asset_permissions
|
||||
ON
|
||||
asset_search.asset_id = asset_permissions.asset_id
|
||||
WHERE
|
||||
asset_search.asset_type IN ({})
|
||||
AND (asset_permissions.identity_id = '{}')
|
||||
AND asset_search.deleted_at IS NULL
|
||||
AND asset_permissions.deleted_at IS NULL
|
||||
)
|
||||
SELECT *
|
||||
FROM distinct_assets
|
||||
ORDER BY updated_at DESC
|
||||
LIMIT {};
|
||||
"#,
|
||||
asset_types
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# Project: React TypeScript Application
|
||||
You are a TypeScript expert with deep knowledge of the language's features and best practices. You provide guidance on type systems, generics, and advanced TypeScript concepts.
|
||||
|
||||
|
||||
## Coding Standards
|
||||
- Use TypeScript for all new code
|
||||
- Prefer functional components and hooks over class components
|
||||
- Use proper TypeScript types for all variables and functions
|
||||
|
||||
## Best Practices
|
||||
- Try to use Ant Design componets (Button, Input, etc) over native HTML elements.
|
||||
- If we need to create custom elements like cards or containers with border colors, use createStyles from antd-style and use the token to get the exact color
|
||||
- If newly defined element has a border, it should be 0.5px
|
||||
- Use React.memo() for performance optimization when appropriate
|
||||
- Prefer async/await over .then() for asynchronous operations
|
|
@ -0,0 +1,24 @@
|
|||
import nextJest from 'next/jest.js';
|
||||
|
||||
const createJestConfig = nextJest({
|
||||
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
|
||||
dir: './'
|
||||
});
|
||||
|
||||
// Add any custom config to be passed to Jest
|
||||
/** @type {import('jest').Config} */
|
||||
const config = {
|
||||
// Add more setup options before each test is run
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
||||
testEnvironment: 'jest-environment-jsdom',
|
||||
preset: 'ts-jest',
|
||||
moduleNameMapper: {
|
||||
// Handle module aliases (if you're using them in your Next.js project)
|
||||
'^@/(.*)$': '<rootDir>/src/$1'
|
||||
},
|
||||
// Test files can be next to components with .test.tsx or .spec.tsx extensions
|
||||
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)']
|
||||
};
|
||||
|
||||
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
|
||||
export default createJestConfig(config);
|
|
@ -0,0 +1,45 @@
|
|||
// Learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom';
|
||||
|
||||
// Mock Next.js router
|
||||
jest.mock('next/router', () => ({
|
||||
useRouter() {
|
||||
return {
|
||||
route: '/',
|
||||
pathname: '',
|
||||
query: {},
|
||||
asPath: '',
|
||||
push: jest.fn(),
|
||||
replace: jest.fn(),
|
||||
reload: jest.fn(),
|
||||
back: jest.fn(),
|
||||
prefetch: jest.fn(),
|
||||
beforePopState: jest.fn(),
|
||||
events: {
|
||||
on: jest.fn(),
|
||||
off: jest.fn(),
|
||||
emit: jest.fn()
|
||||
},
|
||||
isFallback: false
|
||||
};
|
||||
}
|
||||
}));
|
||||
|
||||
// Mock next/navigation
|
||||
jest.mock('next/navigation', () => ({
|
||||
useRouter() {
|
||||
return {
|
||||
push: jest.fn(),
|
||||
replace: jest.fn(),
|
||||
refresh: jest.fn(),
|
||||
back: jest.fn(),
|
||||
forward: jest.fn()
|
||||
};
|
||||
},
|
||||
usePathname() {
|
||||
return '';
|
||||
},
|
||||
useSearchParams() {
|
||||
return new URLSearchParams();
|
||||
}
|
||||
}));
|
File diff suppressed because it is too large
Load Diff
|
@ -7,7 +7,9 @@
|
|||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"cy:run": "npx cypress run --browser chrome"
|
||||
"cy:run": "npx cypress run --browser chrome",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
|
@ -101,7 +103,11 @@
|
|||
"virtua": "^0.39.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/jest-dom": "^6.6.3",
|
||||
"@testing-library/react": "^14.3.1",
|
||||
"@testing-library/user-event": "^14.5.1",
|
||||
"@types/canvas-confetti": "^1.9.0",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/js-cookie": "^3.0.6",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^20",
|
||||
|
@ -119,10 +125,13 @@
|
|||
"eslint-config-next": "14.2.3",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.2.2",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"monaco-editor-webpack-plugin": "^7.1.0",
|
||||
"postcss": "~8",
|
||||
"sass": "^1.83.4",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"ts-jest": "^29.2.5",
|
||||
"typescript": "^5"
|
||||
},
|
||||
"overrides": {}
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"types": [
|
||||
"node",
|
||||
"jest",
|
||||
"@testing-library/jest-dom"
|
||||
],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
|
@ -18,19 +27,23 @@
|
|||
}
|
||||
],
|
||||
"paths": {
|
||||
"@/*": ["./src/*"],
|
||||
"@utils/*": ["./src/utils/*"],
|
||||
"typeRoots": ["./node_modules/@types", "./src/components/chartjs"]
|
||||
"@/*": [
|
||||
"./src/*"
|
||||
],
|
||||
"@utils/*": [
|
||||
"./src/utils/*"
|
||||
]
|
||||
},
|
||||
"target": "ES2017"
|
||||
},
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
".next/types/**/*.ts",
|
||||
"middleware.ts",
|
||||
"**/*.d.ts"
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
".next/types/**/*.ts"
|
||||
],
|
||||
"exclude": ["node_modules"]
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"dist"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue