chore: re-enables database adapter types

This commit is contained in:
James
2024-04-04 20:07:59 -04:00
parent b73ec6ae94
commit 922ce9ef5f
3 changed files with 21 additions and 3 deletions

View File

@@ -79,7 +79,7 @@ export class BasePayload<TGeneratedTypes extends GeneratedTypes> {
return create<T>(this, options)
}
db: BaseDatabaseAdapter
db: DatabaseAdapter
decrypt = decrypt
@@ -469,6 +469,6 @@ interface RequestContext {
[key: string]: unknown
}
// type DatabaseAdapter = BaseDatabaseAdapter
type DatabaseAdapter = BaseDatabaseAdapter
export type { GeneratedTypes, Payload, RequestContext }
export type { DatabaseAdapter, GeneratedTypes, Payload, RequestContext }

View File

@@ -367,6 +367,7 @@ describe('admin', () => {
test('collection — should render preview button when `admin.preview` is set', async () => {
const collectionWithPreview = new AdminUrlUtil(serverURL, postsCollectionSlug)
await page.goto(collectionWithPreview.create)
await page.waitForURL(collectionWithPreview.create)
await page.locator('#field-title').fill(title)
await saveDocAndAssert(page)
await expect(page.locator('.btn.preview-btn')).toBeVisible()
@@ -375,6 +376,7 @@ describe('admin', () => {
test('collection — should not render preview button when `admin.preview` is not set', async () => {
const collectionWithoutPreview = new AdminUrlUtil(serverURL, group1Collection1Slug)
await page.goto(collectionWithoutPreview.create)
await page.waitForURL(collectionWithoutPreview.create)
await page.locator('#field-title').fill(title)
await saveDocAndAssert(page)
await expect(page.locator('.btn.preview-btn')).toBeHidden()
@@ -769,6 +771,7 @@ describe('admin', () => {
test('should link second cell', async () => {
const { id } = await createPost()
await page.reload()
const linkCell = page.locator(`${tableRowLocator} td`).nth(1).locator('a')
await expect(linkCell).toHaveAttribute('href', `/admin/collections/posts/${id}`)
@@ -1180,6 +1183,7 @@ describe('admin', () => {
})
test('should select multiple rows', async () => {
await page.reload()
const selectAll = page.locator('.checkbox-input:has(#select-all)')
await page.locator('.row-1 .cell-_select input').check()
@@ -1251,6 +1255,7 @@ describe('admin', () => {
})
test('should sort', async () => {
await page.reload()
const upChevron = page.locator('#heading-number .sort-column__asc')
const downChevron = page.locator('#heading-number .sort-column__desc')

View File

@@ -15,6 +15,19 @@ import {
} from './slugs.js'
export const seed = async (_payload) => {
if (_payload.db.name === 'mongoose') {
await Promise.all(
_payload.config.collections.map(async (coll) => {
await new Promise((resolve, reject) => {
_payload.db?.collections[coll.slug]?.ensureIndexes(function (err) {
if (err) reject(err)
resolve(true)
})
})
}),
)
}
await executePromises(
[
() =>