mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-1650 Templates | Default template for new object creation (#462)
This commit is contained in:
parent
9e43f5af02
commit
ad9bc52e2e
25 changed files with 367 additions and 284 deletions
|
@ -864,7 +864,7 @@ class Middleware @Inject constructor(
|
|||
templateId = command.template.orEmpty(),
|
||||
internalFlags = command.internalFlags.toMiddlewareModel(),
|
||||
spaceId = command.space.id,
|
||||
objectTypeUniqueKey = command.type.key
|
||||
objectTypeUniqueKey = command.typeKey.key
|
||||
)
|
||||
if (BuildConfig.DEBUG) logRequest(request)
|
||||
val response = service.objectCreate(request)
|
||||
|
@ -885,7 +885,8 @@ class Middleware @Inject constructor(
|
|||
internalFlags = command.internalFlags.toMiddlewareModel(),
|
||||
targetId = command.target,
|
||||
position = command.position.toMiddlewareModel(),
|
||||
fields = null
|
||||
fields = null,
|
||||
spaceId = command.space
|
||||
)
|
||||
|
||||
if (BuildConfig.DEBUG) logRequest(request)
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.mockito.kotlin.times
|
|||
import org.mockito.kotlin.verify
|
||||
import org.mockito.kotlin.verifyNoMoreInteractions
|
||||
|
||||
typealias CBlock = com.anytypeio.anytype.core_models.Block
|
||||
typealias CFields = com.anytypeio.anytype.core_models.Block.Fields
|
||||
typealias CBlockFileType = com.anytypeio.anytype.core_models.Block.Content.File.Type
|
||||
typealias CBlockPrototypeText = com.anytypeio.anytype.core_models.Block.Prototype.Text
|
||||
|
@ -79,6 +78,7 @@ class MiddlewareTest {
|
|||
// SETUP
|
||||
|
||||
val templateId = MockDataFactory.randomUuid()
|
||||
val spaceId = MockDataFactory.randomUuid()
|
||||
|
||||
val typeKey = TypeKey(MockDataFactory.randomUuid())
|
||||
|
||||
|
@ -89,7 +89,8 @@ class MiddlewareTest {
|
|||
template = templateId,
|
||||
prefilled = emptyMap(),
|
||||
internalFlags = listOf(),
|
||||
type = typeKey
|
||||
type = typeKey,
|
||||
space = spaceId
|
||||
)
|
||||
|
||||
val response = Rpc.BlockLink.CreateWithObject.Response(
|
||||
|
@ -104,7 +105,8 @@ class MiddlewareTest {
|
|||
position = Block.Position.Inner,
|
||||
details = mapOf<String, Any?>(),
|
||||
templateId = templateId,
|
||||
objectTypeUniqueKey = typeKey.key
|
||||
objectTypeUniqueKey = typeKey.key,
|
||||
spaceId = spaceId
|
||||
)
|
||||
|
||||
service.stub {
|
||||
|
@ -136,6 +138,7 @@ class MiddlewareTest {
|
|||
val name = MockDataFactory.randomString()
|
||||
|
||||
val typeKey = TypeKey(MockDataFactory.randomUuid())
|
||||
val spaceId = MockDataFactory.randomUuid()
|
||||
|
||||
val command = Command.CreateBlockLinkWithObject(
|
||||
context = MockDataFactory.randomUuid(),
|
||||
|
@ -144,7 +147,8 @@ class MiddlewareTest {
|
|||
template = null,
|
||||
prefilled = buildMap { put(Relations.NAME, name) },
|
||||
internalFlags = listOf(),
|
||||
type = typeKey
|
||||
type = typeKey,
|
||||
space = spaceId
|
||||
)
|
||||
|
||||
val response = Rpc.BlockLink.CreateWithObject.Response(
|
||||
|
@ -158,7 +162,8 @@ class MiddlewareTest {
|
|||
targetId = command.target,
|
||||
position = Block.Position.Inner,
|
||||
details = buildMap { put(Relations.NAME, name) },
|
||||
objectTypeUniqueKey = typeKey.key
|
||||
objectTypeUniqueKey = typeKey.key,
|
||||
spaceId = spaceId
|
||||
)
|
||||
|
||||
service.stub {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue