Add super basic group model/command
This commit is contained in:
13
PluralKit.Core/Models/Patch/GroupPatch.cs
Normal file
13
PluralKit.Core/Models/Patch/GroupPatch.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
#nullable enable
|
||||
namespace PluralKit.Core
|
||||
{
|
||||
public class GroupPatch: PatchObject
|
||||
{
|
||||
public Partial<string> Name { get; set; }
|
||||
public Partial<string?> Description { get; set; }
|
||||
|
||||
public override UpdateQueryBuilder Apply(UpdateQueryBuilder b) => b
|
||||
.With("name", Name)
|
||||
.With("description", Description);
|
||||
}
|
||||
}
|
@@ -60,5 +60,10 @@ namespace PluralKit.Core
|
||||
.Build();
|
||||
return conn.ExecuteAsync(query, pms);
|
||||
}
|
||||
|
||||
public static Task<PKGroup> CreateGroup(this IPKConnection conn, SystemId system, string name) =>
|
||||
conn.QueryFirstAsync<PKGroup>(
|
||||
"insert into groups (hid, system, name) values (find_free_group_hid(), @System, @Name) returning *",
|
||||
new {System = system, Name = name});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user