Skip to content

Commit fe7a3de

Browse files
committed
reorganize lib
1 parent 9ade8d7 commit fe7a3de

63 files changed

Lines changed: 206 additions & 429 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"use server";
2+
3+
import { createClientServerComponent } from "@/utils/supabase/server";
4+
import { newApplicantsSchema, NewApplicantType } from "@/types/applicants";
5+
6+
export async function getNewApplicants(): Promise<NewApplicantType[]> {
7+
try {
8+
const supabase = await createClientServerComponent();
9+
10+
const { data: newApplicants, error } = await supabase
11+
.from("codev")
12+
.select(`*,
13+
applicant (*)
14+
`)
15+
.not("application_status", "eq", "passed")
16+
.order("date_applied", { ascending: false });
17+
18+
if (error) {
19+
console.error("Error fetching new applicants:", error);
20+
return [];
21+
}
22+
23+
const parsedNewApplicants = newApplicantsSchema.array().safeParse(newApplicants);
24+
25+
if (parsedNewApplicants.error) {
26+
console.error("Error parsing new applicants:", parsedNewApplicants.error);
27+
return [];
28+
}
29+
30+
return parsedNewApplicants.data;
31+
} catch (error) {
32+
console.error("Error fetching new applicants:", error);
33+
return [];
34+
}
35+
}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use server";
22

3-
import type { PostType } from "@/types/feeds";
43
import { createClientServerComponent } from "@/utils/supabase/server";
54

65
export const getPosts = async () => {
@@ -30,7 +29,6 @@ export const getPosts = async () => {
3029

3130
if (error) throw error;
3231

33-
// compute counts + flatten tag structure
3432
const postsWithCounts = posts.map((post) => ({
3533
...post,
3634
upvote_count: post.post_upvotes?.length ?? 0,
@@ -48,8 +46,6 @@ export const getPosts = async () => {
4846
}
4947
};
5048

51-
export type { PostType } from "@/types/feeds";
52-
5349
export const getPostTagsLookup = async () => {
5450
try {
5551
const supabase = await createClientServerComponent();
@@ -66,4 +62,4 @@ export const getPostTagsLookup = async () => {
6662
console.error(error);
6763
throw error;
6864
}
69-
};
65+
};

‎apps/codebility/actions/kanban/board.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from "@/lib/server/kanban-task-query";
1111
import { fetchMemberBoardTasks as fetchMemberBoardTasksQuery } from "@/lib/server/kanban-member-tasks-query";
1212
import { fetchColumnTasksPage as fetchColumnTasksPageQuery } from "@/lib/server/kanban-column-tasks-query";
13-
import { KANBAN_COLUMN_TASK_PAGE_SIZE } from "@/lib/kanban/board-pagination";
13+
import { KANBAN_COLUMN_TASK_PAGE_SIZE } from "@/constants/kanban/pagination";
1414
import type { BoardSnapshotInput } from "@/lib/kanban/board-snapshot-types";
1515
import { persistBoardSnapshot } from "@/lib/server/kanban-board-snapshot-sync";
1616
import { updateDeveloperLevels } from "@/lib/kanban/update-developer-levels";

‎apps/codebility/actions/kanban/columns.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from "@/lib/server/kanban-task-query";
1111
import { fetchMemberBoardTasks as fetchMemberBoardTasksQuery } from "@/lib/server/kanban-member-tasks-query";
1212
import { fetchColumnTasksPage as fetchColumnTasksPageQuery } from "@/lib/server/kanban-column-tasks-query";
13-
import { KANBAN_COLUMN_TASK_PAGE_SIZE } from "@/lib/kanban/board-pagination";
13+
import { KANBAN_COLUMN_TASK_PAGE_SIZE } from "@/constants/kanban/pagination";
1414
import type { BoardSnapshotInput } from "@/lib/kanban/board-snapshot-types";
1515
import { persistBoardSnapshot } from "@/lib/server/kanban-board-snapshot-sync";
1616
import { updateDeveloperLevels } from "@/lib/kanban/update-developer-levels";

‎apps/codebility/actions/kanban/drafts.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from "@/lib/server/kanban-task-query";
1111
import { fetchMemberBoardTasks as fetchMemberBoardTasksQuery } from "@/lib/server/kanban-member-tasks-query";
1212
import { fetchColumnTasksPage as fetchColumnTasksPageQuery } from "@/lib/server/kanban-column-tasks-query";
13-
import { KANBAN_COLUMN_TASK_PAGE_SIZE } from "@/lib/kanban/board-pagination";
13+
import { KANBAN_COLUMN_TASK_PAGE_SIZE } from "@/constants/kanban/pagination";
1414
import type { BoardSnapshotInput } from "@/lib/kanban/board-snapshot-types";
1515
import { persistBoardSnapshot } from "@/lib/server/kanban-board-snapshot-sync";
1616
import { updateDeveloperLevels } from "@/lib/kanban/update-developer-levels";

‎apps/codebility/actions/kanban/queries.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from "@/lib/server/kanban-task-query";
1111
import { fetchMemberBoardTasks as fetchMemberBoardTasksQuery } from "@/lib/server/kanban-member-tasks-query";
1212
import { fetchColumnTasksPage as fetchColumnTasksPageQuery } from "@/lib/server/kanban-column-tasks-query";
13-
import { KANBAN_COLUMN_TASK_PAGE_SIZE } from "@/lib/kanban/board-pagination";
13+
import { KANBAN_COLUMN_TASK_PAGE_SIZE } from "@/constants/kanban/pagination";
1414
import type { BoardSnapshotInput } from "@/lib/kanban/board-snapshot-types";
1515
import { persistBoardSnapshot } from "@/lib/server/kanban-board-snapshot-sync";
1616
import { updateDeveloperLevels } from "@/lib/kanban/update-developer-levels";

‎apps/codebility/actions/kanban/sprints.ts‎

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use server";
22

33
import { requireProjectMember } from "@/lib/server/auth-guard";
4+
import { createClientServerComponent } from "@/utils/supabase/server";
45
import { revalidatePath } from "next/cache";
56

67
export async function createNewSprint(formData: FormData) {
@@ -157,4 +158,40 @@ export async function EditSprint(formData: FormData) {
157158
return { isSuccess: false, error: "Failed to edit sprint" };
158159
}
159160

160-
}
161+
}
162+
163+
export const getSprintsData = async (projectId: string) => {
164+
try {
165+
const supabase = await createClientServerComponent();
166+
167+
const { data, error } = await supabase
168+
.from("projects")
169+
.select(
170+
`
171+
id,
172+
name,
173+
kanban_sprints!kanban_sprints_project_id_fkey (
174+
id,
175+
name,
176+
start_at,
177+
end_at,
178+
project_id,
179+
board_id,
180+
kanban_board:kanban_boards!kanban_sprints_board_id_fkey (
181+
id,
182+
name
183+
)
184+
)
185+
`,
186+
)
187+
.eq("id", projectId)
188+
.single();
189+
190+
if (error) throw error;
191+
192+
return data;
193+
} catch (error) {
194+
console.error(error);
195+
throw error;
196+
}
197+
};

‎apps/codebility/actions/kanban/tasks.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from "@/lib/server/kanban-task-query";
1111
import { fetchMemberBoardTasks as fetchMemberBoardTasksQuery } from "@/lib/server/kanban-member-tasks-query";
1212
import { fetchColumnTasksPage as fetchColumnTasksPageQuery } from "@/lib/server/kanban-column-tasks-query";
13-
import { KANBAN_COLUMN_TASK_PAGE_SIZE } from "@/lib/kanban/board-pagination";
13+
import { KANBAN_COLUMN_TASK_PAGE_SIZE } from "@/constants/kanban/pagination";
1414
import type { BoardSnapshotInput } from "@/lib/kanban/board-snapshot-types";
1515
import { persistBoardSnapshot } from "@/lib/server/kanban-board-snapshot-sync";
1616
import { updateDeveloperLevels } from "@/lib/kanban/update-developer-levels";

‎apps/codebility/actions/my-team/project.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import { revalidatePath } from "next/cache";
44
import { createClientServerComponent } from "@/utils/supabase/server";
55
import { requireProjectMember, requireUser } from "@/lib/server/auth-guard";
6-
7-
const ATTENDANCE_POINTS_PER_DAY = 2;
6+
import { ATTENDANCE_POINTS_PER_DAY } from "@/constants/my-team/attendance";
87

98
// ─── INTERNAL: Core save logic only — no point recalc (trigger handles it) ───
109
async function saveAttendanceRecord(

‎apps/codebility/app/(marketing)/ai-integration/_components/AiIntegration-development-process-react-flow.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import "../_styles/index.css";
99
import {
1010
DevProcessInitialEdges,
1111
DevProcessInitialNodes,
12-
} from "@/lib/ai-integration/dummy-data";
12+
} from "@/constants/ai-integration/dummy-data";
1313
import Section from "../../_components/MarketingSection";
1414
import { CustomEdge } from "./AiIntegrationEdgeTypes";
1515
import GradientBackgroundWhite from "./AiIntegrationGradientBgWhite";

0 commit comments

Comments
 (0)