Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: lowercased urls #629

Merged
merged 2 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions api/src/app/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import { SearchResponse } from "src/search/types";

// ts-prune-ignore-next
export interface Endpoints {
// @TODO-ZM: lower case the endpoints, curtesy of @Fcmam5
"api:Projects": {
"api:projects": {
response: GetProjectsResponse;
};
"api:projects/for-sitemap": {
Expand All @@ -32,14 +31,14 @@ export interface Endpoints {
response: GetProjectNameResponse;
params: { id: string };
};
"api:Projects/:id": {
"api:projects/:id": {
response: GetProjectResponse;
params: { id: string };
};
"api:Contributions": {
"api:contributions": {
response: GetContributionsResponse;
};
"api:Contributions/:id": {
"api:contributions/:id": {
response: GetContributionResponse;
params: { id: string };
};
Expand All @@ -50,24 +49,24 @@ export interface Endpoints {
"api:contributions/for-sitemap": {
response: GetContributionsForSitemapResponse;
};
"api:Contributors": {
"api:contributors": {
response: GetContributorsResponse;
};
"api:contributors/for-sitemap": {
response: GetContributorsForSitemapResponse;
};
"api:Contributors/:id": {
"api:contributors/:id": {
response: GetContributorResponse;
params: { id: string };
};
"api:contributors/:id/name": {
response: GetContributorNameResponse;
params: { id: string };
};
"api:MileStones/dzcode": {
"api:milestones/dzcode": {
response: GetMilestonesResponse;
};
"api:Search": {
"api:search": {
response: SearchResponse;
query: [["query", string], ["limit", number]];
};
Expand Down
2 changes: 1 addition & 1 deletion api/src/contribution/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from "./types";

@Service()
@Controller("/Contributions")
@Controller("/contributions")
export class ContributionController {
constructor(private readonly contributionRepository: ContributionRepository) {}

Expand Down
2 changes: 1 addition & 1 deletion api/src/contributor/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ProjectRepository } from "src/project/repository";
import { ContributionRepository } from "src/contribution/repository";

@Service()
@Controller("/Contributors")
@Controller("/contributors")
export class ContributorController {
constructor(
private readonly contributorRepository: ContributorRepository,
Expand Down
4 changes: 2 additions & 2 deletions api/src/github/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { Service } from "typedi";
import { GetRateLimitResponse } from "./types";

@Service()
@Controller("/Github")
@Controller("/github")
export class GithubController {
constructor(private readonly githubService: GithubService) {}

@Get("/RateLimit")
@Get("/rate-limit")
public async getRateLimitInfo(): Promise<GetRateLimitResponse> {
const { limit, used, ratio } = await this.githubService.getRateLimit();

Expand Down
2 changes: 1 addition & 1 deletion api/src/milestone/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Service } from "typedi";
import { GetMilestonesResponse } from "./types";

@Service()
@Controller("/Milestones")
@Controller("/milestones")
export class MilestoneController {
constructor(private readonly githubService: GithubService) {}

Expand Down
2 changes: 1 addition & 1 deletion api/src/project/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ContributorRepository } from "src/contributor/repository";
import { ContributionRepository } from "src/contribution/repository";

@Service()
@Controller("/Projects")
@Controller("/projects")
export class ProjectController {
constructor(
private readonly projectRepository: ProjectRepository,
Expand Down
2 changes: 1 addition & 1 deletion api/src/search/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { SearchService } from "./service";
import { Service } from "typedi";

@Service()
@Controller("/Search")
@Controller("/search")
export class SearchController {
constructor(private readonly searchService: SearchService) {}

Expand Down
6 changes: 3 additions & 3 deletions web/src/components/locale/dictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ export const dictionary = {
ar: "أرغب في البرمجة ، من أين أبدأ؟",
},
"faq-topic-2-answer-2": {
en: `Go to [/Contribute](/Contribute) page, you will see a list of projects with available tasks for you to pick from whatever you like and start programming 🔥.`,
ar: `انتقل إلى صفحة [المساهمة](/Contribute) ، سترى قائمة بالمشاريع بالمهام المتاحة لتختار منها ما تريد وتبدأ البرمجة 🔥.`,
en: `Go to [/contribute](/contribute) page, you will see a list of projects with available tasks for you to pick from whatever you like and start programming 🔥.`,
ar: `انتقل إلى صفحة [المساهمة](/contribute) ، سترى قائمة بالمشاريع بالمهام المتاحة لتختار منها ما تريد وتبدأ البرمجة 🔥.`,
},
"faq-topic-2-question-3": {
en: "I like the idea, what are the different ways I can contribute to DzCode i/o ?",
ar: "تعجبني الفكرة ، ما هي الطرق المختلفة التي يمكنني من خلالها المساهمة في DzCode i/o؟",
},
"faq-topic-2-answer-3": {
en: `
Besides the open tasks on [/Contribute](/Contribute) page, you can also contribute to DzCode i/o by:
Besides the open tasks on [/contribute](/contribute) page, you can also contribute to DzCode i/o by:

- Adding your open-source projects to the dzcode.io website.
`,
Expand Down
2 changes: 1 addition & 1 deletion web/src/redux/actions/contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const fetchContributionAction =
}
try {
dispatch(contributionPageSlice.actions.set({ contribution: null }));
const { contribution } = await fetchV2("api:Contributions/:id", { params: { id } });
const { contribution } = await fetchV2("api:contributions/:id", { params: { id } });
dispatch(contributionPageSlice.actions.set({ contribution }));
} catch (error) {
dispatch(contributionPageSlice.actions.set({ contribution: "ERROR" }));
Expand Down
2 changes: 1 addition & 1 deletion web/src/redux/actions/contributions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const fetchContributionsListAction =
(): ThunkAction<void, AppState, unknown, Action> => async (dispatch) => {
try {
dispatch(contributionsPageSlice.actions.set({ contributionsList: null }));
const { contributions } = await fetchV2("api:Contributions", {});
const { contributions } = await fetchV2("api:contributions", {});

dispatch(contributionsPageSlice.actions.set({ contributionsList: contributions }));
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion web/src/redux/actions/contributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const fetchContributorAction =
}
try {
dispatch(contributorPageSlice.actions.set({ contributor: null }));
const { contributor } = await fetchV2("api:Contributors/:id", { params: { id } });
const { contributor } = await fetchV2("api:contributors/:id", { params: { id } });
dispatch(contributorPageSlice.actions.set({ contributor }));
} catch (error) {
dispatch(contributorPageSlice.actions.set({ contributor: "ERROR" }));
Expand Down
2 changes: 1 addition & 1 deletion web/src/redux/actions/contributors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const fetchContributorsListAction =
(): ThunkAction<void, AppState, unknown, Action> => async (dispatch) => {
try {
dispatch(contributorsPageSlice.actions.set({ contributorsList: null }));
const { contributors } = await fetchV2("api:Contributors", {});
const { contributors } = await fetchV2("api:contributors", {});
dispatch(contributorsPageSlice.actions.set({ contributorsList: contributors }));
} catch (error) {
dispatch(contributorsPageSlice.actions.set({ contributorsList: "ERROR" }));
Expand Down
2 changes: 1 addition & 1 deletion web/src/redux/actions/milestones.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const fetchMilestonesListAction =
try {
if (getState().landingPage.milestones === "ERROR")
dispatch(landingPageSlice.actions.set({ milestones: null }));
const { milestones } = await fetchV2("api:MileStones/dzcode", {});
const { milestones } = await fetchV2("api:milestones/dzcode", {});
dispatch(landingPageSlice.actions.set({ milestones }));
} catch (error) {
dispatch(landingPageSlice.actions.set({ milestones: "ERROR" }));
Expand Down
2 changes: 1 addition & 1 deletion web/src/redux/actions/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const fetchProjectAction =
}
try {
dispatch(projectPageSlice.actions.set({ project: null }));
const { project } = await fetchV2("api:Projects/:id", { params: { id } });
const { project } = await fetchV2("api:projects/:id", { params: { id } });
dispatch(projectPageSlice.actions.set({ project }));
} catch (error) {
dispatch(projectPageSlice.actions.set({ project: "ERROR" }));
Expand Down
2 changes: 1 addition & 1 deletion web/src/redux/actions/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const fetchProjectsListAction =
(): ThunkAction<void, AppState, unknown, Action> => async (dispatch) => {
try {
dispatch(projectsPageSlice.actions.set({ projectsList: null }));
const { projects } = await fetchV2("api:Projects", {});
const { projects } = await fetchV2("api:projects", {});
dispatch(projectsPageSlice.actions.set({ projectsList: projects }));
} catch (error) {
dispatch(projectsPageSlice.actions.set({ projectsList: "ERROR" }));
Expand Down
2 changes: 1 addition & 1 deletion web/src/utils/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const useSearch = (query: string, limit: number = 5) => {

const search = useCallback(async () => {
setIsFetching(true);
const searchResults = await fetchV2("api:Search", {
const searchResults = await fetchV2("api:search", {
query: [
["query", queryRef.current],
["limit", limit],
Expand Down
Loading