Skip to content

Instantly share code, notes, and snippets.

View MinSomai's full-sized avatar
🇳🇵
from the land of Mountains, Nepal. Namaste!

Min Somai MinSomai

🇳🇵
from the land of Mountains, Nepal. Namaste!
View GitHub Profile
<?xml version="1.0" encoding="ISO-8859-1"?>
<TransportCoordination xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://tr02-wiki.dakosy.de/dokumentation/TR02XMLv14.3/TransportCoordination.xsd">
<Transaction code="TR02XML" version="14" type="TransportCoordination"/>
<Interchange>
<CreationTime>2024-11-07T15:35:49</CreationTime>
<ExchangeNumber>N6Q2B1P4749057</ExchangeNumber>
<MessageCount>1</MessageCount>
<Sender>
<ParticipantCode agencyID="DAKOSY">NIEL</ParticipantCode>
</Sender>
<TransportCoordination xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://tr02-wiki.dakosy.de/dokumentation/TR02XMLv14.3/TransportCoordination.xsd">
<Transaction code="TR02XML" version="14" type="TransportCoordination" />
<Interchange>
<CreationTime>2024-10-18T00:00:00</CreationTime>
<!--Incorrect Timestamp -->
<ExchangeNumber>2001456789</ExchangeNumber>
<TestIndicator>1</TestIndicator>
<MessageCount>1</MessageCount>
@MinSomai
MinSomai / upsertuser.js
Last active August 5, 2024 08:13
PayloadCMS upsert social auth user after arctic auth
const upsertAuthUser = async (result: {
email: string | null;
userId: string | null;
token: string | null;
refreshToken: string | null;
name: string | null;
meta: any;
}, providerType: ProviderTypes): Promise<Result> => {
let foundSocialUser: null | SocialAuthUser = null;
let htmlString = `
<script type="text/javascript">
if (typeof (smartWeb) == 'undefined') smartWeb = {};
if (typeof (smartWeb.Appointment) == 'undefined') smartWeb.Appointment = {};
smartWeb.Appointment.Constants = {
NL_VALUE: 99999,
NL: 'NL',
NR: 'NR',
DEFAULT_LIMIT_DATA: '0-0-0',
const _ = require('lodash');

// RequestedDateTimeHelper is a helper related to requested times.
// Requested dates can be either datetime or time (military).
class RequestedDateTimeHelper {
    /**
     * isDateTimeDifferent method returns true if datetime/time is different
     *
     * Time can change from:
{
"lastIndex": 110016362472800256,
"clientSegment": [
0,
128
],
"updates": [
{
"index": 110015715536535552,
"timestamp": "2023-03-13T11:23:16.887Z",
let update8 = {
lastIndex: 110016159375425536,
clientSegment: [0, 128],
updates: [
{
index: 110015715536535552,
timestamp: '2023-03-13T11:23:16.887Z',
before: null,
after: {
voyageId: 'b0571ec1-ff7c-4b67-b00d-0121bd8dc372',
let updates3 = {
lastIndex: 110014217503309824,
clientSegment: [0, 128],
updates: [
{
index: 110014180472848384,
timestamp: '2023-03-13T04:52:53.677Z',
before: {
voyageId: '5a21e768-9670-48e6-8522-551e4eef7f00',
declarant: {
[
{
"@class": "com.portbase.hinterland.api.common.Terminal",
"shortName": "NONPCS_ROTTERDAM",
"ean": null,
"bicsCode": "00RHB",
"quayName": "Rotterdams Haven Bedrijf",
"smdgCode": null,
"location": {
"name": "Rotterdam",
let updates2 = {
lastIndex: 110014179357687808,
clientSegment: [0, 128],
updates: [
{
index: 110013966679998464,
timestamp: '2023-03-13T03:58:31.456Z',
before: {
voyageId: 'b4ee3a61-ede9-43bd-aef8-0eb65e19cfaf',
declarant: {