Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoerlitz committed May 18, 2024
2 parents aae9b8d + 71ac7ec commit 761f989
Show file tree
Hide file tree
Showing 6 changed files with 245 additions and 282 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.env
backend/.env

# Logs
logs
Expand Down
21 changes: 11 additions & 10 deletions backend/src/libraries/vateud/VateudCoreLibrary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ async function _send<T>(props: SendT): Promise<T | undefined> {
try {
const res = await axios({
headers: {
"x-api-key": Config.VATEUD_CORE_CONFIG.API_KEY,
"X-API-KEY": Config.VATEUD_CORE_CONFIG.API_KEY,
},
url: `${Config.URI_CONFIG.VATEUD_API_BASE}/${props.endpoint}`,
method: props.method,
data: props.data,
});

return res.data as T;
} catch (e) {
} catch (e : any ) {
Logger.log(LogLevels.LOG_WARN, e);
return undefined;
}
}
Expand All @@ -54,16 +55,16 @@ export async function createSolo(userSolo: UserSolo, endorsementGroup: Endorseme
const soloInfo: VateudCoreSoloCreateT = {
local_solo_id: userSolo.id,
post_data: {
user_id: userSolo.user_id,
user_cid: userSolo.user_id,
position: endorsementGroup.name,
instructor_cid: userSolo.created_by,
starts_at: userSolo.current_solo_start?.toISOString() ?? "",
expires_at: userSolo.current_solo_end?.toISOString() ?? "",
instructor_cid: 1439797,//userSolo.created_by,
start_at: userSolo.current_solo_start?.toISOString() ?? "",
expire_at: userSolo.current_solo_end?.toISOString() ?? "",
},
};

const res = await _send<VateudCoreSoloCreateResponseT>({
endpoint: "/solo",
endpoint: "facility/endorsements/solo",
method: "post",
data: soloInfo.post_data,
});
Expand All @@ -75,10 +76,10 @@ export async function createSolo(userSolo: UserSolo, endorsementGroup: Endorseme
data: {
solo_create: {
local_solo_id: soloInfo.local_solo_id,
user_id: soloInfo.post_data.user_id,
user_id: soloInfo.post_data.user_cid,
position: soloInfo.post_data.position,
instructor_cid: soloInfo.post_data.instructor_cid,
expire_at: soloInfo.post_data.expires_at,
expire_at: soloInfo.post_data.expire_at,
},
},
});
Expand All @@ -105,7 +106,7 @@ export async function createSolo(userSolo: UserSolo, endorsementGroup: Endorseme
*/
export async function removeSolo(userSolo: UserSolo) {
const res = await _send<VateudCoreSoloRemoveResponseT>({
endpoint: `/solo/${userSolo.vateud_solo_id}`,
endpoint: `facility/endorsements/solo/${userSolo.vateud_solo_id}`,
method: "delete",
});

Expand Down
6 changes: 3 additions & 3 deletions backend/src/libraries/vateud/VateudCoreLibraryTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ export type VateudCorePayload = {
export type VateudCoreSoloCreateT = {
local_solo_id: number;
post_data: {
user_id: number;
user_cid: number;
position: string;
instructor_cid: number;
starts_at: string;
expires_at: string;
start_at: string;
expire_at: string;
};
};

Expand Down
1 change: 1 addition & 0 deletions frontend/src/models/UserModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export type UserDataModel = {
export type UserSoloModel = {
id: number;
user_id: number;
vateud_solo_id: number|null;
created_by: number;
solo_rating: "s1" | "s2" | "s3" | "c1";
solo_used: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,10 @@ export function UVSoloPartial({ user, setUser }: { user?: UserModel; setUser: Di
value={`${user?.user_solo?.solo_creator?.first_name} ${user?.user_solo?.solo_creator?.last_name} (${user?.user_solo?.solo_creator?.id})`}
/>
</div>

<RenderIf truthValue={user?.user_solo?.vateud_solo_id == null} elementTrue={
<span className="text-danger flex text-xs mt-4">Die Solo konnte nicht bei VATEUD Core eingetragen werden.</span>
} />
<Separator />

<div className={"flex flex-col lg:flex-row"}>
<RenderIf
truthValue={kontingent > 0}
Expand Down
Loading

0 comments on commit 761f989

Please sign in to comment.