Skip to content

Conversation

@HugoGresse
Copy link
Owner

@HugoGresse HugoGresse commented Nov 1, 2025

Add a real API with either an organization API Key or an event API Key !

API Keys are available:

  • through organizations for the whole organization
  • through a given event (project) for this event only

Endpoint added in this PR:

  • get organization

to test / todo :

  • send email from functions still ok
  • delete project (firebase-tools update)
  • add UI in Admin (integration?)
  • add UI in org (admin ? )

Linked to #1454
this API will be made in multiple PR

@HugoGresse HugoGresse self-assigned this Nov 1, 2025
@HugoGresse HugoGresse added tech Technical issue or improvement admin app Admin app (openfeedback.io/admin) labels Nov 1, 2025
const data = userDoc.data()
return {
id: userDoc.id,
displayName: data?.displayName,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing error: Expression expected


const mockOrganization = (
organization?: Partial<OrganizationDBEntity>,
users?: any[]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected any. Specify a different type @typescript-eslint/no-explicit-any

AggregateSpec: vi.fn() as unknown as any,
AggregateSpecData: vi.fn(),
AggregateType: vi.fn() as unknown as any,
BulkWriter: vi.fn() as unknown as any,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected any. Specify a different type @typescript-eslint/no-explicit-any

AggregateQuerySnapshot: vi.fn() as unknown as any,
AggregateSpec: vi.fn() as unknown as any,
AggregateSpecData: vi.fn(),
AggregateType: vi.fn() as unknown as any,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected any. Specify a different type @typescript-eslint/no-explicit-any

AggregateField: vi.fn() as unknown as any,
AggregateQuery: vi.fn() as unknown as any,
AggregateQuerySnapshot: vi.fn() as unknown as any,
AggregateSpec: vi.fn() as unknown as any,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected any. Specify a different type @typescript-eslint/no-explicit-any

getFirestore: firestoreStub(database),
initializeFirestore: vi.fn(),
AggregateField: vi.fn() as unknown as any,
AggregateQuery: vi.fn() as unknown as any,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected any. Specify a different type @typescript-eslint/no-explicit-any

return {
getFirestore: firestoreStub(database),
initializeFirestore: vi.fn(),
AggregateField: vi.fn() as unknown as any,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected any. Specify a different type @typescript-eslint/no-explicit-any

return firestoreConstructor
}

export const mockFirebaseAdminApp = (database: { [key: string]: any }) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected any. Specify a different type @typescript-eslint/no-explicit-any

bulkWriter: () => void
bundle: () => void
} {
return new FakeFirestore(database) as any
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected any. Specify a different type @typescript-eslint/no-explicit-any

import { vi } from 'vitest'
import { FakeFirestore } from 'firestore-vitest'

const firestoreStub = (database: { [key: string]: any }) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected any. Specify a different type @typescript-eslint/no-explicit-any

@cypress
Copy link

cypress bot commented Nov 1, 2025

open-feedback    Run #3009

Run Properties:  status check passed Passed #3009  •  git commit 0d460744bc: Revert and remove hound
Project open-feedback
Branch Review api
Run status status check passed Passed #3009
Run duration 02m 39s
Commit git commit 0d460744bc: Revert and remove hound
Committer Hugo Gresse
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 1
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 14
View all changes introduced in this branch ↗︎

// Get API key from header
const apiKeyHeader = request.headers['x-api-key']
const apiKeyParam =
typeof apiKeyHeader === 'string' ? apiKeyHeader : apiKeyHeader?.[0]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing error: Expression expected

import { mockFirebaseAdminApp } from '../../testUtils/firestoreMock'

describe('/organizations/me', () => {
let fastify: any
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected any. Specify a different type @typescript-eslint/no-explicit-any

* This plugin adds Swagger documentation to the API
*/
export const openAPIPlugin = fastifyPlugin(async (fastify: FastifyInstance) => {
console.log('isNodeEnvDev', isNodeEnvDev, isNodeEnvTest)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected console statement no-console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

admin app Admin app (openfeedback.io/admin) tech Technical issue or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants