Skip to content

Add submodules for go-api and risk-api #1814

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

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
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
49 changes: 31 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,26 +230,39 @@
- name: Lint CSS
run: pnpm lint:css

# FIXME: Identify a way to generate schema before we run typecheck
# typecheck:
# name: Typecheck
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Install pnpm
# uses: pnpm/action-setup@v4
# - name: Install Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 20
# cache: 'pnpm'
# - name: Install dependencies
# run: pnpm install
#
# - name: Typecheck
# run: pnpm typecheck
typecheck:
name: Typecheck
runs-on: ubuntu-latest
defaults:
run:
working-directory: app
needs: [ui]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install

- uses: actions/download-artifact@v4
with:
name: ui-build
path: packages/ui/dist

- name: Generate types
run: pnpm generate:type

- name: Typecheck
run: pnpm typecheck

typos:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
Expand Down
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[submodule "go-api"]
path = go-api
url = https://github.com/IFRCGo/go-api.git
branch = feature/schema-file
[submodule "risk-api"]
path = risk-api
url = https://github.com/IFRCGo/go-risk-module-api.git
branch = feature/schema-file
4 changes: 2 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"initialize:type:go-api": "test -f ./generated/types.ts && true || cp types.stub.ts ./generated/types.ts",
"initialize:type:risk-api": "test -f ./generated/riskTypes.ts && true || cp types.stub.ts ./generated/riskTypes.ts",
"generate:type": "pnpm generate:type:go-api && pnpm generate:type:risk-api",
"generate:type:go-api": "dotenv -- cross-var openapi-typescript \"%APP_API_ENDPOINT%api-docs/\" -o ./generated/types.ts --alphabetize",
"generate:type:risk-api": "dotenv -- cross-var openapi-typescript \"%APP_RISK_API_ENDPOINT%api-docs/\" -o ./generated/riskTypes.ts --alphabetize",
"generate:type:go-api": "dotenv -- cross-var openapi-typescript ../go-api/openapi-schema.yaml -o ./generated/types.ts --alphabetize",
"generate:type:risk-api": "dotenv -- cross-var openapi-typescript ../risk-api/openapi-schema.yaml -o ./generated/riskTypes.ts --alphabetize",
"prestart": "pnpm initialize:type",
"start": "pnpm -F @ifrc-go/ui build && vite",
"prebuild": "pnpm initialize:type",
Expand Down
1 change: 1 addition & 0 deletions app/src/components/PerExportModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function PerExportModal(props: Props) {
export_id: Number(perId),
export_type: 'per' as const,
per_country: Number(countryId),
is_pga: false,
}),
[perId, countryId],
);
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/SelectOutput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TextOutput } from '@ifrc-go/ui';
import { isDefined } from '@togglecorp/fujs';

interface Props<VALUE, OPTION> {
className: string;
className?: string;
value: VALUE | undefined;
options: OPTION[] | undefined;
keySelector: (datum: OPTION) => VALUE;
Expand Down
3 changes: 2 additions & 1 deletion app/src/components/domain/DrefExportModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ function DrefExportModal(props: Props) {
export_id: id,
export_type: type,
selector: '#pdf-preview-ready',
per_country: undefined, // FIXME: typing is altered by the useRequest function
per_country: undefined,
is_pga: false,
};
},
[id, applicationType],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ function DrefTableActions(props: Props) {
allocationRequested: response?.additional_allocation,
previousAllocation: response?.dref_allocated_so_far ?? 0,
totalDREFAllocation: response?.total_dref_allocation,
noOfPeopleTargeted: response?.number_of_people_targeted,
toBeAllocatedFrom:
response?.type_of_dref_display === 'Imminent'
// FIXME: can't compare imminent with Anticipatory Pillar
Expand Down
12 changes: 9 additions & 3 deletions app/src/views/DrefOperationalUpdateForm/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ export type OpsUpdateRequestBody = GoApiBody<'/api/v2/dref-op-update/{id}/', 'PA
};

type NeedIdentifiedResponse = NonNullable<OpsUpdateRequestBody['needs_identified']>[number];
type NsActionResponse = NonNullable<OpsUpdateRequestBody['national_society_actions']>[number];
type InterventionResponse = NonNullable<OpsUpdateRequestBody['planned_interventions']>[number];
type IndicatorResponse = NonNullable<InterventionResponse['indicators']>[number];
type RiskSecurityResponse = NonNullable<OpsUpdateRequestBody['risk_security']>[number];
type ImagesFileResponse = NonNullable<OpsUpdateRequestBody['images_file']>[number];
type SourceInformationResponse = NonNullable<OpsUpdateRequestBody['source_information']>[number];

type NeedIdentifiedFormFields = NeedIdentifiedResponse & { client_id: string };
type NsActionFormFields = NsActionResponse & { client_id: string; }
type InterventionFormFields = InterventionResponse & { client_id: string };
type IndicatorFormFields = IndicatorResponse & { client_id: string };
type SourceInformationFormFields = SourceInformationResponse & { client_id: string };
Expand All @@ -81,9 +83,13 @@ type OpsUpdateFormFields = (
DeepReplace<
DeepReplace<
DeepReplace<
OpsUpdateRequestBody,
NeedIdentifiedResponse,
NeedIdentifiedFormFields
DeepReplace<
OpsUpdateRequestBody,
NeedIdentifiedResponse,
NeedIdentifiedFormFields
>,
NsActionResponse,
NsActionFormFields
>,
InterventionResponse,
InterventionFormFields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface Props {
emergencyName: string | null | undefined;
appealDocumentURL: string;
extract: string | null | undefined;
operationStartDate: string;
operationStartDate: string | null | undefined;
}
function Extract(props: Props) {
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function OperationalLearningMap(props: Props) {
}

const features = learningByCountry
.map((value) => {
?.map((value) => {
const country = countriesMap?.[value.country_id];
if (isNotDefined(country)) {
return undefined;
Expand Down
1 change: 0 additions & 1 deletion app/src/views/SurgeCatalogueBasecampOffice/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export function Component() {
label={strings.compositionLabel}
strongLabel
/>
<div>{strings.compositionDescription}</div>
</SurgeContentContainer>
<SurgeContentContainer
heading={strings.standardComponents}
Expand Down
1 change: 1 addition & 0 deletions go-api
Submodule go-api added at bde055
1 change: 1 addition & 0 deletions risk-api
Submodule risk-api added at f2499a
Loading