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: Add T on timestamp and default num of notes to 500 #7

Merged
merged 3 commits into from
Nov 25, 2023
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
46 changes: 11 additions & 35 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,42 +45,18 @@ jobs:
skip-build-cache: true
skip-pkg-cache: true

tests-on-windows:
name: Run unit tests on windows
test:
name: Run unit tests
needs: golangci-lint
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}

- name: Run unit tests
run: make.exe test-unit

tests-on-macos:
name: Run unit tests on macos
needs: golangci-lint
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}

- name: Run unit tests
run: make test-unit

tests-on-unix:
name: Run unit tests on linux
needs: golangci-lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [
"macos-latest",
"ubuntu-latest",
"windows-latest"
]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions internal/sn/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type Item struct {
UpdatedAt string `json:"updated_at"`
UUID uuid.UUID `json:"uuid"`
}

type AppData struct {
OrgStandardnotesSn map[string]string `json:"org.standardnotes.sn"`
}
9 changes: 6 additions & 3 deletions internal/sn/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ import (
"github.com/danielnetop/notesnook-to-standardnotes/internal/time"
)

const numOfNotesPerFile = "NUM_OF_NOTES_PER_FILE"
const (
numOfNotesPerFileVar = "NUM_OF_NOTES_PER_FILE"
numOfNotesPerFile = 500
)

var (
notebooks = make(map[string]notesnook.NotebookInfo, 0)
Expand Down Expand Up @@ -194,9 +197,9 @@ func ProcessConversionAndSaveToFile(nooks []notesnook.Nook) error {
storeDataInMaps(nook, tipTaps)
}

numOfNotes, err := strconv.Atoi(os.Getenv(numOfNotesPerFile))
numOfNotes, err := strconv.Atoi(os.Getenv(numOfNotesPerFileVar))
if err != nil {
numOfNotes = 200
numOfNotes = numOfNotesPerFile
}

return splitAndStoreConvertedNotes(convertNotesnookToStandardNotes(nooks), numOfNotes, 1)
Expand Down
2 changes: 1 addition & 1 deletion internal/time/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package time
import "time"

func MilliToTime(milli int64) string {
return time.UnixMilli(milli).UTC().Format("2006-01-02 15:04:05Z")
return time.UnixMilli(milli).UTC().Format("2006-01-02T15:04:05Z")
}
2 changes: 1 addition & 1 deletion internal/time/time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestMilliToTime(t *testing.T) {
}{
{
milli: 1699404581000,
want: "2023-11-08 00:49:41Z",
want: "2023-11-08T00:49:41Z",
},
}
for _, tt := range tests {
Expand Down