public DiaryServiceTest() { var pathOption = new PathOption { Default = new Dictionary <PathType, string> { [PathType.DiaryNameListFile] = "/db/diary/diary-name-list.json", [PathType.DiaryListPath] = "/db/diary/diary-info", [PathType.DiaryContentsRootPath] = "/diary", }, }; var fsOption = new FileSystemOption { MainFileSystem = new MainFileSystemOption { UseBackup = false, MainFileSystem = FileSystemType.InMemory, }, }; var diaryOption = new DiaryOption { FileSystemSelect = new FileSystemSelectOption { UseMainFileSystem = true, }, }; var fileSystemService = new FileSystemService(fsOption, pathOption, null, null); _diaryService = new DiaryService(diaryOption, null, fileSystemService); _user = new AppUser("Test", "1234") { Email = "*****@*****.**", UserName = "******", }; _diary = new DiaryInfo { DiaryName = "testdiary", Id = _user.Id, IsSecret = false, Owner = _user.Email, Writers = new List <string>(), Viewers = new List <string>(), }; }
public void Add(DiaryInfo diaryInfo) { System.IO.File.WriteAllText($"AppData\\{Guid.NewGuid()}.json", System.Text.Json.JsonSerializer.Serialize(diaryInfo)); }
public static string Edit(DiaryInfo diaryInfo, DateTime date) { return($"/diary/edit/{diaryInfo.DiaryName}/{date:yyyyMMdd}"); }
public static string Write(DiaryInfo diaryInfo) { return($"/diary/write/{diaryInfo.DiaryName}"); }