Initial commit: Open sourcing all of the Maple Open Technologies code.

This commit is contained in:
Bartlomiej Mika 2025-12-02 14:33:08 -05:00
commit 755d54a99d
2010 changed files with 448675 additions and 0 deletions

View file

@ -0,0 +1,19 @@
package collection
import (
"codeberg.org/mapleopentech/monorepo/native/desktop/maplefile/internal/domain/collection"
)
type CreateUseCase struct {
collectionRepo collection.Repository
}
// ProvideCreateUseCase creates the use case for Wire
func ProvideCreateUseCase(collectionRepo collection.Repository) *CreateUseCase {
return &CreateUseCase{collectionRepo: collectionRepo}
}
// Execute creates a new collection record
func (uc *CreateUseCase) Execute(c *collection.Collection) error {
return uc.collectionRepo.Create(c)
}

View file

@ -0,0 +1,19 @@
package collection
import (
"codeberg.org/mapleopentech/monorepo/native/desktop/maplefile/internal/domain/collection"
)
type DeleteUseCase struct {
collectionRepo collection.Repository
}
// ProvideDeleteUseCase creates the use case for Wire
func ProvideDeleteUseCase(collectionRepo collection.Repository) *DeleteUseCase {
return &DeleteUseCase{collectionRepo: collectionRepo}
}
// Execute deletes a collection by ID
func (uc *DeleteUseCase) Execute(id string) error {
return uc.collectionRepo.Delete(id)
}

View file

@ -0,0 +1,19 @@
package collection
import (
"codeberg.org/mapleopentech/monorepo/native/desktop/maplefile/internal/domain/collection"
)
type GetUseCase struct {
collectionRepo collection.Repository
}
// ProvideGetUseCase creates the use case for Wire
func ProvideGetUseCase(collectionRepo collection.Repository) *GetUseCase {
return &GetUseCase{collectionRepo: collectionRepo}
}
// Execute retrieves a collection by ID
func (uc *GetUseCase) Execute(id string) (*collection.Collection, error) {
return uc.collectionRepo.Get(id)
}

View file

@ -0,0 +1,19 @@
package collection
import (
"codeberg.org/mapleopentech/monorepo/native/desktop/maplefile/internal/domain/collection"
)
type ListUseCase struct {
collectionRepo collection.Repository
}
// ProvideListUseCase creates the use case for Wire
func ProvideListUseCase(collectionRepo collection.Repository) *ListUseCase {
return &ListUseCase{collectionRepo: collectionRepo}
}
// Execute returns all collections
func (uc *ListUseCase) Execute() ([]*collection.Collection, error) {
return uc.collectionRepo.List()
}

View file

@ -0,0 +1,19 @@
package collection
import (
"codeberg.org/mapleopentech/monorepo/native/desktop/maplefile/internal/domain/collection"
)
type ListByParentUseCase struct {
collectionRepo collection.Repository
}
// ProvideListByParentUseCase creates the use case for Wire
func ProvideListByParentUseCase(collectionRepo collection.Repository) *ListByParentUseCase {
return &ListByParentUseCase{collectionRepo: collectionRepo}
}
// Execute returns all collections with a specific parent ID
func (uc *ListByParentUseCase) Execute(parentID string) ([]*collection.Collection, error) {
return uc.collectionRepo.ListByParent(parentID)
}

View file

@ -0,0 +1,19 @@
package collection
import (
"codeberg.org/mapleopentech/monorepo/native/desktop/maplefile/internal/domain/collection"
)
type ListRootUseCase struct {
collectionRepo collection.Repository
}
// ProvideListRootUseCase creates the use case for Wire
func ProvideListRootUseCase(collectionRepo collection.Repository) *ListRootUseCase {
return &ListRootUseCase{collectionRepo: collectionRepo}
}
// Execute returns all root-level collections (no parent)
func (uc *ListRootUseCase) Execute() ([]*collection.Collection, error) {
return uc.collectionRepo.ListRoot()
}

View file

@ -0,0 +1,19 @@
package collection
import (
"codeberg.org/mapleopentech/monorepo/native/desktop/maplefile/internal/domain/collection"
)
type UpdateUseCase struct {
collectionRepo collection.Repository
}
// ProvideUpdateUseCase creates the use case for Wire
func ProvideUpdateUseCase(collectionRepo collection.Repository) *UpdateUseCase {
return &UpdateUseCase{collectionRepo: collectionRepo}
}
// Execute updates an existing collection record
func (uc *UpdateUseCase) Execute(c *collection.Collection) error {
return uc.collectionRepo.Update(c)
}