-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into refactor/case-insensitive-usernames
- Loading branch information
Showing
310 changed files
with
6,727 additions
and
1,954 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { createZodActionError } from './error' | ||
import { safeServerCall } from './safeServerCall' | ||
import { Session } from '@/auth/Session' | ||
import type { SessionMaybeUser } from '@/auth/Session' | ||
import type { ServiceMethod } from '@/services/ServiceTypes' | ||
|
||
export function Action< | ||
TypeType, | ||
DetailedType, | ||
Params, | ||
Return, | ||
WantsToOpenTransaction extends boolean, | ||
NoAuther extends boolean | ||
>(serviceMethod: ServiceMethod< | ||
true, | ||
TypeType, | ||
DetailedType, | ||
Params, | ||
Return, | ||
WantsToOpenTransaction, | ||
NoAuther | ||
>) { | ||
return async (params: Params, rawData: FormData) => { | ||
const session = await Session.fromNextAuth() | ||
const parse = serviceMethod.typeValidate(rawData) | ||
if (!parse.success) return createZodActionError(parse) | ||
const data = parse.data | ||
const config: { session: SessionMaybeUser, params: Params, data: DetailedType } = { session, params, data } | ||
return { | ||
...(await safeServerCall(() => serviceMethod.client('NEW').execute(config, { withAuth: true }))), | ||
session: session.toJsObject() | ||
} | ||
} | ||
} | ||
|
||
export function ActionNoData< | ||
Params, | ||
Return, | ||
WantsToOpenTransaction extends boolean, | ||
NoAuther extends boolean | ||
>(serviceMethod: ServiceMethod< | ||
false, | ||
never, | ||
never, | ||
Params, | ||
Return, | ||
WantsToOpenTransaction, | ||
NoAuther | ||
>) { | ||
return async (params: Params) => { | ||
const session = await Session.fromNextAuth() | ||
const config: { session: SessionMaybeUser, params: Params, data: unknown } = { session, params, data: {} } | ||
return { | ||
...(await safeServerCall(() => serviceMethod.client('NEW').execute(config, { withAuth: true }))), | ||
session: session.toJsObject() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use server' | ||
import { Action } from '@/actions/Action' | ||
import { Companies } from '@/services/career/companies' | ||
|
||
export const createCompanyAction = Action(Companies.create) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use server' | ||
import { ActionNoData } from '@/actions/Action' | ||
import { Companies } from '@/services/career/companies' | ||
|
||
export const destroyCompanyAction = ActionNoData(Companies.destory) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use server' | ||
import { ActionNoData } from '@/actions/Action' | ||
import { Companies } from '@/services/career/companies' | ||
|
||
export const readCompanyPageAction = ActionNoData(Companies.readPage) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use server' | ||
import { Action } from '@/actions/Action' | ||
import { Companies } from '@/services/career/companies' | ||
|
||
export const updateComanyAction = Action(Companies.update) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use server' | ||
import { Action } from '@/actions/Action' | ||
import { JobAds } from '@/services/career/jobAds' | ||
|
||
export const createJobAdAction = Action(JobAds.create) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use server' | ||
import { ActionNoData } from '@/actions/Action' | ||
import { JobAds } from '@/services/career/jobAds' | ||
|
||
export const destroyJobAdAction = ActionNoData(JobAds.destroy) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use server' | ||
import { ActionNoData } from '@/actions/Action' | ||
import { JobAds } from '@/services/career/jobAds' | ||
|
||
export const readJobAdAction = ActionNoData(JobAds.read) | ||
export const readActiveJobAdsAction = ActionNoData(JobAds.readActive) | ||
export const readInactiveJobAdsPageAction = ActionNoData(JobAds.readInactivePage) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use server' | ||
import { Action } from '@/actions/Action' | ||
import { JobAds } from '@/services/career/jobAds' | ||
|
||
export const updateJobAdAction = Action(JobAds.update) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use server' | ||
|
||
import { ActionNoData } from '@/actions/Action' | ||
import { CmsLinks } from '@/services/cms/links' | ||
|
||
export const readSpecialCmsLinkAction = ActionNoData(CmsLinks.readSpacial) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use server' | ||
import { Action } from '@/actions/Action' | ||
import { Dots } from '@/services/dots' | ||
|
||
export const createDotAction = Action(Dots.create) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use server' | ||
import { ActionNoData } from '@/actions/Action' | ||
import { Dots } from '@/services/dots' | ||
|
||
export const readDotPage = ActionNoData(Dots.readPage) | ||
|
||
export const readDotWrapperForUser = ActionNoData(Dots.readWrapperForUser) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,14 @@ | ||
'use server' | ||
import { ActionNoData } from '@/actions/Action' | ||
import { safeServerCall } from '@/actions/safeServerCall' | ||
import { Session } from '@/auth/Session' | ||
import { Events } from '@/services/events' | ||
import type { ReadPageInput } from '@/services/paging/Types' | ||
import type { EventArchiveCursor, EventArchiveDetails } from '@/services/events/Types' | ||
|
||
export async function readCurrentEvents() { | ||
const session = await Session.fromNextAuth() | ||
return await safeServerCall(() => Events.readCurrent.client('NEW').execute({ | ||
params: { tags: null, visibilityFilter: {} }, session, | ||
})) | ||
} | ||
export const readCurrentEventsAction = ActionNoData(Events.readCurrent) | ||
|
||
export async function readEvent(params: {order: number, name: string}) { | ||
const session = await Session.fromNextAuth() | ||
return await safeServerCall(() => Events.read.client('NEW').execute({ params, session })) | ||
} | ||
|
||
export async function readArchivedEventsPage<const PageSize extends number>( | ||
paging: ReadPageInput<PageSize, EventArchiveCursor, EventArchiveDetails> | ||
) { | ||
const session = await Session.fromNextAuth() | ||
return await safeServerCall(() => Events.readArchivedPage.client('NEW').execute({ session, params: { paging } })) | ||
} | ||
export const readArchivedEventsPage = ActionNoData(Events.readArchivedPage) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use server' | ||
import { EventTags } from '@/services/events/tags' | ||
import { Action } from '@/actions/Action' | ||
|
||
export const createEventTagAction = Action(EventTags.create) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use server' | ||
import { ActionNoData } from '@/actions/Action' | ||
import { EventTags } from '@/services/events/tags' | ||
|
||
export const destroyEventTagAction = ActionNoData(EventTags.destroy) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use server' | ||
import { ActionNoData } from '@/actions/Action' | ||
import { EventTags } from '@/services/events/tags' | ||
|
||
export const readEventTagsAction = ActionNoData(EventTags.readAll) | ||
export const readSpecialEventTagAction = ActionNoData(EventTags.readSpecial) | ||
export const readEventTagAction = ActionNoData(EventTags.read) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use server' | ||
import { Action } from '@/actions/Action' | ||
import { EventTags } from '@/services/events/tags' | ||
|
||
export const updateEventTagAction = Action(EventTags.update) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.